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