ARM: OMAP2PLUS: DSS: Ensure DSS works correctly if display is enabled in bootloader
[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_RX,
309                 .end = IRQ_UART0_RX+1,
310                 .flags = IORESOURCE_IRQ,
311         },
312         {
313                 .start = IRQ_UART0_ERROR,
314                 .end = IRQ_UART0_ERROR,
315                 .flags = IORESOURCE_IRQ,
316         },
317         {
318                 .start = CH_UART0_TX,
319                 .end = CH_UART0_TX,
320                 .flags = IORESOURCE_DMA,
321         },
322         {
323                 .start = CH_UART0_RX,
324                 .end = CH_UART0_RX,
325                 .flags = IORESOURCE_DMA,
326         },
327 #ifdef CONFIG_BFIN_UART0_CTSRTS
328         {
329                 /*
330                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
331                  */
332                 .start = -1,
333                 .end = -1,
334                 .flags = IORESOURCE_IO,
335         },
336         {
337                 /*
338                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
339                  */
340                 .start = -1,
341                 .end = -1,
342                 .flags = IORESOURCE_IO,
343         },
344 #endif
345 };
346
347 static unsigned short bfin_uart0_peripherals[] = {
348         P_UART0_TX, P_UART0_RX, 0
349 };
350
351 static struct platform_device bfin_uart0_device = {
352         .name = "bfin-uart",
353         .id = 0,
354         .num_resources = ARRAY_SIZE(bfin_uart0_resources),
355         .resource = bfin_uart0_resources,
356         .dev = {
357                 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
358         },
359 };
360 #endif
361 #ifdef CONFIG_SERIAL_BFIN_UART1
362 static struct resource bfin_uart1_resources[] = {
363         {
364                 .start = UART1_THR,
365                 .end = UART1_GCTL+2,
366                 .flags = IORESOURCE_MEM,
367         },
368         {
369                 .start = IRQ_UART1_RX,
370                 .end = IRQ_UART1_RX+1,
371                 .flags = IORESOURCE_IRQ,
372         },
373         {
374                 .start = IRQ_UART1_ERROR,
375                 .end = IRQ_UART1_ERROR,
376                 .flags = IORESOURCE_IRQ,
377         },
378         {
379                 .start = CH_UART1_TX,
380                 .end = CH_UART1_TX,
381                 .flags = IORESOURCE_DMA,
382         },
383         {
384                 .start = CH_UART1_RX,
385                 .end = CH_UART1_RX,
386                 .flags = IORESOURCE_DMA,
387         },
388 #ifdef CONFIG_BFIN_UART1_CTSRTS
389         {
390                 /*
391                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
392                  */
393                 .start = -1,
394                 .end = -1,
395                 .flags = IORESOURCE_IO,
396         },
397         {
398                 /*
399                  * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
400                  */
401                 .start = -1,
402                 .end = -1,
403                 .flags = IORESOURCE_IO,
404         },
405 #endif
406 };
407
408 static unsigned short bfin_uart1_peripherals[] = {
409         P_UART1_TX, P_UART1_RX, 0
410 };
411
412 static struct platform_device bfin_uart1_device = {
413         .name = "bfin-uart",
414         .id = 1,
415         .num_resources = ARRAY_SIZE(bfin_uart1_resources),
416         .resource = bfin_uart1_resources,
417         .dev = {
418                 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
419         },
420 };
421 #endif
422 #endif
423
424 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
425 #ifdef CONFIG_BFIN_SIR0
426 static struct resource bfin_sir0_resources[] = {
427         {
428                 .start = 0xFFC00400,
429                 .end = 0xFFC004FF,
430                 .flags = IORESOURCE_MEM,
431         },
432         {
433                 .start = IRQ_UART0_RX,
434                 .end = IRQ_UART0_RX+1,
435                 .flags = IORESOURCE_IRQ,
436         },
437         {
438                 .start = CH_UART0_RX,
439                 .end = CH_UART0_RX+1,
440                 .flags = IORESOURCE_DMA,
441         },
442 };
443 static struct platform_device bfin_sir0_device = {
444         .name = "bfin_sir",
445         .id = 0,
446         .num_resources = ARRAY_SIZE(bfin_sir0_resources),
447         .resource = bfin_sir0_resources,
448 };
449 #endif
450 #ifdef CONFIG_BFIN_SIR1
451 static struct resource bfin_sir1_resources[] = {
452         {
453                 .start = 0xFFC02000,
454                 .end = 0xFFC020FF,
455                 .flags = IORESOURCE_MEM,
456         },
457         {
458                 .start = IRQ_UART1_RX,
459                 .end = IRQ_UART1_RX+1,
460                 .flags = IORESOURCE_IRQ,
461         },
462         {
463                 .start = CH_UART1_RX,
464                 .end = CH_UART1_RX+1,
465                 .flags = IORESOURCE_DMA,
466         },
467 };
468 static struct platform_device bfin_sir1_device = {
469         .name = "bfin_sir",
470         .id = 1,
471         .num_resources = ARRAY_SIZE(bfin_sir1_resources),
472         .resource = bfin_sir1_resources,
473 };
474 #endif
475 #endif
476
477 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
478 static struct resource bfin_twi0_resource[] = {
479         [0] = {
480                 .start = TWI0_REGBASE,
481                 .end   = TWI0_REGBASE,
482                 .flags = IORESOURCE_MEM,
483         },
484         [1] = {
485                 .start = IRQ_TWI,
486                 .end   = IRQ_TWI,
487                 .flags = IORESOURCE_IRQ,
488         },
489 };
490
491 static struct platform_device i2c_bfin_twi_device = {
492         .name = "i2c-bfin-twi",
493         .id = 0,
494         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
495         .resource = bfin_twi0_resource,
496 };
497 #endif
498
499 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
500 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
501 static struct resource bfin_sport0_uart_resources[] = {
502         {
503                 .start = SPORT0_TCR1,
504                 .end = SPORT0_MRCS3+4,
505                 .flags = IORESOURCE_MEM,
506         },
507         {
508                 .start = IRQ_SPORT0_RX,
509                 .end = IRQ_SPORT0_RX+1,
510                 .flags = IORESOURCE_IRQ,
511         },
512         {
513                 .start = IRQ_SPORT0_ERROR,
514                 .end = IRQ_SPORT0_ERROR,
515                 .flags = IORESOURCE_IRQ,
516         },
517 };
518
519 static unsigned short bfin_sport0_peripherals[] = {
520         P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
521         P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
522 };
523
524 static struct platform_device bfin_sport0_uart_device = {
525         .name = "bfin-sport-uart",
526         .id = 0,
527         .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
528         .resource = bfin_sport0_uart_resources,
529         .dev = {
530                 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
531         },
532 };
533 #endif
534 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
535 static struct resource bfin_sport1_uart_resources[] = {
536         {
537                 .start = SPORT1_TCR1,
538                 .end = SPORT1_MRCS3+4,
539                 .flags = IORESOURCE_MEM,
540         },
541         {
542                 .start = IRQ_SPORT1_RX,
543                 .end = IRQ_SPORT1_RX+1,
544                 .flags = IORESOURCE_IRQ,
545         },
546         {
547                 .start = IRQ_SPORT1_ERROR,
548                 .end = IRQ_SPORT1_ERROR,
549                 .flags = IORESOURCE_IRQ,
550         },
551 };
552
553 static unsigned short bfin_sport1_peripherals[] = {
554         P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
555         P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
556 };
557
558 static struct platform_device bfin_sport1_uart_device = {
559         .name = "bfin-sport-uart",
560         .id = 1,
561         .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
562         .resource = bfin_sport1_uart_resources,
563         .dev = {
564                 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
565         },
566 };
567 #endif
568 #endif
569
570 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
571 #include <linux/bfin_mac.h>
572 #include <linux/export.h>
573 static const unsigned short bfin_mac_peripherals[] = P_MII0;
574
575 static struct bfin_phydev_platform_data bfin_phydev_data[] = {
576         {
577                 .addr = 1,
578                 .irq = IRQ_MAC_PHYINT,
579         },
580 };
581
582 static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
583         .phydev_number = 1,
584         .phydev_data = bfin_phydev_data,
585         .phy_mode = PHY_INTERFACE_MODE_MII,
586         .mac_peripherals = bfin_mac_peripherals,
587 };
588
589 static struct platform_device bfin_mii_bus = {
590         .name = "bfin_mii_bus",
591         .dev = {
592                 .platform_data = &bfin_mii_bus_data,
593         }
594 };
595
596 static struct platform_device bfin_mac_device = {
597         .name = "bfin_mac",
598         .dev = {
599                 .platform_data = &bfin_mii_bus,
600         }
601 };
602 #endif
603
604 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
605 #define PATA_INT        IRQ_PF14
606
607 static struct pata_platform_info bfin_pata_platform_data = {
608         .ioport_shift = 2,
609         .irq_type = IRQF_TRIGGER_HIGH,
610 };
611
612 static struct resource bfin_pata_resources[] = {
613         {
614                 .start = 0x2030C000,
615                 .end = 0x2030C01F,
616                 .flags = IORESOURCE_MEM,
617         },
618         {
619                 .start = 0x2030D018,
620                 .end = 0x2030D01B,
621                 .flags = IORESOURCE_MEM,
622         },
623         {
624                 .start = PATA_INT,
625                 .end = PATA_INT,
626                 .flags = IORESOURCE_IRQ,
627         },
628 };
629
630 static struct platform_device bfin_pata_device = {
631         .name = "pata_platform",
632         .id = -1,
633         .num_resources = ARRAY_SIZE(bfin_pata_resources),
634         .resource = bfin_pata_resources,
635         .dev = {
636                 .platform_data = &bfin_pata_platform_data,
637         }
638 };
639 #endif
640
641 static const unsigned int cclk_vlev_datasheet[] =
642 {
643         VRPAIR(VLEV_085, 250000000),
644         VRPAIR(VLEV_090, 376000000),
645         VRPAIR(VLEV_095, 426000000),
646         VRPAIR(VLEV_100, 426000000),
647         VRPAIR(VLEV_105, 476000000),
648         VRPAIR(VLEV_110, 476000000),
649         VRPAIR(VLEV_115, 476000000),
650         VRPAIR(VLEV_120, 500000000),
651         VRPAIR(VLEV_125, 533000000),
652         VRPAIR(VLEV_130, 600000000),
653 };
654
655 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
656         .tuple_tab = cclk_vlev_datasheet,
657         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
658         .vr_settling_time = 25 /* us */,
659 };
660
661 static struct platform_device bfin_dpmc = {
662         .name = "bfin dpmc",
663         .dev = {
664                 .platform_data = &bfin_dmpc_vreg_data,
665         },
666 };
667
668 static struct platform_device *cm_bf537e_devices[] __initdata = {
669
670         &bfin_dpmc,
671
672 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
673         &hitachi_fb_device,
674 #endif
675
676 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
677         &rtc_device,
678 #endif
679
680 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
681 #ifdef CONFIG_SERIAL_BFIN_UART0
682         &bfin_uart0_device,
683 #endif
684 #ifdef CONFIG_SERIAL_BFIN_UART1
685         &bfin_uart1_device,
686 #endif
687 #endif
688
689 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
690 #ifdef CONFIG_BFIN_SIR0
691         &bfin_sir0_device,
692 #endif
693 #ifdef CONFIG_BFIN_SIR1
694         &bfin_sir1_device,
695 #endif
696 #endif
697
698 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
699         &i2c_bfin_twi_device,
700 #endif
701
702 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
703 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
704         &bfin_sport0_uart_device,
705 #endif
706 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
707         &bfin_sport1_uart_device,
708 #endif
709 #endif
710
711 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
712         &isp1362_hcd_device,
713 #endif
714
715 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
716         &smc91x_device,
717 #endif
718
719 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
720         &bfin_mii_bus,
721         &bfin_mac_device,
722 #endif
723
724 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
725         &net2272_bfin_device,
726 #endif
727
728 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
729         &bfin_spi0_device,
730 #endif
731
732 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
733         &bfin_pata_device,
734 #endif
735
736 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
737         &cm_flash_device,
738 #endif
739 };
740
741 static int __init net2272_init(void)
742 {
743 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
744         int ret;
745
746         ret = gpio_request(GPIO_PG14, "net2272");
747         if (ret)
748                 return ret;
749
750         /* Reset USB Chip, PG14 */
751         gpio_direction_output(GPIO_PG14, 0);
752         mdelay(2);
753         gpio_set_value(GPIO_PG14, 1);
754 #endif
755
756         return 0;
757 }
758
759 static int __init cm_bf537e_init(void)
760 {
761         printk(KERN_INFO "%s(): registering device resources\n", __func__);
762         platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
763 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
764         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
765 #endif
766
767 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
768         irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
769 #endif
770
771         if (net2272_init())
772                 pr_warning("unable to configure net2272; it probably won't work\n");
773
774         return 0;
775 }
776
777 arch_initcall(cm_bf537e_init);
778
779 static struct platform_device *cm_bf537e_early_devices[] __initdata = {
780 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
781 #ifdef CONFIG_SERIAL_BFIN_UART0
782         &bfin_uart0_device,
783 #endif
784 #ifdef CONFIG_SERIAL_BFIN_UART1
785         &bfin_uart1_device,
786 #endif
787 #endif
788
789 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
790 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
791         &bfin_sport0_uart_device,
792 #endif
793 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
794         &bfin_sport1_uart_device,
795 #endif
796 #endif
797 };
798
799 void __init native_machine_early_platform_add_devices(void)
800 {
801         printk(KERN_INFO "register early platform devices\n");
802         early_platform_add_devices(cm_bf537e_early_devices,
803                 ARRAY_SIZE(cm_bf537e_early_devices));
804 }
805
806 void bfin_get_ether_addr(char *addr)
807 {
808         random_ether_addr(addr);
809         printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
810 }
811 EXPORT_SYMBOL(bfin_get_ether_addr);