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