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