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