Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[pandora-kernel.git] / arch / blackfin / mach-bf527 / boards / ezkit.c
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
3  *                2005 National ICT Australia (NICTA)
4  *                      Aidan Williams <aidan@nicta.com.au>
5  *
6  * Licensed under the GPL-2 or later.
7  */
8
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #include <linux/i2c.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/musb.h>
20 #include <linux/leds.h>
21 #include <linux/input.h>
22 #include <asm/dma.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/reboot.h>
25 #include <asm/nand.h>
26 #include <asm/portmux.h>
27 #include <asm/dpmc.h>
28 #include <linux/spi/ad7877.h>
29 #include <asm/bfin_sport.h>
30
31 /*
32  * Name the Board for the /proc/cpuinfo
33  */
34 #ifdef CONFIG_BFIN527_EZKIT_V2
35 const char bfin_board_name[] = "ADI BF527-EZKIT V2";
36 #else
37 const char bfin_board_name[] = "ADI BF527-EZKIT";
38 #endif
39
40 /*
41  *  Driver needs to know address, irq and flag pin.
42  */
43
44 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
45 #include <linux/usb/isp1760.h>
46 static struct resource bfin_isp1760_resources[] = {
47         [0] = {
48                 .start  = 0x203C0000,
49                 .end    = 0x203C0000 + 0x000fffff,
50                 .flags  = IORESOURCE_MEM,
51         },
52         [1] = {
53                 .start  = IRQ_PF7,
54                 .end    = IRQ_PF7,
55                 .flags  = IORESOURCE_IRQ,
56         },
57 };
58
59 static struct isp1760_platform_data isp1760_priv = {
60         .is_isp1761 = 0,
61         .bus_width_16 = 1,
62         .port1_otg = 0,
63         .analog_oc = 0,
64         .dack_polarity_high = 0,
65         .dreq_polarity_high = 0,
66 };
67
68 static struct platform_device bfin_isp1760_device = {
69         .name           = "isp1760",
70         .id             = 0,
71         .dev = {
72                 .platform_data = &isp1760_priv,
73         },
74         .num_resources  = ARRAY_SIZE(bfin_isp1760_resources),
75         .resource       = bfin_isp1760_resources,
76 };
77 #endif
78
79 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
80 static struct resource musb_resources[] = {
81         [0] = {
82                 .start  = 0xffc03800,
83                 .end    = 0xffc03cff,
84                 .flags  = IORESOURCE_MEM,
85         },
86         [1] = { /* general IRQ */
87                 .start  = IRQ_USB_INT0,
88                 .end    = IRQ_USB_INT0,
89                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
90                 .name   = "mc"
91         },
92         [2] = { /* DMA IRQ */
93                 .start  = IRQ_USB_DMA,
94                 .end    = IRQ_USB_DMA,
95                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
96                 .name   = "dma"
97         },
98 };
99
100 static struct musb_hdrc_config musb_config = {
101         .multipoint     = 0,
102         .dyn_fifo       = 0,
103         .soft_con       = 1,
104         .dma            = 1,
105         .num_eps        = 8,
106         .dma_channels   = 8,
107         .gpio_vrsel     = GPIO_PG13,
108         /* Some custom boards need to be active low, just set it to "0"
109          * if it is the case.
110          */
111         .gpio_vrsel_active      = 1,
112         .clkin          = 24,           /* musb CLKIN in MHZ */
113 };
114
115 static struct musb_hdrc_platform_data musb_plat = {
116 #if defined(CONFIG_USB_MUSB_OTG)
117         .mode           = MUSB_OTG,
118 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
119         .mode           = MUSB_HOST,
120 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
121         .mode           = MUSB_PERIPHERAL,
122 #endif
123         .config         = &musb_config,
124 };
125
126 static u64 musb_dmamask = ~(u32)0;
127
128 static struct platform_device musb_device = {
129         .name           = "musb-blackfin",
130         .id             = 0,
131         .dev = {
132                 .dma_mask               = &musb_dmamask,
133                 .coherent_dma_mask      = 0xffffffff,
134                 .platform_data          = &musb_plat,
135         },
136         .num_resources  = ARRAY_SIZE(musb_resources),
137         .resource       = musb_resources,
138 };
139 #endif
140
141 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
142
143 static struct resource bf52x_t350mcqb_resources[] = {
144         {
145                 .start = IRQ_PPI_ERROR,
146                 .end = IRQ_PPI_ERROR,
147                 .flags = IORESOURCE_IRQ,
148         },
149 };
150
151 static struct platform_device bf52x_t350mcqb_device = {
152         .name           = "bfin-t350mcqb",
153         .id             = -1,
154         .num_resources  = ARRAY_SIZE(bf52x_t350mcqb_resources),
155         .resource       = bf52x_t350mcqb_resources,
156 };
157 #endif
158
159 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
160 #include <asm/bfin-lq035q1.h>
161
162 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
163         .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
164         .ppi_mode = USE_RGB565_8_BIT_PPI,
165 };
166
167 static struct resource bfin_lq035q1_resources[] = {
168         {
169                 .start = IRQ_PPI_ERROR,
170                 .end = IRQ_PPI_ERROR,
171                 .flags = IORESOURCE_IRQ,
172         },
173 };
174
175 static struct platform_device bfin_lq035q1_device = {
176         .name           = "bfin-lq035q1",
177         .id             = -1,
178         .num_resources  = ARRAY_SIZE(bfin_lq035q1_resources),
179         .resource       = bfin_lq035q1_resources,
180         .dev            = {
181                 .platform_data = &bfin_lq035q1_data,
182         },
183 };
184 #endif
185
186 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
187 static struct mtd_partition ezkit_partitions[] = {
188         {
189                 .name       = "bootloader(nor)",
190                 .size       = 0x40000,
191                 .offset     = 0,
192         }, {
193                 .name       = "linux kernel(nor)",
194                 .size       = 0x1C0000,
195                 .offset     = MTDPART_OFS_APPEND,
196         }, {
197                 .name       = "file system(nor)",
198                 .size       = MTDPART_SIZ_FULL,
199                 .offset     = MTDPART_OFS_APPEND,
200         }
201 };
202
203 static struct physmap_flash_data ezkit_flash_data = {
204         .width      = 2,
205         .parts      = ezkit_partitions,
206         .nr_parts   = ARRAY_SIZE(ezkit_partitions),
207 };
208
209 static struct resource ezkit_flash_resource = {
210         .start = 0x20000000,
211         .end   = 0x203fffff,
212         .flags = IORESOURCE_MEM,
213 };
214
215 static struct platform_device ezkit_flash_device = {
216         .name          = "physmap-flash",
217         .id            = 0,
218         .dev = {
219                 .platform_data = &ezkit_flash_data,
220         },
221         .num_resources = 1,
222         .resource      = &ezkit_flash_resource,
223 };
224 #endif
225
226 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
227 static struct mtd_partition partition_info[] = {
228         {
229                 .name = "bootloader(nand)",
230                 .offset = 0,
231                 .size = 0x40000,
232         }, {
233                 .name = "linux kernel(nand)",
234                 .offset = MTDPART_OFS_APPEND,
235                 .size = 4 * 1024 * 1024,
236         },
237         {
238                 .name = "file system(nand)",
239                 .offset = MTDPART_OFS_APPEND,
240                 .size = MTDPART_SIZ_FULL,
241         },
242 };
243
244 static struct bf5xx_nand_platform bf5xx_nand_platform = {
245         .data_width = NFC_NWIDTH_8,
246         .partitions = partition_info,
247         .nr_partitions = ARRAY_SIZE(partition_info),
248         .rd_dly = 3,
249         .wr_dly = 3,
250 };
251
252 static struct resource bf5xx_nand_resources[] = {
253         {
254                 .start = NFC_CTL,
255                 .end = NFC_DATA_RD + 2,
256                 .flags = IORESOURCE_MEM,
257         },
258         {
259                 .start = CH_NFC,
260                 .end = CH_NFC,
261                 .flags = IORESOURCE_IRQ,
262         },
263 };
264
265 static struct platform_device bf5xx_nand_device = {
266         .name = "bf5xx-nand",
267         .id = 0,
268         .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
269         .resource = bf5xx_nand_resources,
270         .dev = {
271                 .platform_data = &bf5xx_nand_platform,
272         },
273 };
274 #endif
275
276 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
277 static struct resource bfin_pcmcia_cf_resources[] = {
278         {
279                 .start = 0x20310000, /* IO PORT */
280                 .end = 0x20312000,
281                 .flags = IORESOURCE_MEM,
282         }, {
283                 .start = 0x20311000, /* Attribute Memory */
284                 .end = 0x20311FFF,
285                 .flags = IORESOURCE_MEM,
286         }, {
287                 .start = IRQ_PF4,
288                 .end = IRQ_PF4,
289                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
290         }, {
291                 .start = 6, /* Card Detect PF6 */
292                 .end = 6,
293                 .flags = IORESOURCE_IRQ,
294         },
295 };
296
297 static struct platform_device bfin_pcmcia_cf_device = {
298         .name = "bfin_cf_pcmcia",
299         .id = -1,
300         .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
301         .resource = bfin_pcmcia_cf_resources,
302 };
303 #endif
304
305 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
306 static struct platform_device rtc_device = {
307         .name = "rtc-bfin",
308         .id   = -1,
309 };
310 #endif
311
312 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
313 #include <linux/smc91x.h>
314
315 static struct smc91x_platdata smc91x_info = {
316         .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
317         .leda = RPC_LED_100_10,
318         .ledb = RPC_LED_TX_RX,
319 };
320
321 static struct resource smc91x_resources[] = {
322         {
323                 .name = "smc91x-regs",
324                 .start = 0x20300300,
325                 .end = 0x20300300 + 16,
326                 .flags = IORESOURCE_MEM,
327         }, {
328
329                 .start = IRQ_PF7,
330                 .end = IRQ_PF7,
331                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
332         },
333 };
334 static struct platform_device smc91x_device = {
335         .name = "smc91x",
336         .id = 0,
337         .num_resources = ARRAY_SIZE(smc91x_resources),
338         .resource = smc91x_resources,
339         .dev    = {
340                 .platform_data  = &smc91x_info,
341         },
342 };
343 #endif
344
345 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
346 static struct resource dm9000_resources[] = {
347         [0] = {
348                 .start  = 0x203FB800,
349                 .end    = 0x203FB800 + 1,
350                 .flags  = IORESOURCE_MEM,
351         },
352         [1] = {
353                 .start  = 0x203FB800 + 4,
354                 .end    = 0x203FB800 + 5,
355                 .flags  = IORESOURCE_MEM,
356         },
357         [2] = {
358                 .start  = IRQ_PF9,
359                 .end    = IRQ_PF9,
360                 .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
361         },
362 };
363
364 static struct platform_device dm9000_device = {
365         .name           = "dm9000",
366         .id             = -1,
367         .num_resources  = ARRAY_SIZE(dm9000_resources),
368         .resource       = dm9000_resources,
369 };
370 #endif
371
372 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
373 #include <linux/bfin_mac.h>
374 static const unsigned short bfin_mac_peripherals[] = P_RMII0;
375
376 static struct bfin_phydev_platform_data bfin_phydev_data[] = {
377         {
378                 .addr = 1,
379                 .irq = IRQ_MAC_PHYINT,
380         },
381 };
382
383 static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
384         .phydev_number = 1,
385         .phydev_data = bfin_phydev_data,
386         .phy_mode = PHY_INTERFACE_MODE_RMII,
387         .mac_peripherals = bfin_mac_peripherals,
388 };
389
390 static struct platform_device bfin_mii_bus = {
391         .name = "bfin_mii_bus",
392         .dev = {
393                 .platform_data = &bfin_mii_bus_data,
394         }
395 };
396
397 static struct platform_device bfin_mac_device = {
398         .name = "bfin_mac",
399         .dev = {
400                 .platform_data = &bfin_mii_bus,
401         }
402 };
403 #endif
404
405 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
406 static struct resource net2272_bfin_resources[] = {
407         {
408                 .start = 0x20300000,
409                 .end = 0x20300000 + 0x100,
410                 .flags = IORESOURCE_MEM,
411         }, {
412                 .start = IRQ_PF7,
413                 .end = IRQ_PF7,
414                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
415         },
416 };
417
418 static struct platform_device net2272_bfin_device = {
419         .name = "net2272",
420         .id = -1,
421         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
422         .resource = net2272_bfin_resources,
423 };
424 #endif
425
426 #if defined(CONFIG_MTD_M25P80) \
427         || defined(CONFIG_MTD_M25P80_MODULE)
428 static struct mtd_partition bfin_spi_flash_partitions[] = {
429         {
430                 .name = "bootloader(spi)",
431                 .size = 0x00040000,
432                 .offset = 0,
433                 .mask_flags = MTD_CAP_ROM
434         }, {
435                 .name = "linux kernel(spi)",
436                 .size = MTDPART_SIZ_FULL,
437                 .offset = MTDPART_OFS_APPEND,
438         }
439 };
440
441 static struct flash_platform_data bfin_spi_flash_data = {
442         .name = "m25p80",
443         .parts = bfin_spi_flash_partitions,
444         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
445         .type = "m25p16",
446 };
447
448 /* SPI flash chip (m25p64) */
449 static struct bfin5xx_spi_chip spi_flash_chip_info = {
450         .enable_dma = 0,         /* use dma transfer with this chip*/
451         .bits_per_word = 8,
452 };
453 #endif
454
455 #if defined(CONFIG_BFIN_SPI_ADC) \
456         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
457 /* SPI ADC chip */
458 static struct bfin5xx_spi_chip spi_adc_chip_info = {
459         .enable_dma = 1,         /* use dma transfer with this chip*/
460         .bits_per_word = 16,
461 };
462 #endif
463
464 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
465         || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
466 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
467         .enable_dma = 0,
468         .bits_per_word = 16,
469 };
470 #endif
471
472 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
473 static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
474         .enable_dma = 0,
475         .bits_per_word = 8,
476 };
477 #endif
478
479 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
480 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
481         .enable_dma = 0,
482         .bits_per_word = 16,
483 };
484
485 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
486         .model                  = 7877,
487         .vref_delay_usecs       = 50,   /* internal, no capacitor */
488         .x_plate_ohms           = 419,
489         .y_plate_ohms           = 486,
490         .pressure_max           = 1000,
491         .pressure_min           = 0,
492         .stopacq_polarity       = 1,
493         .first_conversion_delay = 3,
494         .acquisition_time       = 1,
495         .averaging              = 1,
496         .pen_down_acc_interval  = 1,
497 };
498 #endif
499
500 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
501 #include <linux/spi/ad7879.h>
502 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
503         .model                  = 7879, /* Model = AD7879 */
504         .x_plate_ohms           = 620,  /* 620 Ohm from the touch datasheet */
505         .pressure_max           = 10000,
506         .pressure_min           = 0,
507         .first_conversion_delay = 3,    /* wait 512us before do a first conversion */
508         .acquisition_time       = 1,    /* 4us acquisition time per sample */
509         .median                 = 2,    /* do 8 measurements */
510         .averaging              = 1,    /* take the average of 4 middle samples */
511         .pen_down_acc_interval  = 255,  /* 9.4 ms */
512         .gpio_export            = 0,    /* Export GPIO to gpiolib */
513 };
514 #endif
515
516 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
517 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
518         .enable_dma = 0,
519         .bits_per_word = 16,
520 };
521 #endif
522
523 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
524 static struct bfin5xx_spi_chip spidev_chip_info = {
525         .enable_dma = 0,
526         .bits_per_word = 8,
527 };
528 #endif
529
530 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
531         defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
532
533 static const u16 bfin_snd_pin[][7] = {
534         {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
535                 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0},
536         {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
537                 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0},
538 };
539
540 static struct bfin_snd_platform_data bfin_snd_data[] = {
541         {
542                 .pin_req = &bfin_snd_pin[0][0],
543         },
544         {
545                 .pin_req = &bfin_snd_pin[1][0],
546         },
547 };
548
549 #define BFIN_SND_RES(x) \
550         [x] = { \
551                 { \
552                         .start = SPORT##x##_TCR1, \
553                         .end = SPORT##x##_TCR1, \
554                         .flags = IORESOURCE_MEM \
555                 }, \
556                 { \
557                         .start = CH_SPORT##x##_RX, \
558                         .end = CH_SPORT##x##_RX, \
559                         .flags = IORESOURCE_DMA, \
560                 }, \
561                 { \
562                         .start = CH_SPORT##x##_TX, \
563                         .end = CH_SPORT##x##_TX, \
564                         .flags = IORESOURCE_DMA, \
565                 }, \
566                 { \
567                         .start = IRQ_SPORT##x##_ERROR, \
568                         .end = IRQ_SPORT##x##_ERROR, \
569                         .flags = IORESOURCE_IRQ, \
570                 } \
571         }
572
573 static struct resource bfin_snd_resources[][4] = {
574         BFIN_SND_RES(0),
575         BFIN_SND_RES(1),
576 };
577
578 static struct platform_device bfin_pcm = {
579         .name = "bfin-pcm-audio",
580         .id = -1,
581 };
582 #endif
583
584 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
585 static struct platform_device bfin_i2s = {
586         .name = "bfin-i2s",
587         .id = CONFIG_SND_BF5XX_SPORT_NUM,
588         .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
589         .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
590         .dev = {
591                 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
592         },
593 };
594 #endif
595
596 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
597 static struct platform_device bfin_tdm = {
598         .name = "bfin-tdm",
599         .id = CONFIG_SND_BF5XX_SPORT_NUM,
600         .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
601         .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
602         .dev = {
603                 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
604         },
605 };
606 #endif
607
608 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
609 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
610         .enable_dma     = 0,
611         .bits_per_word  = 8,
612 };
613 #endif
614
615 static struct spi_board_info bfin_spi_board_info[] __initdata = {
616 #if defined(CONFIG_MTD_M25P80) \
617         || defined(CONFIG_MTD_M25P80_MODULE)
618         {
619                 /* the modalias must be the same as spi device driver name */
620                 .modalias = "m25p80", /* Name of spi_driver for this device */
621                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
622                 .bus_num = 0, /* Framework bus number */
623                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
624                 .platform_data = &bfin_spi_flash_data,
625                 .controller_data = &spi_flash_chip_info,
626                 .mode = SPI_MODE_3,
627         },
628 #endif
629
630 #if defined(CONFIG_BFIN_SPI_ADC) \
631         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
632         {
633                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
634                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
635                 .bus_num = 0, /* Framework bus number */
636                 .chip_select = 1, /* Framework chip select. */
637                 .platform_data = NULL, /* No spi_driver specific config */
638                 .controller_data = &spi_adc_chip_info,
639         },
640 #endif
641
642 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
643         || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
644         {
645                 .modalias = "ad183x",
646                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
647                 .bus_num = 0,
648                 .chip_select = 4,
649                 .platform_data = "ad1836",
650                 .controller_data = &ad1836_spi_chip_info,
651                 .mode = SPI_MODE_3,
652         },
653 #endif
654 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
655         {
656                 .modalias = "mmc_spi",
657                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
658                 .bus_num = 0,
659                 .chip_select = 3,
660                 .controller_data = &mmc_spi_chip_info,
661                 .mode = SPI_MODE_0,
662         },
663 #endif
664
665 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
666         {
667                 .modalias               = "ad7877",
668                 .platform_data          = &bfin_ad7877_ts_info,
669                 .irq                    = IRQ_PF8,
670                 .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
671                 .bus_num        = 0,
672                 .chip_select  = 2,
673                 .controller_data = &spi_ad7877_chip_info,
674         },
675 #endif
676 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
677         {
678                 .modalias = "ad7879",
679                 .platform_data = &bfin_ad7879_ts_info,
680                 .irq = IRQ_PF8,
681                 .max_speed_hz = 5000000,     /* max spi clock (SCK) speed in HZ */
682                 .bus_num = 0,
683                 .chip_select = 3,
684                 .controller_data = &spi_ad7879_chip_info,
685                 .mode = SPI_CPHA | SPI_CPOL,
686         },
687 #endif
688 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
689         {
690                 .modalias = "spidev",
691                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
692                 .bus_num = 0,
693                 .chip_select = 1,
694                 .controller_data = &spidev_chip_info,
695         },
696 #endif
697 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
698         {
699                 .modalias = "bfin-lq035q1-spi",
700                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
701                 .bus_num = 0,
702                 .chip_select = 7,
703                 .controller_data = &lq035q1_spi_chip_info,
704                 .mode = SPI_CPHA | SPI_CPOL,
705         },
706 #endif
707 };
708
709 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
710 /* SPI controller data */
711 static struct bfin5xx_spi_master bfin_spi0_info = {
712         .num_chipselect = 8,
713         .enable_dma = 1,  /* master has the ability to do dma transfer */
714         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
715 };
716
717 /* SPI (0) */
718 static struct resource bfin_spi0_resource[] = {
719         [0] = {
720                 .start = SPI0_REGBASE,
721                 .end   = SPI0_REGBASE + 0xFF,
722                 .flags = IORESOURCE_MEM,
723                 },
724         [1] = {
725                 .start = CH_SPI,
726                 .end   = CH_SPI,
727                 .flags = IORESOURCE_DMA,
728         },
729         [2] = {
730                 .start = IRQ_SPI,
731                 .end   = IRQ_SPI,
732                 .flags = IORESOURCE_IRQ,
733         },
734 };
735
736 static struct platform_device bfin_spi0_device = {
737         .name = "bfin-spi",
738         .id = 0, /* Bus number */
739         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
740         .resource = bfin_spi0_resource,
741         .dev = {
742                 .platform_data = &bfin_spi0_info, /* Passed to driver */
743         },
744 };
745 #endif  /* spi master and devices */
746
747 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
748 #ifdef CONFIG_SERIAL_BFIN_UART0
749 static struct resource bfin_uart0_resources[] = {
750         {
751                 .start = UART0_THR,
752                 .end = UART0_GCTL+2,
753                 .flags = IORESOURCE_MEM,
754         },
755         {
756                 .start = IRQ_UART0_RX,
757                 .end = IRQ_UART0_RX+1,
758                 .flags = IORESOURCE_IRQ,
759         },
760         {
761                 .start = IRQ_UART0_ERROR,
762                 .end = IRQ_UART0_ERROR,
763                 .flags = IORESOURCE_IRQ,
764         },
765         {
766                 .start = CH_UART0_TX,
767                 .end = CH_UART0_TX,
768                 .flags = IORESOURCE_DMA,
769         },
770         {
771                 .start = CH_UART0_RX,
772                 .end = CH_UART0_RX,
773                 .flags = IORESOURCE_DMA,
774         },
775 };
776
777 static unsigned short bfin_uart0_peripherals[] = {
778         P_UART0_TX, P_UART0_RX, 0
779 };
780
781 static struct platform_device bfin_uart0_device = {
782         .name = "bfin-uart",
783         .id = 0,
784         .num_resources = ARRAY_SIZE(bfin_uart0_resources),
785         .resource = bfin_uart0_resources,
786         .dev = {
787                 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
788         },
789 };
790 #endif
791 #ifdef CONFIG_SERIAL_BFIN_UART1
792 static struct resource bfin_uart1_resources[] = {
793         {
794                 .start = UART1_THR,
795                 .end = UART1_GCTL+2,
796                 .flags = IORESOURCE_MEM,
797         },
798         {
799                 .start = IRQ_UART1_RX,
800                 .end = IRQ_UART1_RX+1,
801                 .flags = IORESOURCE_IRQ,
802         },
803         {
804                 .start = IRQ_UART1_ERROR,
805                 .end = IRQ_UART1_ERROR,
806                 .flags = IORESOURCE_IRQ,
807         },
808         {
809                 .start = CH_UART1_TX,
810                 .end = CH_UART1_TX,
811                 .flags = IORESOURCE_DMA,
812         },
813         {
814                 .start = CH_UART1_RX,
815                 .end = CH_UART1_RX,
816                 .flags = IORESOURCE_DMA,
817         },
818 #ifdef CONFIG_BFIN_UART1_CTSRTS
819         {       /* CTS pin */
820                 .start = GPIO_PF9,
821                 .end = GPIO_PF9,
822                 .flags = IORESOURCE_IO,
823         },
824         {       /* RTS pin */
825                 .start = GPIO_PF10,
826                 .end = GPIO_PF10,
827                 .flags = IORESOURCE_IO,
828         },
829 #endif
830 };
831
832 static unsigned short bfin_uart1_peripherals[] = {
833         P_UART1_TX, P_UART1_RX, 0
834 };
835
836 static struct platform_device bfin_uart1_device = {
837         .name = "bfin-uart",
838         .id = 1,
839         .num_resources = ARRAY_SIZE(bfin_uart1_resources),
840         .resource = bfin_uart1_resources,
841         .dev = {
842                 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
843         },
844 };
845 #endif
846 #endif
847
848 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
849 #ifdef CONFIG_BFIN_SIR0
850 static struct resource bfin_sir0_resources[] = {
851         {
852                 .start = 0xFFC00400,
853                 .end = 0xFFC004FF,
854                 .flags = IORESOURCE_MEM,
855         },
856         {
857                 .start = IRQ_UART0_RX,
858                 .end = IRQ_UART0_RX+1,
859                 .flags = IORESOURCE_IRQ,
860         },
861         {
862                 .start = CH_UART0_RX,
863                 .end = CH_UART0_RX+1,
864                 .flags = IORESOURCE_DMA,
865         },
866 };
867
868 static struct platform_device bfin_sir0_device = {
869         .name = "bfin_sir",
870         .id = 0,
871         .num_resources = ARRAY_SIZE(bfin_sir0_resources),
872         .resource = bfin_sir0_resources,
873 };
874 #endif
875 #ifdef CONFIG_BFIN_SIR1
876 static struct resource bfin_sir1_resources[] = {
877         {
878                 .start = 0xFFC02000,
879                 .end = 0xFFC020FF,
880                 .flags = IORESOURCE_MEM,
881         },
882         {
883                 .start = IRQ_UART1_RX,
884                 .end = IRQ_UART1_RX+1,
885                 .flags = IORESOURCE_IRQ,
886         },
887         {
888                 .start = CH_UART1_RX,
889                 .end = CH_UART1_RX+1,
890                 .flags = IORESOURCE_DMA,
891         },
892 };
893
894 static struct platform_device bfin_sir1_device = {
895         .name = "bfin_sir",
896         .id = 1,
897         .num_resources = ARRAY_SIZE(bfin_sir1_resources),
898         .resource = bfin_sir1_resources,
899 };
900 #endif
901 #endif
902
903 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
904 static struct resource bfin_twi0_resource[] = {
905         [0] = {
906                 .start = TWI0_REGBASE,
907                 .end   = TWI0_REGBASE,
908                 .flags = IORESOURCE_MEM,
909         },
910         [1] = {
911                 .start = IRQ_TWI,
912                 .end   = IRQ_TWI,
913                 .flags = IORESOURCE_IRQ,
914         },
915 };
916
917 static struct platform_device i2c_bfin_twi_device = {
918         .name = "i2c-bfin-twi",
919         .id = 0,
920         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
921         .resource = bfin_twi0_resource,
922 };
923 #endif
924
925 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
926 #include <linux/mfd/adp5520.h>
927
928         /*
929          *  ADP5520/5501 LEDs Data
930          */
931
932 static struct led_info adp5520_leds[] = {
933         {
934                 .name = "adp5520-led1",
935                 .default_trigger = "none",
936                 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
937         },
938 };
939
940 static struct adp5520_leds_platform_data adp5520_leds_data = {
941         .num_leds = ARRAY_SIZE(adp5520_leds),
942         .leds = adp5520_leds,
943         .fade_in = ADP5520_FADE_T_600ms,
944         .fade_out = ADP5520_FADE_T_600ms,
945         .led_on_time = ADP5520_LED_ONT_600ms,
946 };
947
948         /*
949          *  ADP5520 Keypad Data
950          */
951
952 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
953         [ADP5520_KEY(3, 3)]     = KEY_1,
954         [ADP5520_KEY(2, 3)]     = KEY_2,
955         [ADP5520_KEY(1, 3)]     = KEY_3,
956         [ADP5520_KEY(0, 3)]     = KEY_UP,
957         [ADP5520_KEY(3, 2)]     = KEY_4,
958         [ADP5520_KEY(2, 2)]     = KEY_5,
959         [ADP5520_KEY(1, 2)]     = KEY_6,
960         [ADP5520_KEY(0, 2)]     = KEY_DOWN,
961         [ADP5520_KEY(3, 1)]     = KEY_7,
962         [ADP5520_KEY(2, 1)]     = KEY_8,
963         [ADP5520_KEY(1, 1)]     = KEY_9,
964         [ADP5520_KEY(0, 1)]     = KEY_DOT,
965         [ADP5520_KEY(3, 0)]     = KEY_BACKSPACE,
966         [ADP5520_KEY(2, 0)]     = KEY_0,
967         [ADP5520_KEY(1, 0)]     = KEY_HELP,
968         [ADP5520_KEY(0, 0)]     = KEY_ENTER,
969 };
970
971 static struct adp5520_keys_platform_data adp5520_keys_data = {
972         .rows_en_mask   = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
973         .cols_en_mask   = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
974         .keymap         = adp5520_keymap,
975         .keymapsize     = ARRAY_SIZE(adp5520_keymap),
976         .repeat         = 0,
977 };
978
979         /*
980          *  ADP5520/5501 Multifunction Device Init Data
981          */
982
983 static struct adp5520_platform_data adp5520_pdev_data = {
984         .leds = &adp5520_leds_data,
985         .keys = &adp5520_keys_data,
986 };
987
988 #endif
989
990 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
991 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
992         {
993                 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
994         },
995 #endif
996 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
997         {
998                 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
999                 .irq = IRQ_PF8,
1000         },
1001 #endif
1002 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1003         {
1004                 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1005         },
1006 #endif
1007 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1008         {
1009                 I2C_BOARD_INFO("ad7879", 0x2C),
1010                 .irq = IRQ_PF8,
1011                 .platform_data = (void *)&bfin_ad7879_ts_info,
1012         },
1013 #endif
1014 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1015         {
1016                 I2C_BOARD_INFO("pmic-adp5520", 0x32),
1017                 .irq = IRQ_PF9,
1018                 .platform_data = (void *)&adp5520_pdev_data,
1019         },
1020 #endif
1021 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1022         {
1023                 I2C_BOARD_INFO("ssm2602", 0x1b),
1024         },
1025 #endif
1026 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1027         {
1028                 I2C_BOARD_INFO("ad5252", 0x2f),
1029         },
1030 #endif
1031 #if defined(CONFIG_SND_SOC_ADAU1373) || defined(CONFIG_SND_SOC_ADAU1373_MODULE)
1032         {
1033                 I2C_BOARD_INFO("adau1373", 0x1A),
1034         },
1035 #endif
1036 };
1037
1038 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1039 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1040 static struct resource bfin_sport0_uart_resources[] = {
1041         {
1042                 .start = SPORT0_TCR1,
1043                 .end = SPORT0_MRCS3+4,
1044                 .flags = IORESOURCE_MEM,
1045         },
1046         {
1047                 .start = IRQ_SPORT0_RX,
1048                 .end = IRQ_SPORT0_RX+1,
1049                 .flags = IORESOURCE_IRQ,
1050         },
1051         {
1052                 .start = IRQ_SPORT0_ERROR,
1053                 .end = IRQ_SPORT0_ERROR,
1054                 .flags = IORESOURCE_IRQ,
1055         },
1056 };
1057
1058 static unsigned short bfin_sport0_peripherals[] = {
1059         P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1060         P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
1061 };
1062
1063 static struct platform_device bfin_sport0_uart_device = {
1064         .name = "bfin-sport-uart",
1065         .id = 0,
1066         .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1067         .resource = bfin_sport0_uart_resources,
1068         .dev = {
1069                 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1070         },
1071 };
1072 #endif
1073 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1074 static struct resource bfin_sport1_uart_resources[] = {
1075         {
1076                 .start = SPORT1_TCR1,
1077                 .end = SPORT1_MRCS3+4,
1078                 .flags = IORESOURCE_MEM,
1079         },
1080         {
1081                 .start = IRQ_SPORT1_RX,
1082                 .end = IRQ_SPORT1_RX+1,
1083                 .flags = IORESOURCE_IRQ,
1084         },
1085         {
1086                 .start = IRQ_SPORT1_ERROR,
1087                 .end = IRQ_SPORT1_ERROR,
1088                 .flags = IORESOURCE_IRQ,
1089         },
1090 };
1091
1092 static unsigned short bfin_sport1_peripherals[] = {
1093         P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1094         P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
1095 };
1096
1097 static struct platform_device bfin_sport1_uart_device = {
1098         .name = "bfin-sport-uart",
1099         .id = 1,
1100         .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1101         .resource = bfin_sport1_uart_resources,
1102         .dev = {
1103                 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1104         },
1105 };
1106 #endif
1107 #endif
1108
1109 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1110 #include <linux/gpio_keys.h>
1111
1112 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1113         {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1114         {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1115 };
1116
1117 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1118         .buttons        = bfin_gpio_keys_table,
1119         .nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
1120 };
1121
1122 static struct platform_device bfin_device_gpiokeys = {
1123         .name      = "gpio-keys",
1124         .dev = {
1125                 .platform_data = &bfin_gpio_keys_data,
1126         },
1127 };
1128 #endif
1129
1130 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1131 #include <asm/bfin_rotary.h>
1132
1133 static struct bfin_rotary_platform_data bfin_rotary_data = {
1134         /*.rotary_up_key     = KEY_UP,*/
1135         /*.rotary_down_key   = KEY_DOWN,*/
1136         .rotary_rel_code   = REL_WHEEL,
1137         .rotary_button_key = KEY_ENTER,
1138         .debounce          = 10,        /* 0..17 */
1139         .mode              = ROT_QUAD_ENC | ROT_DEBE,
1140 };
1141
1142 static struct resource bfin_rotary_resources[] = {
1143         {
1144                 .start = IRQ_CNT,
1145                 .end = IRQ_CNT,
1146                 .flags = IORESOURCE_IRQ,
1147         },
1148 };
1149
1150 static struct platform_device bfin_rotary_device = {
1151         .name           = "bfin-rotary",
1152         .id             = -1,
1153         .num_resources  = ARRAY_SIZE(bfin_rotary_resources),
1154         .resource       = bfin_rotary_resources,
1155         .dev            = {
1156                 .platform_data = &bfin_rotary_data,
1157         },
1158 };
1159 #endif
1160
1161 static const unsigned int cclk_vlev_datasheet[] =
1162 {
1163         VRPAIR(VLEV_100, 400000000),
1164         VRPAIR(VLEV_105, 426000000),
1165         VRPAIR(VLEV_110, 500000000),
1166         VRPAIR(VLEV_115, 533000000),
1167         VRPAIR(VLEV_120, 600000000),
1168 };
1169
1170 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1171         .tuple_tab = cclk_vlev_datasheet,
1172         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1173         .vr_settling_time = 25 /* us */,
1174 };
1175
1176 static struct platform_device bfin_dpmc = {
1177         .name = "bfin dpmc",
1178         .dev = {
1179                 .platform_data = &bfin_dmpc_vreg_data,
1180         },
1181 };
1182
1183 static struct platform_device *stamp_devices[] __initdata = {
1184
1185         &bfin_dpmc,
1186
1187 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1188         &bf5xx_nand_device,
1189 #endif
1190
1191 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1192         &bfin_pcmcia_cf_device,
1193 #endif
1194
1195 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1196         &rtc_device,
1197 #endif
1198
1199 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1200         &bfin_isp1760_device,
1201 #endif
1202
1203 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1204         &musb_device,
1205 #endif
1206
1207 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1208         &smc91x_device,
1209 #endif
1210
1211 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1212         &dm9000_device,
1213 #endif
1214
1215 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1216         &bfin_mii_bus,
1217         &bfin_mac_device,
1218 #endif
1219
1220 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1221         &net2272_bfin_device,
1222 #endif
1223
1224 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1225         &bfin_spi0_device,
1226 #endif
1227
1228 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1229         &bf52x_t350mcqb_device,
1230 #endif
1231
1232 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1233         &bfin_lq035q1_device,
1234 #endif
1235
1236 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1237 #ifdef CONFIG_SERIAL_BFIN_UART0
1238         &bfin_uart0_device,
1239 #endif
1240 #ifdef CONFIG_SERIAL_BFIN_UART1
1241         &bfin_uart1_device,
1242 #endif
1243 #endif
1244
1245 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1246 #ifdef CONFIG_BFIN_SIR0
1247         &bfin_sir0_device,
1248 #endif
1249 #ifdef CONFIG_BFIN_SIR1
1250         &bfin_sir1_device,
1251 #endif
1252 #endif
1253
1254 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1255         &i2c_bfin_twi_device,
1256 #endif
1257
1258 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1259 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1260         &bfin_sport0_uart_device,
1261 #endif
1262 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1263         &bfin_sport1_uart_device,
1264 #endif
1265 #endif
1266
1267 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1268         &bfin_device_gpiokeys,
1269 #endif
1270
1271 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1272         &bfin_rotary_device,
1273 #endif
1274
1275 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1276         &ezkit_flash_device,
1277 #endif
1278
1279 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1280         defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1281         &bfin_pcm,
1282 #endif
1283
1284 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1285         &bfin_i2s,
1286 #endif
1287
1288 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1289         &bfin_tdm,
1290 #endif
1291 };
1292
1293 static int __init ezkit_init(void)
1294 {
1295         printk(KERN_INFO "%s(): registering device resources\n", __func__);
1296         i2c_register_board_info(0, bfin_i2c_board_info,
1297                                 ARRAY_SIZE(bfin_i2c_board_info));
1298         platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1299         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1300         return 0;
1301 }
1302
1303 arch_initcall(ezkit_init);
1304
1305 static struct platform_device *ezkit_early_devices[] __initdata = {
1306 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1307 #ifdef CONFIG_SERIAL_BFIN_UART0
1308         &bfin_uart0_device,
1309 #endif
1310 #ifdef CONFIG_SERIAL_BFIN_UART1
1311         &bfin_uart1_device,
1312 #endif
1313 #endif
1314
1315 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1316 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1317         &bfin_sport0_uart_device,
1318 #endif
1319 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1320         &bfin_sport1_uart_device,
1321 #endif
1322 #endif
1323 };
1324
1325 void __init native_machine_early_platform_add_devices(void)
1326 {
1327         printk(KERN_INFO "register early platform devices\n");
1328         early_platform_add_devices(ezkit_early_devices,
1329                 ARRAY_SIZE(ezkit_early_devices));
1330 }
1331
1332 void native_machine_restart(char *cmd)
1333 {
1334         /* workaround reboot hang when booting from SPI */
1335         if ((bfin_read_SYSCR() & 0x7) == 0x3)
1336                 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1337 }
1338
1339 void bfin_get_ether_addr(char *addr)
1340 {
1341         /* the MAC is stored in OTP memory page 0xDF */
1342         u32 ret;
1343         u64 otp_mac;
1344         u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1345
1346         ret = otp_read(0xDF, 0x00, &otp_mac);
1347         if (!(ret & 0x1)) {
1348                 char *otp_mac_p = (char *)&otp_mac;
1349                 for (ret = 0; ret < 6; ++ret)
1350                         addr[ret] = otp_mac_p[5 - ret];
1351         }
1352 }
1353 EXPORT_SYMBOL(bfin_get_ether_addr);