blob: 802cbf4b2f3cbd900fcdf9c5ef6c44a3bf938a8f [file] [log] [blame]
Andrew Lunn28a2b452011-05-15 13:32:41 +02001/*
2 * arch/arm/plat-orion/common.c
3 *
4 * Marvell Orion SoC common setup code used by multiple mach-/common.c
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/init.h>
13#include <linux/platform_device.h>
Andrew Lunn7e3819d2011-05-15 13:32:44 +020014#include <linux/dma-mapping.h>
Andrew Lunn28a2b452011-05-15 13:32:41 +020015#include <linux/serial_8250.h>
Andrew Lunn7e3819d2011-05-15 13:32:44 +020016#include <linux/mbus.h>
17#include <linux/mv643xx_eth.h>
Andrew Lunnaac7ffa2011-05-15 13:32:45 +020018#include <linux/mv643xx_i2c.h>
Andrew Lunn7e3819d2011-05-15 13:32:44 +020019#include <net/dsa.h>
Andrew Lunn980f9f62011-05-15 13:32:46 +020020#include <linux/spi/orion_spi.h>
Andrew Lunn5e00d372011-05-15 13:32:47 +020021#include <plat/orion_wdt.h>
Andrew Lunnee962722011-05-15 13:32:48 +020022#include <plat/mv_xor.h>
Andrew Lunn4fcd3f32011-05-15 13:32:49 +020023#include <plat/ehci-orion.h>
Andrew Lunn28a2b452011-05-15 13:32:41 +020024
25/* Fill in the resources structure and link it into the platform
26 device structure. There is always a memory region, and nearly
27 always an interrupt.*/
28static void fill_resources(struct platform_device *device,
29 struct resource *resources,
30 resource_size_t mapbase,
31 resource_size_t size,
32 unsigned int irq)
33{
34 device->resource = resources;
35 device->num_resources = 1;
36 resources[0].flags = IORESOURCE_MEM;
37 resources[0].start = mapbase;
38 resources[0].end = mapbase + size;
39
40 if (irq != NO_IRQ) {
41 device->num_resources++;
42 resources[1].flags = IORESOURCE_IRQ;
43 resources[1].start = irq;
44 resources[1].end = irq;
45 }
46}
47
48/*****************************************************************************
49 * UART
50 ****************************************************************************/
51static void __init uart_complete(
52 struct platform_device *orion_uart,
53 struct plat_serial8250_port *data,
54 struct resource *resources,
55 unsigned int membase,
56 resource_size_t mapbase,
57 unsigned int irq,
58 unsigned int uartclk)
59{
60 data->mapbase = mapbase;
61 data->membase = (void __iomem *)membase;
62 data->irq = irq;
63 data->uartclk = uartclk;
64 orion_uart->dev.platform_data = data;
65
66 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
67 platform_device_register(orion_uart);
68}
69
70/*****************************************************************************
71 * UART0
72 ****************************************************************************/
73static struct plat_serial8250_port orion_uart0_data[] = {
74 {
75 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
76 .iotype = UPIO_MEM,
77 .regshift = 2,
78 }, {
79 },
80};
81
82static struct resource orion_uart0_resources[2];
83
84static struct platform_device orion_uart0 = {
85 .name = "serial8250",
86 .id = PLAT8250_DEV_PLATFORM,
87};
88
89void __init orion_uart0_init(unsigned int membase,
90 resource_size_t mapbase,
91 unsigned int irq,
92 unsigned int uartclk)
93{
94 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
95 membase, mapbase, irq, uartclk);
96}
97
98/*****************************************************************************
99 * UART1
100 ****************************************************************************/
101static struct plat_serial8250_port orion_uart1_data[] = {
102 {
103 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
104 .iotype = UPIO_MEM,
105 .regshift = 2,
106 }, {
107 },
108};
109
110static struct resource orion_uart1_resources[2];
111
112static struct platform_device orion_uart1 = {
113 .name = "serial8250",
114 .id = PLAT8250_DEV_PLATFORM1,
115};
116
117void __init orion_uart1_init(unsigned int membase,
118 resource_size_t mapbase,
119 unsigned int irq,
120 unsigned int uartclk)
121{
122 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
123 membase, mapbase, irq, uartclk);
124}
125
126/*****************************************************************************
127 * UART2
128 ****************************************************************************/
129static struct plat_serial8250_port orion_uart2_data[] = {
130 {
131 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
132 .iotype = UPIO_MEM,
133 .regshift = 2,
134 }, {
135 },
136};
137
138static struct resource orion_uart2_resources[2];
139
140static struct platform_device orion_uart2 = {
141 .name = "serial8250",
142 .id = PLAT8250_DEV_PLATFORM2,
143};
144
145void __init orion_uart2_init(unsigned int membase,
146 resource_size_t mapbase,
147 unsigned int irq,
148 unsigned int uartclk)
149{
150 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
151 membase, mapbase, irq, uartclk);
152}
153
154/*****************************************************************************
155 * UART3
156 ****************************************************************************/
157static struct plat_serial8250_port orion_uart3_data[] = {
158 {
159 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
160 .iotype = UPIO_MEM,
161 .regshift = 2,
162 }, {
163 },
164};
165
166static struct resource orion_uart3_resources[2];
167
168static struct platform_device orion_uart3 = {
169 .name = "serial8250",
170 .id = 3,
171};
172
173void __init orion_uart3_init(unsigned int membase,
174 resource_size_t mapbase,
175 unsigned int irq,
176 unsigned int uartclk)
177{
178 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
179 membase, mapbase, irq, uartclk);
180}
Andrew Lunnf6eaccb2011-05-15 13:32:42 +0200181
182/*****************************************************************************
183 * SoC RTC
184 ****************************************************************************/
185static struct resource orion_rtc_resource[2];
186
187void __init orion_rtc_init(unsigned long mapbase,
188 unsigned long irq)
189{
190 orion_rtc_resource[0].start = mapbase;
191 orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
192 orion_rtc_resource[0].flags = IORESOURCE_MEM;
193 orion_rtc_resource[1].start = irq;
194 orion_rtc_resource[1].end = irq;
195 orion_rtc_resource[1].flags = IORESOURCE_IRQ;
196
197 platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
198}
Andrew Lunn7e3819d2011-05-15 13:32:44 +0200199
200/*****************************************************************************
201 * GE
202 ****************************************************************************/
203static __init void ge_complete(
204 struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
205 struct mbus_dram_target_info *mbus_dram_info, int tclk,
206 struct resource *orion_ge_resource, unsigned long irq,
207 struct platform_device *orion_ge_shared,
208 struct mv643xx_eth_platform_data *eth_data,
209 struct platform_device *orion_ge)
210{
211 orion_ge_shared_data->dram = mbus_dram_info;
212 orion_ge_shared_data->t_clk = tclk;
213 orion_ge_resource->start = irq;
214 orion_ge_resource->end = irq;
215 eth_data->shared = orion_ge_shared;
216 orion_ge->dev.platform_data = eth_data;
217
218 platform_device_register(orion_ge_shared);
219 platform_device_register(orion_ge);
220}
221
222/*****************************************************************************
223 * GE00
224 ****************************************************************************/
225struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
226
227static struct resource orion_ge00_shared_resources[] = {
228 {
229 .name = "ge00 base",
230 }, {
231 .name = "ge00 err irq",
232 },
233};
234
235static struct platform_device orion_ge00_shared = {
236 .name = MV643XX_ETH_SHARED_NAME,
237 .id = 0,
238 .dev = {
239 .platform_data = &orion_ge00_shared_data,
240 },
241};
242
243static struct resource orion_ge00_resources[] = {
244 {
245 .name = "ge00 irq",
246 .flags = IORESOURCE_IRQ,
247 },
248};
249
250static struct platform_device orion_ge00 = {
251 .name = MV643XX_ETH_NAME,
252 .id = 0,
253 .num_resources = 1,
254 .resource = orion_ge00_resources,
255 .dev = {
256 .coherent_dma_mask = DMA_BIT_MASK(32),
257 },
258};
259
260void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
261 struct mbus_dram_target_info *mbus_dram_info,
262 unsigned long mapbase,
263 unsigned long irq,
264 unsigned long irq_err,
265 int tclk)
266{
267 fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
268 mapbase + 0x2000, SZ_16K - 1, irq_err);
269 ge_complete(&orion_ge00_shared_data, mbus_dram_info, tclk,
270 orion_ge00_resources, irq, &orion_ge00_shared,
271 eth_data, &orion_ge00);
272}
273
274/*****************************************************************************
275 * GE01
276 ****************************************************************************/
277struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = {
278 .shared_smi = &orion_ge00_shared,
279};
280
281static struct resource orion_ge01_shared_resources[] = {
282 {
283 .name = "ge01 base",
284 }, {
285 .name = "ge01 err irq",
286 },
287};
288
289static struct platform_device orion_ge01_shared = {
290 .name = MV643XX_ETH_SHARED_NAME,
291 .id = 1,
292 .dev = {
293 .platform_data = &orion_ge01_shared_data,
294 },
295};
296
297static struct resource orion_ge01_resources[] = {
298 {
299 .name = "ge01 irq",
300 .flags = IORESOURCE_IRQ,
301 },
302};
303
304static struct platform_device orion_ge01 = {
305 .name = MV643XX_ETH_NAME,
306 .id = 1,
307 .num_resources = 1,
308 .resource = orion_ge01_resources,
309 .dev = {
310 .coherent_dma_mask = DMA_BIT_MASK(32),
311 },
312};
313
314void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
315 struct mbus_dram_target_info *mbus_dram_info,
316 unsigned long mapbase,
317 unsigned long irq,
318 unsigned long irq_err,
319 int tclk)
320{
321 fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
322 mapbase + 0x2000, SZ_16K - 1, irq_err);
323 ge_complete(&orion_ge01_shared_data, mbus_dram_info, tclk,
324 orion_ge01_resources, irq, &orion_ge01_shared,
325 eth_data, &orion_ge01);
326}
327
328/*****************************************************************************
329 * GE10
330 ****************************************************************************/
331struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = {
332 .shared_smi = &orion_ge00_shared,
333};
334
335static struct resource orion_ge10_shared_resources[] = {
336 {
337 .name = "ge10 base",
338 }, {
339 .name = "ge10 err irq",
340 },
341};
342
343static struct platform_device orion_ge10_shared = {
344 .name = MV643XX_ETH_SHARED_NAME,
345 .id = 1,
346 .dev = {
347 .platform_data = &orion_ge10_shared_data,
348 },
349};
350
351static struct resource orion_ge10_resources[] = {
352 {
353 .name = "ge10 irq",
354 .flags = IORESOURCE_IRQ,
355 },
356};
357
358static struct platform_device orion_ge10 = {
359 .name = MV643XX_ETH_NAME,
360 .id = 1,
361 .num_resources = 2,
362 .resource = orion_ge10_resources,
363 .dev = {
364 .coherent_dma_mask = DMA_BIT_MASK(32),
365 },
366};
367
368void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
369 struct mbus_dram_target_info *mbus_dram_info,
370 unsigned long mapbase,
371 unsigned long irq,
372 unsigned long irq_err,
373 int tclk)
374{
375 fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
376 mapbase + 0x2000, SZ_16K - 1, irq_err);
377 ge_complete(&orion_ge10_shared_data, mbus_dram_info, tclk,
378 orion_ge10_resources, irq, &orion_ge10_shared,
379 eth_data, &orion_ge10);
380}
381
382/*****************************************************************************
383 * GE11
384 ****************************************************************************/
385struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = {
386 .shared_smi = &orion_ge00_shared,
387};
388
389static struct resource orion_ge11_shared_resources[] = {
390 {
391 .name = "ge11 base",
392 }, {
393 .name = "ge11 err irq",
394 },
395};
396
397static struct platform_device orion_ge11_shared = {
398 .name = MV643XX_ETH_SHARED_NAME,
399 .id = 1,
400 .dev = {
401 .platform_data = &orion_ge11_shared_data,
402 },
403};
404
405static struct resource orion_ge11_resources[] = {
406 {
407 .name = "ge11 irq",
408 .flags = IORESOURCE_IRQ,
409 },
410};
411
412static struct platform_device orion_ge11 = {
413 .name = MV643XX_ETH_NAME,
414 .id = 1,
415 .num_resources = 2,
416 .resource = orion_ge11_resources,
417 .dev = {
418 .coherent_dma_mask = DMA_BIT_MASK(32),
419 },
420};
421
422void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
423 struct mbus_dram_target_info *mbus_dram_info,
424 unsigned long mapbase,
425 unsigned long irq,
426 unsigned long irq_err,
427 int tclk)
428{
429 fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
430 mapbase + 0x2000, SZ_16K - 1, irq_err);
431 ge_complete(&orion_ge11_shared_data, mbus_dram_info, tclk,
432 orion_ge11_resources, irq, &orion_ge11_shared,
433 eth_data, &orion_ge11);
434}
435
436/*****************************************************************************
437 * Ethernet switch
438 ****************************************************************************/
439static struct resource orion_switch_resources[] = {
440 {
441 .start = 0,
442 .end = 0,
443 .flags = IORESOURCE_IRQ,
444 },
445};
446
447static struct platform_device orion_switch_device = {
448 .name = "dsa",
449 .id = 0,
450 .num_resources = 0,
451 .resource = orion_switch_resources,
452};
453
454void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
455{
456 int i;
457
458 if (irq != NO_IRQ) {
459 orion_switch_resources[0].start = irq;
460 orion_switch_resources[0].end = irq;
461 orion_switch_device.num_resources = 1;
462 }
463
464 d->netdev = &orion_ge00.dev;
465 for (i = 0; i < d->nr_chips; i++)
466 d->chip[i].mii_bus = &orion_ge00_shared.dev;
467 orion_switch_device.dev.platform_data = d;
468
469 platform_device_register(&orion_switch_device);
470}
Andrew Lunnaac7ffa2011-05-15 13:32:45 +0200471
472/*****************************************************************************
473 * I2C
474 ****************************************************************************/
475static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
476 .freq_n = 3,
477 .timeout = 1000, /* Default timeout of 1 second */
478};
479
480static struct resource orion_i2c_resources[2];
481
482static struct platform_device orion_i2c = {
483 .name = MV64XXX_I2C_CTLR_NAME,
484 .id = 0,
485 .dev = {
486 .platform_data = &orion_i2c_pdata,
487 },
488};
489
490static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
491 .freq_n = 3,
492 .timeout = 1000, /* Default timeout of 1 second */
493};
494
495static struct resource orion_i2c_1_resources[2];
496
497static struct platform_device orion_i2c_1 = {
498 .name = MV64XXX_I2C_CTLR_NAME,
499 .id = 1,
500 .dev = {
501 .platform_data = &orion_i2c_1_pdata,
502 },
503};
504
505void __init orion_i2c_init(unsigned long mapbase,
506 unsigned long irq,
507 unsigned long freq_m)
508{
509 orion_i2c_pdata.freq_m = freq_m;
510 fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
511 SZ_32 - 1, irq);
512 platform_device_register(&orion_i2c);
513}
514
515void __init orion_i2c_1_init(unsigned long mapbase,
516 unsigned long irq,
517 unsigned long freq_m)
518{
519 orion_i2c_1_pdata.freq_m = freq_m;
520 fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
521 SZ_32 - 1, irq);
522 platform_device_register(&orion_i2c_1);
523}
Andrew Lunn980f9f62011-05-15 13:32:46 +0200524
525/*****************************************************************************
526 * SPI
527 ****************************************************************************/
528static struct orion_spi_info orion_spi_plat_data;
529static struct resource orion_spi_resources;
530
531static struct platform_device orion_spi = {
532 .name = "orion_spi",
533 .id = 0,
534 .dev = {
535 .platform_data = &orion_spi_plat_data,
536 },
537};
538
539static struct orion_spi_info orion_spi_1_plat_data;
540static struct resource orion_spi_1_resources;
541
542static struct platform_device orion_spi_1 = {
543 .name = "orion_spi",
544 .id = 1,
545 .dev = {
546 .platform_data = &orion_spi_1_plat_data,
547 },
548};
549
550/* Note: The SPI silicon core does have interrupts. However the
551 * current Linux software driver does not use interrupts. */
552
553void __init orion_spi_init(unsigned long mapbase,
554 unsigned long tclk)
555{
556 orion_spi_plat_data.tclk = tclk;
557 fill_resources(&orion_spi, &orion_spi_resources,
558 mapbase, SZ_512 - 1, NO_IRQ);
559 platform_device_register(&orion_spi);
560}
561
562void __init orion_spi_1_init(unsigned long mapbase,
563 unsigned long tclk)
564{
565 orion_spi_1_plat_data.tclk = tclk;
566 fill_resources(&orion_spi_1, &orion_spi_1_resources,
567 mapbase, SZ_512 - 1, NO_IRQ);
568 platform_device_register(&orion_spi_1);
569}
Andrew Lunn5e00d372011-05-15 13:32:47 +0200570
571/*****************************************************************************
572 * Watchdog
573 ****************************************************************************/
574static struct orion_wdt_platform_data orion_wdt_data;
575
576static struct platform_device orion_wdt_device = {
577 .name = "orion_wdt",
578 .id = -1,
579 .dev = {
580 .platform_data = &orion_wdt_data,
581 },
582 .num_resources = 0,
583};
584
585void __init orion_wdt_init(unsigned long tclk)
586{
587 orion_wdt_data.tclk = tclk;
588 platform_device_register(&orion_wdt_device);
589}
Andrew Lunnee962722011-05-15 13:32:48 +0200590
591/*****************************************************************************
592 * XOR
593 ****************************************************************************/
594static struct mv_xor_platform_shared_data orion_xor_shared_data;
595
596static u64 orion_xor_dmamask = DMA_BIT_MASK(32);
597
598void __init orion_xor_init_channels(
599 struct mv_xor_platform_data *orion_xor0_data,
600 struct platform_device *orion_xor0_channel,
601 struct mv_xor_platform_data *orion_xor1_data,
602 struct platform_device *orion_xor1_channel)
603{
604 /*
605 * two engines can't do memset simultaneously, this limitation
606 * satisfied by removing memset support from one of the engines.
607 */
608 dma_cap_set(DMA_MEMCPY, orion_xor0_data->cap_mask);
609 dma_cap_set(DMA_XOR, orion_xor0_data->cap_mask);
610 platform_device_register(orion_xor0_channel);
611
612 dma_cap_set(DMA_MEMCPY, orion_xor1_data->cap_mask);
613 dma_cap_set(DMA_MEMSET, orion_xor1_data->cap_mask);
614 dma_cap_set(DMA_XOR, orion_xor1_data->cap_mask);
615 platform_device_register(orion_xor1_channel);
616}
617
618/*****************************************************************************
619 * XOR0
620 ****************************************************************************/
621static struct resource orion_xor0_shared_resources[] = {
622 {
623 .name = "xor 0 low",
624 .flags = IORESOURCE_MEM,
625 }, {
626 .name = "xor 0 high",
627 .flags = IORESOURCE_MEM,
628 },
629};
630
631static struct platform_device orion_xor0_shared = {
632 .name = MV_XOR_SHARED_NAME,
633 .id = 0,
634 .dev = {
635 .platform_data = &orion_xor_shared_data,
636 },
637 .num_resources = ARRAY_SIZE(orion_xor0_shared_resources),
638 .resource = orion_xor0_shared_resources,
639};
640
641static struct resource orion_xor00_resources[] = {
642 [0] = {
643 .flags = IORESOURCE_IRQ,
644 },
645};
646
647static struct mv_xor_platform_data orion_xor00_data = {
648 .shared = &orion_xor0_shared,
649 .hw_id = 0,
650 .pool_size = PAGE_SIZE,
651};
652
653static struct platform_device orion_xor00_channel = {
654 .name = MV_XOR_NAME,
655 .id = 0,
656 .num_resources = ARRAY_SIZE(orion_xor00_resources),
657 .resource = orion_xor00_resources,
658 .dev = {
659 .dma_mask = &orion_xor_dmamask,
660 .coherent_dma_mask = DMA_BIT_MASK(64),
661 .platform_data = &orion_xor00_data,
662 },
663};
664
665static struct resource orion_xor01_resources[] = {
666 [0] = {
667 .flags = IORESOURCE_IRQ,
668 },
669};
670
671static struct mv_xor_platform_data orion_xor01_data = {
672 .shared = &orion_xor0_shared,
673 .hw_id = 1,
674 .pool_size = PAGE_SIZE,
675};
676
677static struct platform_device orion_xor01_channel = {
678 .name = MV_XOR_NAME,
679 .id = 1,
680 .num_resources = ARRAY_SIZE(orion_xor01_resources),
681 .resource = orion_xor01_resources,
682 .dev = {
683 .dma_mask = &orion_xor_dmamask,
684 .coherent_dma_mask = DMA_BIT_MASK(64),
685 .platform_data = &orion_xor01_data,
686 },
687};
688
689void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info,
690 unsigned long mapbase_low,
691 unsigned long mapbase_high,
692 unsigned long irq_0,
693 unsigned long irq_1)
694{
695 orion_xor_shared_data.dram = mbus_dram_info;
696
697 orion_xor0_shared_resources[0].start = mapbase_low;
698 orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
699 orion_xor0_shared_resources[1].start = mapbase_high;
700 orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
701
702 orion_xor00_resources[0].start = irq_0;
703 orion_xor00_resources[0].end = irq_0;
704 orion_xor01_resources[0].start = irq_1;
705 orion_xor01_resources[0].end = irq_1;
706
707 platform_device_register(&orion_xor0_shared);
708
709 orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel,
710 &orion_xor01_data, &orion_xor01_channel);
711}
712
713/*****************************************************************************
714 * XOR1
715 ****************************************************************************/
716static struct resource orion_xor1_shared_resources[] = {
717 {
718 .name = "xor 1 low",
719 .flags = IORESOURCE_MEM,
720 }, {
721 .name = "xor 1 high",
722 .flags = IORESOURCE_MEM,
723 },
724};
725
726static struct platform_device orion_xor1_shared = {
727 .name = MV_XOR_SHARED_NAME,
728 .id = 1,
729 .dev = {
730 .platform_data = &orion_xor_shared_data,
731 },
732 .num_resources = ARRAY_SIZE(orion_xor1_shared_resources),
733 .resource = orion_xor1_shared_resources,
734};
735
736static struct resource orion_xor10_resources[] = {
737 [0] = {
738 .flags = IORESOURCE_IRQ,
739 },
740};
741
742static struct mv_xor_platform_data orion_xor10_data = {
743 .shared = &orion_xor1_shared,
744 .hw_id = 0,
745 .pool_size = PAGE_SIZE,
746};
747
748static struct platform_device orion_xor10_channel = {
749 .name = MV_XOR_NAME,
750 .id = 2,
751 .num_resources = ARRAY_SIZE(orion_xor10_resources),
752 .resource = orion_xor10_resources,
753 .dev = {
754 .dma_mask = &orion_xor_dmamask,
755 .coherent_dma_mask = DMA_BIT_MASK(64),
756 .platform_data = &orion_xor10_data,
757 },
758};
759
760static struct resource orion_xor11_resources[] = {
761 [0] = {
762 .flags = IORESOURCE_IRQ,
763 },
764};
765
766static struct mv_xor_platform_data orion_xor11_data = {
767 .shared = &orion_xor1_shared,
768 .hw_id = 1,
769 .pool_size = PAGE_SIZE,
770};
771
772static struct platform_device orion_xor11_channel = {
773 .name = MV_XOR_NAME,
774 .id = 3,
775 .num_resources = ARRAY_SIZE(orion_xor11_resources),
776 .resource = orion_xor11_resources,
777 .dev = {
778 .dma_mask = &orion_xor_dmamask,
779 .coherent_dma_mask = DMA_BIT_MASK(64),
780 .platform_data = &orion_xor11_data,
781 },
782};
783
784void __init orion_xor1_init(unsigned long mapbase_low,
785 unsigned long mapbase_high,
786 unsigned long irq_0,
787 unsigned long irq_1)
788{
789 orion_xor1_shared_resources[0].start = mapbase_low;
790 orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
791 orion_xor1_shared_resources[1].start = mapbase_high;
792 orion_xor1_shared_resources[1].end = mapbase_high + 0xff;
793
794 orion_xor10_resources[0].start = irq_0;
795 orion_xor10_resources[0].end = irq_0;
796 orion_xor11_resources[0].start = irq_1;
797 orion_xor11_resources[0].end = irq_1;
798
799 platform_device_register(&orion_xor1_shared);
800
801 orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel,
802 &orion_xor11_data, &orion_xor11_channel);
803}
Andrew Lunn4fcd3f32011-05-15 13:32:49 +0200804
805/*****************************************************************************
806 * EHCI
807 ****************************************************************************/
808static struct orion_ehci_data orion_ehci_data = {
809 .phy_version = EHCI_PHY_NA,
810};
811
812static u64 ehci_dmamask = DMA_BIT_MASK(32);
813
814
815/*****************************************************************************
816 * EHCI0
817 ****************************************************************************/
818static struct resource orion_ehci_resources[2];
819
820static struct platform_device orion_ehci = {
821 .name = "orion-ehci",
822 .id = 0,
823 .dev = {
824 .dma_mask = &ehci_dmamask,
825 .coherent_dma_mask = DMA_BIT_MASK(32),
826 .platform_data = &orion_ehci_data,
827 },
828};
829
830void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
831 unsigned long mapbase,
832 unsigned long irq)
833{
834 orion_ehci_data.dram = mbus_dram_info;
835 fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
836 irq);
837
838 platform_device_register(&orion_ehci);
839}
840
841/*****************************************************************************
842 * EHCI1
843 ****************************************************************************/
844static struct resource orion_ehci_1_resources[2];
845
846static struct platform_device orion_ehci_1 = {
847 .name = "orion-ehci",
848 .id = 1,
849 .dev = {
850 .dma_mask = &ehci_dmamask,
851 .coherent_dma_mask = DMA_BIT_MASK(32),
852 .platform_data = &orion_ehci_data,
853 },
854};
855
856void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
857 unsigned long mapbase,
858 unsigned long irq)
859{
860 orion_ehci_data.dram = mbus_dram_info;
861 fill_resources(&orion_ehci_1, orion_ehci_1_resources,
862 mapbase, SZ_4K - 1, irq);
863
864 platform_device_register(&orion_ehci_1);
865}
866
867/*****************************************************************************
868 * EHCI2
869 ****************************************************************************/
870static struct resource orion_ehci_2_resources[2];
871
872static struct platform_device orion_ehci_2 = {
873 .name = "orion-ehci",
874 .id = 2,
875 .dev = {
876 .dma_mask = &ehci_dmamask,
877 .coherent_dma_mask = DMA_BIT_MASK(32),
878 .platform_data = &orion_ehci_data,
879 },
880};
881
882void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
883 unsigned long mapbase,
884 unsigned long irq)
885{
886 orion_ehci_data.dram = mbus_dram_info;
887 fill_resources(&orion_ehci_2, orion_ehci_2_resources,
888 mapbase, SZ_4K - 1, irq);
889
890 platform_device_register(&orion_ehci_2);
891}