blob: 84a959530fb6a280af8e0a9409d9f1848af13b52 [file] [log] [blame]
Catalin Marinas8ad68bb2005-10-31 14:25:02 +00001/*
2 * linux/arch/arm/mach-realview/realview_eb.c
3 *
4 * Copyright (C) 2004 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000022#include <linux/init.h>
Russell King1be72282005-10-31 16:57:06 +000023#include <linux/platform_device.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000024#include <linux/sysdev.h>
Russell Kinga62c80e2006-01-07 13:52:45 +000025#include <linux/amba/bus.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000026
27#include <asm/hardware.h>
28#include <asm/io.h>
29#include <asm/irq.h>
30#include <asm/leds.h>
31#include <asm/mach-types.h>
32#include <asm/hardware/gic.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000033#include <asm/hardware/icst307.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/mmc.h>
38
39#include <asm/arch/irqs.h>
40
41#include "core.h"
42#include "clock.h"
43
44static struct map_desc realview_eb_io_desc[] __initdata = {
Russell King1ffedce2005-11-02 14:14:37 +000045 {
46 .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
47 .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
48 .length = SZ_4K,
49 .type = MT_DEVICE,
50 }, {
51 .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE),
52 .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE),
53 .length = SZ_4K,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE),
57 .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE),
58 .length = SZ_4K,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
62 .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
63 .length = SZ_4K,
64 .type = MT_DEVICE,
65 }, {
66 .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE),
67 .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE),
68 .length = SZ_4K,
69 .type = MT_DEVICE,
70 }, {
71 .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE),
72 .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE),
73 .length = SZ_4K,
74 .type = MT_DEVICE,
75 },
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000076#ifdef CONFIG_DEBUG_LL
Russell King1ffedce2005-11-02 14:14:37 +000077 {
78 .virtual = IO_ADDRESS(REALVIEW_UART0_BASE),
79 .pfn = __phys_to_pfn(REALVIEW_UART0_BASE),
80 .length = SZ_4K,
81 .type = MT_DEVICE,
82 }
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000083#endif
84};
85
86static void __init realview_eb_map_io(void)
87{
88 iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
89}
90
91/* FPGA Primecells */
92AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
93AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
94AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
95AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
96AMBA_DEVICE(uart3, "fpga:09", UART3, NULL);
97
98/* DevChip Primecells */
99AMBA_DEVICE(smc, "dev:00", SMC, NULL);
100AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
101AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
102AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
103AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
104AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL);
105AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
106AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
107AMBA_DEVICE(rtc, "dev:e8", RTC, NULL);
108AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
109AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
110AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
111AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
112AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL);
113
114static struct amba_device *amba_devs[] __initdata = {
115 &dmac_device,
116 &uart0_device,
117 &uart1_device,
118 &uart2_device,
119 &uart3_device,
120 &smc_device,
121 &clcd_device,
122 &sctl_device,
123 &wdog_device,
124 &gpio0_device,
125 &gpio1_device,
126 &gpio2_device,
127 &rtc_device,
128 &sci0_device,
129 &ssp0_device,
130 &aaci_device,
131 &mmc0_device,
132 &kmi0_device,
133 &kmi1_device,
134};
135
136static void __init gic_init_irq(void)
137{
Russell King9b1283b2005-11-07 21:01:06 +0000138#ifdef CONFIG_REALVIEW_MPCORE
Harry Fearnhammbb1a2aa2006-05-16 16:50:21 +0100139 unsigned int pldctrl;
Russell King9b1283b2005-11-07 21:01:06 +0000140 writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
Harry Fearnhammbb1a2aa2006-05-16 16:50:21 +0100141 pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + 0xd8);
142 pldctrl |= 0x00800000; /* New irq mode */
143 writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + 0xd8);
Russell King9b1283b2005-11-07 21:01:06 +0000144 writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
145#endif
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000146 gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE));
147 gic_cpu_init(__io_address(REALVIEW_GIC_CPU_BASE));
148}
149
150static void __init realview_eb_init(void)
151{
152 int i;
153
154 clk_register(&realview_clcd_clk);
155
156 platform_device_register(&realview_flash_device);
157 platform_device_register(&realview_smc91x_device);
158
159 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
160 struct amba_device *d = amba_devs[i];
161 amba_device_register(d, &iomem_resource);
162 }
163
164#ifdef CONFIG_LEDS
165 leds_event = realview_leds_event;
166#endif
167}
168
169MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
170 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000171 .phys_io = REALVIEW_UART0_BASE,
172 .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
173 .boot_params = 0x00000100,
174 .map_io = realview_eb_map_io,
175 .init_irq = gic_init_irq,
176 .timer = &realview_timer,
177 .init_machine = realview_eb_init,
178MACHINE_END