blob: 5b1c8bfe6fa938e9c5413c4c556bad17db4cfe31 [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>
Kay Sieversedbaa602011-12-21 16:26:03 -080024#include <linux/device.h>
Russell Kinga62c80e2006-01-07 13:52:45 +000025#include <linux/amba/bus.h>
Russell Kingeb7fffa2009-07-05 22:41:31 +010026#include <linux/amba/pl061.h>
Linus Walleij6ef297f2009-09-22 14:29:36 +010027#include <linux/amba/mmci.h>
Linus Walleijd6ada862010-07-14 23:58:38 +010028#include <linux/amba/pl022.h>
Russell Kingfced80c2008-09-06 12:10:45 +010029#include <linux/io.h>
Rob Herring520f7bd2012-12-27 13:10:24 -060030#include <linux/irqchip/arm-gic.h>
Linus Walleijf9a6aa42012-08-06 18:32:08 +020031#include <linux/platform_data/clk-realview.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000032
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/hardware.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000034#include <asm/irq.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000035#include <asm/mach-types.h>
Catalin Marinascc9897d2010-06-21 15:12:40 +010036#include <asm/pgtable.h>
Catalin Marinas7770bdd2007-02-05 14:48:24 +010037#include <asm/hardware/cache-l2x0.h>
Marc Zyngier7c380f22011-08-04 11:57:04 +010038#include <asm/smp_twd.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000039
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
Catalin Marinas8cc4c542008-02-04 17:43:02 +010042#include <asm/mach/time.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000043
Russell Kinga09e64f2008-08-05 16:14:15 +010044#include <mach/board-eb.h>
45#include <mach/irqs.h>
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000046
47#include "core.h"
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000048
49static struct map_desc realview_eb_io_desc[] __initdata = {
Russell King1ffedce2005-11-02 14:14:37 +000050 {
51 .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
52 .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
53 .length = SZ_4K,
54 .type = MT_DEVICE,
55 }, {
Catalin Marinas073b6ff2008-04-18 22:43:09 +010056 .virtual = IO_ADDRESS(REALVIEW_EB_GIC_CPU_BASE),
57 .pfn = __phys_to_pfn(REALVIEW_EB_GIC_CPU_BASE),
Russell King1ffedce2005-11-02 14:14:37 +000058 .length = SZ_4K,
59 .type = MT_DEVICE,
60 }, {
Catalin Marinas073b6ff2008-04-18 22:43:09 +010061 .virtual = IO_ADDRESS(REALVIEW_EB_GIC_DIST_BASE),
62 .pfn = __phys_to_pfn(REALVIEW_EB_GIC_DIST_BASE),
Russell King1ffedce2005-11-02 14:14:37 +000063 .length = SZ_4K,
64 .type = MT_DEVICE,
65 }, {
66 .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
67 .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
68 .length = SZ_4K,
69 .type = MT_DEVICE,
70 }, {
Catalin Marinas80192732008-04-18 22:43:11 +010071 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER0_1_BASE),
72 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER0_1_BASE),
Russell King1ffedce2005-11-02 14:14:37 +000073 .length = SZ_4K,
74 .type = MT_DEVICE,
75 }, {
Catalin Marinas80192732008-04-18 22:43:11 +010076 .virtual = IO_ADDRESS(REALVIEW_EB_TIMER2_3_BASE),
77 .pfn = __phys_to_pfn(REALVIEW_EB_TIMER2_3_BASE),
Russell King1ffedce2005-11-02 14:14:37 +000078 .length = SZ_4K,
79 .type = MT_DEVICE,
80 },
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000081#ifdef CONFIG_DEBUG_LL
Russell King1ffedce2005-11-02 14:14:37 +000082 {
Catalin Marinas9a386f02008-04-18 22:43:11 +010083 .virtual = IO_ADDRESS(REALVIEW_EB_UART0_BASE),
84 .pfn = __phys_to_pfn(REALVIEW_EB_UART0_BASE),
Russell King1ffedce2005-11-02 14:14:37 +000085 .length = SZ_4K,
86 .type = MT_DEVICE,
87 }
Catalin Marinas8ad68bb2005-10-31 14:25:02 +000088#endif
89};
90
Catalin Marinas7dd19e72008-02-04 17:39:00 +010091static struct map_desc realview_eb11mp_io_desc[] __initdata = {
92 {
Marc Zyngier34ae6c92012-01-24 11:56:02 +010093 .virtual = IO_ADDRESS(REALVIEW_EB11MP_PRIV_MEM_BASE),
94 .pfn = __phys_to_pfn(REALVIEW_EB11MP_PRIV_MEM_BASE),
95 .length = REALVIEW_EB11MP_PRIV_MEM_SIZE,
Catalin Marinas7dd19e72008-02-04 17:39:00 +010096 .type = MT_DEVICE,
97 }, {
98 .virtual = IO_ADDRESS(REALVIEW_EB11MP_L220_BASE),
99 .pfn = __phys_to_pfn(REALVIEW_EB11MP_L220_BASE),
100 .length = SZ_8K,
101 .type = MT_DEVICE,
102 }
103};
104
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000105static void __init realview_eb_map_io(void)
106{
107 iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
Jon Callan4c3ea372008-12-01 14:54:56 +0000108 if (core_tile_eb11mp() || core_tile_a9mp())
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100109 iotable_init(realview_eb11mp_io_desc, ARRAY_SIZE(realview_eb11mp_io_desc));
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000110}
111
Russell Kingeb7fffa2009-07-05 22:41:31 +0100112static struct pl061_platform_data gpio0_plat_data = {
113 .gpio_base = 0,
Russell Kingeb7fffa2009-07-05 22:41:31 +0100114};
115
116static struct pl061_platform_data gpio1_plat_data = {
117 .gpio_base = 8,
Russell Kingeb7fffa2009-07-05 22:41:31 +0100118};
119
120static struct pl061_platform_data gpio2_plat_data = {
121 .gpio_base = 16,
Russell Kingeb7fffa2009-07-05 22:41:31 +0100122};
123
Linus Walleijd6ada862010-07-14 23:58:38 +0100124static struct pl022_ssp_controller ssp0_plat_data = {
125 .bus_id = 0,
126 .enable_dma = 0,
127 .num_chipselect = 1,
128};
129
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100130/*
131 * RealView EB AMBA devices
132 */
133
134/*
135 * These devices are connected via the core APB bridge
136 */
Russell King0dada612011-12-18 11:40:46 +0000137#define GPIO2_IRQ { IRQ_EB_GPIO2 }
138#define GPIO3_IRQ { IRQ_EB_GPIO3 }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100139
Russell King0dada612011-12-18 11:40:46 +0000140#define AACI_IRQ { IRQ_EB_AACI }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100141#define MMCI0_IRQ { IRQ_EB_MMCI0A, IRQ_EB_MMCI0B }
Russell King0dada612011-12-18 11:40:46 +0000142#define KMI0_IRQ { IRQ_EB_KMI0 }
143#define KMI1_IRQ { IRQ_EB_KMI1 }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100144
145/*
146 * These devices are connected directly to the multi-layer AHB switch
147 */
Russell King0dada612011-12-18 11:40:46 +0000148#define EB_SMC_IRQ { }
149#define MPMC_IRQ { }
150#define EB_CLCD_IRQ { IRQ_EB_CLCD }
151#define DMAC_IRQ { IRQ_EB_DMA }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100152
153/*
154 * These devices are connected via the core APB bridge
155 */
Russell King0dada612011-12-18 11:40:46 +0000156#define SCTL_IRQ { }
157#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG }
158#define EB_GPIO0_IRQ { IRQ_EB_GPIO0 }
159#define GPIO1_IRQ { IRQ_EB_GPIO1 }
160#define EB_RTC_IRQ { IRQ_EB_RTC }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100161
162/*
163 * These devices are connected via the DMA APB bridge
164 */
Russell King0dada612011-12-18 11:40:46 +0000165#define SCI_IRQ { IRQ_EB_SCI }
166#define EB_UART0_IRQ { IRQ_EB_UART0 }
167#define EB_UART1_IRQ { IRQ_EB_UART1 }
168#define EB_UART2_IRQ { IRQ_EB_UART2 }
169#define EB_UART3_IRQ { IRQ_EB_UART3 }
170#define EB_SSP_IRQ { IRQ_EB_SSP }
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100171
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000172/* FPGA Primecells */
Russell King9199340b2011-12-18 13:38:49 +0000173APB_DEVICE(aaci, "fpga:aaci", AACI, NULL);
174APB_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
175APB_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
176APB_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
177APB_DEVICE(uart3, "fpga:uart3", EB_UART3, NULL);
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000178
179/* DevChip Primecells */
Russell King9199340b2011-12-18 13:38:49 +0000180AHB_DEVICE(smc, "dev:smc", EB_SMC, NULL);
181AHB_DEVICE(clcd, "dev:clcd", EB_CLCD, &clcd_plat_data);
182AHB_DEVICE(dmac, "dev:dmac", DMAC, NULL);
183AHB_DEVICE(sctl, "dev:sctl", SCTL, NULL);
184APB_DEVICE(wdog, "dev:wdog", EB_WATCHDOG, NULL);
185APB_DEVICE(gpio0, "dev:gpio0", EB_GPIO0, &gpio0_plat_data);
186APB_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
187APB_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
188APB_DEVICE(rtc, "dev:rtc", EB_RTC, NULL);
189APB_DEVICE(sci0, "dev:sci0", SCI, NULL);
190APB_DEVICE(uart0, "dev:uart0", EB_UART0, NULL);
191APB_DEVICE(uart1, "dev:uart1", EB_UART1, NULL);
192APB_DEVICE(uart2, "dev:uart2", EB_UART2, NULL);
193APB_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data);
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000194
195static struct amba_device *amba_devs[] __initdata = {
196 &dmac_device,
197 &uart0_device,
198 &uart1_device,
199 &uart2_device,
200 &uart3_device,
201 &smc_device,
202 &clcd_device,
203 &sctl_device,
204 &wdog_device,
205 &gpio0_device,
206 &gpio1_device,
207 &gpio2_device,
208 &rtc_device,
209 &sci0_device,
210 &ssp0_device,
211 &aaci_device,
212 &mmc0_device,
213 &kmi0_device,
214 &kmi1_device,
215};
216
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100217/*
218 * RealView EB platform devices
219 */
Catalin Marinasa44ddfd2008-04-18 22:43:10 +0100220static struct resource realview_eb_flash_resource = {
221 .start = REALVIEW_EB_FLASH_BASE,
222 .end = REALVIEW_EB_FLASH_BASE + REALVIEW_EB_FLASH_SIZE - 1,
223 .flags = IORESOURCE_MEM,
224};
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100225
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100226static struct resource realview_eb_eth_resources[] = {
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100227 [0] = {
Catalin Marinas393538e2008-04-18 22:43:11 +0100228 .start = REALVIEW_EB_ETH_BASE,
229 .end = REALVIEW_EB_ETH_BASE + SZ_64K - 1,
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100230 .flags = IORESOURCE_MEM,
231 },
232 [1] = {
233 .start = IRQ_EB_ETH,
234 .end = IRQ_EB_ETH,
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100239/*
240 * Detect and register the correct Ethernet device. RealView/EB rev D
241 * platforms use the newer SMSC LAN9118 Ethernet chip
242 */
243static int eth_device_register(void)
244{
Catalin Marinas393538e2008-04-18 22:43:11 +0100245 void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K);
Catalin Marinas0a381332008-12-01 14:54:58 +0000246 const char *name = NULL;
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100247 u32 idrev;
248
249 if (!eth_addr)
250 return -ENOMEM;
251
252 idrev = readl(eth_addr + 0x50);
Catalin Marinas0a381332008-12-01 14:54:58 +0000253 if ((idrev & 0xFFFF0000) != 0x01180000)
254 /* SMSC LAN9118 not present, use LAN91C111 instead */
255 name = "smc91x";
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100256
257 iounmap(eth_addr);
Catalin Marinas0a381332008-12-01 14:54:58 +0000258 return realview_eth_register(name, realview_eb_eth_resources);
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100259}
260
Catalin Marinas7db21712009-02-12 16:00:21 +0100261static struct resource realview_eb_isp1761_resources[] = {
262 [0] = {
263 .start = REALVIEW_EB_USB_BASE,
264 .end = REALVIEW_EB_USB_BASE + SZ_128K - 1,
265 .flags = IORESOURCE_MEM,
266 },
267 [1] = {
268 .start = IRQ_EB_USB,
269 .end = IRQ_EB_USB,
270 .flags = IORESOURCE_IRQ,
271 },
272};
273
Will Deaconf417cba2010-04-15 10:16:26 +0100274static struct resource pmu_resources[] = {
275 [0] = {
276 .start = IRQ_EB11MP_PMU_CPU0,
277 .end = IRQ_EB11MP_PMU_CPU0,
278 .flags = IORESOURCE_IRQ,
279 },
280 [1] = {
281 .start = IRQ_EB11MP_PMU_CPU1,
282 .end = IRQ_EB11MP_PMU_CPU1,
283 .flags = IORESOURCE_IRQ,
284 },
285 [2] = {
286 .start = IRQ_EB11MP_PMU_CPU2,
287 .end = IRQ_EB11MP_PMU_CPU2,
288 .flags = IORESOURCE_IRQ,
289 },
290 [3] = {
291 .start = IRQ_EB11MP_PMU_CPU3,
292 .end = IRQ_EB11MP_PMU_CPU3,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device pmu_device = {
298 .name = "arm-pmu",
Sudeep KarkadaNageshadf3d17e2012-07-19 09:50:21 +0100299 .id = -1,
Will Deaconf417cba2010-04-15 10:16:26 +0100300 .num_resources = ARRAY_SIZE(pmu_resources),
301 .resource = pmu_resources,
302};
303
Linus Walleijd161edf2010-07-17 12:34:25 +0100304static struct resource char_lcd_resources[] = {
305 {
306 .start = REALVIEW_CHAR_LCD_BASE,
307 .end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
308 .flags = IORESOURCE_MEM,
309 },
310 {
311 .start = IRQ_EB_CHARLCD,
312 .end = IRQ_EB_CHARLCD,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static struct platform_device char_lcd_device = {
318 .name = "arm-charlcd",
319 .id = -1,
320 .num_resources = ARRAY_SIZE(char_lcd_resources),
321 .resource = char_lcd_resources,
322};
323
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000324static void __init gic_init_irq(void)
325{
Jon Callan4c3ea372008-12-01 14:54:56 +0000326 if (core_tile_eb11mp() || core_tile_a9mp()) {
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100327 unsigned int pldctrl;
328
329 /* new irq mode */
330 writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
331 pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1);
332 pldctrl |= 0x00800000;
333 writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1);
334 writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
335
336 /* core tile GIC, primary */
Russell Kingb580b892010-12-04 15:55:14 +0000337 gic_init(0, 29, __io_address(REALVIEW_EB11MP_GIC_DIST_BASE),
Russell Kingff2e27a2010-12-04 16:13:29 +0000338 __io_address(REALVIEW_EB11MP_GIC_CPU_BASE));
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100339
Catalin Marinas41579f42008-02-04 17:47:04 +0100340#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100341 /* board GIC, secondary */
Pawel Moll0efc48e2011-03-17 13:10:22 +0100342 gic_init(1, 96, __io_address(REALVIEW_EB_GIC_DIST_BASE),
Russell Kingb580b892010-12-04 15:55:14 +0000343 __io_address(REALVIEW_EB_GIC_CPU_BASE));
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100344 gic_cascade_irq(1, IRQ_EB11MP_EB_IRQ1);
Russell King9b1283b2005-11-07 21:01:06 +0000345#endif
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100346 } else {
347 /* board GIC, primary */
Russell Kingb580b892010-12-04 15:55:14 +0000348 gic_init(0, 29, __io_address(REALVIEW_EB_GIC_DIST_BASE),
Russell Kingff2e27a2010-12-04 16:13:29 +0000349 __io_address(REALVIEW_EB_GIC_CPU_BASE));
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100350 }
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000351}
352
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100353/*
354 * Fix up the IRQ numbers for the RealView EB/ARM11MPCore tile
355 */
356static void realview_eb11mp_fixup(void)
357{
358 /* AMBA devices */
359 dmac_device.irq[0] = IRQ_EB11MP_DMA;
360 uart0_device.irq[0] = IRQ_EB11MP_UART0;
361 uart1_device.irq[0] = IRQ_EB11MP_UART1;
362 uart2_device.irq[0] = IRQ_EB11MP_UART2;
363 uart3_device.irq[0] = IRQ_EB11MP_UART3;
364 clcd_device.irq[0] = IRQ_EB11MP_CLCD;
365 wdog_device.irq[0] = IRQ_EB11MP_WDOG;
366 gpio0_device.irq[0] = IRQ_EB11MP_GPIO0;
367 gpio1_device.irq[0] = IRQ_EB11MP_GPIO1;
368 gpio2_device.irq[0] = IRQ_EB11MP_GPIO2;
369 rtc_device.irq[0] = IRQ_EB11MP_RTC;
370 sci0_device.irq[0] = IRQ_EB11MP_SCI;
371 ssp0_device.irq[0] = IRQ_EB11MP_SSP;
372 aaci_device.irq[0] = IRQ_EB11MP_AACI;
373 mmc0_device.irq[0] = IRQ_EB11MP_MMCI0A;
374 mmc0_device.irq[1] = IRQ_EB11MP_MMCI0B;
375 kmi0_device.irq[0] = IRQ_EB11MP_KMI0;
376 kmi1_device.irq[0] = IRQ_EB11MP_KMI1;
377
378 /* platform devices */
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100379 realview_eb_eth_resources[1].start = IRQ_EB11MP_ETH;
380 realview_eb_eth_resources[1].end = IRQ_EB11MP_ETH;
Catalin Marinas7db21712009-02-12 16:00:21 +0100381 realview_eb_isp1761_resources[1].start = IRQ_EB11MP_USB;
382 realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100383}
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100384
Marc Zyngier7c380f22011-08-04 11:57:04 +0100385#ifdef CONFIG_HAVE_ARM_TWD
386static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
387 REALVIEW_EB11MP_TWD_BASE,
388 IRQ_LOCALTIMER);
389
390static void __init realview_eb_twd_init(void)
391{
392 if (core_tile_eb11mp() || core_tile_a9mp()) {
393 int err = twd_local_timer_register(&twd_local_timer);
394 if (err)
395 pr_err("twd_local_timer_register failed %d\n", err);
396 }
397}
398#else
399#define realview_eb_twd_init() do { } while(0)
400#endif
401
Catalin Marinas8cc4c542008-02-04 17:43:02 +0100402static void __init realview_eb_timer_init(void)
403{
404 unsigned int timer_irq;
405
Catalin Marinas80192732008-04-18 22:43:11 +0100406 timer0_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE);
407 timer1_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE) + 0x20;
408 timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
409 timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
410
Marc Zyngier7c380f22011-08-04 11:57:04 +0100411 if (core_tile_eb11mp() || core_tile_a9mp())
Catalin Marinas8cc4c542008-02-04 17:43:02 +0100412 timer_irq = IRQ_EB11MP_TIMER0_1;
Marc Zyngier7c380f22011-08-04 11:57:04 +0100413 else
Catalin Marinas8cc4c542008-02-04 17:43:02 +0100414 timer_irq = IRQ_EB_TIMER0_1;
415
Linus Walleijf9a6aa42012-08-06 18:32:08 +0200416 realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);
Catalin Marinas8cc4c542008-02-04 17:43:02 +0100417 realview_timer_init(timer_irq);
Marc Zyngier7c380f22011-08-04 11:57:04 +0100418 realview_eb_twd_init();
Catalin Marinas8cc4c542008-02-04 17:43:02 +0100419}
420
Russell King47cacdd42011-11-03 14:00:13 +0000421static void realview_eb_restart(char mode, const char *cmd)
Colin Tuckley4c9f8be2010-01-11 11:09:15 +0100422{
423 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
424 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
425
426 /*
427 * To reset, we hit the on-board reset register
428 * in the system FPGA
429 */
430 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
431 if (core_tile_eb11mp())
432 __raw_writel(0x0008, reset_ctrl);
Russell King47cacdd42011-11-03 14:00:13 +0000433 dsb();
Colin Tuckley4c9f8be2010-01-11 11:09:15 +0100434}
435
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000436static void __init realview_eb_init(void)
437{
438 int i;
439
Jon Callan4c3ea372008-12-01 14:54:56 +0000440 if (core_tile_eb11mp() || core_tile_a9mp()) {
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100441 realview_eb11mp_fixup();
Catalin Marinas0fc2a162008-02-04 17:36:59 +0100442
Catalin Marinasba927952008-04-18 22:43:17 +0100443#ifdef CONFIG_CACHE_L2X0
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100444 /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
445 * Bits: .... ...0 0111 1001 0000 .... .... .... */
446 l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff);
Catalin Marinasba927952008-04-18 22:43:17 +0100447#endif
Will Deaconf417cba2010-04-15 10:16:26 +0100448 platform_device_register(&pmu_device);
Catalin Marinas7dd19e72008-02-04 17:39:00 +0100449 }
450
Catalin Marinasa44ddfd2008-04-18 22:43:10 +0100451 realview_flash_register(&realview_eb_flash_resource, 1);
Russell King6b65cd72006-12-10 21:21:32 +0100452 platform_device_register(&realview_i2c_device);
Linus Walleijd161edf2010-07-17 12:34:25 +0100453 platform_device_register(&char_lcd_device);
Catalin Marinasbe4f3c82008-04-18 22:43:09 +0100454 eth_device_register();
Catalin Marinas7db21712009-02-12 16:00:21 +0100455 realview_usb_register(realview_eb_isp1761_resources);
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000456
457 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
458 struct amba_device *d = amba_devs[i];
459 amba_device_register(d, &iomem_resource);
460 }
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000461}
462
463MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
464 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
Nicolas Pitre9ddea572011-07-05 22:38:16 -0400465 .atag_offset = 0x100,
Steve Capper810883f2012-12-06 11:44:59 +0100466 .smp = smp_ops(realview_smp_ops),
Catalin Marinas5b39d152009-11-04 12:19:04 +0000467 .fixup = realview_fixup,
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000468 .map_io = realview_eb_map_io,
Russell King631e55f2011-01-11 13:05:01 +0000469 .init_early = realview_init_early,
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000470 .init_irq = gic_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700471 .init_time = realview_eb_timer_init,
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000472 .init_machine = realview_eb_init,
Nicolas Pitre00e91252011-07-05 22:28:09 -0400473#ifdef CONFIG_ZONE_DMA
474 .dma_zone_size = SZ_256M,
475#endif
Russell King47cacdd42011-11-03 14:00:13 +0000476 .restart = realview_eb_restart,
Catalin Marinas8ad68bb2005-10-31 14:25:02 +0000477MACHINE_END