Blackfin: add serial TX IRQ in individual platform resource
[pandora-kernel.git] / arch / blackfin / mach-bf537 / boards / cm_bf537e.c
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
3  *           2008-2009 Bluetechnix
4  *                2005 National ICT Australia (NICTA)
5  *                      Aidan Williams <aidan@nicta.com.au>
6  *
7  * Licensed under the GPL-2 or later.
8  */
9
10 #include <linux/device.h>
11 #include <linux/etherdevice.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/spi/spi.h>
17 #include <linux/spi/flash.h>
18 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19 #include <linux/usb/isp1362.h>
20 #endif
21 #include <linux/ata_platform.h>
22 #include <linux/irq.h>
23 #include <asm/dma.h>
24 #include <asm/bfin5xx_spi.h>
25 #include <asm/portmux.h>
26 #include <asm/dpmc.h>
27
28 /*
29  * Name the Board for the /proc/cpuinfo
30  */
31 const char bfin_board_name[] = "Bluetechnix CM BF537E";
32
33 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
34 /* all SPI peripherals info goes here */
35
36 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
37 static struct mtd_partition bfin_spi_flash_partitions[] = {
38         {
39                 .name = "bootloader(spi)",
40                 .size = 0x00020000,
41                 .offset = 0,
42                 .mask_flags = MTD_CAP_ROM
43         }, {
44                 .name = "linux kernel(spi)",
45                 .size = 0xe0000,
46                 .offset = 0x20000
47         }, {
48                 .name = "file system(spi)",
49                 .size = 0x700000,
50                 .offset = 0x00100000,
51         }
52 };
53
54 static struct flash_platform_data bfin_spi_flash_data = {
55         .name = "m25p80",
56         .parts = bfin_spi_flash_partitions,
57         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
58         .type = "m25p64",
59 };
60
61 /* SPI flash chip (m25p64) */
62 static struct bfin5xx_spi_chip spi_flash_chip_info = {
63         .enable_dma = 0,         /* use dma transfer with this chip*/
64 };
65 #endif
66
67 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
68 static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
69         .enable_dma = 0,
70 };
71 #endif
72
73 static struct spi_board_info bfin_spi_board_info[] __initdata = {
74 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
75         {
76                 /* the modalias must be the same as spi device driver name */
77                 .modalias = "m25p80", /* Name of spi_driver for this device */
78                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
79                 .bus_num = 0, /* Framework bus number */
80                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
81                 .platform_data = &bfin_spi_flash_data,
82                 .controller_data = &spi_flash_chip_info,
83                 .mode = SPI_MODE_3,
84         },
85 #endif
86
87 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
88         {
89                 .modalias = "ad183x",
90                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
91                 .bus_num = 0,
92                 .chip_select = 4,
93         },
94 #endif
95
96 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
97         {
98                 .modalias = "mmc_spi",
99                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
100                 .bus_num = 0,
101                 .chip_select = 1,
102                 .controller_data = &mmc_spi_chip_info,
103                 .mode = SPI_MODE_3,
104         },
105 #endif
106 };
107
108 /* SPI (0) */
109 static struct resource bfin_spi0_resource[] = {
110         [0] = {
111                 .start = SPI0_REGBASE,
112                 .end   = SPI0_REGBASE + 0xFF,
113                 .flags = IORESOURCE_MEM,
114                 },
115         [1] = {
116                 .start = CH_SPI,
117                 .end   = CH_SPI,
118                 .flags = IORESOURCE_DMA,
119         },
120         [2] = {
121                 .start = IRQ_SPI,
122                 .end   = IRQ_SPI,
123                 .flags = IORESOURCE_IRQ,
124         },
125 };
126
127 /* SPI controller data */
128 static struct bfin5xx_spi_master bfin_spi0_info = {
129         .num_chipselect = 8,
130         .enable_dma = 1,  /* master has the ability to do dma transfer */
131         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
132 };
133
134 static struct platform_device bfin_spi0_device = {
135         .name = "bfin-spi",
136         .id = 0, /* Bus number */
137         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
138         .resource = bfin_spi0_resource,
139         .dev = {
140                 .platform_data = &bfin_spi0_info, /* Passed to driver */
141         },
142 };
143 #endif  /* spi master and devices */
144
145 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
146 static struct platform_device rtc_device = {
147         .name = "rtc-bfin",
148         .id   = -1,
149 };
150 #endif
151
152 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
153 static struct platform_device hitachi_fb_device = {
154         .name = "hitachi-tx09",
155 };
156 #endif
157
158 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
159 #include <linux/smc91x.h>
160
161 static struct smc91x_platdata smc91x_info = {
162         .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
163         .leda = RPC_LED_100_10,
164         .ledb = RPC_LED_TX_RX,
165 };
166
167 static struct resource smc91x_resources[] = {
168         {
169                 .start = 0x20200300,
170                 .end = 0x20200300 + 16,
171                 .flags = IORESOURCE_MEM,
172         }, {
173                 .start = IRQ_PF14,
174                 .end = IRQ_PF14,
175                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
176                 },
177 };
178
179 static struct platform_device smc91x_device = {
180         .name = "smc91x",
181         .id = 0,
182         .num_resources = ARRAY_SIZE(smc91x_resources),
183         .resource = smc91x_resources,
184         .dev    = {
185                 .platform_data  = &smc91x_info,
186         },
187 };
188 #endif
189
190 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
191 static struct resource isp1362_hcd_resources[] = {
192         {
193                 .start = 0x20308000,
194                 .end = 0x20308000,
195                 .flags = IORESOURCE_MEM,
196         }, {
197                 .start = 0x20308004,
198                 .end = 0x20308004,
199                 .flags = IORESOURCE_MEM,
200         }, {
201                 .start = IRQ_PG15,
202                 .end = IRQ_PG15,
203                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
204         },
205 };
206
207 static struct isp1362_platform_data isp1362_priv = {
208         .sel15Kres = 1,
209         .clknotstop = 0,
210         .oc_enable = 0,
211         .int_act_high = 0,
212         .int_edge_triggered = 0,
213         .remote_wakeup_connected = 0,
214         .no_power_switching = 1,
215         .power_switching_mode = 0,
216 };
217
218 static struct platform_device isp1362_hcd_device = {
219         .name = "isp1362-hcd",
220         .id = 0,
221         .dev = {
222                 .platform_data = &isp1362_priv,
223         },
224         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
225         .resource = isp1362_hcd_resources,
226 };
227 #endif
228
229 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
230 static struct resource net2272_bfin_resources[] = {
231         {
232                 .start = 0x20300000,
233                 .end = 0x20300000 + 0x100,
234                 .flags = IORESOURCE_MEM,
235         }, {
236                 .start = IRQ_PG13,
237                 .end = IRQ_PG13,
238                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
239         },
240 };
241
242 static struct platform_device net2272_bfin_device = {
243         .name = "net2272",
244         .id = -1,
245         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
246         .resource = net2272_bfin_resources,
247 };
248 #endif
249
250 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
251 static struct mtd_partition cm_partitions[] = {
252         {
253                 .name   = "bootloader(nor)",
254                 .size   = 0x40000,
255                 .offset = 0,
256         }, {
257                 .name   = "linux kernel(nor)",
258                 .size   = 0x100000,
259                 .offset = MTDPART_OFS_APPEND,
260         }, {
261                 .name   = "file system(nor)",
262                 .size   = MTDPART_SIZ_FULL,
263                 .offset = MTDPART_OFS_APPEND,
264         }
265 };
266
267 static struct physmap_flash_data cm_flash_data = {
268         .width    = 2,
269         .parts    = cm_partitions,
270         .nr_parts = ARRAY_SIZE(cm_partitions),
271 };
272
273 static unsigned cm_flash_gpios[] = { GPIO_PF4 };
274
275 static struct resource cm_flash_resource[] = {
276         {
277                 .name  = "cfi_probe",
278                 .start = 0x20000000,
279                 .end   = 0x201fffff,
280                 .flags = IORESOURCE_MEM,
281         }, {
282                 .start = (unsigned long)cm_flash_gpios,
283                 .end   = ARRAY_SIZE(cm_flash_gpios),
284                 .flags = IORESOURCE_IRQ,
285         }
286 };
287
288 static struct platform_device cm_flash_device = {
289         .name          = "gpio-addr-flash",
290         .id            = 0,
291         .dev = {
292                 .platform_data = &cm_flash_data,
293         },
294         .num_resources = ARRAY_SIZE(cm_flash_resource),
295         .resource      = cm_flash_resource,
296 };
297 #endif
298
299 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
300 #ifdef CONFIG_SERIAL_BFIN_UART0
301 static struct resource bfin_uart0_resources[] = {
302         {
303                 .start = UART0_THR,
304                 .end = UART0_GCTL+2,
305                 .flags = IORESOURCE_MEM,
306         },
307         {
308                 .start = IRQ_UART0_TX,
309                 .end = IRQ_UART0_TX,
310                 .flags = IORESOURCE_IRQ,
311         },
312         {
313                 .start = IRQ_UART0_RX,
314                 .end = IRQ_UART0_RX,
315                 .flags = IORESOURCE_IRQ,
316         },
317         {
318                 .start = IRQ_UART0_ERROR,
319                 .end = IRQ_UART0_ERROR,
320                 .flags = IORESOURCE_IRQ,
321         },
322         {
323                 .start = CH_UART0_TX,
324                 .end = CH_UART0_TX,
325                 .flags = IORESOURCE_DMA,
326         },
327         {
328                 .start = CH_UART0_RX,
329                 .end = CH_UART0_RX,
330                 .flags = IORESOURCE_DMA,
331         },
332 #ifdef CONFIG_BFIN_UART0_CTSRTS
333         {
334                 /*
335                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
336                  */
337                 .start = -1,
338                 .end = -1,
339                 .flags = IORESOURCE_IO,
340         },
341         {
342                 /*
343                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
344                  */
345                 .start = -1,
346                 .end = -1,
347                 .flags = IORESOURCE_IO,
348         },
349 #endif
350 };
351
352 static unsigned short bfin_uart0_peripherals[] = {
353         P_UART0_TX, P_UART0_RX, 0
354 };
355
356 static struct platform_device bfin_uart0_device = {
357         .name = "bfin-uart",
358         .id = 0,
359         .num_resources = ARRAY_SIZE(bfin_uart0_resources),
360         .resource = bfin_uart0_resources,
361         .dev = {
362                 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
363         },
364 };
365 #endif
366 #ifdef CONFIG_SERIAL_BFIN_UART1
367 static struct resource bfin_uart1_resources[] = {
368         {
369                 .start = UART1_THR,
370                 .end = UART1_GCTL+2,
371                 .flags = IORESOURCE_MEM,
372         },
373         {
374                 .start = IRQ_UART1_TX,
375                 .end = IRQ_UART1_TX,
376                 .flags = IORESOURCE_IRQ,
377         },
378         {
379                 .start = IRQ_UART1_RX,
380                 .end = IRQ_UART1_RX,
381                 .flags = IORESOURCE_IRQ,
382         },
383         {
384                 .start = IRQ_UART1_ERROR,
385                 .end = IRQ_UART1_ERROR,
386                 .flags = IORESOURCE_IRQ,
387         },
388         {
389                 .start = CH_UART1_TX,
390                 .end = CH_UART1_TX,
391                 .flags = IORESOURCE_DMA,
392         },
393         {
394                 .start = CH_UART1_RX,
395                 .end = CH_UART1_RX,
396                 .flags = IORESOURCE_DMA,
397         },
398 #ifdef CONFIG_BFIN_UART1_CTSRTS
399         {
400                 /*
401                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
402                  */
403                 .start = -1,
404                 .end = -1,
405                 .flags = IORESOURCE_IO,
406         },
407         {
408                 /*
409                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
410                  */
411                 .start = -1,
412                 .end = -1,
413                 .flags = IORESOURCE_IO,
414         },
415 #endif
416 };
417
418 static unsigned short bfin_uart1_peripherals[] = {
419         P_UART1_TX, P_UART1_RX, 0
420 };
421
422 static struct platform_device bfin_uart1_device = {
423         .name = "bfin-uart",
424         .id = 1,
425         .num_resources = ARRAY_SIZE(bfin_uart1_resources),
426         .resource = bfin_uart1_resources,
427         .dev = {
428                 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
429         },
430 };
431 #endif
432 #endif
433
434 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
435 #ifdef CONFIG_BFIN_SIR0
436 static struct resource bfin_sir0_resources[] = {
437         {
438                 .start = 0xFFC00400,
439                 .end = 0xFFC004FF,
440                 .flags = IORESOURCE_MEM,
441         },
442         {
443                 .start = IRQ_UART0_RX,
444                 .end = IRQ_UART0_RX+1,
445                 .flags = IORESOURCE_IRQ,
446         },
447         {
448                 .start = CH_UART0_RX,
449                 .end = CH_UART0_RX+1,
450                 .flags = IORESOURCE_DMA,
451         },
452 };
453 static struct platform_device bfin_sir0_device = {
454         .name = "bfin_sir",
455         .id = 0,
456         .num_resources = ARRAY_SIZE(bfin_sir0_resources),
457         .resource = bfin_sir0_resources,
458 };
459 #endif
460 #ifdef CONFIG_BFIN_SIR1
461 static struct resource bfin_sir1_resources[] = {
462         {
463                 .start = 0xFFC02000,
464                 .end = 0xFFC020FF,
465                 .flags = IORESOURCE_MEM,
466         },
467         {
468                 .start = IRQ_UART1_RX,
469                 .end = IRQ_UART1_RX+1,
470                 .flags = IORESOURCE_IRQ,
471         },
472         {
473                 .start = CH_UART1_RX,
474                 .end = CH_UART1_RX+1,
475                 .flags = IORESOURCE_DMA,
476         },
477 };
478 static struct platform_device bfin_sir1_device = {
479         .name = "bfin_sir",
480         .id = 1,
481         .num_resources = ARRAY_SIZE(bfin_sir1_resources),
482         .resource = bfin_sir1_resources,
483 };
484 #endif
485 #endif
486
487 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
488 static struct resource bfin_twi0_resource[] = {
489         [0] = {
490                 .start = TWI0_REGBASE,
491                 .end   = TWI0_REGBASE,
492                 .flags = IORESOURCE_MEM,
493         },
494         [1] = {
495                 .start = IRQ_TWI,
496                 .end   = IRQ_TWI,
497                 .flags = IORESOURCE_IRQ,
498         },
499 };
500
501 static struct platform_device i2c_bfin_twi_device = {
502         .name = "i2c-bfin-twi",
503         .id = 0,
504         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
505         .resource = bfin_twi0_resource,
506 };
507 #endif
508
509 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
510 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
511 static struct resource bfin_sport0_uart_resources[] = {
512         {
513                 .start = SPORT0_TCR1,
514                 .end = SPORT0_MRCS3+4,
515                 .flags = IORESOURCE_MEM,
516         },
517         {
518                 .start = IRQ_SPORT0_RX,
519                 .end = IRQ_SPORT0_RX+1,
520                 .flags = IORESOURCE_IRQ,
521         },
522         {
523                 .start = IRQ_SPORT0_ERROR,
524                 .end = IRQ_SPORT0_ERROR,
525                 .flags = IORESOURCE_IRQ,
526         },
527 };
528
529 static unsigned short bfin_sport0_peripherals[] = {
530         P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
531         P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
532 };
533
534 static struct platform_device bfin_sport0_uart_device = {
535         .name = "bfin-sport-uart",
536         .id = 0,
537         .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
538         .resource = bfin_sport0_uart_resources,
539         .dev = {
540                 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
541         },
542 };
543 #endif
544 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
545 static struct resource bfin_sport1_uart_resources[] = {
546         {
547                 .start = SPORT1_TCR1,
548                 .end = SPORT1_MRCS3+4,
549                 .flags = IORESOURCE_MEM,
550         },
551         {
552                 .start = IRQ_SPORT1_RX,
553                 .end = IRQ_SPORT1_RX+1,
554                 .flags = IORESOURCE_IRQ,
555         },
556         {
557                 .start = IRQ_SPORT1_ERROR,
558                 .end = IRQ_SPORT1_ERROR,
559                 .flags = IORESOURCE_IRQ,
560         },
561 };
562
563 static unsigned short bfin_sport1_peripherals[] = {
564         P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
565         P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
566 };
567
568 static struct platform_device bfin_sport1_uart_device = {
569         .name = "bfin-sport-uart",
570         .id = 1,
571         .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
572         .resource = bfin_sport1_uart_resources,
573         .dev = {
574                 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
575         },
576 };
577 #endif
578 #endif
579
580 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
581 #include <linux/bfin_mac.h>
582 #include <linux/export.h>
583 static const unsigned short bfin_mac_peripherals[] = P_MII0;
584
585 static struct bfin_phydev_platform_data bfin_phydev_data[] = {
586         {
587                 .addr = 1,
588                 .irq = IRQ_MAC_PHYINT,
589         },
590 };
591
592 static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
593         .phydev_number = 1,
594         .phydev_data = bfin_phydev_data,
595         .phy_mode = PHY_INTERFACE_MODE_MII,
596         .mac_peripherals = bfin_mac_peripherals,
597 };
598
599 static struct platform_device bfin_mii_bus = {
600         .name = "bfin_mii_bus",
601         .dev = {
602                 .platform_data = &bfin_mii_bus_data,
603         }
604 };
605
606 static struct platform_device bfin_mac_device = {
607         .name = "bfin_mac",
608         .dev = {
609                 .platform_data = &bfin_mii_bus,
610         }
611 };
612 #endif
613
614 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
615 #define PATA_INT        IRQ_PF14
616
617 static struct pata_platform_info bfin_pata_platform_data = {
618         .ioport_shift = 2,
619         .irq_type = IRQF_TRIGGER_HIGH,
620 };
621
622 static struct resource bfin_pata_resources[] = {
623         {
624                 .start = 0x2030C000,
625                 .end = 0x2030C01F,
626                 .flags = IORESOURCE_MEM,
627         },
628         {
629                 .start = 0x2030D018,
630                 .end = 0x2030D01B,
631                 .flags = IORESOURCE_MEM,
632         },
633         {
634                 .start = PATA_INT,
635                 .end = PATA_INT,
636                 .flags = IORESOURCE_IRQ,
637         },
638 };
639
640 static struct platform_device bfin_pata_device = {
641         .name = "pata_platform",
642         .id = -1,
643         .num_resources = ARRAY_SIZE(bfin_pata_resources),
644         .resource = bfin_pata_resources,
645         .dev = {
646                 .platform_data = &bfin_pata_platform_data,
647         }
648 };
649 #endif
650
651 static const unsigned int cclk_vlev_datasheet[] =
652 {
653         VRPAIR(VLEV_085, 250000000),
654         VRPAIR(VLEV_090, 376000000),
655         VRPAIR(VLEV_095, 426000000),
656         VRPAIR(VLEV_100, 426000000),
657         VRPAIR(VLEV_105, 476000000),
658         VRPAIR(VLEV_110, 476000000),
659         VRPAIR(VLEV_115, 476000000),
660         VRPAIR(VLEV_120, 500000000),
661         VRPAIR(VLEV_125, 533000000),
662         VRPAIR(VLEV_130, 600000000),
663 };
664
665 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
666         .tuple_tab = cclk_vlev_datasheet,
667         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
668         .vr_settling_time = 25 /* us */,
669 };
670
671 static struct platform_device bfin_dpmc = {
672         .name = "bfin dpmc",
673         .dev = {
674                 .platform_data = &bfin_dmpc_vreg_data,
675         },
676 };
677
678 static struct platform_device *cm_bf537e_devices[] __initdata = {
679
680         &bfin_dpmc,
681
682 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
683         &hitachi_fb_device,
684 #endif
685
686 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
687         &rtc_device,
688 #endif
689
690 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
691 #ifdef CONFIG_SERIAL_BFIN_UART0
692         &bfin_uart0_device,
693 #endif
694 #ifdef CONFIG_SERIAL_BFIN_UART1
695         &bfin_uart1_device,
696 #endif
697 #endif
698
699 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
700 #ifdef CONFIG_BFIN_SIR0
701         &bfin_sir0_device,
702 #endif
703 #ifdef CONFIG_BFIN_SIR1
704         &bfin_sir1_device,
705 #endif
706 #endif
707
708 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
709         &i2c_bfin_twi_device,
710 #endif
711
712 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
713 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
714         &bfin_sport0_uart_device,
715 #endif
716 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
717         &bfin_sport1_uart_device,
718 #endif
719 #endif
720
721 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
722         &isp1362_hcd_device,
723 #endif
724
725 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
726         &smc91x_device,
727 #endif
728
729 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
730         &bfin_mii_bus,
731         &bfin_mac_device,
732 #endif
733
734 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
735         &net2272_bfin_device,
736 #endif
737
738 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
739         &bfin_spi0_device,
740 #endif
741
742 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
743         &bfin_pata_device,
744 #endif
745
746 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
747         &cm_flash_device,
748 #endif
749 };
750
751 static int __init net2272_init(void)
752 {
753 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
754         int ret;
755
756         ret = gpio_request(GPIO_PG14, "net2272");
757         if (ret)
758                 return ret;
759
760         /* Reset USB Chip, PG14 */
761         gpio_direction_output(GPIO_PG14, 0);
762         mdelay(2);
763         gpio_set_value(GPIO_PG14, 1);
764 #endif
765
766         return 0;
767 }
768
769 static int __init cm_bf537e_init(void)
770 {
771         printk(KERN_INFO "%s(): registering device resources\n", __func__);
772         platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
773 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
774         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
775 #endif
776
777 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
778         irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
779 #endif
780
781         if (net2272_init())
782                 pr_warning("unable to configure net2272; it probably won't work\n");
783
784         return 0;
785 }
786
787 arch_initcall(cm_bf537e_init);
788
789 static struct platform_device *cm_bf537e_early_devices[] __initdata = {
790 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
791 #ifdef CONFIG_SERIAL_BFIN_UART0
792         &bfin_uart0_device,
793 #endif
794 #ifdef CONFIG_SERIAL_BFIN_UART1
795         &bfin_uart1_device,
796 #endif
797 #endif
798
799 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
800 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
801         &bfin_sport0_uart_device,
802 #endif
803 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
804         &bfin_sport1_uart_device,
805 #endif
806 #endif
807 };
808
809 void __init native_machine_early_platform_add_devices(void)
810 {
811         printk(KERN_INFO "register early platform devices\n");
812         early_platform_add_devices(cm_bf537e_early_devices,
813                 ARRAY_SIZE(cm_bf537e_early_devices));
814 }
815
816 void bfin_get_ether_addr(char *addr)
817 {
818         random_ether_addr(addr);
819         printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
820 }
821 EXPORT_SYMBOL(bfin_get_ether_addr);