blob: 05da36f754dd9eb8a80f9097be8795057842c018 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-integrator/integrator_cp.c
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License.
9 */
10#include <linux/types.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/list.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010014#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/dma-mapping.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/string.h>
17#include <linux/sysdev.h>
Russell Kinga62c80e2006-01-07 13:52:45 +000018#include <linux/amba/bus.h>
19#include <linux/amba/kmi.h>
20#include <linux/amba/clcd.h>
Linus Walleij6ef297f2009-09-22 14:29:36 +010021#include <linux/amba/mmci.h>
Russell Kingfced80c2008-09-06 12:10:45 +010022#include <linux/io.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090023#include <linux/gfp.h>
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +010024#include <linux/clkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Russell Kinga285edc2010-01-14 19:59:37 +000027#include <mach/platform.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/irq.h>
29#include <asm/setup.h>
30#include <asm/mach-types.h>
Russell King5a463342010-01-16 23:52:12 +000031#include <asm/hardware/arm_timer.h>
Russell Kingc5a0adb2010-01-16 20:16:10 +000032#include <asm/hardware/icst.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/cm.h>
35#include <mach/lm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
37#include <asm/mach/arch.h>
38#include <asm/mach/flash.h>
39#include <asm/mach/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#include <asm/mach/map.h>
41#include <asm/mach/time.h>
42
Rob Herring8a9618f2010-10-06 16:18:08 +010043#include <asm/hardware/timer-sp.h>
Russell King5a463342010-01-16 23:52:12 +000044
Russell King9dfec4f2011-01-18 20:10:10 +000045#include <plat/clcd.h>
Russell Kingc41b16f2011-01-19 15:32:15 +000046#include <plat/fpga-irq.h>
Russell King9dfec4f2011-01-18 20:10:10 +000047
Russell King98c672c2010-05-22 18:18:57 +010048#include "common.h"
49
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#define INTCP_PA_FLASH_BASE 0x24000000
51#define INTCP_FLASH_SIZE SZ_32M
52
53#define INTCP_PA_CLCD_BASE 0xc0000000
54
Russell Kingc41b16f2011-01-19 15:32:15 +000055#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
56#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
57#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#define INTCP_ETH_SIZE 0x10
60
Russell Kingda7ba952010-01-17 19:59:58 +000061#define INTCP_VA_CTRL_BASE IO_ADDRESS(INTEGRATOR_CP_CTL_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070062#define INTCP_FLASHPROG 0x04
63#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
64#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
65
66/*
67 * Logical Physical
68 * f1000000 10000000 Core module registers
69 * f1100000 11000000 System controller registers
70 * f1200000 12000000 EBI registers
71 * f1300000 13000000 Counter/Timer
72 * f1400000 14000000 Interrupt controller
73 * f1600000 16000000 UART 0
74 * f1700000 17000000 UART 1
75 * f1a00000 1a000000 Debug LEDs
Russell Kingda7ba952010-01-17 19:59:58 +000076 * fc900000 c9000000 GPIO
77 * fca00000 ca000000 SIC
78 * fcb00000 cb000000 CP system control
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 */
80
81static struct map_desc intcp_io_desc[] __initdata = {
Deepak Saxenac8d27292005-10-28 15:19:10 +010082 {
83 .virtual = IO_ADDRESS(INTEGRATOR_HDR_BASE),
84 .pfn = __phys_to_pfn(INTEGRATOR_HDR_BASE),
85 .length = SZ_4K,
86 .type = MT_DEVICE
87 }, {
88 .virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
89 .pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
90 .length = SZ_4K,
91 .type = MT_DEVICE
92 }, {
93 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
94 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
95 .length = SZ_4K,
96 .type = MT_DEVICE
97 }, {
98 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE),
99 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE),
100 .length = SZ_4K,
101 .type = MT_DEVICE
102 }, {
103 .virtual = IO_ADDRESS(INTEGRATOR_IC_BASE),
104 .pfn = __phys_to_pfn(INTEGRATOR_IC_BASE),
105 .length = SZ_4K,
106 .type = MT_DEVICE
107 }, {
108 .virtual = IO_ADDRESS(INTEGRATOR_UART0_BASE),
109 .pfn = __phys_to_pfn(INTEGRATOR_UART0_BASE),
110 .length = SZ_4K,
111 .type = MT_DEVICE
112 }, {
113 .virtual = IO_ADDRESS(INTEGRATOR_UART1_BASE),
114 .pfn = __phys_to_pfn(INTEGRATOR_UART1_BASE),
115 .length = SZ_4K,
116 .type = MT_DEVICE
117 }, {
118 .virtual = IO_ADDRESS(INTEGRATOR_DBG_BASE),
119 .pfn = __phys_to_pfn(INTEGRATOR_DBG_BASE),
120 .length = SZ_4K,
121 .type = MT_DEVICE
122 }, {
Russell Kingda7ba952010-01-17 19:59:58 +0000123 .virtual = IO_ADDRESS(INTEGRATOR_CP_GPIO_BASE),
124 .pfn = __phys_to_pfn(INTEGRATOR_CP_GPIO_BASE),
Deepak Saxenac8d27292005-10-28 15:19:10 +0100125 .length = SZ_4K,
126 .type = MT_DEVICE
127 }, {
Russell Kingda7ba952010-01-17 19:59:58 +0000128 .virtual = IO_ADDRESS(INTEGRATOR_CP_SIC_BASE),
129 .pfn = __phys_to_pfn(INTEGRATOR_CP_SIC_BASE),
Deepak Saxenac8d27292005-10-28 15:19:10 +0100130 .length = SZ_4K,
131 .type = MT_DEVICE
132 }, {
Russell Kingda7ba952010-01-17 19:59:58 +0000133 .virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
134 .pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
Deepak Saxenac8d27292005-10-28 15:19:10 +0100135 .length = SZ_4K,
136 .type = MT_DEVICE
137 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138};
139
140static void __init intcp_map_io(void)
141{
142 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc));
143}
144
Russell Kingc41b16f2011-01-19 15:32:15 +0000145static struct fpga_irq_data cic_irq_data = {
146 .base = INTCP_VA_CIC_BASE,
147 .irq_start = IRQ_CIC_START,
148 .chip.name = "CIC",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149};
150
Russell Kingc41b16f2011-01-19 15:32:15 +0000151static struct fpga_irq_data pic_irq_data = {
152 .base = INTCP_VA_PIC_BASE,
153 .irq_start = IRQ_PIC_START,
154 .chip.name = "PIC",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155};
156
Russell Kingc41b16f2011-01-19 15:32:15 +0000157static struct fpga_irq_data sic_irq_data = {
158 .base = INTCP_VA_SIC_BASE,
159 .irq_start = IRQ_SIC_START,
160 .chip.name = "SIC",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161};
162
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163static void __init intcp_init_irq(void)
164{
Russell Kingc41b16f2011-01-19 15:32:15 +0000165 u32 pic_mask, sic_mask;
166
167 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
168 pic_mask |= (~((~0u) << (29 - 22))) << 22;
169 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
171 /*
172 * Disable all interrupt sources
173 */
Russell Kingc41b16f2011-01-19 15:32:15 +0000174 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
175 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
176 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
177 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
178 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
179 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
Russell Kingc41b16f2011-01-19 15:32:15 +0000181 fpga_irq_init(-1, pic_mask, &pic_irq_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
Russell Kingc41b16f2011-01-19 15:32:15 +0000183 fpga_irq_init(-1, ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START)),
184 &cic_irq_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
Russell Kingc41b16f2011-01-19 15:32:15 +0000186 fpga_irq_init(IRQ_CP_CPPLDINT, sic_mask, &sic_irq_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187}
188
189/*
190 * Clock handling
191 */
Russell Kingd1914c72010-01-14 20:09:34 +0000192#define CM_LOCK (__io_address(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
193#define CM_AUXOSC (__io_address(INTEGRATOR_HDR_BASE)+0x1c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Russell King39c0cb02010-01-16 16:27:28 +0000195static const struct icst_params cp_auxvco_params = {
Russell King64fceb12010-01-16 17:28:44 +0000196 .ref = 24000000,
Russell King4de2edb2010-01-16 18:08:47 +0000197 .vco_max = ICST525_VCO_MAX_5V,
Russell Kinge73a46a2010-01-16 19:49:39 +0000198 .vco_min = ICST525_VCO_MIN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 .vd_min = 8,
200 .vd_max = 263,
201 .rd_min = 3,
202 .rd_max = 65,
Russell King232eaf72010-01-16 19:46:19 +0000203 .s2div = icst525_s2div,
204 .idx2s = icst525_idx2s,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205};
206
Russell King39c0cb02010-01-16 16:27:28 +0000207static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208{
209 u32 val;
210
Russell Kingd1914c72010-01-14 20:09:34 +0000211 val = readl(clk->vcoreg) & ~0x7ffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 val |= vco.v | (vco.r << 9) | (vco.s << 16);
213
214 writel(0xa05f, CM_LOCK);
Russell Kingd1914c72010-01-14 20:09:34 +0000215 writel(val, clk->vcoreg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 writel(0, CM_LOCK);
217}
218
Russell King9bf5b2e2010-03-01 16:18:39 +0000219static const struct clk_ops cp_auxclk_ops = {
220 .round = icst_clk_round,
221 .set = icst_clk_set,
222 .setvco = cp_auxvco_set,
223};
224
Russell Kingd72fbdf2008-11-08 20:08:08 +0000225static struct clk cp_auxclk = {
Russell King9bf5b2e2010-03-01 16:18:39 +0000226 .ops = &cp_auxclk_ops,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 .params = &cp_auxvco_params,
Russell Kingd1914c72010-01-14 20:09:34 +0000228 .vcoreg = CM_AUXOSC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229};
230
Russell Kingd72fbdf2008-11-08 20:08:08 +0000231static struct clk_lookup cp_lookups[] = {
232 { /* CLCD */
233 .dev_id = "mb:c0",
234 .clk = &cp_auxclk,
235 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236};
237
238/*
239 * Flash handling.
240 */
241static int intcp_flash_init(void)
242{
243 u32 val;
244
245 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
246 val |= CINTEGRATOR_FLASHPROG_FLWREN;
247 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
248
249 return 0;
250}
251
252static void intcp_flash_exit(void)
253{
254 u32 val;
255
256 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
257 val &= ~(CINTEGRATOR_FLASHPROG_FLVPPEN|CINTEGRATOR_FLASHPROG_FLWREN);
258 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
259}
260
261static void intcp_flash_set_vpp(int on)
262{
263 u32 val;
264
265 val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
266 if (on)
267 val |= CINTEGRATOR_FLASHPROG_FLVPPEN;
268 else
269 val &= ~CINTEGRATOR_FLASHPROG_FLVPPEN;
270 writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
271}
272
273static struct flash_platform_data intcp_flash_data = {
274 .map_name = "cfi_probe",
275 .width = 4,
276 .init = intcp_flash_init,
277 .exit = intcp_flash_exit,
278 .set_vpp = intcp_flash_set_vpp,
279};
280
281static struct resource intcp_flash_resource = {
282 .start = INTCP_PA_FLASH_BASE,
283 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
284 .flags = IORESOURCE_MEM,
285};
286
287static struct platform_device intcp_flash_device = {
288 .name = "armflash",
289 .id = 0,
290 .dev = {
291 .platform_data = &intcp_flash_data,
292 },
293 .num_resources = 1,
294 .resource = &intcp_flash_resource,
295};
296
297static struct resource smc91x_resources[] = {
298 [0] = {
Russell Kingda7ba952010-01-17 19:59:58 +0000299 .start = INTEGRATOR_CP_ETH_BASE,
300 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 .flags = IORESOURCE_MEM,
302 },
303 [1] = {
304 .start = IRQ_CP_ETHINT,
305 .end = IRQ_CP_ETHINT,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device smc91x_device = {
311 .name = "smc91x",
312 .id = 0,
313 .num_resources = ARRAY_SIZE(smc91x_resources),
314 .resource = smc91x_resources,
315};
316
317static struct platform_device *intcp_devs[] __initdata = {
318 &intcp_flash_device,
319 &smc91x_device,
320};
321
322/*
323 * It seems that the card insertion interrupt remains active after
324 * we've acknowledged it. We therefore ignore the interrupt, and
325 * rely on reading it from the SIC. This also means that we must
326 * clear the latched interrupt.
327 */
328static unsigned int mmc_status(struct device *dev)
329{
Russell Kingb830b9b2010-01-17 20:45:12 +0000330 unsigned int status = readl(IO_ADDRESS(0xca000000 + 4));
331 writel(8, IO_ADDRESS(INTEGRATOR_CP_CTL_BASE + 8));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332
333 return status & 8;
334}
335
Linus Walleij6ef297f2009-09-22 14:29:36 +0100336static struct mmci_platform_data mmc_data = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
338 .status = mmc_status,
Russell King7fb2bbf2009-07-09 15:15:12 +0100339 .gpio_wp = -1,
340 .gpio_cd = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341};
342
343static struct amba_device mmc_device = {
344 .dev = {
Kay Sievers1d559e22009-01-06 10:44:43 -0800345 .init_name = "mb:1c",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 .platform_data = &mmc_data,
347 },
348 .res = {
Russell Kingda7ba952010-01-17 19:59:58 +0000349 .start = INTEGRATOR_CP_MMC_BASE,
350 .end = INTEGRATOR_CP_MMC_BASE + SZ_4K - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 .flags = IORESOURCE_MEM,
352 },
353 .irq = { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 },
354 .periphid = 0,
355};
356
357static struct amba_device aaci_device = {
358 .dev = {
Kay Sievers1d559e22009-01-06 10:44:43 -0800359 .init_name = "mb:1d",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 },
361 .res = {
Russell Kingda7ba952010-01-17 19:59:58 +0000362 .start = INTEGRATOR_CP_AACI_BASE,
363 .end = INTEGRATOR_CP_AACI_BASE + SZ_4K - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 .flags = IORESOURCE_MEM,
365 },
366 .irq = { IRQ_CP_AACIINT, NO_IRQ },
367 .periphid = 0,
368};
369
370
371/*
372 * CLCD support
373 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374/*
375 * Ensure VGA is selected.
376 */
377static void cp_clcd_enable(struct clcd_fb *fb)
378{
Russell Kinge6b9c1f2011-01-22 11:02:10 +0000379 struct fb_var_screeninfo *var = &fb->fb.var;
380 u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2;
Russell King4774e222005-04-30 23:32:38 +0100381
Russell Kinge6b9c1f2011-01-22 11:02:10 +0000382 if (var->bits_per_pixel <= 8 ||
383 (var->bits_per_pixel == 16 && var->green.length == 5))
384 /* Pseudocolor, RGB555, BGR555 */
385 val |= CM_CTRL_LCDMUXSEL_VGA555_TFT555;
Russell King4774e222005-04-30 23:32:38 +0100386 else if (fb->fb.var.bits_per_pixel <= 16)
Russell Kinge6b9c1f2011-01-22 11:02:10 +0000387 /* truecolor RGB565 */
388 val |= CM_CTRL_LCDMUXSEL_VGA565_TFT555;
Russell King4774e222005-04-30 23:32:38 +0100389 else
390 val = 0; /* no idea for this, don't trust the docs */
391
392 cm_control(CM_CTRL_LCDMUXSEL_MASK|
393 CM_CTRL_LCDEN0|
394 CM_CTRL_LCDEN1|
395 CM_CTRL_STATIC1|
396 CM_CTRL_STATIC2|
397 CM_CTRL_STATIC|
398 CM_CTRL_n24BITEN, val);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399}
400
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401static int cp_clcd_setup(struct clcd_fb *fb)
402{
Russell King9dfec4f2011-01-18 20:10:10 +0000403 fb->panel = versatile_clcd_get_panel("VGA");
404 if (!fb->panel)
405 return -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406
Russell King9dfec4f2011-01-18 20:10:10 +0000407 return versatile_clcd_setup_dma(fb, SZ_1M);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408}
409
410static struct clcd_board clcd_data = {
411 .name = "Integrator/CP",
Russell King9dfec4f2011-01-18 20:10:10 +0000412 .caps = CLCD_CAP_5551 | CLCD_CAP_RGB565 | CLCD_CAP_888,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 .check = clcdfb_check,
414 .decode = clcdfb_decode,
415 .enable = cp_clcd_enable,
416 .setup = cp_clcd_setup,
Russell King9dfec4f2011-01-18 20:10:10 +0000417 .mmap = versatile_clcd_mmap_dma,
418 .remove = versatile_clcd_remove_dma,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419};
420
421static struct amba_device clcd_device = {
422 .dev = {
Kay Sievers1d559e22009-01-06 10:44:43 -0800423 .init_name = "mb:c0",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 .coherent_dma_mask = ~0,
425 .platform_data = &clcd_data,
426 },
427 .res = {
428 .start = INTCP_PA_CLCD_BASE,
429 .end = INTCP_PA_CLCD_BASE + SZ_4K - 1,
430 .flags = IORESOURCE_MEM,
431 },
432 .dma_mask = ~0,
433 .irq = { IRQ_CP_CLCDCINT, NO_IRQ },
434 .periphid = 0,
435};
436
437static struct amba_device *amba_devs[] __initdata = {
438 &mmc_device,
439 &aaci_device,
440 &clcd_device,
441};
442
Russell Kingc735c982011-01-11 13:00:04 +0000443static void __init intcp_init_early(void)
444{
445 clkdev_add_table(cp_lookups, ARRAY_SIZE(cp_lookups));
446
447 integrator_init_early();
448}
449
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450static void __init intcp_init(void)
451{
452 int i;
453
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
455
456 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
457 struct amba_device *d = amba_devs[i];
458 amba_device_register(d, &iomem_resource);
459 }
460}
461
Russell King5a463342010-01-16 23:52:12 +0000462#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
463#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
464#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
466static void __init intcp_timer_init(void)
467{
Russell King5a463342010-01-16 23:52:12 +0000468 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
469 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
470 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
471
472 sp804_clocksource_init(TIMER2_VA_BASE);
473 sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474}
475
476static struct sys_timer cp_timer = {
477 .init = intcp_timer_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478};
479
480MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100481 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100482 .boot_params = 0x00000100,
Russell King98c672c2010-05-22 18:18:57 +0100483 .reserve = integrator_reserve,
Russell Kingc735c982011-01-11 13:00:04 +0000484 .map_io = intcp_map_io,
485 .init_early = intcp_init_early,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100486 .init_irq = intcp_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 .timer = &cp_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100488 .init_machine = intcp_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489MACHINE_END