Staging: hv: mousevsc: Cleanup alloc_input_device()
[zen-stable.git] / arch / arm / plat-orion / common.c
blob9e5451b3c8e3be92c441dc977c906b63715544a5
1 /*
2 * arch/arm/plat-orion/common.c
4 * Marvell Orion SoC common setup code used by multiple mach-/common.c
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 */
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/serial_8250.h>
16 #include <linux/mbus.h>
17 #include <linux/ata_platform.h>
18 #include <linux/mv643xx_eth.h>
19 #include <linux/mv643xx_i2c.h>
20 #include <net/dsa.h>
21 #include <linux/spi/orion_spi.h>
22 #include <plat/orion_wdt.h>
23 #include <plat/mv_xor.h>
24 #include <plat/ehci-orion.h>
26 /* Fill in the resources structure and link it into the platform
27 device structure. There is always a memory region, and nearly
28 always an interrupt.*/
29 static void fill_resources(struct platform_device *device,
30 struct resource *resources,
31 resource_size_t mapbase,
32 resource_size_t size,
33 unsigned int irq)
35 device->resource = resources;
36 device->num_resources = 1;
37 resources[0].flags = IORESOURCE_MEM;
38 resources[0].start = mapbase;
39 resources[0].end = mapbase + size;
41 if (irq != NO_IRQ) {
42 device->num_resources++;
43 resources[1].flags = IORESOURCE_IRQ;
44 resources[1].start = irq;
45 resources[1].end = irq;
49 /*****************************************************************************
50 * UART
51 ****************************************************************************/
52 static void __init uart_complete(
53 struct platform_device *orion_uart,
54 struct plat_serial8250_port *data,
55 struct resource *resources,
56 unsigned int membase,
57 resource_size_t mapbase,
58 unsigned int irq,
59 unsigned int uartclk)
61 data->mapbase = mapbase;
62 data->membase = (void __iomem *)membase;
63 data->irq = irq;
64 data->uartclk = uartclk;
65 orion_uart->dev.platform_data = data;
67 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
68 platform_device_register(orion_uart);
71 /*****************************************************************************
72 * UART0
73 ****************************************************************************/
74 static struct plat_serial8250_port orion_uart0_data[] = {
76 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
77 .iotype = UPIO_MEM,
78 .regshift = 2,
79 }, {
83 static struct resource orion_uart0_resources[2];
85 static struct platform_device orion_uart0 = {
86 .name = "serial8250",
87 .id = PLAT8250_DEV_PLATFORM,
90 void __init orion_uart0_init(unsigned int membase,
91 resource_size_t mapbase,
92 unsigned int irq,
93 unsigned int uartclk)
95 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
96 membase, mapbase, irq, uartclk);
99 /*****************************************************************************
100 * UART1
101 ****************************************************************************/
102 static struct plat_serial8250_port orion_uart1_data[] = {
104 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
105 .iotype = UPIO_MEM,
106 .regshift = 2,
107 }, {
111 static struct resource orion_uart1_resources[2];
113 static struct platform_device orion_uart1 = {
114 .name = "serial8250",
115 .id = PLAT8250_DEV_PLATFORM1,
118 void __init orion_uart1_init(unsigned int membase,
119 resource_size_t mapbase,
120 unsigned int irq,
121 unsigned int uartclk)
123 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
124 membase, mapbase, irq, uartclk);
127 /*****************************************************************************
128 * UART2
129 ****************************************************************************/
130 static struct plat_serial8250_port orion_uart2_data[] = {
132 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
133 .iotype = UPIO_MEM,
134 .regshift = 2,
135 }, {
139 static struct resource orion_uart2_resources[2];
141 static struct platform_device orion_uart2 = {
142 .name = "serial8250",
143 .id = PLAT8250_DEV_PLATFORM2,
146 void __init orion_uart2_init(unsigned int membase,
147 resource_size_t mapbase,
148 unsigned int irq,
149 unsigned int uartclk)
151 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
152 membase, mapbase, irq, uartclk);
155 /*****************************************************************************
156 * UART3
157 ****************************************************************************/
158 static struct plat_serial8250_port orion_uart3_data[] = {
160 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
161 .iotype = UPIO_MEM,
162 .regshift = 2,
163 }, {
167 static struct resource orion_uart3_resources[2];
169 static struct platform_device orion_uart3 = {
170 .name = "serial8250",
171 .id = 3,
174 void __init orion_uart3_init(unsigned int membase,
175 resource_size_t mapbase,
176 unsigned int irq,
177 unsigned int uartclk)
179 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
180 membase, mapbase, irq, uartclk);
183 /*****************************************************************************
184 * SoC RTC
185 ****************************************************************************/
186 static struct resource orion_rtc_resource[2];
188 void __init orion_rtc_init(unsigned long mapbase,
189 unsigned long irq)
191 orion_rtc_resource[0].start = mapbase;
192 orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
193 orion_rtc_resource[0].flags = IORESOURCE_MEM;
194 orion_rtc_resource[1].start = irq;
195 orion_rtc_resource[1].end = irq;
196 orion_rtc_resource[1].flags = IORESOURCE_IRQ;
198 platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
201 /*****************************************************************************
202 * GE
203 ****************************************************************************/
204 static __init void ge_complete(
205 struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
206 struct mbus_dram_target_info *mbus_dram_info, int tclk,
207 struct resource *orion_ge_resource, unsigned long irq,
208 struct platform_device *orion_ge_shared,
209 struct mv643xx_eth_platform_data *eth_data,
210 struct platform_device *orion_ge)
212 orion_ge_shared_data->dram = mbus_dram_info;
213 orion_ge_shared_data->t_clk = tclk;
214 orion_ge_resource->start = irq;
215 orion_ge_resource->end = irq;
216 eth_data->shared = orion_ge_shared;
217 orion_ge->dev.platform_data = eth_data;
219 platform_device_register(orion_ge_shared);
220 platform_device_register(orion_ge);
223 /*****************************************************************************
224 * GE00
225 ****************************************************************************/
226 struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
228 static struct resource orion_ge00_shared_resources[] = {
230 .name = "ge00 base",
231 }, {
232 .name = "ge00 err irq",
236 static struct platform_device orion_ge00_shared = {
237 .name = MV643XX_ETH_SHARED_NAME,
238 .id = 0,
239 .dev = {
240 .platform_data = &orion_ge00_shared_data,
244 static struct resource orion_ge00_resources[] = {
246 .name = "ge00 irq",
247 .flags = IORESOURCE_IRQ,
251 static struct platform_device orion_ge00 = {
252 .name = MV643XX_ETH_NAME,
253 .id = 0,
254 .num_resources = 1,
255 .resource = orion_ge00_resources,
256 .dev = {
257 .coherent_dma_mask = DMA_BIT_MASK(32),
261 void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
262 struct mbus_dram_target_info *mbus_dram_info,
263 unsigned long mapbase,
264 unsigned long irq,
265 unsigned long irq_err,
266 int tclk)
268 fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
269 mapbase + 0x2000, SZ_16K - 1, irq_err);
270 ge_complete(&orion_ge00_shared_data, mbus_dram_info, tclk,
271 orion_ge00_resources, irq, &orion_ge00_shared,
272 eth_data, &orion_ge00);
275 /*****************************************************************************
276 * GE01
277 ****************************************************************************/
278 struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = {
279 .shared_smi = &orion_ge00_shared,
282 static struct resource orion_ge01_shared_resources[] = {
284 .name = "ge01 base",
285 }, {
286 .name = "ge01 err irq",
290 static struct platform_device orion_ge01_shared = {
291 .name = MV643XX_ETH_SHARED_NAME,
292 .id = 1,
293 .dev = {
294 .platform_data = &orion_ge01_shared_data,
298 static struct resource orion_ge01_resources[] = {
300 .name = "ge01 irq",
301 .flags = IORESOURCE_IRQ,
305 static struct platform_device orion_ge01 = {
306 .name = MV643XX_ETH_NAME,
307 .id = 1,
308 .num_resources = 1,
309 .resource = orion_ge01_resources,
310 .dev = {
311 .coherent_dma_mask = DMA_BIT_MASK(32),
315 void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
316 struct mbus_dram_target_info *mbus_dram_info,
317 unsigned long mapbase,
318 unsigned long irq,
319 unsigned long irq_err,
320 int tclk)
322 fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
323 mapbase + 0x2000, SZ_16K - 1, irq_err);
324 ge_complete(&orion_ge01_shared_data, mbus_dram_info, tclk,
325 orion_ge01_resources, irq, &orion_ge01_shared,
326 eth_data, &orion_ge01);
329 /*****************************************************************************
330 * GE10
331 ****************************************************************************/
332 struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = {
333 .shared_smi = &orion_ge00_shared,
336 static struct resource orion_ge10_shared_resources[] = {
338 .name = "ge10 base",
339 }, {
340 .name = "ge10 err irq",
344 static struct platform_device orion_ge10_shared = {
345 .name = MV643XX_ETH_SHARED_NAME,
346 .id = 1,
347 .dev = {
348 .platform_data = &orion_ge10_shared_data,
352 static struct resource orion_ge10_resources[] = {
354 .name = "ge10 irq",
355 .flags = IORESOURCE_IRQ,
359 static struct platform_device orion_ge10 = {
360 .name = MV643XX_ETH_NAME,
361 .id = 1,
362 .num_resources = 2,
363 .resource = orion_ge10_resources,
364 .dev = {
365 .coherent_dma_mask = DMA_BIT_MASK(32),
369 void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
370 struct mbus_dram_target_info *mbus_dram_info,
371 unsigned long mapbase,
372 unsigned long irq,
373 unsigned long irq_err,
374 int tclk)
376 fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
377 mapbase + 0x2000, SZ_16K - 1, irq_err);
378 ge_complete(&orion_ge10_shared_data, mbus_dram_info, tclk,
379 orion_ge10_resources, irq, &orion_ge10_shared,
380 eth_data, &orion_ge10);
383 /*****************************************************************************
384 * GE11
385 ****************************************************************************/
386 struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = {
387 .shared_smi = &orion_ge00_shared,
390 static struct resource orion_ge11_shared_resources[] = {
392 .name = "ge11 base",
393 }, {
394 .name = "ge11 err irq",
398 static struct platform_device orion_ge11_shared = {
399 .name = MV643XX_ETH_SHARED_NAME,
400 .id = 1,
401 .dev = {
402 .platform_data = &orion_ge11_shared_data,
406 static struct resource orion_ge11_resources[] = {
408 .name = "ge11 irq",
409 .flags = IORESOURCE_IRQ,
413 static struct platform_device orion_ge11 = {
414 .name = MV643XX_ETH_NAME,
415 .id = 1,
416 .num_resources = 2,
417 .resource = orion_ge11_resources,
418 .dev = {
419 .coherent_dma_mask = DMA_BIT_MASK(32),
423 void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
424 struct mbus_dram_target_info *mbus_dram_info,
425 unsigned long mapbase,
426 unsigned long irq,
427 unsigned long irq_err,
428 int tclk)
430 fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
431 mapbase + 0x2000, SZ_16K - 1, irq_err);
432 ge_complete(&orion_ge11_shared_data, mbus_dram_info, tclk,
433 orion_ge11_resources, irq, &orion_ge11_shared,
434 eth_data, &orion_ge11);
437 /*****************************************************************************
438 * Ethernet switch
439 ****************************************************************************/
440 static struct resource orion_switch_resources[] = {
442 .start = 0,
443 .end = 0,
444 .flags = IORESOURCE_IRQ,
448 static struct platform_device orion_switch_device = {
449 .name = "dsa",
450 .id = 0,
451 .num_resources = 0,
452 .resource = orion_switch_resources,
455 void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
457 int i;
459 if (irq != NO_IRQ) {
460 orion_switch_resources[0].start = irq;
461 orion_switch_resources[0].end = irq;
462 orion_switch_device.num_resources = 1;
465 d->netdev = &orion_ge00.dev;
466 for (i = 0; i < d->nr_chips; i++)
467 d->chip[i].mii_bus = &orion_ge00_shared.dev;
468 orion_switch_device.dev.platform_data = d;
470 platform_device_register(&orion_switch_device);
473 /*****************************************************************************
474 * I2C
475 ****************************************************************************/
476 static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
477 .freq_n = 3,
478 .timeout = 1000, /* Default timeout of 1 second */
481 static struct resource orion_i2c_resources[2];
483 static struct platform_device orion_i2c = {
484 .name = MV64XXX_I2C_CTLR_NAME,
485 .id = 0,
486 .dev = {
487 .platform_data = &orion_i2c_pdata,
491 static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
492 .freq_n = 3,
493 .timeout = 1000, /* Default timeout of 1 second */
496 static struct resource orion_i2c_1_resources[2];
498 static struct platform_device orion_i2c_1 = {
499 .name = MV64XXX_I2C_CTLR_NAME,
500 .id = 1,
501 .dev = {
502 .platform_data = &orion_i2c_1_pdata,
506 void __init orion_i2c_init(unsigned long mapbase,
507 unsigned long irq,
508 unsigned long freq_m)
510 orion_i2c_pdata.freq_m = freq_m;
511 fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
512 SZ_32 - 1, irq);
513 platform_device_register(&orion_i2c);
516 void __init orion_i2c_1_init(unsigned long mapbase,
517 unsigned long irq,
518 unsigned long freq_m)
520 orion_i2c_1_pdata.freq_m = freq_m;
521 fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
522 SZ_32 - 1, irq);
523 platform_device_register(&orion_i2c_1);
526 /*****************************************************************************
527 * SPI
528 ****************************************************************************/
529 static struct orion_spi_info orion_spi_plat_data;
530 static struct resource orion_spi_resources;
532 static struct platform_device orion_spi = {
533 .name = "orion_spi",
534 .id = 0,
535 .dev = {
536 .platform_data = &orion_spi_plat_data,
540 static struct orion_spi_info orion_spi_1_plat_data;
541 static struct resource orion_spi_1_resources;
543 static struct platform_device orion_spi_1 = {
544 .name = "orion_spi",
545 .id = 1,
546 .dev = {
547 .platform_data = &orion_spi_1_plat_data,
551 /* Note: The SPI silicon core does have interrupts. However the
552 * current Linux software driver does not use interrupts. */
554 void __init orion_spi_init(unsigned long mapbase,
555 unsigned long tclk)
557 orion_spi_plat_data.tclk = tclk;
558 fill_resources(&orion_spi, &orion_spi_resources,
559 mapbase, SZ_512 - 1, NO_IRQ);
560 platform_device_register(&orion_spi);
563 void __init orion_spi_1_init(unsigned long mapbase,
564 unsigned long tclk)
566 orion_spi_1_plat_data.tclk = tclk;
567 fill_resources(&orion_spi_1, &orion_spi_1_resources,
568 mapbase, SZ_512 - 1, NO_IRQ);
569 platform_device_register(&orion_spi_1);
572 /*****************************************************************************
573 * Watchdog
574 ****************************************************************************/
575 static struct orion_wdt_platform_data orion_wdt_data;
577 static struct platform_device orion_wdt_device = {
578 .name = "orion_wdt",
579 .id = -1,
580 .dev = {
581 .platform_data = &orion_wdt_data,
583 .num_resources = 0,
586 void __init orion_wdt_init(unsigned long tclk)
588 orion_wdt_data.tclk = tclk;
589 platform_device_register(&orion_wdt_device);
592 /*****************************************************************************
593 * XOR
594 ****************************************************************************/
595 static struct mv_xor_platform_shared_data orion_xor_shared_data;
597 static u64 orion_xor_dmamask = DMA_BIT_MASK(32);
599 void __init orion_xor_init_channels(
600 struct mv_xor_platform_data *orion_xor0_data,
601 struct platform_device *orion_xor0_channel,
602 struct mv_xor_platform_data *orion_xor1_data,
603 struct platform_device *orion_xor1_channel)
606 * two engines can't do memset simultaneously, this limitation
607 * satisfied by removing memset support from one of the engines.
609 dma_cap_set(DMA_MEMCPY, orion_xor0_data->cap_mask);
610 dma_cap_set(DMA_XOR, orion_xor0_data->cap_mask);
611 platform_device_register(orion_xor0_channel);
613 dma_cap_set(DMA_MEMCPY, orion_xor1_data->cap_mask);
614 dma_cap_set(DMA_MEMSET, orion_xor1_data->cap_mask);
615 dma_cap_set(DMA_XOR, orion_xor1_data->cap_mask);
616 platform_device_register(orion_xor1_channel);
619 /*****************************************************************************
620 * XOR0
621 ****************************************************************************/
622 static struct resource orion_xor0_shared_resources[] = {
624 .name = "xor 0 low",
625 .flags = IORESOURCE_MEM,
626 }, {
627 .name = "xor 0 high",
628 .flags = IORESOURCE_MEM,
632 static struct platform_device orion_xor0_shared = {
633 .name = MV_XOR_SHARED_NAME,
634 .id = 0,
635 .dev = {
636 .platform_data = &orion_xor_shared_data,
638 .num_resources = ARRAY_SIZE(orion_xor0_shared_resources),
639 .resource = orion_xor0_shared_resources,
642 static struct resource orion_xor00_resources[] = {
643 [0] = {
644 .flags = IORESOURCE_IRQ,
648 static struct mv_xor_platform_data orion_xor00_data = {
649 .shared = &orion_xor0_shared,
650 .hw_id = 0,
651 .pool_size = PAGE_SIZE,
654 static struct platform_device orion_xor00_channel = {
655 .name = MV_XOR_NAME,
656 .id = 0,
657 .num_resources = ARRAY_SIZE(orion_xor00_resources),
658 .resource = orion_xor00_resources,
659 .dev = {
660 .dma_mask = &orion_xor_dmamask,
661 .coherent_dma_mask = DMA_BIT_MASK(64),
662 .platform_data = &orion_xor00_data,
666 static struct resource orion_xor01_resources[] = {
667 [0] = {
668 .flags = IORESOURCE_IRQ,
672 static struct mv_xor_platform_data orion_xor01_data = {
673 .shared = &orion_xor0_shared,
674 .hw_id = 1,
675 .pool_size = PAGE_SIZE,
678 static struct platform_device orion_xor01_channel = {
679 .name = MV_XOR_NAME,
680 .id = 1,
681 .num_resources = ARRAY_SIZE(orion_xor01_resources),
682 .resource = orion_xor01_resources,
683 .dev = {
684 .dma_mask = &orion_xor_dmamask,
685 .coherent_dma_mask = DMA_BIT_MASK(64),
686 .platform_data = &orion_xor01_data,
690 void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info,
691 unsigned long mapbase_low,
692 unsigned long mapbase_high,
693 unsigned long irq_0,
694 unsigned long irq_1)
696 orion_xor_shared_data.dram = mbus_dram_info;
698 orion_xor0_shared_resources[0].start = mapbase_low;
699 orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
700 orion_xor0_shared_resources[1].start = mapbase_high;
701 orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
703 orion_xor00_resources[0].start = irq_0;
704 orion_xor00_resources[0].end = irq_0;
705 orion_xor01_resources[0].start = irq_1;
706 orion_xor01_resources[0].end = irq_1;
708 platform_device_register(&orion_xor0_shared);
710 orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel,
711 &orion_xor01_data, &orion_xor01_channel);
714 /*****************************************************************************
715 * XOR1
716 ****************************************************************************/
717 static struct resource orion_xor1_shared_resources[] = {
719 .name = "xor 1 low",
720 .flags = IORESOURCE_MEM,
721 }, {
722 .name = "xor 1 high",
723 .flags = IORESOURCE_MEM,
727 static struct platform_device orion_xor1_shared = {
728 .name = MV_XOR_SHARED_NAME,
729 .id = 1,
730 .dev = {
731 .platform_data = &orion_xor_shared_data,
733 .num_resources = ARRAY_SIZE(orion_xor1_shared_resources),
734 .resource = orion_xor1_shared_resources,
737 static struct resource orion_xor10_resources[] = {
738 [0] = {
739 .flags = IORESOURCE_IRQ,
743 static struct mv_xor_platform_data orion_xor10_data = {
744 .shared = &orion_xor1_shared,
745 .hw_id = 0,
746 .pool_size = PAGE_SIZE,
749 static struct platform_device orion_xor10_channel = {
750 .name = MV_XOR_NAME,
751 .id = 2,
752 .num_resources = ARRAY_SIZE(orion_xor10_resources),
753 .resource = orion_xor10_resources,
754 .dev = {
755 .dma_mask = &orion_xor_dmamask,
756 .coherent_dma_mask = DMA_BIT_MASK(64),
757 .platform_data = &orion_xor10_data,
761 static struct resource orion_xor11_resources[] = {
762 [0] = {
763 .flags = IORESOURCE_IRQ,
767 static struct mv_xor_platform_data orion_xor11_data = {
768 .shared = &orion_xor1_shared,
769 .hw_id = 1,
770 .pool_size = PAGE_SIZE,
773 static struct platform_device orion_xor11_channel = {
774 .name = MV_XOR_NAME,
775 .id = 3,
776 .num_resources = ARRAY_SIZE(orion_xor11_resources),
777 .resource = orion_xor11_resources,
778 .dev = {
779 .dma_mask = &orion_xor_dmamask,
780 .coherent_dma_mask = DMA_BIT_MASK(64),
781 .platform_data = &orion_xor11_data,
785 void __init orion_xor1_init(unsigned long mapbase_low,
786 unsigned long mapbase_high,
787 unsigned long irq_0,
788 unsigned long irq_1)
790 orion_xor1_shared_resources[0].start = mapbase_low;
791 orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
792 orion_xor1_shared_resources[1].start = mapbase_high;
793 orion_xor1_shared_resources[1].end = mapbase_high + 0xff;
795 orion_xor10_resources[0].start = irq_0;
796 orion_xor10_resources[0].end = irq_0;
797 orion_xor11_resources[0].start = irq_1;
798 orion_xor11_resources[0].end = irq_1;
800 platform_device_register(&orion_xor1_shared);
802 orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel,
803 &orion_xor11_data, &orion_xor11_channel);
806 /*****************************************************************************
807 * EHCI
808 ****************************************************************************/
809 static struct orion_ehci_data orion_ehci_data = {
810 .phy_version = EHCI_PHY_NA,
813 static u64 ehci_dmamask = DMA_BIT_MASK(32);
816 /*****************************************************************************
817 * EHCI0
818 ****************************************************************************/
819 static struct resource orion_ehci_resources[2];
821 static struct platform_device orion_ehci = {
822 .name = "orion-ehci",
823 .id = 0,
824 .dev = {
825 .dma_mask = &ehci_dmamask,
826 .coherent_dma_mask = DMA_BIT_MASK(32),
827 .platform_data = &orion_ehci_data,
831 void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
832 unsigned long mapbase,
833 unsigned long irq)
835 orion_ehci_data.dram = mbus_dram_info;
836 fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
837 irq);
839 platform_device_register(&orion_ehci);
842 /*****************************************************************************
843 * EHCI1
844 ****************************************************************************/
845 static struct resource orion_ehci_1_resources[2];
847 static struct platform_device orion_ehci_1 = {
848 .name = "orion-ehci",
849 .id = 1,
850 .dev = {
851 .dma_mask = &ehci_dmamask,
852 .coherent_dma_mask = DMA_BIT_MASK(32),
853 .platform_data = &orion_ehci_data,
857 void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
858 unsigned long mapbase,
859 unsigned long irq)
861 orion_ehci_data.dram = mbus_dram_info;
862 fill_resources(&orion_ehci_1, orion_ehci_1_resources,
863 mapbase, SZ_4K - 1, irq);
865 platform_device_register(&orion_ehci_1);
868 /*****************************************************************************
869 * EHCI2
870 ****************************************************************************/
871 static struct resource orion_ehci_2_resources[2];
873 static struct platform_device orion_ehci_2 = {
874 .name = "orion-ehci",
875 .id = 2,
876 .dev = {
877 .dma_mask = &ehci_dmamask,
878 .coherent_dma_mask = DMA_BIT_MASK(32),
879 .platform_data = &orion_ehci_data,
883 void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
884 unsigned long mapbase,
885 unsigned long irq)
887 orion_ehci_data.dram = mbus_dram_info;
888 fill_resources(&orion_ehci_2, orion_ehci_2_resources,
889 mapbase, SZ_4K - 1, irq);
891 platform_device_register(&orion_ehci_2);
894 /*****************************************************************************
895 * SATA
896 ****************************************************************************/
897 static struct resource orion_sata_resources[2] = {
899 .name = "sata base",
900 }, {
901 .name = "sata irq",
905 static struct platform_device orion_sata = {
906 .name = "sata_mv",
907 .id = 0,
908 .dev = {
909 .coherent_dma_mask = DMA_BIT_MASK(32),
913 void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
914 struct mbus_dram_target_info *mbus_dram_info,
915 unsigned long mapbase,
916 unsigned long irq)
918 sata_data->dram = mbus_dram_info;
919 orion_sata.dev.platform_data = sata_data;
920 fill_resources(&orion_sata, orion_sata_resources,
921 mapbase, 0x5000 - 1, irq);
923 platform_device_register(&orion_sata);
926 /*****************************************************************************
927 * Cryptographic Engines and Security Accelerator (CESA)
928 ****************************************************************************/
929 static struct resource orion_crypto_resources[] = {
931 .name = "regs",
932 }, {
933 .name = "crypto interrupt",
934 }, {
935 .name = "sram",
936 .flags = IORESOURCE_MEM,
940 static struct platform_device orion_crypto = {
941 .name = "mv_crypto",
942 .id = -1,
945 void __init orion_crypto_init(unsigned long mapbase,
946 unsigned long srambase,
947 unsigned long sram_size,
948 unsigned long irq)
950 fill_resources(&orion_crypto, orion_crypto_resources,
951 mapbase, 0xffff, irq);
952 orion_crypto.num_resources = 3;
953 orion_crypto_resources[2].start = srambase;
954 orion_crypto_resources[2].end = srambase + sram_size - 1;
956 platform_device_register(&orion_crypto);