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