blob: 30c9518797876792ca45fa7c0925b835842d290c [file] [log] [blame]
Saeed Bisharaedabd382009-08-06 15:12:43 +03001/*
2 * arch/arm/mach-dove/common.c
3 *
4 * Core functions for Marvell Dove 88AP510 System On Chip
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/delay.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/serial_8250.h>
17#include <linux/clk.h>
18#include <linux/mbus.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/mv643xx_i2c.h>
21#include <linux/ata_platform.h>
Andrew Lunn5c602552011-05-15 13:32:40 +020022#include <linux/serial_8250.h>
Saeed Bisharaedabd382009-08-06 15:12:43 +030023#include <linux/spi/orion_spi.h>
24#include <linux/gpio.h>
25#include <asm/page.h>
26#include <asm/setup.h>
27#include <asm/timex.h>
Lennert Buytenhek573a6522009-11-24 19:33:52 +020028#include <asm/hardware/cache-tauros2.h>
Saeed Bisharaedabd382009-08-06 15:12:43 +030029#include <asm/mach/map.h>
30#include <asm/mach/time.h>
31#include <asm/mach/pci.h>
32#include <mach/dove.h>
33#include <mach/bridge-regs.h>
34#include <asm/mach/arch.h>
35#include <linux/irq.h>
36#include <plat/mv_xor.h>
37#include <plat/ehci-orion.h>
38#include <plat/time.h>
39#include "common.h"
40
41/*****************************************************************************
42 * I/O Address Mapping
43 ****************************************************************************/
44static struct map_desc dove_io_desc[] __initdata = {
45 {
46 .virtual = DOVE_SB_REGS_VIRT_BASE,
47 .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE),
48 .length = DOVE_SB_REGS_SIZE,
49 .type = MT_DEVICE,
50 }, {
51 .virtual = DOVE_NB_REGS_VIRT_BASE,
52 .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE),
53 .length = DOVE_NB_REGS_SIZE,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = DOVE_PCIE0_IO_VIRT_BASE,
57 .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE),
58 .length = DOVE_PCIE0_IO_SIZE,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = DOVE_PCIE1_IO_VIRT_BASE,
62 .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE),
63 .length = DOVE_PCIE1_IO_SIZE,
64 .type = MT_DEVICE,
65 },
66};
67
68void __init dove_map_io(void)
69{
70 iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc));
71}
72
73/*****************************************************************************
74 * EHCI
75 ****************************************************************************/
76static struct orion_ehci_data dove_ehci_data = {
77 .dram = &dove_mbus_dram_info,
78 .phy_version = EHCI_PHY_NA,
79};
80
81static u64 ehci_dmamask = DMA_BIT_MASK(32);
82
83/*****************************************************************************
84 * EHCI0
85 ****************************************************************************/
86static struct resource dove_ehci0_resources[] = {
87 {
88 .start = DOVE_USB0_PHYS_BASE,
89 .end = DOVE_USB0_PHYS_BASE + SZ_4K - 1,
90 .flags = IORESOURCE_MEM,
91 }, {
92 .start = IRQ_DOVE_USB0,
93 .end = IRQ_DOVE_USB0,
94 .flags = IORESOURCE_IRQ,
95 },
96};
97
98static struct platform_device dove_ehci0 = {
99 .name = "orion-ehci",
100 .id = 0,
101 .dev = {
102 .dma_mask = &ehci_dmamask,
103 .coherent_dma_mask = DMA_BIT_MASK(32),
104 .platform_data = &dove_ehci_data,
105 },
106 .resource = dove_ehci0_resources,
107 .num_resources = ARRAY_SIZE(dove_ehci0_resources),
108};
109
110void __init dove_ehci0_init(void)
111{
112 platform_device_register(&dove_ehci0);
113}
114
115/*****************************************************************************
116 * EHCI1
117 ****************************************************************************/
118static struct resource dove_ehci1_resources[] = {
119 {
120 .start = DOVE_USB1_PHYS_BASE,
121 .end = DOVE_USB1_PHYS_BASE + SZ_4K - 1,
122 .flags = IORESOURCE_MEM,
123 }, {
124 .start = IRQ_DOVE_USB1,
125 .end = IRQ_DOVE_USB1,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device dove_ehci1 = {
131 .name = "orion-ehci",
132 .id = 1,
133 .dev = {
134 .dma_mask = &ehci_dmamask,
135 .coherent_dma_mask = DMA_BIT_MASK(32),
136 .platform_data = &dove_ehci_data,
137 },
138 .resource = dove_ehci1_resources,
139 .num_resources = ARRAY_SIZE(dove_ehci1_resources),
140};
141
142void __init dove_ehci1_init(void)
143{
144 platform_device_register(&dove_ehci1);
145}
146
147/*****************************************************************************
148 * GE00
149 ****************************************************************************/
150struct mv643xx_eth_shared_platform_data dove_ge00_shared_data = {
151 .t_clk = 0,
152 .dram = &dove_mbus_dram_info,
153};
154
155static struct resource dove_ge00_shared_resources[] = {
156 {
157 .name = "ge00 base",
158 .start = DOVE_GE00_PHYS_BASE + 0x2000,
159 .end = DOVE_GE00_PHYS_BASE + SZ_16K - 1,
160 .flags = IORESOURCE_MEM,
161 },
162};
163
164static struct platform_device dove_ge00_shared = {
165 .name = MV643XX_ETH_SHARED_NAME,
166 .id = 0,
167 .dev = {
168 .platform_data = &dove_ge00_shared_data,
169 },
170 .num_resources = 1,
171 .resource = dove_ge00_shared_resources,
172};
173
174static struct resource dove_ge00_resources[] = {
175 {
176 .name = "ge00 irq",
177 .start = IRQ_DOVE_GE00_SUM,
178 .end = IRQ_DOVE_GE00_SUM,
179 .flags = IORESOURCE_IRQ,
180 },
181};
182
183static struct platform_device dove_ge00 = {
184 .name = MV643XX_ETH_NAME,
185 .id = 0,
186 .num_resources = 1,
187 .resource = dove_ge00_resources,
188 .dev = {
189 .coherent_dma_mask = 0xffffffff,
190 },
191};
192
193void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
194{
195 eth_data->shared = &dove_ge00_shared;
196 dove_ge00.dev.platform_data = eth_data;
197
198 platform_device_register(&dove_ge00_shared);
199 platform_device_register(&dove_ge00);
200}
201
202/*****************************************************************************
203 * SoC RTC
204 ****************************************************************************/
205static struct resource dove_rtc_resource[] = {
206 {
207 .start = DOVE_RTC_PHYS_BASE,
208 .end = DOVE_RTC_PHYS_BASE + 32 - 1,
209 .flags = IORESOURCE_MEM,
210 }, {
211 .start = IRQ_DOVE_RTC,
212 .flags = IORESOURCE_IRQ,
213 }
214};
215
216void __init dove_rtc_init(void)
217{
218 platform_device_register_simple("rtc-mv", -1, dove_rtc_resource, 2);
219}
220
221/*****************************************************************************
222 * SATA
223 ****************************************************************************/
224static struct resource dove_sata_resources[] = {
225 {
226 .name = "sata base",
227 .start = DOVE_SATA_PHYS_BASE,
228 .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1,
229 .flags = IORESOURCE_MEM,
230 }, {
231 .name = "sata irq",
232 .start = IRQ_DOVE_SATA,
233 .end = IRQ_DOVE_SATA,
234 .flags = IORESOURCE_IRQ,
235 },
236};
237
238static struct platform_device dove_sata = {
239 .name = "sata_mv",
240 .id = 0,
241 .dev = {
242 .coherent_dma_mask = DMA_BIT_MASK(32),
243 },
244 .num_resources = ARRAY_SIZE(dove_sata_resources),
245 .resource = dove_sata_resources,
246};
247
248void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
249{
250 sata_data->dram = &dove_mbus_dram_info;
251 dove_sata.dev.platform_data = sata_data;
252 platform_device_register(&dove_sata);
253}
254
255/*****************************************************************************
256 * UART0
257 ****************************************************************************/
258static struct plat_serial8250_port dove_uart0_data[] = {
259 {
260 .mapbase = DOVE_UART0_PHYS_BASE,
261 .membase = (char *)DOVE_UART0_VIRT_BASE,
262 .irq = IRQ_DOVE_UART_0,
263 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
264 .iotype = UPIO_MEM,
265 .regshift = 2,
266 .uartclk = 0,
267 }, {
268 },
269};
270
271static struct resource dove_uart0_resources[] = {
272 {
273 .start = DOVE_UART0_PHYS_BASE,
274 .end = DOVE_UART0_PHYS_BASE + SZ_256 - 1,
275 .flags = IORESOURCE_MEM,
276 }, {
277 .start = IRQ_DOVE_UART_0,
278 .end = IRQ_DOVE_UART_0,
279 .flags = IORESOURCE_IRQ,
280 },
281};
282
283static struct platform_device dove_uart0 = {
284 .name = "serial8250",
Andrew Lunn5c602552011-05-15 13:32:40 +0200285 .id = PLAT8250_DEV_PLATFORM,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300286 .dev = {
287 .platform_data = dove_uart0_data,
288 },
289 .resource = dove_uart0_resources,
290 .num_resources = ARRAY_SIZE(dove_uart0_resources),
291};
292
293void __init dove_uart0_init(void)
294{
295 platform_device_register(&dove_uart0);
296}
297
298/*****************************************************************************
299 * UART1
300 ****************************************************************************/
301static struct plat_serial8250_port dove_uart1_data[] = {
302 {
303 .mapbase = DOVE_UART1_PHYS_BASE,
304 .membase = (char *)DOVE_UART1_VIRT_BASE,
305 .irq = IRQ_DOVE_UART_1,
306 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
307 .iotype = UPIO_MEM,
308 .regshift = 2,
309 .uartclk = 0,
310 }, {
311 },
312};
313
314static struct resource dove_uart1_resources[] = {
315 {
316 .start = DOVE_UART1_PHYS_BASE,
317 .end = DOVE_UART1_PHYS_BASE + SZ_256 - 1,
318 .flags = IORESOURCE_MEM,
319 }, {
320 .start = IRQ_DOVE_UART_1,
321 .end = IRQ_DOVE_UART_1,
322 .flags = IORESOURCE_IRQ,
323 },
324};
325
326static struct platform_device dove_uart1 = {
327 .name = "serial8250",
Andrew Lunn5c602552011-05-15 13:32:40 +0200328 .id = PLAT8250_DEV_PLATFORM1,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300329 .dev = {
330 .platform_data = dove_uart1_data,
331 },
332 .resource = dove_uart1_resources,
333 .num_resources = ARRAY_SIZE(dove_uart1_resources),
334};
335
336void __init dove_uart1_init(void)
337{
338 platform_device_register(&dove_uart1);
339}
340
341/*****************************************************************************
342 * UART2
343 ****************************************************************************/
344static struct plat_serial8250_port dove_uart2_data[] = {
345 {
346 .mapbase = DOVE_UART2_PHYS_BASE,
347 .membase = (char *)DOVE_UART2_VIRT_BASE,
348 .irq = IRQ_DOVE_UART_2,
349 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
350 .iotype = UPIO_MEM,
351 .regshift = 2,
352 .uartclk = 0,
353 }, {
354 },
355};
356
357static struct resource dove_uart2_resources[] = {
358 {
359 .start = DOVE_UART2_PHYS_BASE,
360 .end = DOVE_UART2_PHYS_BASE + SZ_256 - 1,
361 .flags = IORESOURCE_MEM,
362 }, {
363 .start = IRQ_DOVE_UART_2,
364 .end = IRQ_DOVE_UART_2,
365 .flags = IORESOURCE_IRQ,
366 },
367};
368
369static struct platform_device dove_uart2 = {
370 .name = "serial8250",
Andrew Lunn5c602552011-05-15 13:32:40 +0200371 .id = PLAT8250_DEV_PLATFORM2,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300372 .dev = {
373 .platform_data = dove_uart2_data,
374 },
375 .resource = dove_uart2_resources,
376 .num_resources = ARRAY_SIZE(dove_uart2_resources),
377};
378
379void __init dove_uart2_init(void)
380{
381 platform_device_register(&dove_uart2);
382}
383
384/*****************************************************************************
385 * UART3
386 ****************************************************************************/
387static struct plat_serial8250_port dove_uart3_data[] = {
388 {
389 .mapbase = DOVE_UART3_PHYS_BASE,
390 .membase = (char *)DOVE_UART3_VIRT_BASE,
391 .irq = IRQ_DOVE_UART_3,
392 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
393 .iotype = UPIO_MEM,
394 .regshift = 2,
395 .uartclk = 0,
396 }, {
397 },
398};
399
400static struct resource dove_uart3_resources[] = {
401 {
402 .start = DOVE_UART3_PHYS_BASE,
403 .end = DOVE_UART3_PHYS_BASE + SZ_256 - 1,
404 .flags = IORESOURCE_MEM,
405 }, {
406 .start = IRQ_DOVE_UART_3,
407 .end = IRQ_DOVE_UART_3,
408 .flags = IORESOURCE_IRQ,
409 },
410};
411
412static struct platform_device dove_uart3 = {
413 .name = "serial8250",
414 .id = 3,
415 .dev = {
416 .platform_data = dove_uart3_data,
417 },
418 .resource = dove_uart3_resources,
419 .num_resources = ARRAY_SIZE(dove_uart3_resources),
420};
421
422void __init dove_uart3_init(void)
423{
424 platform_device_register(&dove_uart3);
425}
426
427/*****************************************************************************
428 * SPI0
429 ****************************************************************************/
430static struct orion_spi_info dove_spi0_data = {
431 .tclk = 0,
432};
433
434static struct resource dove_spi0_resources[] = {
435 {
436 .start = DOVE_SPI0_PHYS_BASE,
437 .end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1,
438 .flags = IORESOURCE_MEM,
439 }, {
440 .start = IRQ_DOVE_SPI0,
441 .end = IRQ_DOVE_SPI0,
442 .flags = IORESOURCE_IRQ,
443 },
444};
445
446static struct platform_device dove_spi0 = {
447 .name = "orion_spi",
448 .id = 0,
449 .resource = dove_spi0_resources,
450 .dev = {
451 .platform_data = &dove_spi0_data,
452 },
453 .num_resources = ARRAY_SIZE(dove_spi0_resources),
454};
455
456void __init dove_spi0_init(void)
457{
458 platform_device_register(&dove_spi0);
459}
460
461/*****************************************************************************
462 * SPI1
463 ****************************************************************************/
464static struct orion_spi_info dove_spi1_data = {
465 .tclk = 0,
466};
467
468static struct resource dove_spi1_resources[] = {
469 {
470 .start = DOVE_SPI1_PHYS_BASE,
471 .end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1,
472 .flags = IORESOURCE_MEM,
473 }, {
474 .start = IRQ_DOVE_SPI1,
475 .end = IRQ_DOVE_SPI1,
476 .flags = IORESOURCE_IRQ,
477 },
478};
479
480static struct platform_device dove_spi1 = {
481 .name = "orion_spi",
482 .id = 1,
483 .resource = dove_spi1_resources,
484 .dev = {
485 .platform_data = &dove_spi1_data,
486 },
487 .num_resources = ARRAY_SIZE(dove_spi1_resources),
488};
489
490void __init dove_spi1_init(void)
491{
492 platform_device_register(&dove_spi1);
493}
494
495/*****************************************************************************
496 * I2C
497 ****************************************************************************/
498static struct mv64xxx_i2c_pdata dove_i2c_data = {
499 .freq_m = 10, /* assumes 166 MHz TCLK gets 94.3kHz */
500 .freq_n = 3,
501 .timeout = 1000, /* Default timeout of 1 second */
502};
503
504static struct resource dove_i2c_resources[] = {
505 {
506 .name = "i2c base",
507 .start = DOVE_I2C_PHYS_BASE,
508 .end = DOVE_I2C_PHYS_BASE + 0x20 - 1,
509 .flags = IORESOURCE_MEM,
510 }, {
511 .name = "i2c irq",
512 .start = IRQ_DOVE_I2C,
513 .end = IRQ_DOVE_I2C,
514 .flags = IORESOURCE_IRQ,
515 },
516};
517
518static struct platform_device dove_i2c = {
519 .name = MV64XXX_I2C_CTLR_NAME,
520 .id = 0,
521 .num_resources = ARRAY_SIZE(dove_i2c_resources),
522 .resource = dove_i2c_resources,
523 .dev = {
524 .platform_data = &dove_i2c_data,
525 },
526};
527
528void __init dove_i2c_init(void)
529{
530 platform_device_register(&dove_i2c);
531}
532
533/*****************************************************************************
534 * Time handling
535 ****************************************************************************/
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200536void __init dove_init_early(void)
537{
538 orion_time_set_base(TIMER_VIRT_BASE);
539}
540
Saeed Bisharaedabd382009-08-06 15:12:43 +0300541static int get_tclk(void)
542{
543 /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
544 return 166666667;
545}
546
547static void dove_timer_init(void)
548{
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200549 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
550 IRQ_DOVE_BRIDGE, get_tclk());
Saeed Bisharaedabd382009-08-06 15:12:43 +0300551}
552
553struct sys_timer dove_timer = {
554 .init = dove_timer_init,
555};
556
557/*****************************************************************************
558 * XOR
559 ****************************************************************************/
560static struct mv_xor_platform_shared_data dove_xor_shared_data = {
561 .dram = &dove_mbus_dram_info,
562};
563
564/*****************************************************************************
565 * XOR 0
566 ****************************************************************************/
567static u64 dove_xor0_dmamask = DMA_BIT_MASK(32);
568
569static struct resource dove_xor0_shared_resources[] = {
570 {
571 .name = "xor 0 low",
572 .start = DOVE_XOR0_PHYS_BASE,
573 .end = DOVE_XOR0_PHYS_BASE + 0xff,
574 .flags = IORESOURCE_MEM,
575 }, {
576 .name = "xor 0 high",
577 .start = DOVE_XOR0_HIGH_PHYS_BASE,
578 .end = DOVE_XOR0_HIGH_PHYS_BASE + 0xff,
579 .flags = IORESOURCE_MEM,
580 },
581};
582
583static struct platform_device dove_xor0_shared = {
584 .name = MV_XOR_SHARED_NAME,
585 .id = 0,
586 .dev = {
587 .platform_data = &dove_xor_shared_data,
588 },
589 .num_resources = ARRAY_SIZE(dove_xor0_shared_resources),
590 .resource = dove_xor0_shared_resources,
591};
592
593static struct resource dove_xor00_resources[] = {
594 [0] = {
595 .start = IRQ_DOVE_XOR_00,
596 .end = IRQ_DOVE_XOR_00,
597 .flags = IORESOURCE_IRQ,
598 },
599};
600
601static struct mv_xor_platform_data dove_xor00_data = {
602 .shared = &dove_xor0_shared,
603 .hw_id = 0,
604 .pool_size = PAGE_SIZE,
605};
606
607static struct platform_device dove_xor00_channel = {
608 .name = MV_XOR_NAME,
609 .id = 0,
610 .num_resources = ARRAY_SIZE(dove_xor00_resources),
611 .resource = dove_xor00_resources,
612 .dev = {
613 .dma_mask = &dove_xor0_dmamask,
614 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweeten639b9be2010-01-29 15:30:53 -0700615 .platform_data = &dove_xor00_data,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300616 },
617};
618
619static struct resource dove_xor01_resources[] = {
620 [0] = {
621 .start = IRQ_DOVE_XOR_01,
622 .end = IRQ_DOVE_XOR_01,
623 .flags = IORESOURCE_IRQ,
624 },
625};
626
627static struct mv_xor_platform_data dove_xor01_data = {
628 .shared = &dove_xor0_shared,
629 .hw_id = 1,
630 .pool_size = PAGE_SIZE,
631};
632
633static struct platform_device dove_xor01_channel = {
634 .name = MV_XOR_NAME,
635 .id = 1,
636 .num_resources = ARRAY_SIZE(dove_xor01_resources),
637 .resource = dove_xor01_resources,
638 .dev = {
639 .dma_mask = &dove_xor0_dmamask,
640 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweeten639b9be2010-01-29 15:30:53 -0700641 .platform_data = &dove_xor01_data,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300642 },
643};
644
645void __init dove_xor0_init(void)
646{
647 platform_device_register(&dove_xor0_shared);
648
649 /*
650 * two engines can't do memset simultaneously, this limitation
651 * satisfied by removing memset support from one of the engines.
652 */
653 dma_cap_set(DMA_MEMCPY, dove_xor00_data.cap_mask);
654 dma_cap_set(DMA_XOR, dove_xor00_data.cap_mask);
655 platform_device_register(&dove_xor00_channel);
656
657 dma_cap_set(DMA_MEMCPY, dove_xor01_data.cap_mask);
658 dma_cap_set(DMA_MEMSET, dove_xor01_data.cap_mask);
659 dma_cap_set(DMA_XOR, dove_xor01_data.cap_mask);
660 platform_device_register(&dove_xor01_channel);
661}
662
663/*****************************************************************************
664 * XOR 1
665 ****************************************************************************/
666static u64 dove_xor1_dmamask = DMA_BIT_MASK(32);
667
668static struct resource dove_xor1_shared_resources[] = {
669 {
670 .name = "xor 0 low",
671 .start = DOVE_XOR1_PHYS_BASE,
672 .end = DOVE_XOR1_PHYS_BASE + 0xff,
673 .flags = IORESOURCE_MEM,
674 }, {
675 .name = "xor 0 high",
676 .start = DOVE_XOR1_HIGH_PHYS_BASE,
677 .end = DOVE_XOR1_HIGH_PHYS_BASE + 0xff,
678 .flags = IORESOURCE_MEM,
679 },
680};
681
682static struct platform_device dove_xor1_shared = {
683 .name = MV_XOR_SHARED_NAME,
684 .id = 1,
685 .dev = {
686 .platform_data = &dove_xor_shared_data,
687 },
688 .num_resources = ARRAY_SIZE(dove_xor1_shared_resources),
689 .resource = dove_xor1_shared_resources,
690};
691
692static struct resource dove_xor10_resources[] = {
693 [0] = {
694 .start = IRQ_DOVE_XOR_10,
695 .end = IRQ_DOVE_XOR_10,
696 .flags = IORESOURCE_IRQ,
697 },
698};
699
700static struct mv_xor_platform_data dove_xor10_data = {
701 .shared = &dove_xor1_shared,
702 .hw_id = 0,
703 .pool_size = PAGE_SIZE,
704};
705
706static struct platform_device dove_xor10_channel = {
707 .name = MV_XOR_NAME,
708 .id = 2,
709 .num_resources = ARRAY_SIZE(dove_xor10_resources),
710 .resource = dove_xor10_resources,
711 .dev = {
712 .dma_mask = &dove_xor1_dmamask,
713 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweeten639b9be2010-01-29 15:30:53 -0700714 .platform_data = &dove_xor10_data,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300715 },
716};
717
718static struct resource dove_xor11_resources[] = {
719 [0] = {
720 .start = IRQ_DOVE_XOR_11,
721 .end = IRQ_DOVE_XOR_11,
722 .flags = IORESOURCE_IRQ,
723 },
724};
725
726static struct mv_xor_platform_data dove_xor11_data = {
727 .shared = &dove_xor1_shared,
728 .hw_id = 1,
729 .pool_size = PAGE_SIZE,
730};
731
732static struct platform_device dove_xor11_channel = {
733 .name = MV_XOR_NAME,
734 .id = 3,
735 .num_resources = ARRAY_SIZE(dove_xor11_resources),
736 .resource = dove_xor11_resources,
737 .dev = {
738 .dma_mask = &dove_xor1_dmamask,
739 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweeten639b9be2010-01-29 15:30:53 -0700740 .platform_data = &dove_xor11_data,
Saeed Bisharaedabd382009-08-06 15:12:43 +0300741 },
742};
743
744void __init dove_xor1_init(void)
745{
746 platform_device_register(&dove_xor1_shared);
747
748 /*
749 * two engines can't do memset simultaneously, this limitation
750 * satisfied by removing memset support from one of the engines.
751 */
752 dma_cap_set(DMA_MEMCPY, dove_xor10_data.cap_mask);
753 dma_cap_set(DMA_XOR, dove_xor10_data.cap_mask);
754 platform_device_register(&dove_xor10_channel);
755
756 dma_cap_set(DMA_MEMCPY, dove_xor11_data.cap_mask);
757 dma_cap_set(DMA_MEMSET, dove_xor11_data.cap_mask);
758 dma_cap_set(DMA_XOR, dove_xor11_data.cap_mask);
759 platform_device_register(&dove_xor11_channel);
760}
761
Saeed Bishara16bc90a2010-05-06 16:12:06 +0300762/*****************************************************************************
763 * SDIO
764 ****************************************************************************/
765static u64 sdio_dmamask = DMA_BIT_MASK(32);
766
767static struct resource dove_sdio0_resources[] = {
768 {
769 .start = DOVE_SDIO0_PHYS_BASE,
770 .end = DOVE_SDIO0_PHYS_BASE + 0xff,
771 .flags = IORESOURCE_MEM,
772 }, {
773 .start = IRQ_DOVE_SDIO0,
774 .end = IRQ_DOVE_SDIO0,
775 .flags = IORESOURCE_IRQ,
776 },
777};
778
779static struct platform_device dove_sdio0 = {
Mike Rapoport930e2fe2010-10-28 21:23:53 +0200780 .name = "sdhci-dove",
Saeed Bishara16bc90a2010-05-06 16:12:06 +0300781 .id = 0,
782 .dev = {
783 .dma_mask = &sdio_dmamask,
784 .coherent_dma_mask = DMA_BIT_MASK(32),
785 },
786 .resource = dove_sdio0_resources,
787 .num_resources = ARRAY_SIZE(dove_sdio0_resources),
788};
789
790void __init dove_sdio0_init(void)
791{
792 platform_device_register(&dove_sdio0);
793}
794
795static struct resource dove_sdio1_resources[] = {
796 {
797 .start = DOVE_SDIO1_PHYS_BASE,
798 .end = DOVE_SDIO1_PHYS_BASE + 0xff,
799 .flags = IORESOURCE_MEM,
800 }, {
801 .start = IRQ_DOVE_SDIO1,
802 .end = IRQ_DOVE_SDIO1,
803 .flags = IORESOURCE_IRQ,
804 },
805};
806
807static struct platform_device dove_sdio1 = {
Mike Rapoport930e2fe2010-10-28 21:23:53 +0200808 .name = "sdhci-dove",
Saeed Bishara16bc90a2010-05-06 16:12:06 +0300809 .id = 1,
810 .dev = {
811 .dma_mask = &sdio_dmamask,
812 .coherent_dma_mask = DMA_BIT_MASK(32),
813 },
814 .resource = dove_sdio1_resources,
815 .num_resources = ARRAY_SIZE(dove_sdio1_resources),
816};
817
818void __init dove_sdio1_init(void)
819{
820 platform_device_register(&dove_sdio1);
821}
822
Saeed Bisharaedabd382009-08-06 15:12:43 +0300823void __init dove_init(void)
824{
825 int tclk;
826
827 tclk = get_tclk();
828
829 printk(KERN_INFO "Dove 88AP510 SoC, ");
830 printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
831
Lennert Buytenhek573a6522009-11-24 19:33:52 +0200832#ifdef CONFIG_CACHE_TAUROS2
833 tauros2_init();
834#endif
Saeed Bisharaedabd382009-08-06 15:12:43 +0300835 dove_setup_cpu_mbus();
836
837 dove_ge00_shared_data.t_clk = tclk;
838 dove_uart0_data[0].uartclk = tclk;
839 dove_uart1_data[0].uartclk = tclk;
840 dove_uart2_data[0].uartclk = tclk;
841 dove_uart3_data[0].uartclk = tclk;
842 dove_spi0_data.tclk = tclk;
843 dove_spi1_data.tclk = tclk;
844
845 /* internal devices that every board has */
846 dove_rtc_init();
847 dove_xor0_init();
848 dove_xor1_init();
849}