Blackfin: bf537-stamp: add example ADAU1361 resources
[safe/jmp/linux-2.6] / arch / blackfin / mach-bf537 / boards / stamp.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/kernel.h>
11 #include <linux/platform_device.h>
12 #include <linux/io.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/nand.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/plat-ram.h>
17 #include <linux/mtd/physmap.h>
18 #include <linux/spi/spi.h>
19 #include <linux/spi/flash.h>
20 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
21 #include <linux/usb/isp1362.h>
22 #endif
23 #include <linux/i2c.h>
24 #include <linux/i2c/adp5588.h>
25 #include <linux/etherdevice.h>
26 #include <linux/ata_platform.h>
27 #include <linux/irq.h>
28 #include <linux/interrupt.h>
29 #include <linux/usb/sl811.h>
30 #include <linux/spi/mmc_spi.h>
31 #include <linux/leds.h>
32 #include <linux/input.h>
33 #include <asm/dma.h>
34 #include <asm/bfin5xx_spi.h>
35 #include <asm/reboot.h>
36 #include <asm/portmux.h>
37 #include <asm/dpmc.h>
38 #ifdef CONFIG_REGULATOR_ADP_SWITCH
39 #include <linux/regulator/adp_switch.h>
40 #endif
41 #ifdef CONFIG_REGULATOR_AD5398
42 #include <linux/regulator/ad5398.h>
43 #endif
44 #include <linux/regulator/consumer.h>
45 #include <linux/regulator/userspace-consumer.h>
46
47 /*
48  * Name the Board for the /proc/cpuinfo
49  */
50 const char bfin_board_name[] = "ADI BF537-STAMP";
51
52 /*
53  *  Driver needs to know address, irq and flag pin.
54  */
55
56 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
57 #include <linux/usb/isp1760.h>
58 static struct resource bfin_isp1760_resources[] = {
59         [0] = {
60                 .start  = 0x203C0000,
61                 .end    = 0x203C0000 + 0x000fffff,
62                 .flags  = IORESOURCE_MEM,
63         },
64         [1] = {
65                 .start  = IRQ_PF7,
66                 .end    = IRQ_PF7,
67                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
68         },
69 };
70
71 static struct isp1760_platform_data isp1760_priv = {
72         .is_isp1761 = 0,
73         .bus_width_16 = 1,
74         .port1_otg = 0,
75         .analog_oc = 0,
76         .dack_polarity_high = 0,
77         .dreq_polarity_high = 0,
78 };
79
80 static struct platform_device bfin_isp1760_device = {
81         .name           = "isp1760",
82         .id             = 0,
83         .dev = {
84                 .platform_data = &isp1760_priv,
85         },
86         .num_resources  = ARRAY_SIZE(bfin_isp1760_resources),
87         .resource       = bfin_isp1760_resources,
88 };
89 #endif
90
91 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
92 #include <linux/gpio_keys.h>
93
94 static struct gpio_keys_button bfin_gpio_keys_table[] = {
95         {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
96         {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
97         {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
98         {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
99 };
100
101 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
102         .buttons        = bfin_gpio_keys_table,
103         .nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
104 };
105
106 static struct platform_device bfin_device_gpiokeys = {
107         .name      = "gpio-keys",
108         .dev = {
109                 .platform_data = &bfin_gpio_keys_data,
110         },
111 };
112 #endif
113
114 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
115 static struct resource bfin_pcmcia_cf_resources[] = {
116         {
117                 .start = 0x20310000, /* IO PORT */
118                 .end = 0x20312000,
119                 .flags = IORESOURCE_MEM,
120         }, {
121                 .start = 0x20311000, /* Attribute Memory */
122                 .end = 0x20311FFF,
123                 .flags = IORESOURCE_MEM,
124         }, {
125                 .start = IRQ_PF4,
126                 .end = IRQ_PF4,
127                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
128         }, {
129                 .start = 6, /* Card Detect PF6 */
130                 .end = 6,
131                 .flags = IORESOURCE_IRQ,
132         },
133 };
134
135 static struct platform_device bfin_pcmcia_cf_device = {
136         .name = "bfin_cf_pcmcia",
137         .id = -1,
138         .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
139         .resource = bfin_pcmcia_cf_resources,
140 };
141 #endif
142
143 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
144 static struct platform_device rtc_device = {
145         .name = "rtc-bfin",
146         .id   = -1,
147 };
148 #endif
149
150 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
151 #include <linux/smc91x.h>
152
153 static struct smc91x_platdata smc91x_info = {
154         .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
155         .leda = RPC_LED_100_10,
156         .ledb = RPC_LED_TX_RX,
157 };
158
159 static struct resource smc91x_resources[] = {
160         {
161                 .name = "smc91x-regs",
162                 .start = 0x20300300,
163                 .end = 0x20300300 + 16,
164                 .flags = IORESOURCE_MEM,
165         }, {
166
167                 .start = IRQ_PF7,
168                 .end = IRQ_PF7,
169                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
170         },
171 };
172 static struct platform_device smc91x_device = {
173         .name = "smc91x",
174         .id = 0,
175         .num_resources = ARRAY_SIZE(smc91x_resources),
176         .resource = smc91x_resources,
177         .dev    = {
178                 .platform_data  = &smc91x_info,
179         },
180 };
181 #endif
182
183 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
184 static struct resource dm9000_resources[] = {
185         [0] = {
186                 .start  = 0x203FB800,
187                 .end    = 0x203FB800 + 1,
188                 .flags  = IORESOURCE_MEM,
189         },
190         [1] = {
191                 .start  = 0x203FB804,
192                 .end    = 0x203FB804 + 1,
193                 .flags  = IORESOURCE_MEM,
194         },
195         [2] = {
196                 .start  = IRQ_PF9,
197                 .end    = IRQ_PF9,
198                 .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
199         },
200 };
201
202 static struct platform_device dm9000_device = {
203         .name           = "dm9000",
204         .id             = -1,
205         .num_resources  = ARRAY_SIZE(dm9000_resources),
206         .resource       = dm9000_resources,
207 };
208 #endif
209
210 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
211 static struct resource sl811_hcd_resources[] = {
212         {
213                 .start = 0x20340000,
214                 .end = 0x20340000,
215                 .flags = IORESOURCE_MEM,
216         }, {
217                 .start = 0x20340004,
218                 .end = 0x20340004,
219                 .flags = IORESOURCE_MEM,
220         }, {
221                 .start = IRQ_PF4,
222                 .end = IRQ_PF4,
223                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
224         },
225 };
226
227 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
228 void sl811_port_power(struct device *dev, int is_on)
229 {
230         gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
231         gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
232 }
233 #endif
234
235 static struct sl811_platform_data sl811_priv = {
236         .potpg = 10,
237         .power = 250,       /* == 500mA */
238 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
239         .port_power = &sl811_port_power,
240 #endif
241 };
242
243 static struct platform_device sl811_hcd_device = {
244         .name = "sl811-hcd",
245         .id = 0,
246         .dev = {
247                 .platform_data = &sl811_priv,
248         },
249         .num_resources = ARRAY_SIZE(sl811_hcd_resources),
250         .resource = sl811_hcd_resources,
251 };
252 #endif
253
254 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
255 static struct resource isp1362_hcd_resources[] = {
256         {
257                 .start = 0x20360000,
258                 .end = 0x20360000,
259                 .flags = IORESOURCE_MEM,
260         }, {
261                 .start = 0x20360004,
262                 .end = 0x20360004,
263                 .flags = IORESOURCE_MEM,
264         }, {
265                 .start = IRQ_PF3,
266                 .end = IRQ_PF3,
267                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
268         },
269 };
270
271 static struct isp1362_platform_data isp1362_priv = {
272         .sel15Kres = 1,
273         .clknotstop = 0,
274         .oc_enable = 0,
275         .int_act_high = 0,
276         .int_edge_triggered = 0,
277         .remote_wakeup_connected = 0,
278         .no_power_switching = 1,
279         .power_switching_mode = 0,
280 };
281
282 static struct platform_device isp1362_hcd_device = {
283         .name = "isp1362-hcd",
284         .id = 0,
285         .dev = {
286                 .platform_data = &isp1362_priv,
287         },
288         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
289         .resource = isp1362_hcd_resources,
290 };
291 #endif
292
293 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
294 unsigned short bfin_can_peripherals[] = {
295         P_CAN0_RX, P_CAN0_TX, 0
296 };
297
298 static struct resource bfin_can_resources[] = {
299         {
300                 .start = 0xFFC02A00,
301                 .end = 0xFFC02FFF,
302                 .flags = IORESOURCE_MEM,
303         },
304         {
305                 .start = IRQ_CAN_RX,
306                 .end = IRQ_CAN_RX,
307                 .flags = IORESOURCE_IRQ,
308         },
309         {
310                 .start = IRQ_CAN_TX,
311                 .end = IRQ_CAN_TX,
312                 .flags = IORESOURCE_IRQ,
313         },
314         {
315                 .start = IRQ_CAN_ERROR,
316                 .end = IRQ_CAN_ERROR,
317                 .flags = IORESOURCE_IRQ,
318         },
319 };
320
321 static struct platform_device bfin_can_device = {
322         .name = "bfin_can",
323         .num_resources = ARRAY_SIZE(bfin_can_resources),
324         .resource = bfin_can_resources,
325         .dev = {
326                 .platform_data = &bfin_can_peripherals, /* Passed to driver */
327         },
328 };
329 #endif
330
331 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
332 static struct platform_device bfin_mii_bus = {
333         .name = "bfin_mii_bus",
334 };
335
336 static struct platform_device bfin_mac_device = {
337         .name = "bfin_mac",
338         .dev.platform_data = &bfin_mii_bus,
339 };
340 #endif
341
342 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
343 static struct resource net2272_bfin_resources[] = {
344         {
345                 .start = 0x20300000,
346                 .end = 0x20300000 + 0x100,
347                 .flags = IORESOURCE_MEM,
348         }, {
349                 .start = IRQ_PF7,
350                 .end = IRQ_PF7,
351                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
352         },
353 };
354
355 static struct platform_device net2272_bfin_device = {
356         .name = "net2272",
357         .id = -1,
358         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
359         .resource = net2272_bfin_resources,
360 };
361 #endif
362
363 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
364 #ifdef CONFIG_MTD_PARTITIONS
365 const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
366
367 static struct mtd_partition bfin_plat_nand_partitions[] = {
368         {
369                 .name   = "linux kernel(nand)",
370                 .size   = 0x400000,
371                 .offset = 0,
372         }, {
373                 .name   = "file system(nand)",
374                 .size   = MTDPART_SIZ_FULL,
375                 .offset = MTDPART_OFS_APPEND,
376         },
377 };
378 #endif
379
380 #define BFIN_NAND_PLAT_CLE 2
381 #define BFIN_NAND_PLAT_ALE 1
382 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
383 {
384         struct nand_chip *this = mtd->priv;
385
386         if (cmd == NAND_CMD_NONE)
387                 return;
388
389         if (ctrl & NAND_CLE)
390                 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
391         else
392                 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
393 }
394
395 #define BFIN_NAND_PLAT_READY GPIO_PF3
396 static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
397 {
398         return gpio_get_value(BFIN_NAND_PLAT_READY);
399 }
400
401 static struct platform_nand_data bfin_plat_nand_data = {
402         .chip = {
403                 .chip_delay = 30,
404 #ifdef CONFIG_MTD_PARTITIONS
405                 .part_probe_types = part_probes,
406                 .partitions = bfin_plat_nand_partitions,
407                 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
408 #endif
409         },
410         .ctrl = {
411                 .cmd_ctrl  = bfin_plat_nand_cmd_ctrl,
412                 .dev_ready = bfin_plat_nand_dev_ready,
413         },
414 };
415
416 #define MAX(x, y) (x > y ? x : y)
417 static struct resource bfin_plat_nand_resources = {
418         .start = 0x20212000,
419         .end   = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
420         .flags = IORESOURCE_IO,
421 };
422
423 static struct platform_device bfin_async_nand_device = {
424         .name = "gen_nand",
425         .id = -1,
426         .num_resources = 1,
427         .resource = &bfin_plat_nand_resources,
428         .dev = {
429                 .platform_data = &bfin_plat_nand_data,
430         },
431 };
432
433 static void bfin_plat_nand_init(void)
434 {
435         gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
436 }
437 #else
438 static void bfin_plat_nand_init(void) {}
439 #endif
440
441 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
442 static struct mtd_partition stamp_partitions[] = {
443         {
444                 .name       = "bootloader(nor)",
445                 .size       = 0x40000,
446                 .offset     = 0,
447         }, {
448                 .name       = "linux kernel(nor)",
449                 .size       = 0x180000,
450                 .offset     = MTDPART_OFS_APPEND,
451         }, {
452                 .name       = "file system(nor)",
453                 .size       = 0x400000 - 0x40000 - 0x180000 - 0x10000,
454                 .offset     = MTDPART_OFS_APPEND,
455         }, {
456                 .name       = "MAC Address(nor)",
457                 .size       = MTDPART_SIZ_FULL,
458                 .offset     = 0x3F0000,
459                 .mask_flags = MTD_WRITEABLE,
460         }
461 };
462
463 static struct physmap_flash_data stamp_flash_data = {
464         .width      = 2,
465         .parts      = stamp_partitions,
466         .nr_parts   = ARRAY_SIZE(stamp_partitions),
467 #ifdef CONFIG_ROMKERNEL
468         .probe_type = "map_rom",
469 #endif
470 };
471
472 static struct resource stamp_flash_resource = {
473         .start = 0x20000000,
474         .end   = 0x203fffff,
475         .flags = IORESOURCE_MEM,
476 };
477
478 static struct platform_device stamp_flash_device = {
479         .name          = "physmap-flash",
480         .id            = 0,
481         .dev = {
482                 .platform_data = &stamp_flash_data,
483         },
484         .num_resources = 1,
485         .resource      = &stamp_flash_resource,
486 };
487 #endif
488
489 #if defined(CONFIG_MTD_M25P80) \
490         || defined(CONFIG_MTD_M25P80_MODULE)
491 static struct mtd_partition bfin_spi_flash_partitions[] = {
492         {
493                 .name = "bootloader(spi)",
494                 .size = 0x00040000,
495                 .offset = 0,
496                 .mask_flags = MTD_CAP_ROM
497         }, {
498                 .name = "linux kernel(spi)",
499                 .size = 0x180000,
500                 .offset = MTDPART_OFS_APPEND,
501         }, {
502                 .name = "file system(spi)",
503                 .size = MTDPART_SIZ_FULL,
504                 .offset = MTDPART_OFS_APPEND,
505         }
506 };
507
508 static struct flash_platform_data bfin_spi_flash_data = {
509         .name = "m25p80",
510         .parts = bfin_spi_flash_partitions,
511         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
512         /* .type = "m25p64", */
513 };
514
515 /* SPI flash chip (m25p64) */
516 static struct bfin5xx_spi_chip spi_flash_chip_info = {
517         .enable_dma = 0,         /* use dma transfer with this chip*/
518         .bits_per_word = 8,
519 };
520 #endif
521
522 #if defined(CONFIG_BFIN_SPI_ADC) \
523         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
524 /* SPI ADC chip */
525 static struct bfin5xx_spi_chip spi_adc_chip_info = {
526         .enable_dma = 1,         /* use dma transfer with this chip*/
527         .bits_per_word = 16,
528 };
529 #endif
530
531 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
532         || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
533 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
534         .enable_dma = 0,
535         .bits_per_word = 16,
536 };
537 #endif
538
539 #if defined(CONFIG_SND_BF5XX_SOC_AD193X) \
540         || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
541 static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
542         .enable_dma = 0,
543         .bits_per_word = 8,
544 };
545 #endif
546
547 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
548 #include <linux/input/ad714x.h>
549 static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
550         .enable_dma = 0,
551         .bits_per_word = 16,
552 };
553
554 static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
555         {
556                 .start_stage = 0,
557                 .end_stage = 7,
558                 .max_coord = 128,
559         },
560 };
561
562 static struct ad714x_button_plat ad7147_spi_button_plat[] = {
563         {
564                 .keycode = BTN_FORWARD,
565                 .l_mask = 0,
566                 .h_mask = 0x600,
567         },
568         {
569                 .keycode = BTN_LEFT,
570                 .l_mask = 0,
571                 .h_mask = 0x500,
572         },
573         {
574                 .keycode = BTN_MIDDLE,
575                 .l_mask = 0,
576                 .h_mask = 0x800,
577         },
578         {
579                 .keycode = BTN_RIGHT,
580                 .l_mask = 0x100,
581                 .h_mask = 0x400,
582         },
583         {
584                 .keycode = BTN_BACK,
585                 .l_mask = 0x200,
586                 .h_mask = 0x400,
587         },
588 };
589 static struct ad714x_platform_data ad7147_spi_platform_data = {
590         .slider_num = 1,
591         .button_num = 5,
592         .slider = ad7147_spi_slider_plat,
593         .button = ad7147_spi_button_plat,
594         .stage_cfg_reg =  {
595                 {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
596                 {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
597                 {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
598                 {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
599                 {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
600                 {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
601                 {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
602                 {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
603                 {0xFF7B, 0x3FFF, 0x506,  0x2626, 1100, 1100, 1150, 1150},
604                 {0xFDFE, 0x3FFF, 0x606,  0x2626, 1100, 1100, 1150, 1150},
605                 {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
606                 {0xFFEF, 0x1FFF, 0x0,    0x2626, 1100, 1100, 1150, 1150},
607         },
608         .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
609 };
610 #endif
611
612 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
613 #include <linux/input/ad714x.h>
614 static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
615         {
616                 .keycode = BTN_1,
617                 .l_mask = 0,
618                 .h_mask = 0x1,
619         },
620         {
621                 .keycode = BTN_2,
622                 .l_mask = 0,
623                 .h_mask = 0x2,
624         },
625         {
626                 .keycode = BTN_3,
627                 .l_mask = 0,
628                 .h_mask = 0x4,
629         },
630         {
631                 .keycode = BTN_4,
632                 .l_mask = 0x0,
633                 .h_mask = 0x8,
634         },
635 };
636 static struct ad714x_platform_data ad7142_i2c_platform_data = {
637         .button_num = 4,
638         .button = ad7142_i2c_button_plat,
639         .stage_cfg_reg =  {
640                 /* fixme: figure out right setting for all comoponent according
641                  * to hardware feature of EVAL-AD7142EB board */
642                 {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
643                 {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
644                 {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
645                 {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
646                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
647                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
648                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
649                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
650                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
651                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
652                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
653                 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
654         },
655         .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
656 };
657 #endif
658
659 #if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
660 static struct bfin5xx_spi_chip ad2s90_spi_chip_info = {
661         .enable_dma = 0,
662         .bits_per_word = 16,
663 };
664 #endif
665
666 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
667 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
668
669 static int bfin_mmc_spi_init(struct device *dev,
670         irqreturn_t (*detect_int)(int, void *), void *data)
671 {
672         return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
673                 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
674 }
675
676 static void bfin_mmc_spi_exit(struct device *dev, void *data)
677 {
678         free_irq(MMC_SPI_CARD_DETECT_INT, data);
679 }
680
681 static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
682         .init = bfin_mmc_spi_init,
683         .exit = bfin_mmc_spi_exit,
684         .detect_delay = 100, /* msecs */
685 };
686
687 static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
688         .enable_dma = 0,
689         .bits_per_word = 8,
690         .pio_interrupt = 0,
691 };
692 #endif
693
694 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
695 #include <linux/spi/ad7877.h>
696 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
697         .enable_dma = 0,
698         .bits_per_word = 16,
699 };
700
701 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
702         .model                  = 7877,
703         .vref_delay_usecs       = 50,   /* internal, no capacitor */
704         .x_plate_ohms           = 419,
705         .y_plate_ohms           = 486,
706         .pressure_max           = 1000,
707         .pressure_min           = 0,
708         .stopacq_polarity       = 1,
709         .first_conversion_delay = 3,
710         .acquisition_time       = 1,
711         .averaging              = 1,
712         .pen_down_acc_interval  = 1,
713 };
714 #endif
715
716 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
717 #include <linux/spi/ad7879.h>
718 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
719         .model                  = 7879, /* Model = AD7879 */
720         .x_plate_ohms           = 620,  /* 620 Ohm from the touch datasheet */
721         .pressure_max           = 10000,
722         .pressure_min           = 0,
723         .first_conversion_delay = 3,    /* wait 512us before do a first conversion */
724         .acquisition_time       = 1,    /* 4us acquisition time per sample */
725         .median                 = 2,    /* do 8 measurements */
726         .averaging              = 1,    /* take the average of 4 middle samples */
727         .pen_down_acc_interval  = 255,  /* 9.4 ms */
728         .gpio_export            = 1,    /* Export GPIO to gpiolib */
729         .gpio_base              = -1,   /* Dynamic allocation */
730 };
731 #endif
732
733 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
734 #include <linux/input/adxl34x.h>
735 static const struct adxl34x_platform_data adxl34x_info = {
736         .x_axis_offset = 0,
737         .y_axis_offset = 0,
738         .z_axis_offset = 0,
739         .tap_threshold = 0x31,
740         .tap_duration = 0x10,
741         .tap_latency = 0x60,
742         .tap_window = 0xF0,
743         .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
744         .act_axis_control = 0xFF,
745         .activity_threshold = 5,
746         .inactivity_threshold = 3,
747         .inactivity_time = 4,
748         .free_fall_threshold = 0x7,
749         .free_fall_time = 0x20,
750         .data_rate = 0x8,
751         .data_range = ADXL_FULL_RES,
752
753         .ev_type = EV_ABS,
754         .ev_code_x = ABS_X,             /* EV_REL */
755         .ev_code_y = ABS_Y,             /* EV_REL */
756         .ev_code_z = ABS_Z,             /* EV_REL */
757
758         .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
759
760 /*      .ev_code_ff = KEY_F,*/          /* EV_KEY */
761 /*      .ev_code_act_inactivity = KEY_A,*/      /* EV_KEY */
762         .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
763         .fifo_mode = ADXL_FIFO_STREAM,
764 };
765 #endif
766
767 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
768 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
769         .enable_dma = 0,
770         .bits_per_word = 16,
771 };
772 #endif
773
774 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
775 static struct bfin5xx_spi_chip spidev_chip_info = {
776         .enable_dma = 0,
777         .bits_per_word = 8,
778 };
779 #endif
780
781 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
782 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
783         .enable_dma     = 0,
784         .bits_per_word  = 8,
785 };
786 #endif
787
788 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
789 static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
790         .enable_dma     = 1,
791         .bits_per_word  = 8,
792         .cs_gpio = GPIO_PF10,
793 };
794 #endif
795
796 #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
797 static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
798         .bits_per_word = 16,
799         .cs_gpio = GPIO_PF10,
800 };
801
802 #include <linux/spi/adf702x.h>
803 #define TXREG 0x0160A470
804 static const u32 adf7021_regs[] = {
805         0x09608FA0,
806         0x00575011,
807         0x00A7F092,
808         0x2B141563,
809         0x81F29E94,
810         0x00003155,
811         0x050A4F66,
812         0x00000007,
813         0x00000008,
814         0x000231E9,
815         0x3296354A,
816         0x891A2B3B,
817         0x00000D9C,
818         0x0000000D,
819         0x0000000E,
820         0x0000000F,
821 };
822
823 static struct adf702x_platform_data adf7021_platform_data = {
824         .regs_base = (void *)SPORT1_TCR1,
825         .dma_ch_rx = CH_SPORT1_RX,
826         .dma_ch_tx = CH_SPORT1_TX,
827         .irq_sport_err = IRQ_SPORT1_ERROR,
828         .gpio_int_rfs = GPIO_PF8,
829         .pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
830                         P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
831         .adf702x_model = MODEL_ADF7021,
832         .adf702x_regs = adf7021_regs,
833         .tx_reg = TXREG,
834 };
835 static inline void adf702x_mac_init(void)
836 {
837         random_ether_addr(adf7021_platform_data.mac_addr);
838 }
839 #else
840 static inline void adf702x_mac_init(void) {}
841 #endif
842
843 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
844 #include <linux/spi/ads7846.h>
845 static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
846         .bits_per_word  = 8,
847 };
848
849 static int ads7873_get_pendown_state(void)
850 {
851         return gpio_get_value(GPIO_PF6);
852 }
853
854 static struct ads7846_platform_data __initdata ad7873_pdata = {
855         .model          = 7873,         /* AD7873 */
856         .x_max          = 0xfff,
857         .y_max          = 0xfff,
858         .x_plate_ohms   = 620,
859         .debounce_max   = 1,
860         .debounce_rep   = 0,
861         .debounce_tol   = (~0),
862         .get_pendown_state = ads7873_get_pendown_state,
863 };
864 #endif
865
866 #if defined(CONFIG_MTD_DATAFLASH) \
867         || defined(CONFIG_MTD_DATAFLASH_MODULE)
868
869 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
870         {
871                 .name = "bootloader(spi)",
872                 .size = 0x00040000,
873                 .offset = 0,
874                 .mask_flags = MTD_CAP_ROM
875         }, {
876                 .name = "linux kernel(spi)",
877                 .size = 0x180000,
878                 .offset = MTDPART_OFS_APPEND,
879         }, {
880                 .name = "file system(spi)",
881                 .size = MTDPART_SIZ_FULL,
882                 .offset = MTDPART_OFS_APPEND,
883         }
884 };
885
886 static struct flash_platform_data bfin_spi_dataflash_data = {
887         .name = "SPI Dataflash",
888         .parts = bfin_spi_dataflash_partitions,
889         .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
890 };
891
892 /* DataFlash chip */
893 static struct bfin5xx_spi_chip data_flash_chip_info = {
894         .enable_dma = 0,         /* use dma transfer with this chip*/
895         .bits_per_word = 8,
896 };
897 #endif
898
899 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
900 static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
901         .enable_dma = 0,         /* use dma transfer with this chip*/
902         .bits_per_word = 8,
903 };
904 #endif
905
906 static struct spi_board_info bfin_spi_board_info[] __initdata = {
907 #if defined(CONFIG_MTD_M25P80) \
908         || defined(CONFIG_MTD_M25P80_MODULE)
909         {
910                 /* the modalias must be the same as spi device driver name */
911                 .modalias = "m25p80", /* Name of spi_driver for this device */
912                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
913                 .bus_num = 0, /* Framework bus number */
914                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
915                 .platform_data = &bfin_spi_flash_data,
916                 .controller_data = &spi_flash_chip_info,
917                 .mode = SPI_MODE_3,
918         },
919 #endif
920 #if defined(CONFIG_MTD_DATAFLASH) \
921         || defined(CONFIG_MTD_DATAFLASH_MODULE)
922         {       /* DataFlash chip */
923                 .modalias = "mtd_dataflash",
924                 .max_speed_hz = 33250000,     /* max spi clock (SCK) speed in HZ */
925                 .bus_num = 0, /* Framework bus number */
926                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
927                 .platform_data = &bfin_spi_dataflash_data,
928                 .controller_data = &data_flash_chip_info,
929                 .mode = SPI_MODE_3,
930         },
931 #endif
932 #if defined(CONFIG_BFIN_SPI_ADC) \
933         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
934         {
935                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
936                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
937                 .bus_num = 0, /* Framework bus number */
938                 .chip_select = 1, /* Framework chip select. */
939                 .platform_data = NULL, /* No spi_driver specific config */
940                 .controller_data = &spi_adc_chip_info,
941         },
942 #endif
943
944 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
945         || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
946         {
947                 .modalias = "ad1836",
948                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
949                 .bus_num = 0,
950                 .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
951                 .controller_data = &ad1836_spi_chip_info,
952                 .mode = SPI_MODE_3,
953         },
954 #endif
955
956 #if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
957         {
958                 .modalias = "ad193x",
959                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
960                 .bus_num = 0,
961                 .chip_select = 5,
962                 .controller_data = &ad1938_spi_chip_info,
963                 .mode = SPI_MODE_3,
964         },
965 #endif
966
967 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
968         {
969                 .modalias = "ad714x_captouch",
970                 .max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */
971                 .irq = IRQ_PF4,
972                 .bus_num = 0,
973                 .chip_select = 5,
974                 .mode = SPI_MODE_3,
975                 .platform_data = &ad7147_spi_platform_data,
976                 .controller_data = &ad7147_spi_chip_info,
977         },
978 #endif
979
980 #if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
981         {
982                 .modalias = "ad2s90",
983                 .bus_num = 0,
984                 .chip_select = 3,            /* change it for your board */
985                 .platform_data = NULL,
986                 .controller_data = &ad2s90_spi_chip_info,
987         },
988 #endif
989
990 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
991         {
992                 .modalias = "mmc_spi",
993                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
994                 .bus_num = 0,
995                 .chip_select = 4,
996                 .platform_data = &bfin_mmc_spi_pdata,
997                 .controller_data = &mmc_spi_chip_info,
998                 .mode = SPI_MODE_3,
999         },
1000 #endif
1001 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1002         {
1003                 .modalias               = "ad7877",
1004                 .platform_data          = &bfin_ad7877_ts_info,
1005                 .irq                    = IRQ_PF6,
1006                 .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
1007                 .bus_num        = 0,
1008                 .chip_select  = 1,
1009                 .controller_data = &spi_ad7877_chip_info,
1010         },
1011 #endif
1012 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
1013         {
1014                 .modalias = "ad7879",
1015                 .platform_data = &bfin_ad7879_ts_info,
1016                 .irq = IRQ_PF7,
1017                 .max_speed_hz = 5000000,     /* max spi clock (SCK) speed in HZ */
1018                 .bus_num = 0,
1019                 .chip_select = 1,
1020                 .controller_data = &spi_ad7879_chip_info,
1021                 .mode = SPI_CPHA | SPI_CPOL,
1022         },
1023 #endif
1024 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1025         {
1026                 .modalias = "spidev",
1027                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
1028                 .bus_num = 0,
1029                 .chip_select = 1,
1030                 .controller_data = &spidev_chip_info,
1031         },
1032 #endif
1033 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1034         {
1035                 .modalias = "bfin-lq035q1-spi",
1036                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
1037                 .bus_num = 0,
1038                 .chip_select = 2,
1039                 .controller_data = &lq035q1_spi_chip_info,
1040                 .mode = SPI_CPHA | SPI_CPOL,
1041         },
1042 #endif
1043 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
1044         {
1045                 .modalias = "enc28j60",
1046                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
1047                 .irq = IRQ_PF6,
1048                 .bus_num = 0,
1049                 .chip_select = 0,       /* GPIO controlled SSEL */
1050                 .controller_data = &enc28j60_spi_chip_info,
1051                 .mode = SPI_MODE_0,
1052         },
1053 #endif
1054 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1055         {
1056                 .modalias       = "adxl34x",
1057                 .platform_data  = &adxl34x_info,
1058                 .irq            = IRQ_PF6,
1059                 .max_speed_hz   = 5000000,    /* max spi clock (SCK) speed in HZ */
1060                 .bus_num        = 0,
1061                 .chip_select    = 2,
1062                 .controller_data = &spi_adxl34x_chip_info,
1063                 .mode = SPI_MODE_3,
1064         },
1065 #endif
1066 #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
1067         {
1068                 .modalias = "adf702x",
1069                 .max_speed_hz = 16000000,     /* max spi clock (SCK) speed in HZ */
1070                 .bus_num = 0,
1071                 .chip_select = 0,       /* GPIO controlled SSEL */
1072                 .controller_data = &adf7021_spi_chip_info,
1073                 .platform_data = &adf7021_platform_data,
1074                 .mode = SPI_MODE_0,
1075         },
1076 #endif
1077 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
1078         {
1079                 .modalias = "ads7846",
1080                 .max_speed_hz = 2000000,     /* max spi clock (SCK) speed in HZ */
1081                 .bus_num = 0,
1082                 .irq = IRQ_PF6,
1083                 .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* GPIO controlled SSEL */
1084                 .controller_data = &ad7873_spi_chip_info,
1085                 .platform_data = &ad7873_pdata,
1086                 .mode = SPI_MODE_0,
1087         },
1088 #endif
1089 };
1090
1091 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1092 /* SPI controller data */
1093 static struct bfin5xx_spi_master bfin_spi0_info = {
1094         .num_chipselect = 8,
1095         .enable_dma = 1,  /* master has the ability to do dma transfer */
1096         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1097 };
1098
1099 /* SPI (0) */
1100 static struct resource bfin_spi0_resource[] = {
1101         [0] = {
1102                 .start = SPI0_REGBASE,
1103                 .end   = SPI0_REGBASE + 0xFF,
1104                 .flags = IORESOURCE_MEM,
1105                 },
1106         [1] = {
1107                 .start = CH_SPI,
1108                 .end   = CH_SPI,
1109                 .flags = IORESOURCE_DMA,
1110         },
1111         [2] = {
1112                 .start = IRQ_SPI,
1113                 .end   = IRQ_SPI,
1114                 .flags = IORESOURCE_IRQ,
1115         },
1116 };
1117
1118 static struct platform_device bfin_spi0_device = {
1119         .name = "bfin-spi",
1120         .id = 0, /* Bus number */
1121         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1122         .resource = bfin_spi0_resource,
1123         .dev = {
1124                 .platform_data = &bfin_spi0_info, /* Passed to driver */
1125         },
1126 };
1127 #endif  /* spi master and devices */
1128
1129 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1130
1131 /* SPORT SPI controller data */
1132 static struct bfin5xx_spi_master bfin_sport_spi0_info = {
1133         .num_chipselect = 1, /* master only supports one device */
1134         .enable_dma = 0,  /* master don't support DMA */
1135         .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
1136                 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1137 };
1138
1139 static struct resource bfin_sport_spi0_resource[] = {
1140         [0] = {
1141                 .start = SPORT0_TCR1,
1142                 .end   = SPORT0_TCR1 + 0xFF,
1143                 .flags = IORESOURCE_MEM,
1144                 },
1145         [1] = {
1146                 .start = IRQ_SPORT0_ERROR,
1147                 .end   = IRQ_SPORT0_ERROR,
1148                 .flags = IORESOURCE_IRQ,
1149                 },
1150 };
1151
1152 static struct platform_device bfin_sport_spi0_device = {
1153         .name = "bfin-sport-spi",
1154         .id = 1, /* Bus number */
1155         .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1156         .resource = bfin_sport_spi0_resource,
1157         .dev = {
1158                 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1159         },
1160 };
1161
1162 static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1163         .num_chipselect = 1, /* master only supports one device */
1164         .enable_dma = 0,  /* master don't support DMA */
1165         .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1166                 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1167 };
1168
1169 static struct resource bfin_sport_spi1_resource[] = {
1170         [0] = {
1171                 .start = SPORT1_TCR1,
1172                 .end   = SPORT1_TCR1 + 0xFF,
1173                 .flags = IORESOURCE_MEM,
1174                 },
1175         [1] = {
1176                 .start = IRQ_SPORT1_ERROR,
1177                 .end   = IRQ_SPORT1_ERROR,
1178                 .flags = IORESOURCE_IRQ,
1179                 },
1180 };
1181
1182 static struct platform_device bfin_sport_spi1_device = {
1183         .name = "bfin-sport-spi",
1184         .id = 2, /* Bus number */
1185         .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1186         .resource = bfin_sport_spi1_resource,
1187         .dev = {
1188                 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1189         },
1190 };
1191
1192 #endif  /* sport spi master and devices */
1193
1194 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1195 static struct platform_device bfin_fb_device = {
1196         .name = "bf537-lq035",
1197 };
1198 #endif
1199
1200 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1201 #include <asm/bfin-lq035q1.h>
1202
1203 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
1204         .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
1205         .ppi_mode = USE_RGB565_16_BIT_PPI,
1206         .use_bl = 0,    /* let something else control the LCD Blacklight */
1207         .gpio_bl = GPIO_PF7,
1208 };
1209
1210 static struct resource bfin_lq035q1_resources[] = {
1211         {
1212                 .start = IRQ_PPI_ERROR,
1213                 .end = IRQ_PPI_ERROR,
1214                 .flags = IORESOURCE_IRQ,
1215         },
1216 };
1217
1218 static struct platform_device bfin_lq035q1_device = {
1219         .name           = "bfin-lq035q1",
1220         .id             = -1,
1221         .num_resources  = ARRAY_SIZE(bfin_lq035q1_resources),
1222         .resource       = bfin_lq035q1_resources,
1223         .dev            = {
1224                 .platform_data = &bfin_lq035q1_data,
1225         },
1226 };
1227 #endif
1228
1229 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1230 #ifdef CONFIG_SERIAL_BFIN_UART0
1231 static struct resource bfin_uart0_resources[] = {
1232         {
1233                 .start = UART0_THR,
1234                 .end = UART0_GCTL+2,
1235                 .flags = IORESOURCE_MEM,
1236         },
1237         {
1238                 .start = IRQ_UART0_RX,
1239                 .end = IRQ_UART0_RX+1,
1240                 .flags = IORESOURCE_IRQ,
1241         },
1242         {
1243                 .start = IRQ_UART0_ERROR,
1244                 .end = IRQ_UART0_ERROR,
1245                 .flags = IORESOURCE_IRQ,
1246         },
1247         {
1248                 .start = CH_UART0_TX,
1249                 .end = CH_UART0_TX,
1250                 .flags = IORESOURCE_DMA,
1251         },
1252         {
1253                 .start = CH_UART0_RX,
1254                 .end = CH_UART0_RX,
1255                 .flags = IORESOURCE_DMA,
1256         },
1257 #ifdef CONFIG_BFIN_UART0_CTSRTS
1258         {       /* CTS pin */
1259                 .start = GPIO_PG7,
1260                 .end = GPIO_PG7,
1261                 .flags = IORESOURCE_IO,
1262         },
1263         {       /* RTS pin */
1264                 .start = GPIO_PG6,
1265                 .end = GPIO_PG6,
1266                 .flags = IORESOURCE_IO,
1267         },
1268 #endif
1269 };
1270
1271 unsigned short bfin_uart0_peripherals[] = {
1272         P_UART0_TX, P_UART0_RX, 0
1273 };
1274
1275 static struct platform_device bfin_uart0_device = {
1276         .name = "bfin-uart",
1277         .id = 0,
1278         .num_resources = ARRAY_SIZE(bfin_uart0_resources),
1279         .resource = bfin_uart0_resources,
1280         .dev = {
1281                 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
1282         },
1283 };
1284 #endif
1285 #ifdef CONFIG_SERIAL_BFIN_UART1
1286 static struct resource bfin_uart1_resources[] = {
1287         {
1288                 .start = UART1_THR,
1289                 .end = UART1_GCTL+2,
1290                 .flags = IORESOURCE_MEM,
1291         },
1292         {
1293                 .start = IRQ_UART1_RX,
1294                 .end = IRQ_UART1_RX+1,
1295                 .flags = IORESOURCE_IRQ,
1296         },
1297         {
1298                 .start = IRQ_UART1_ERROR,
1299                 .end = IRQ_UART1_ERROR,
1300                 .flags = IORESOURCE_IRQ,
1301         },
1302         {
1303                 .start = CH_UART1_TX,
1304                 .end = CH_UART1_TX,
1305                 .flags = IORESOURCE_DMA,
1306         },
1307         {
1308                 .start = CH_UART1_RX,
1309                 .end = CH_UART1_RX,
1310                 .flags = IORESOURCE_DMA,
1311         },
1312 };
1313
1314 unsigned short bfin_uart1_peripherals[] = {
1315         P_UART1_TX, P_UART1_RX, 0
1316 };
1317
1318 static struct platform_device bfin_uart1_device = {
1319         .name = "bfin-uart",
1320         .id = 1,
1321         .num_resources = ARRAY_SIZE(bfin_uart1_resources),
1322         .resource = bfin_uart1_resources,
1323         .dev = {
1324                 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
1325         },
1326 };
1327 #endif
1328 #endif
1329
1330 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1331 #ifdef CONFIG_BFIN_SIR0
1332 static struct resource bfin_sir0_resources[] = {
1333         {
1334                 .start = 0xFFC00400,
1335                 .end = 0xFFC004FF,
1336                 .flags = IORESOURCE_MEM,
1337         },
1338         {
1339                 .start = IRQ_UART0_RX,
1340                 .end = IRQ_UART0_RX+1,
1341                 .flags = IORESOURCE_IRQ,
1342         },
1343         {
1344                 .start = CH_UART0_RX,
1345                 .end = CH_UART0_RX+1,
1346                 .flags = IORESOURCE_DMA,
1347         },
1348 };
1349
1350 static struct platform_device bfin_sir0_device = {
1351         .name = "bfin_sir",
1352         .id = 0,
1353         .num_resources = ARRAY_SIZE(bfin_sir0_resources),
1354         .resource = bfin_sir0_resources,
1355 };
1356 #endif
1357 #ifdef CONFIG_BFIN_SIR1
1358 static struct resource bfin_sir1_resources[] = {
1359         {
1360                 .start = 0xFFC02000,
1361                 .end = 0xFFC020FF,
1362                 .flags = IORESOURCE_MEM,
1363         },
1364         {
1365                 .start = IRQ_UART1_RX,
1366                 .end = IRQ_UART1_RX+1,
1367                 .flags = IORESOURCE_IRQ,
1368         },
1369         {
1370                 .start = CH_UART1_RX,
1371                 .end = CH_UART1_RX+1,
1372                 .flags = IORESOURCE_DMA,
1373         },
1374 };
1375
1376 static struct platform_device bfin_sir1_device = {
1377         .name = "bfin_sir",
1378         .id = 1,
1379         .num_resources = ARRAY_SIZE(bfin_sir1_resources),
1380         .resource = bfin_sir1_resources,
1381 };
1382 #endif
1383 #endif
1384
1385 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1386 static struct resource bfin_twi0_resource[] = {
1387         [0] = {
1388                 .start = TWI0_REGBASE,
1389                 .end   = TWI0_REGBASE,
1390                 .flags = IORESOURCE_MEM,
1391         },
1392         [1] = {
1393                 .start = IRQ_TWI,
1394                 .end   = IRQ_TWI,
1395                 .flags = IORESOURCE_IRQ,
1396         },
1397 };
1398
1399 static struct platform_device i2c_bfin_twi_device = {
1400         .name = "i2c-bfin-twi",
1401         .id = 0,
1402         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1403         .resource = bfin_twi0_resource,
1404 };
1405 #endif
1406
1407 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1408 static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1409         [0]      = KEY_GRAVE,
1410         [1]      = KEY_1,
1411         [2]      = KEY_2,
1412         [3]      = KEY_3,
1413         [4]      = KEY_4,
1414         [5]      = KEY_5,
1415         [6]      = KEY_6,
1416         [7]      = KEY_7,
1417         [8]      = KEY_8,
1418         [9]      = KEY_9,
1419         [10]     = KEY_0,
1420         [11]     = KEY_MINUS,
1421         [12]     = KEY_EQUAL,
1422         [13]     = KEY_BACKSLASH,
1423         [15]     = KEY_KP0,
1424         [16]     = KEY_Q,
1425         [17]     = KEY_W,
1426         [18]     = KEY_E,
1427         [19]     = KEY_R,
1428         [20]     = KEY_T,
1429         [21]     = KEY_Y,
1430         [22]     = KEY_U,
1431         [23]     = KEY_I,
1432         [24]     = KEY_O,
1433         [25]     = KEY_P,
1434         [26]     = KEY_LEFTBRACE,
1435         [27]     = KEY_RIGHTBRACE,
1436         [29]     = KEY_KP1,
1437         [30]     = KEY_KP2,
1438         [31]     = KEY_KP3,
1439         [32]     = KEY_A,
1440         [33]     = KEY_S,
1441         [34]     = KEY_D,
1442         [35]     = KEY_F,
1443         [36]     = KEY_G,
1444         [37]     = KEY_H,
1445         [38]     = KEY_J,
1446         [39]     = KEY_K,
1447         [40]     = KEY_L,
1448         [41]     = KEY_SEMICOLON,
1449         [42]     = KEY_APOSTROPHE,
1450         [43]     = KEY_BACKSLASH,
1451         [45]     = KEY_KP4,
1452         [46]     = KEY_KP5,
1453         [47]     = KEY_KP6,
1454         [48]     = KEY_102ND,
1455         [49]     = KEY_Z,
1456         [50]     = KEY_X,
1457         [51]     = KEY_C,
1458         [52]     = KEY_V,
1459         [53]     = KEY_B,
1460         [54]     = KEY_N,
1461         [55]     = KEY_M,
1462         [56]     = KEY_COMMA,
1463         [57]     = KEY_DOT,
1464         [58]     = KEY_SLASH,
1465         [60]     = KEY_KPDOT,
1466         [61]     = KEY_KP7,
1467         [62]     = KEY_KP8,
1468         [63]     = KEY_KP9,
1469         [64]     = KEY_SPACE,
1470         [65]     = KEY_BACKSPACE,
1471         [66]     = KEY_TAB,
1472         [67]     = KEY_KPENTER,
1473         [68]     = KEY_ENTER,
1474         [69]     = KEY_ESC,
1475         [70]     = KEY_DELETE,
1476         [74]     = KEY_KPMINUS,
1477         [76]     = KEY_UP,
1478         [77]     = KEY_DOWN,
1479         [78]     = KEY_RIGHT,
1480         [79]     = KEY_LEFT,
1481 };
1482
1483 static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1484         .rows           = 8,
1485         .cols           = 10,
1486         .keymap         = adp5588_keymap,
1487         .keymapsize     = ARRAY_SIZE(adp5588_keymap),
1488         .repeat         = 0,
1489 };
1490 #endif
1491
1492 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1493 #include <linux/mfd/adp5520.h>
1494
1495         /*
1496          *  ADP5520/5501 Backlight Data
1497          */
1498
1499 static struct adp5520_backlight_platform_data adp5520_backlight_data = {
1500         .fade_in                = ADP5520_FADE_T_1200ms,
1501         .fade_out               = ADP5520_FADE_T_1200ms,
1502         .fade_led_law           = ADP5520_BL_LAW_LINEAR,
1503         .en_ambl_sens           = 1,
1504         .abml_filt              = ADP5520_BL_AMBL_FILT_640ms,
1505         .l1_daylight_max        = ADP5520_BL_CUR_mA(15),
1506         .l1_daylight_dim        = ADP5520_BL_CUR_mA(0),
1507         .l2_office_max          = ADP5520_BL_CUR_mA(7),
1508         .l2_office_dim          = ADP5520_BL_CUR_mA(0),
1509         .l3_dark_max            = ADP5520_BL_CUR_mA(3),
1510         .l3_dark_dim            = ADP5520_BL_CUR_mA(0),
1511         .l2_trip                = ADP5520_L2_COMP_CURR_uA(700),
1512         .l2_hyst                = ADP5520_L2_COMP_CURR_uA(50),
1513         .l3_trip                = ADP5520_L3_COMP_CURR_uA(80),
1514         .l3_hyst                = ADP5520_L3_COMP_CURR_uA(20),
1515 };
1516
1517         /*
1518          *  ADP5520/5501 LEDs Data
1519          */
1520
1521 static struct led_info adp5520_leds[] = {
1522         {
1523                 .name = "adp5520-led1",
1524                 .default_trigger = "none",
1525                 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
1526         },
1527 #ifdef ADP5520_EN_ALL_LEDS
1528         {
1529                 .name = "adp5520-led2",
1530                 .default_trigger = "none",
1531                 .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1532         },
1533         {
1534                 .name = "adp5520-led3",
1535                 .default_trigger = "none",
1536                 .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1537         },
1538 #endif
1539 };
1540
1541 static struct adp5520_leds_platform_data adp5520_leds_data = {
1542         .num_leds = ARRAY_SIZE(adp5520_leds),
1543         .leds = adp5520_leds,
1544         .fade_in = ADP5520_FADE_T_600ms,
1545         .fade_out = ADP5520_FADE_T_600ms,
1546         .led_on_time = ADP5520_LED_ONT_600ms,
1547 };
1548
1549         /*
1550          *  ADP5520 GPIO Data
1551          */
1552
1553 static struct adp5520_gpio_platform_data adp5520_gpio_data = {
1554         .gpio_start = 50,
1555         .gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1556         .gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1557 };
1558
1559         /*
1560          *  ADP5520 Keypad Data
1561          */
1562
1563 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
1564         [ADP5520_KEY(0, 0)]     = KEY_GRAVE,
1565         [ADP5520_KEY(0, 1)]     = KEY_1,
1566         [ADP5520_KEY(0, 2)]     = KEY_2,
1567         [ADP5520_KEY(0, 3)]     = KEY_3,
1568         [ADP5520_KEY(1, 0)]     = KEY_4,
1569         [ADP5520_KEY(1, 1)]     = KEY_5,
1570         [ADP5520_KEY(1, 2)]     = KEY_6,
1571         [ADP5520_KEY(1, 3)]     = KEY_7,
1572         [ADP5520_KEY(2, 0)]     = KEY_8,
1573         [ADP5520_KEY(2, 1)]     = KEY_9,
1574         [ADP5520_KEY(2, 2)]     = KEY_0,
1575         [ADP5520_KEY(2, 3)]     = KEY_MINUS,
1576         [ADP5520_KEY(3, 0)]     = KEY_EQUAL,
1577         [ADP5520_KEY(3, 1)]     = KEY_BACKSLASH,
1578         [ADP5520_KEY(3, 2)]     = KEY_BACKSPACE,
1579         [ADP5520_KEY(3, 3)]     = KEY_ENTER,
1580 };
1581
1582 static struct adp5520_keys_platform_data adp5520_keys_data = {
1583         .rows_en_mask   = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
1584         .cols_en_mask   = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
1585         .keymap         = adp5520_keymap,
1586         .keymapsize     = ARRAY_SIZE(adp5520_keymap),
1587         .repeat         = 0,
1588 };
1589
1590         /*
1591          *  ADP5520/5501 Multifuction Device Init Data
1592          */
1593
1594 static struct adp5520_platform_data adp5520_pdev_data = {
1595         .backlight = &adp5520_backlight_data,
1596         .leds = &adp5520_leds_data,
1597         .gpio = &adp5520_gpio_data,
1598         .keys = &adp5520_keys_data,
1599 };
1600
1601 #endif
1602
1603 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1604 static struct adp5588_gpio_platform_data adp5588_gpio_data = {
1605         .gpio_start = 50,
1606         .pullup_dis_mask = 0,
1607 };
1608 #endif
1609
1610 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1611 #include <linux/i2c/adp8870.h>
1612 static struct led_info adp8870_leds[] = {
1613         {
1614                 .name = "adp8870-led7",
1615                 .default_trigger = "none",
1616                 .flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
1617         },
1618 };
1619
1620
1621 static struct adp8870_backlight_platform_data adp8870_pdata = {
1622         .bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
1623                          ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6, /* 1 = Backlight 0 = Individual LED */
1624         .pwm_assign = 0,                                /* 1 = Enables PWM mode */
1625
1626         .bl_fade_in = ADP8870_FADE_T_1200ms,            /* Backlight Fade-In Timer */
1627         .bl_fade_out = ADP8870_FADE_T_1200ms,           /* Backlight Fade-Out Timer */
1628         .bl_fade_law = ADP8870_FADE_LAW_CUBIC1,         /* fade-on/fade-off transfer characteristic */
1629
1630         .en_ambl_sens = 1,                              /* 1 = enable ambient light sensor */
1631         .abml_filt = ADP8870_BL_AMBL_FILT_320ms,        /* Light sensor filter time */
1632
1633         .l1_daylight_max = ADP8870_BL_CUR_mA(20),       /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1634         .l1_daylight_dim = ADP8870_BL_CUR_mA(0),        /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1635         .l2_bright_max = ADP8870_BL_CUR_mA(14),         /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1636         .l2_bright_dim = ADP8870_BL_CUR_mA(0),          /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1637         .l3_office_max = ADP8870_BL_CUR_mA(6),          /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1638         .l3_office_dim = ADP8870_BL_CUR_mA(0),          /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1639         .l4_indoor_max = ADP8870_BL_CUR_mA(3),          /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1640         .l4_indor_dim = ADP8870_BL_CUR_mA(0),           /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1641         .l5_dark_max = ADP8870_BL_CUR_mA(2),            /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1642         .l5_dark_dim = ADP8870_BL_CUR_mA(0),            /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1643
1644         .l2_trip = ADP8870_L2_COMP_CURR_uA(710),        /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1645         .l2_hyst = ADP8870_L2_COMP_CURR_uA(73),         /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1646         .l3_trip = ADP8870_L3_COMP_CURR_uA(389),        /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1647         .l3_hyst = ADP8870_L3_COMP_CURR_uA(54),         /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1648         .l4_trip = ADP8870_L4_COMP_CURR_uA(167),        /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1649         .l4_hyst = ADP8870_L4_COMP_CURR_uA(16),         /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1650         .l5_trip = ADP8870_L5_COMP_CURR_uA(43),         /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1651         .l5_hyst = ADP8870_L5_COMP_CURR_uA(11),         /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1652
1653         .leds = adp8870_leds,
1654         .num_leds = ARRAY_SIZE(adp8870_leds),
1655         .led_fade_law = ADP8870_FADE_LAW_SQUARE,        /* fade-on/fade-off transfer characteristic */
1656         .led_fade_in = ADP8870_FADE_T_600ms,
1657         .led_fade_out = ADP8870_FADE_T_600ms,
1658         .led_on_time = ADP8870_LED_ONT_200ms,
1659 };
1660 #endif
1661
1662 #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1663 static struct regulator_consumer_supply ad5398_consumer = {
1664         .supply = "current",
1665 };
1666
1667 static struct regulator_init_data ad5398_regulator_data = {
1668         .constraints = {
1669                 .name = "current range",
1670                 .max_uA = 120000,
1671                 .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
1672         },
1673         .num_consumer_supplies = 1,
1674         .consumer_supplies     = &ad5398_consumer,
1675 };
1676
1677 static struct ad5398_platform_data ad5398_i2c_platform_data = {
1678         .current_bits = 10,
1679         .current_offset = 4,
1680         .regulator_data = &ad5398_regulator_data,
1681 };
1682
1683 #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
1684         defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
1685 static struct platform_device ad5398_virt_consumer_device = {
1686         .name = "reg-virt-consumer",
1687         .id = 0,
1688         .dev = {
1689                 .platform_data = "current", /* Passed to driver */
1690         },
1691 };
1692 #endif
1693 #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
1694         defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
1695 static struct regulator_bulk_data ad5398_bulk_data = {
1696         .supply = "current",
1697 };
1698
1699 static struct regulator_userspace_consumer_data ad5398_userspace_comsumer_data = {
1700         .name = "ad5398",
1701         .num_supplies = 1,
1702         .supplies = &ad5398_bulk_data,
1703 };
1704
1705 static struct platform_device ad5398_userspace_consumer_device = {
1706         .name = "reg-userspace-consumer",
1707         .id = 0,
1708         .dev = {
1709                 .platform_data = &ad5398_userspace_comsumer_data,
1710         },
1711 };
1712 #endif
1713 #endif
1714
1715 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1716 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
1717         {
1718                 I2C_BOARD_INFO("ad7142_captouch", 0x2C),
1719                 .irq = IRQ_PG5,
1720                 .platform_data = (void *)&ad7142_i2c_platform_data,
1721         },
1722 #endif
1723
1724 #if defined(CONFIG_AD7150) || defined(CONFIG_AD7150_MODULE)
1725         {
1726                 I2C_BOARD_INFO("ad7150", 0x48),
1727                 .irq = IRQ_PG5, /* fixme: use real interrupt number */
1728         },
1729 #endif
1730
1731 #if defined(CONFIG_AD7152) || defined(CONFIG_AD7152_MODULE)
1732         {
1733                 I2C_BOARD_INFO("ad7152", 0x48),
1734         },
1735 #endif
1736
1737 #if defined(CONFIG_AD774X) || defined(CONFIG_AD774X_MODULE)
1738         {
1739                 I2C_BOARD_INFO("ad774x", 0x48),
1740         },
1741 #endif
1742
1743 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1744         {
1745                 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1746         },
1747 #endif
1748 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1749         {
1750                 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1751                 .irq = IRQ_PG6,
1752         },
1753 #endif
1754 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1755         {
1756                 I2C_BOARD_INFO("ad7879", 0x2F),
1757                 .irq = IRQ_PG5,
1758                 .platform_data = (void *)&bfin_ad7879_ts_info,
1759         },
1760 #endif
1761 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1762         {
1763                 I2C_BOARD_INFO("adp5588-keys", 0x34),
1764                 .irq = IRQ_PG0,
1765                 .platform_data = (void *)&adp5588_kpad_data,
1766         },
1767 #endif
1768 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1769         {
1770                 I2C_BOARD_INFO("pmic-adp5520", 0x32),
1771                 .irq = IRQ_PG0,
1772                 .platform_data = (void *)&adp5520_pdev_data,
1773         },
1774 #endif
1775 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1776         {
1777                 I2C_BOARD_INFO("adxl34x", 0x53),
1778                 .irq = IRQ_PG3,
1779                 .platform_data = (void *)&adxl34x_info,
1780         },
1781 #endif
1782 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1783         {
1784                 I2C_BOARD_INFO("adp5588-gpio", 0x34),
1785                 .platform_data = (void *)&adp5588_gpio_data,
1786         },
1787 #endif
1788 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1789         {
1790                 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1791         },
1792 #endif
1793 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1794         {
1795                 I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
1796         },
1797 #endif
1798 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1799         {
1800                 I2C_BOARD_INFO("adp8870", 0x2B),
1801                 .platform_data = (void *)&adp8870_pdata,
1802         },
1803 #endif
1804 #if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
1805         {
1806                 I2C_BOARD_INFO("adau1371", 0x1A),
1807         },
1808 #endif
1809 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1810         {
1811                 I2C_BOARD_INFO("adau1761", 0x38),
1812         },
1813 #endif
1814 #if defined(CONFIG_SND_SOC_ADAU1361) || defined(CONFIG_SND_SOC_ADAU1361_MODULE)
1815         {
1816                 I2C_BOARD_INFO("adau1361", 0x38),
1817         },
1818 #endif
1819 #if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
1820         {
1821                 I2C_BOARD_INFO("ad5258", 0x18),
1822         },
1823 #endif
1824 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1825         {
1826                 I2C_BOARD_INFO("ssm2602", 0x1b),
1827         },
1828 #endif
1829 #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1830         {
1831                 I2C_BOARD_INFO("ad5398", 0xC),
1832                 .platform_data = (void *)&ad5398_i2c_platform_data,
1833         },
1834 #endif
1835 };
1836
1837 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1838 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1839 static struct resource bfin_sport0_uart_resources[] = {
1840         {
1841                 .start = SPORT0_TCR1,
1842                 .end = SPORT0_MRCS3+4,
1843                 .flags = IORESOURCE_MEM,
1844         },
1845         {
1846                 .start = IRQ_SPORT0_RX,
1847                 .end = IRQ_SPORT0_RX+1,
1848                 .flags = IORESOURCE_IRQ,
1849         },
1850         {
1851                 .start = IRQ_SPORT0_ERROR,
1852                 .end = IRQ_SPORT0_ERROR,
1853                 .flags = IORESOURCE_IRQ,
1854         },
1855 };
1856
1857 unsigned short bfin_sport0_peripherals[] = {
1858         P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1859         P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
1860 };
1861
1862 static struct platform_device bfin_sport0_uart_device = {
1863         .name = "bfin-sport-uart",
1864         .id = 0,
1865         .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1866         .resource = bfin_sport0_uart_resources,
1867         .dev = {
1868                 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1869         },
1870 };
1871 #endif
1872 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1873 static struct resource bfin_sport1_uart_resources[] = {
1874         {
1875                 .start = SPORT1_TCR1,
1876                 .end = SPORT1_MRCS3+4,
1877                 .flags = IORESOURCE_MEM,
1878         },
1879         {
1880                 .start = IRQ_SPORT1_RX,
1881                 .end = IRQ_SPORT1_RX+1,
1882                 .flags = IORESOURCE_IRQ,
1883         },
1884         {
1885                 .start = IRQ_SPORT1_ERROR,
1886                 .end = IRQ_SPORT1_ERROR,
1887                 .flags = IORESOURCE_IRQ,
1888         },
1889 };
1890
1891 unsigned short bfin_sport1_peripherals[] = {
1892         P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1893         P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
1894 };
1895
1896 static struct platform_device bfin_sport1_uart_device = {
1897         .name = "bfin-sport-uart",
1898         .id = 1,
1899         .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1900         .resource = bfin_sport1_uart_resources,
1901         .dev = {
1902                 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1903         },
1904 };
1905 #endif
1906 #endif
1907
1908 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1909 #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1910 /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
1911
1912 #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1913 #define PATA_INT        IRQ_PF5
1914 static struct pata_platform_info bfin_pata_platform_data = {
1915         .ioport_shift = 1,
1916         .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
1917 };
1918
1919 static struct resource bfin_pata_resources[] = {
1920         {
1921                 .start = 0x20314020,
1922                 .end = 0x2031403F,
1923                 .flags = IORESOURCE_MEM,
1924         },
1925         {
1926                 .start = 0x2031401C,
1927                 .end = 0x2031401F,
1928                 .flags = IORESOURCE_MEM,
1929         },
1930         {
1931                 .start = PATA_INT,
1932                 .end = PATA_INT,
1933                 .flags = IORESOURCE_IRQ,
1934         },
1935 };
1936 #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
1937 static struct pata_platform_info bfin_pata_platform_data = {
1938         .ioport_shift = 0,
1939 };
1940 /* CompactFlash Storage Card Memory Mapped Adressing
1941  * /REG = A11 = 1
1942  */
1943 static struct resource bfin_pata_resources[] = {
1944         {
1945                 .start = 0x20211800,
1946                 .end = 0x20211807,
1947                 .flags = IORESOURCE_MEM,
1948         },
1949         {
1950                 .start = 0x2021180E,    /* Device Ctl */
1951                 .end = 0x2021180E,
1952                 .flags = IORESOURCE_MEM,
1953         },
1954 };
1955 #endif
1956
1957 static struct platform_device bfin_pata_device = {
1958         .name = "pata_platform",
1959         .id = -1,
1960         .num_resources = ARRAY_SIZE(bfin_pata_resources),
1961         .resource = bfin_pata_resources,
1962         .dev = {
1963                 .platform_data = &bfin_pata_platform_data,
1964         }
1965 };
1966 #endif
1967
1968 static const unsigned int cclk_vlev_datasheet[] =
1969 {
1970         VRPAIR(VLEV_085, 250000000),
1971         VRPAIR(VLEV_090, 376000000),
1972         VRPAIR(VLEV_095, 426000000),
1973         VRPAIR(VLEV_100, 426000000),
1974         VRPAIR(VLEV_105, 476000000),
1975         VRPAIR(VLEV_110, 476000000),
1976         VRPAIR(VLEV_115, 476000000),
1977         VRPAIR(VLEV_120, 500000000),
1978         VRPAIR(VLEV_125, 533000000),
1979         VRPAIR(VLEV_130, 600000000),
1980 };
1981
1982 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1983         .tuple_tab = cclk_vlev_datasheet,
1984         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1985         .vr_settling_time = 25 /* us */,
1986 };
1987
1988 static struct platform_device bfin_dpmc = {
1989         .name = "bfin dpmc",
1990         .dev = {
1991                 .platform_data = &bfin_dmpc_vreg_data,
1992         },
1993 };
1994
1995 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1996 static struct platform_device bfin_i2s = {
1997         .name = "bfin-i2s",
1998         .id = CONFIG_SND_BF5XX_SPORT_NUM,
1999         /* TODO: add platform data here */
2000 };
2001 #endif
2002
2003 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2004 static struct platform_device bfin_tdm = {
2005         .name = "bfin-tdm",
2006         .id = CONFIG_SND_BF5XX_SPORT_NUM,
2007         /* TODO: add platform data here */
2008 };
2009 #endif
2010
2011 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2012 static struct platform_device bfin_ac97 = {
2013         .name = "bfin-ac97",
2014         .id = CONFIG_SND_BF5XX_SPORT_NUM,
2015         /* TODO: add platform data here */
2016 };
2017 #endif
2018
2019 #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2020 #define REGULATOR_ADP122        "adp122"
2021 #define REGULATOR_ADP150        "adp150"
2022
2023 static struct regulator_consumer_supply adp122_consumers = {
2024                 .supply = REGULATOR_ADP122,
2025 };
2026
2027 static struct regulator_consumer_supply adp150_consumers = {
2028                 .supply = REGULATOR_ADP150,
2029 };
2030
2031 static struct regulator_init_data adp_switch_regulator_data[] = {
2032         {
2033                 .constraints = {
2034                         .name = REGULATOR_ADP122,
2035                         .valid_ops_mask = REGULATOR_CHANGE_STATUS,
2036                 },
2037                 .num_consumer_supplies = 1,     /* only 1 */
2038                 .consumer_supplies     = &adp122_consumers,
2039                 .driver_data           = (void *)GPIO_PF2, /* gpio port only */
2040         },
2041         {
2042                 .constraints = {
2043                         .name = REGULATOR_ADP150,
2044                         .valid_ops_mask = REGULATOR_CHANGE_STATUS,
2045                 },
2046                 .num_consumer_supplies = 1,     /* only 1 */
2047                 .consumer_supplies     = &adp150_consumers,
2048                 .driver_data           = (void *)GPIO_PF3, /* gpio port only */
2049         },
2050 };
2051
2052 static struct adp_switch_platform_data adp_switch_pdata = {
2053         .regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
2054         .regulator_data = adp_switch_regulator_data,
2055 };
2056
2057 static struct platform_device adp_switch_device = {
2058         .name = "adp_switch",
2059         .id = 0,
2060         .dev = {
2061                 .platform_data = &adp_switch_pdata,
2062         },
2063 };
2064
2065 #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2066         defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2067 static struct regulator_bulk_data adp122_bulk_data = {
2068         .supply = REGULATOR_ADP122,
2069 };
2070
2071 static struct regulator_userspace_consumer_data adp122_userspace_comsumer_data = {
2072         .name = REGULATOR_ADP122,
2073         .num_supplies = 1,
2074         .supplies = &adp122_bulk_data,
2075 };
2076
2077 static struct platform_device adp122_userspace_consumer_device = {
2078         .name = "reg-userspace-consumer",
2079         .id = 0,
2080         .dev = {
2081                 .platform_data = &adp122_userspace_comsumer_data,
2082         },
2083 };
2084
2085 static struct regulator_bulk_data adp150_bulk_data = {
2086         .supply = REGULATOR_ADP150,
2087 };
2088
2089 static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
2090         .name = REGULATOR_ADP150,
2091         .num_supplies = 1,
2092         .supplies = &adp150_bulk_data,
2093 };
2094
2095 static struct platform_device adp150_userspace_consumer_device = {
2096         .name = "reg-userspace-consumer",
2097         .id = 1,
2098         .dev = {
2099                 .platform_data = &adp150_userspace_comsumer_data,
2100         },
2101 };
2102 #endif
2103 #endif
2104
2105
2106 static struct platform_device *stamp_devices[] __initdata = {
2107
2108         &bfin_dpmc,
2109
2110 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
2111         &bfin_pcmcia_cf_device,
2112 #endif
2113
2114 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
2115         &rtc_device,
2116 #endif
2117
2118 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
2119         &sl811_hcd_device,
2120 #endif
2121
2122 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
2123         &isp1362_hcd_device,
2124 #endif
2125
2126 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
2127         &bfin_isp1760_device,
2128 #endif
2129
2130 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
2131         &smc91x_device,
2132 #endif
2133
2134 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
2135         &dm9000_device,
2136 #endif
2137
2138 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
2139         &bfin_can_device,
2140 #endif
2141
2142 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
2143         &bfin_mii_bus,
2144         &bfin_mac_device,
2145 #endif
2146
2147 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
2148         &net2272_bfin_device,
2149 #endif
2150
2151 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
2152         &bfin_spi0_device,
2153 #endif
2154
2155 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
2156         &bfin_sport_spi0_device,
2157         &bfin_sport_spi1_device,
2158 #endif
2159
2160 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
2161         &bfin_fb_device,
2162 #endif
2163
2164 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
2165         &bfin_lq035q1_device,
2166 #endif
2167
2168 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
2169 #ifdef CONFIG_SERIAL_BFIN_UART0
2170         &bfin_uart0_device,
2171 #endif
2172 #ifdef CONFIG_SERIAL_BFIN_UART1
2173         &bfin_uart1_device,
2174 #endif
2175 #endif
2176
2177 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
2178 #ifdef CONFIG_BFIN_SIR0
2179         &bfin_sir0_device,
2180 #endif
2181 #ifdef CONFIG_BFIN_SIR1
2182         &bfin_sir1_device,
2183 #endif
2184 #endif
2185
2186 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
2187         &i2c_bfin_twi_device,
2188 #endif
2189
2190 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
2191 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2192         &bfin_sport0_uart_device,
2193 #endif
2194 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2195         &bfin_sport1_uart_device,
2196 #endif
2197 #endif
2198
2199 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2200         &bfin_pata_device,
2201 #endif
2202
2203 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2204         &bfin_device_gpiokeys,
2205 #endif
2206
2207 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
2208         &bfin_async_nand_device,
2209 #endif
2210
2211 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
2212         &stamp_flash_device,
2213 #endif
2214
2215 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2216         &bfin_i2s,
2217 #endif
2218
2219 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2220         &bfin_tdm,
2221 #endif
2222
2223 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2224         &bfin_ac97,
2225 #endif
2226 #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
2227 #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
2228         defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
2229         &ad5398_virt_consumer_device,
2230 #endif
2231 #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2232         defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2233         &ad5398_userspace_consumer_device,
2234 #endif
2235 #endif
2236
2237 #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2238         &adp_switch_device,
2239 #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2240         defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2241         &adp122_userspace_consumer_device,
2242         &adp150_userspace_consumer_device,
2243 #endif
2244 #endif
2245 };
2246
2247 static int __init stamp_init(void)
2248 {
2249         printk(KERN_INFO "%s(): registering device resources\n", __func__);
2250         bfin_plat_nand_init();
2251         adf702x_mac_init();
2252         platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
2253         i2c_register_board_info(0, bfin_i2c_board_info,
2254                                 ARRAY_SIZE(bfin_i2c_board_info));
2255         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
2256
2257         return 0;
2258 }
2259
2260 arch_initcall(stamp_init);
2261
2262
2263 static struct platform_device *stamp_early_devices[] __initdata = {
2264 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2265 #ifdef CONFIG_SERIAL_BFIN_UART0
2266         &bfin_uart0_device,
2267 #endif
2268 #ifdef CONFIG_SERIAL_BFIN_UART1
2269         &bfin_uart1_device,
2270 #endif
2271 #endif
2272
2273 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
2274 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2275         &bfin_sport0_uart_device,
2276 #endif
2277 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2278         &bfin_sport1_uart_device,
2279 #endif
2280 #endif
2281 };
2282
2283 void __init native_machine_early_platform_add_devices(void)
2284 {
2285         printk(KERN_INFO "register early platform devices\n");
2286         early_platform_add_devices(stamp_early_devices,
2287                 ARRAY_SIZE(stamp_early_devices));
2288 }
2289
2290 void native_machine_restart(char *cmd)
2291 {
2292         /* workaround reboot hang when booting from SPI */
2293         if ((bfin_read_SYSCR() & 0x7) == 0x3)
2294                 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
2295 }
2296
2297 /*
2298  * Currently the MAC address is saved in Flash by U-Boot
2299  */
2300 #define FLASH_MAC       0x203f0000
2301 void bfin_get_ether_addr(char *addr)
2302 {
2303         *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
2304         *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
2305 }
2306 EXPORT_SYMBOL(bfin_get_ether_addr);