blob: 9c992568ee40b667f32b2b039381553214b5cc1b [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>
Catalin Marinas7770bdd2007-02-05 14:48:24 +010034#include <asm/hardware/cache-l2x0.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000035
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/mmc.h>
39
Catalin Marinas356cb472008-02-04 17:34:58 +010040#include <asm/arch/board-eb.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000041#include <asm/arch/irqs.h>
42
43#include "core.h"
44#include "clock.h"
45
46static struct map_desc realview_eb_io_desc[] __initdata = {
Russell King1ffedce2005-11-02 14:14:37 +000047 {
48 .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
49 .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
50 .length = SZ_4K,
51 .type = MT_DEVICE,
52 }, {
53 .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE),
54 .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE),
55 .length = SZ_4K,
56 .type = MT_DEVICE,
57 }, {
58 .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE),
59 .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE),
60 .length = SZ_4K,
61 .type = MT_DEVICE,
Catalin Marinas3edf22ab2007-02-14 19:18:09 +010062 },
63#ifdef CONFIG_REALVIEW_MPCORE
64 {
65 .virtual = IO_ADDRESS(REALVIEW_GIC1_CPU_BASE),
66 .pfn = __phys_to_pfn(REALVIEW_GIC1_CPU_BASE),
67 .length = SZ_4K,
68 .type = MT_DEVICE,
Russell King1ffedce2005-11-02 14:14:37 +000069 }, {
Catalin Marinas3edf22ab2007-02-14 19:18:09 +010070 .virtual = IO_ADDRESS(REALVIEW_GIC1_DIST_BASE),
71 .pfn = __phys_to_pfn(REALVIEW_GIC1_DIST_BASE),
72 .length = SZ_4K,
73 .type = MT_DEVICE,
Catalin Marinas7770bdd2007-02-05 14:48:24 +010074 }, {
75 .virtual = IO_ADDRESS(REALVIEW_MPCORE_L220_BASE),
76 .pfn = __phys_to_pfn(REALVIEW_MPCORE_L220_BASE),
77 .length = SZ_8K,
78 .type = MT_DEVICE,
Catalin Marinas3edf22ab2007-02-14 19:18:09 +010079 },
80#endif
81 {
Russell King1ffedce2005-11-02 14:14:37 +000082 .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
83 .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
84 .length = SZ_4K,
85 .type = MT_DEVICE,
86 }, {
87 .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE),
88 .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE),
89 .length = SZ_4K,
90 .type = MT_DEVICE,
91 }, {
92 .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE),
93 .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE),
94 .length = SZ_4K,
95 .type = MT_DEVICE,
96 },
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000097#ifdef CONFIG_DEBUG_LL
Russell King1ffedce2005-11-02 14:14:37 +000098 {
99 .virtual = IO_ADDRESS(REALVIEW_UART0_BASE),
100 .pfn = __phys_to_pfn(REALVIEW_UART0_BASE),
101 .length = SZ_4K,
102 .type = MT_DEVICE,
103 }
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000104#endif
105};
106
107static void __init realview_eb_map_io(void)
108{
109 iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
110}
111
112/* FPGA Primecells */
113AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
114AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
115AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
116AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
117AMBA_DEVICE(uart3, "fpga:09", UART3, NULL);
118
119/* DevChip Primecells */
120AMBA_DEVICE(smc, "dev:00", SMC, NULL);
121AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
122AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
123AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
124AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
125AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL);
126AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
127AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
128AMBA_DEVICE(rtc, "dev:e8", RTC, NULL);
129AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
130AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
131AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
132AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
133AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL);
134
135static struct amba_device *amba_devs[] __initdata = {
136 &dmac_device,
137 &uart0_device,
138 &uart1_device,
139 &uart2_device,
140 &uart3_device,
141 &smc_device,
142 &clcd_device,
143 &sctl_device,
144 &wdog_device,
145 &gpio0_device,
146 &gpio1_device,
147 &gpio2_device,
148 &rtc_device,
149 &sci0_device,
150 &ssp0_device,
151 &aaci_device,
152 &mmc0_device,
153 &kmi0_device,
154 &kmi1_device,
155};
156
157static void __init gic_init_irq(void)
158{
Russell King9b1283b2005-11-07 21:01:06 +0000159#ifdef CONFIG_REALVIEW_MPCORE
Harry Fearnhammbb1a2aa2006-05-16 16:50:21 +0100160 unsigned int pldctrl;
Russell King9b1283b2005-11-07 21:01:06 +0000161 writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
Catalin Marinas4b172442007-02-14 19:20:28 +0100162 pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1);
Harry Fearnhammbb1a2aa2006-05-16 16:50:21 +0100163 pldctrl |= 0x00800000; /* New irq mode */
Catalin Marinas4b172442007-02-14 19:20:28 +0100164 writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1);
Russell King9b1283b2005-11-07 21:01:06 +0000165 writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
166#endif
Catalin Marinasb3a1bde2007-02-14 19:14:56 +0100167 gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29);
168 gic_cpu_init(0, __io_address(REALVIEW_GIC_CPU_BASE));
Russell Kinga53d6fb2007-09-03 09:43:54 +0100169#if defined(CONFIG_REALVIEW_MPCORE) && !defined(CONFIG_REALVIEW_MPCORE_REVB)
Catalin Marinas3edf22ab2007-02-14 19:18:09 +0100170 gic_dist_init(1, __io_address(REALVIEW_GIC1_DIST_BASE), 64);
171 gic_cpu_init(1, __io_address(REALVIEW_GIC1_CPU_BASE));
172 gic_cascade_irq(1, IRQ_EB_IRQ1);
173#endif
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000174}
175
176static void __init realview_eb_init(void)
177{
178 int i;
179
Catalin Marinas7770bdd2007-02-05 14:48:24 +0100180#ifdef CONFIG_REALVIEW_MPCORE
181 /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
182 * Bits: .... ...0 0111 1001 0000 .... .... .... */
183 l2x0_init(__io_address(REALVIEW_MPCORE_L220_BASE), 0x00790000, 0xfe000fff);
184#endif
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000185 clk_register(&realview_clcd_clk);
186
187 platform_device_register(&realview_flash_device);
188 platform_device_register(&realview_smc91x_device);
Russell King6b65cd72006-12-10 21:21:32 +0100189 platform_device_register(&realview_i2c_device);
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000190
191 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
192 struct amba_device *d = amba_devs[i];
193 amba_device_register(d, &iomem_resource);
194 }
195
196#ifdef CONFIG_LEDS
197 leds_event = realview_leds_event;
198#endif
199}
200
201MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
202 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000203 .phys_io = REALVIEW_UART0_BASE,
204 .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
205 .boot_params = 0x00000100,
206 .map_io = realview_eb_map_io,
207 .init_irq = gic_init_irq,
208 .timer = &realview_timer,
209 .init_machine = realview_eb_init,
210MACHINE_END