]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/blackfin/mach-bf527/boards/cm_bf527.c
Blackfin arch: only include asm/cplb.h when it is truly used
[linux-2.6-omap-h63xx.git] / arch / blackfin / mach-bf527 / boards / cm_bf527.c
1 /*
2  * File:         arch/blackfin/mach-bf527/boards/cm-bf527.c
3  * Based on:     arch/blackfin/mach-bf537/boards/stamp.c
4  * Author:       Aidan Williams <aidan@nicta.com.au>
5  *
6  * Created:
7  * Description:
8  *
9  * Modified:
10  *               Copyright 2005 National ICT Australia (NICTA)
11  *               Copyright 2004-2008 Analog Devices Inc.
12  *
13  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
14  *
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, see the file COPYING, or write
27  * to the Free Software Foundation, Inc.,
28  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
29  */
30
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/mtd/physmap.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #include <linux/etherdevice.h>
39 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40 #include <linux/usb/isp1362.h>
41 #endif
42 #include <linux/i2c.h>
43 #include <linux/irq.h>
44 #include <linux/interrupt.h>
45 #include <linux/usb/sl811.h>
46 #include <linux/usb/musb.h>
47 #include <asm/dma.h>
48 #include <asm/bfin5xx_spi.h>
49 #include <asm/reboot.h>
50 #include <asm/nand.h>
51 #include <asm/portmux.h>
52 #include <asm/dpmc.h>
53 #include <linux/spi/ad7877.h>
54
55 /*
56  * Name the Board for the /proc/cpuinfo
57  */
58 const char bfin_board_name[] = "Bluetechnix CM-BF527";
59
60 /*
61  *  Driver needs to know address, irq and flag pin.
62  */
63
64 #define ISP1761_BASE       0x203C0000
65 #define ISP1761_IRQ        IRQ_PF7
66
67 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
68 static struct resource bfin_isp1761_resources[] = {
69         [0] = {
70                 .name   = "isp1761-regs",
71                 .start  = ISP1761_BASE + 0x00000000,
72                 .end    = ISP1761_BASE + 0x000fffff,
73                 .flags  = IORESOURCE_MEM,
74         },
75         [1] = {
76                 .start  = ISP1761_IRQ,
77                 .end    = ISP1761_IRQ,
78                 .flags  = IORESOURCE_IRQ,
79         },
80 };
81
82 static struct platform_device bfin_isp1761_device = {
83         .name           = "isp1761",
84         .id             = 0,
85         .num_resources  = ARRAY_SIZE(bfin_isp1761_resources),
86         .resource       = bfin_isp1761_resources,
87 };
88
89 static struct platform_device *bfin_isp1761_devices[] = {
90         &bfin_isp1761_device,
91 };
92
93 int __init bfin_isp1761_init(void)
94 {
95         unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
96
97         printk(KERN_INFO "%s(): registering device resources\n", __func__);
98         set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
99
100         return platform_add_devices(bfin_isp1761_devices, num_devices);
101 }
102
103 void __exit bfin_isp1761_exit(void)
104 {
105         platform_device_unregister(&bfin_isp1761_device);
106 }
107
108 arch_initcall(bfin_isp1761_init);
109 #endif
110
111 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
112 static struct resource musb_resources[] = {
113         [0] = {
114                 .start  = 0xffc03800,
115                 .end    = 0xffc03cff,
116                 .flags  = IORESOURCE_MEM,
117         },
118         [1] = { /* general IRQ */
119                 .start  = IRQ_USB_INT0,
120                 .end    = IRQ_USB_INT0,
121                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
122         },
123         [2] = { /* DMA IRQ */
124                 .start  = IRQ_USB_DMA,
125                 .end    = IRQ_USB_DMA,
126                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
127         },
128 };
129
130 static struct musb_hdrc_config musb_config = {
131         .multipoint     = 0,
132         .dyn_fifo       = 0,
133         .soft_con       = 1,
134         .dma            = 1,
135         .num_eps        = 7,
136         .dma_channels   = 7,
137         .gpio_vrsel     = GPIO_PF11,
138 };
139
140 static struct musb_hdrc_platform_data musb_plat = {
141 #if defined(CONFIG_USB_MUSB_OTG)
142         .mode           = MUSB_OTG,
143 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
144         .mode           = MUSB_HOST,
145 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
146         .mode           = MUSB_PERIPHERAL,
147 #endif
148         .config         = &musb_config,
149 };
150
151 static u64 musb_dmamask = ~(u32)0;
152
153 static struct platform_device musb_device = {
154         .name           = "musb_hdrc",
155         .id             = 0,
156         .dev = {
157                 .dma_mask               = &musb_dmamask,
158                 .coherent_dma_mask      = 0xffffffff,
159                 .platform_data          = &musb_plat,
160         },
161         .num_resources  = ARRAY_SIZE(musb_resources),
162         .resource       = musb_resources,
163 };
164 #endif
165
166 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
167 static struct mtd_partition ezkit_partitions[] = {
168         {
169                 .name       = "bootloader(nor)",
170                 .size       = 0x40000,
171                 .offset     = 0,
172         }, {
173                 .name       = "linux kernel(nor)",
174                 .size       = 0x1C0000,
175                 .offset     = MTDPART_OFS_APPEND,
176         }, {
177                 .name       = "file system(nor)",
178                 .size       = MTDPART_SIZ_FULL,
179                 .offset     = MTDPART_OFS_APPEND,
180         }
181 };
182
183 static struct physmap_flash_data ezkit_flash_data = {
184         .width      = 2,
185         .parts      = ezkit_partitions,
186         .nr_parts   = ARRAY_SIZE(ezkit_partitions),
187 };
188
189 static struct resource ezkit_flash_resource = {
190         .start = 0x20000000,
191         .end   = 0x201fffff,
192         .flags = IORESOURCE_MEM,
193 };
194
195 static struct platform_device ezkit_flash_device = {
196         .name          = "physmap-flash",
197         .id            = 0,
198         .dev = {
199                 .platform_data = &ezkit_flash_data,
200         },
201         .num_resources = 1,
202         .resource      = &ezkit_flash_resource,
203 };
204 #endif
205
206 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
207 static struct mtd_partition partition_info[] = {
208         {
209                 .name = "linux kernel(nand)",
210                 .offset = 0,
211                 .size = 4 * 1024 * 1024,
212         },
213         {
214                 .name = "file system(nand)",
215                 .offset = MTDPART_OFS_APPEND,
216                 .size = MTDPART_SIZ_FULL,
217         },
218 };
219
220 static struct bf5xx_nand_platform bf5xx_nand_platform = {
221         .page_size = NFC_PG_SIZE_256,
222         .data_width = NFC_NWIDTH_8,
223         .partitions = partition_info,
224         .nr_partitions = ARRAY_SIZE(partition_info),
225         .rd_dly = 3,
226         .wr_dly = 3,
227 };
228
229 static struct resource bf5xx_nand_resources[] = {
230         {
231                 .start = NFC_CTL,
232                 .end = NFC_DATA_RD + 2,
233                 .flags = IORESOURCE_MEM,
234         },
235         {
236                 .start = CH_NFC,
237                 .end = CH_NFC,
238                 .flags = IORESOURCE_IRQ,
239         },
240 };
241
242 static struct platform_device bf5xx_nand_device = {
243         .name = "bf5xx-nand",
244         .id = 0,
245         .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
246         .resource = bf5xx_nand_resources,
247         .dev = {
248                 .platform_data = &bf5xx_nand_platform,
249         },
250 };
251 #endif
252
253 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
254 static struct resource bfin_pcmcia_cf_resources[] = {
255         {
256                 .start = 0x20310000, /* IO PORT */
257                 .end = 0x20312000,
258                 .flags = IORESOURCE_MEM,
259         }, {
260                 .start = 0x20311000, /* Attribute Memory */
261                 .end = 0x20311FFF,
262                 .flags = IORESOURCE_MEM,
263         }, {
264                 .start = IRQ_PF4,
265                 .end = IRQ_PF4,
266                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
267         }, {
268                 .start = 6, /* Card Detect PF6 */
269                 .end = 6,
270                 .flags = IORESOURCE_IRQ,
271         },
272 };
273
274 static struct platform_device bfin_pcmcia_cf_device = {
275         .name = "bfin_cf_pcmcia",
276         .id = -1,
277         .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
278         .resource = bfin_pcmcia_cf_resources,
279 };
280 #endif
281
282 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
283 static struct platform_device rtc_device = {
284         .name = "rtc-bfin",
285         .id   = -1,
286 };
287 #endif
288
289 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
290 static struct resource smc91x_resources[] = {
291         {
292                 .name = "smc91x-regs",
293                 .start = 0x20300300,
294                 .end = 0x20300300 + 16,
295                 .flags = IORESOURCE_MEM,
296         }, {
297
298                 .start = IRQ_PF7,
299                 .end = IRQ_PF7,
300                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
301         },
302 };
303 static struct platform_device smc91x_device = {
304         .name = "smc91x",
305         .id = 0,
306         .num_resources = ARRAY_SIZE(smc91x_resources),
307         .resource = smc91x_resources,
308 };
309 #endif
310
311 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
312 static struct resource dm9000_resources[] = {
313         [0] = {
314                 .start  = 0x203FB800,
315                 .end    = 0x203FB800 + 8,
316                 .flags  = IORESOURCE_MEM,
317         },
318         [1] = {
319                 .start  = IRQ_PF9,
320                 .end    = IRQ_PF9,
321                 .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
322         },
323 };
324
325 static struct platform_device dm9000_device = {
326         .name           = "dm9000",
327         .id             = -1,
328         .num_resources  = ARRAY_SIZE(dm9000_resources),
329         .resource       = dm9000_resources,
330 };
331 #endif
332
333 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
334 static struct resource sl811_hcd_resources[] = {
335         {
336                 .start = 0x20340000,
337                 .end = 0x20340000,
338                 .flags = IORESOURCE_MEM,
339         }, {
340                 .start = 0x20340004,
341                 .end = 0x20340004,
342                 .flags = IORESOURCE_MEM,
343         }, {
344                 .start = CONFIG_USB_SL811_BFIN_IRQ,
345                 .end = CONFIG_USB_SL811_BFIN_IRQ,
346                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
347         },
348 };
349
350 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
351 void sl811_port_power(struct device *dev, int is_on)
352 {
353         gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
354         gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
355 }
356 #endif
357
358 static struct sl811_platform_data sl811_priv = {
359         .potpg = 10,
360         .power = 250,       /* == 500mA */
361 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
362         .port_power = &sl811_port_power,
363 #endif
364 };
365
366 static struct platform_device sl811_hcd_device = {
367         .name = "sl811-hcd",
368         .id = 0,
369         .dev = {
370                 .platform_data = &sl811_priv,
371         },
372         .num_resources = ARRAY_SIZE(sl811_hcd_resources),
373         .resource = sl811_hcd_resources,
374 };
375 #endif
376
377 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
378 static struct resource isp1362_hcd_resources[] = {
379         {
380                 .start = 0x20360000,
381                 .end = 0x20360000,
382                 .flags = IORESOURCE_MEM,
383         }, {
384                 .start = 0x20360004,
385                 .end = 0x20360004,
386                 .flags = IORESOURCE_MEM,
387         }, {
388                 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
389                 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
390                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
391         },
392 };
393
394 static struct isp1362_platform_data isp1362_priv = {
395         .sel15Kres = 1,
396         .clknotstop = 0,
397         .oc_enable = 0,
398         .int_act_high = 0,
399         .int_edge_triggered = 0,
400         .remote_wakeup_connected = 0,
401         .no_power_switching = 1,
402         .power_switching_mode = 0,
403 };
404
405 static struct platform_device isp1362_hcd_device = {
406         .name = "isp1362-hcd",
407         .id = 0,
408         .dev = {
409                 .platform_data = &isp1362_priv,
410         },
411         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
412         .resource = isp1362_hcd_resources,
413 };
414 #endif
415
416 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
417 static struct platform_device bfin_mac_device = {
418         .name = "bfin_mac",
419 };
420 #endif
421
422 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
423 static struct resource net2272_bfin_resources[] = {
424         {
425                 .start = 0x20300000,
426                 .end = 0x20300000 + 0x100,
427                 .flags = IORESOURCE_MEM,
428         }, {
429                 .start = IRQ_PF7,
430                 .end = IRQ_PF7,
431                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
432         },
433 };
434
435 static struct platform_device net2272_bfin_device = {
436         .name = "net2272",
437         .id = -1,
438         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
439         .resource = net2272_bfin_resources,
440 };
441 #endif
442
443 #if defined(CONFIG_MTD_M25P80) \
444         || defined(CONFIG_MTD_M25P80_MODULE)
445 static struct mtd_partition bfin_spi_flash_partitions[] = {
446         {
447                 .name = "bootloader(spi)",
448                 .size = 0x00040000,
449                 .offset = 0,
450                 .mask_flags = MTD_CAP_ROM
451         }, {
452                 .name = "linux kernel(spi)",
453                 .size = MTDPART_SIZ_FULL,
454                 .offset = MTDPART_OFS_APPEND,
455         }
456 };
457
458 static struct flash_platform_data bfin_spi_flash_data = {
459         .name = "m25p80",
460         .parts = bfin_spi_flash_partitions,
461         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
462         .type = "m25p16",
463 };
464
465 /* SPI flash chip (m25p64) */
466 static struct bfin5xx_spi_chip spi_flash_chip_info = {
467         .enable_dma = 0,         /* use dma transfer with this chip*/
468         .bits_per_word = 8,
469 };
470 #endif
471
472 #if defined(CONFIG_SPI_ADC_BF533) \
473         || defined(CONFIG_SPI_ADC_BF533_MODULE)
474 /* SPI ADC chip */
475 static struct bfin5xx_spi_chip spi_adc_chip_info = {
476         .enable_dma = 1,         /* use dma transfer with this chip*/
477         .bits_per_word = 16,
478 };
479 #endif
480
481 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
482         || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
483 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
484         .enable_dma = 0,
485         .bits_per_word = 16,
486 };
487 #endif
488
489 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
490 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
491         .enable_dma = 0,
492         .bits_per_word = 16,
493 };
494 #endif
495
496 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
497 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
498         .enable_dma = 1,
499         .bits_per_word = 8,
500 };
501 #endif
502
503 #if defined(CONFIG_PBX)
504 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
505         .ctl_reg        = 0x4, /* send zero */
506         .enable_dma     = 0,
507         .bits_per_word  = 8,
508         .cs_change_per_word = 1,
509 };
510 #endif
511
512 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
513 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
514         .enable_dma = 0,
515         .bits_per_word = 16,
516 };
517
518 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
519         .model                  = 7877,
520         .vref_delay_usecs       = 50,   /* internal, no capacitor */
521         .x_plate_ohms           = 419,
522         .y_plate_ohms           = 486,
523         .pressure_max           = 1000,
524         .pressure_min           = 0,
525         .stopacq_polarity       = 1,
526         .first_conversion_delay = 3,
527         .acquisition_time       = 1,
528         .averaging              = 1,
529         .pen_down_acc_interval  = 1,
530 };
531 #endif
532
533 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
534          && defined(CONFIG_SND_SOC_WM8731_SPI)
535 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
536         .enable_dma = 0,
537         .bits_per_word = 16,
538 };
539 #endif
540
541 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
542 static struct bfin5xx_spi_chip spidev_chip_info = {
543         .enable_dma = 0,
544         .bits_per_word = 8,
545 };
546 #endif
547
548 static struct spi_board_info bfin_spi_board_info[] __initdata = {
549 #if defined(CONFIG_MTD_M25P80) \
550         || defined(CONFIG_MTD_M25P80_MODULE)
551         {
552                 /* the modalias must be the same as spi device driver name */
553                 .modalias = "m25p80", /* Name of spi_driver for this device */
554                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
555                 .bus_num = 0, /* Framework bus number */
556                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
557                 .platform_data = &bfin_spi_flash_data,
558                 .controller_data = &spi_flash_chip_info,
559                 .mode = SPI_MODE_3,
560         },
561 #endif
562
563 #if defined(CONFIG_SPI_ADC_BF533) \
564         || defined(CONFIG_SPI_ADC_BF533_MODULE)
565         {
566                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
567                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
568                 .bus_num = 0, /* Framework bus number */
569                 .chip_select = 1, /* Framework chip select. */
570                 .platform_data = NULL, /* No spi_driver specific config */
571                 .controller_data = &spi_adc_chip_info,
572         },
573 #endif
574
575 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
576         || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
577         {
578                 .modalias = "ad1836-spi",
579                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
580                 .bus_num = 0,
581                 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
582                 .controller_data = &ad1836_spi_chip_info,
583         },
584 #endif
585 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
586         {
587                 .modalias = "ad9960-spi",
588                 .max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
589                 .bus_num = 0,
590                 .chip_select = 1,
591                 .controller_data = &ad9960_spi_chip_info,
592         },
593 #endif
594 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
595         {
596                 .modalias = "spi_mmc_dummy",
597                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
598                 .bus_num = 0,
599                 .chip_select = 0,
600                 .platform_data = NULL,
601                 .controller_data = &spi_mmc_chip_info,
602                 .mode = SPI_MODE_3,
603         },
604         {
605                 .modalias = "spi_mmc",
606                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
607                 .bus_num = 0,
608                 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
609                 .platform_data = NULL,
610                 .controller_data = &spi_mmc_chip_info,
611                 .mode = SPI_MODE_3,
612         },
613 #endif
614 #if defined(CONFIG_PBX)
615         {
616                 .modalias = "fxs-spi",
617                 .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
618                 .bus_num = 0,
619                 .chip_select = 8 - CONFIG_J11_JUMPER,
620                 .controller_data = &spi_si3xxx_chip_info,
621                 .mode = SPI_MODE_3,
622         },
623         {
624                 .modalias = "fxo-spi",
625                 .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
626                 .bus_num = 0,
627                 .chip_select = 8 - CONFIG_J19_JUMPER,
628                 .controller_data = &spi_si3xxx_chip_info,
629                 .mode = SPI_MODE_3,
630         },
631 #endif
632 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
633         {
634                 .modalias               = "ad7877",
635                 .platform_data          = &bfin_ad7877_ts_info,
636                 .irq                    = IRQ_PF8,
637                 .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
638                 .bus_num        = 0,
639                 .chip_select  = 2,
640                 .controller_data = &spi_ad7877_chip_info,
641         },
642 #endif
643 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
644          && defined(CONFIG_SND_SOC_WM8731_SPI)
645         {
646                 .modalias       = "wm8731",
647                 .max_speed_hz   = 3125000,     /* max spi clock (SCK) speed in HZ */
648                 .bus_num        = 0,
649                 .chip_select    = 5,
650                 .controller_data = &spi_wm8731_chip_info,
651                 .mode = SPI_MODE_0,
652         },
653 #endif
654 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
655         {
656                 .modalias = "spidev",
657                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
658                 .bus_num = 0,
659                 .chip_select = 1,
660                 .controller_data = &spidev_chip_info,
661         },
662 #endif
663 };
664
665 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
666 /* SPI controller data */
667 static struct bfin5xx_spi_master bfin_spi0_info = {
668         .num_chipselect = 8,
669         .enable_dma = 1,  /* master has the ability to do dma transfer */
670         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
671 };
672
673 /* SPI (0) */
674 static struct resource bfin_spi0_resource[] = {
675         [0] = {
676                 .start = SPI0_REGBASE,
677                 .end   = SPI0_REGBASE + 0xFF,
678                 .flags = IORESOURCE_MEM,
679                 },
680         [1] = {
681                 .start = CH_SPI,
682                 .end   = CH_SPI,
683                 .flags = IORESOURCE_IRQ,
684         },
685 };
686
687 static struct platform_device bfin_spi0_device = {
688         .name = "bfin-spi",
689         .id = 0, /* Bus number */
690         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
691         .resource = bfin_spi0_resource,
692         .dev = {
693                 .platform_data = &bfin_spi0_info, /* Passed to driver */
694         },
695 };
696 #endif  /* spi master and devices */
697
698 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
699 static struct platform_device bfin_fb_adv7393_device = {
700         .name = "bfin-adv7393",
701 };
702 #endif
703
704 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
705 static struct resource bfin_uart_resources[] = {
706 #ifdef CONFIG_SERIAL_BFIN_UART0
707         {
708                 .start = 0xFFC00400,
709                 .end = 0xFFC004FF,
710                 .flags = IORESOURCE_MEM,
711         },
712 #endif
713 #ifdef CONFIG_SERIAL_BFIN_UART1
714         {
715                 .start = 0xFFC02000,
716                 .end = 0xFFC020FF,
717                 .flags = IORESOURCE_MEM,
718         },
719 #endif
720 };
721
722 static struct platform_device bfin_uart_device = {
723         .name = "bfin-uart",
724         .id = 1,
725         .num_resources = ARRAY_SIZE(bfin_uart_resources),
726         .resource = bfin_uart_resources,
727 };
728 #endif
729
730 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
731 static struct resource bfin_sir_resources[] = {
732 #ifdef CONFIG_BFIN_SIR0
733         {
734                 .start = 0xFFC00400,
735                 .end = 0xFFC004FF,
736                 .flags = IORESOURCE_MEM,
737         },
738 #endif
739 #ifdef CONFIG_BFIN_SIR1
740         {
741                 .start = 0xFFC02000,
742                 .end = 0xFFC020FF,
743                 .flags = IORESOURCE_MEM,
744         },
745 #endif
746 };
747
748 static struct platform_device bfin_sir_device = {
749         .name = "bfin_sir",
750         .id = 0,
751         .num_resources = ARRAY_SIZE(bfin_sir_resources),
752         .resource = bfin_sir_resources,
753 };
754 #endif
755
756 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
757 static struct resource bfin_twi0_resource[] = {
758         [0] = {
759                 .start = TWI0_REGBASE,
760                 .end   = TWI0_REGBASE,
761                 .flags = IORESOURCE_MEM,
762         },
763         [1] = {
764                 .start = IRQ_TWI,
765                 .end   = IRQ_TWI,
766                 .flags = IORESOURCE_IRQ,
767         },
768 };
769
770 static struct platform_device i2c_bfin_twi_device = {
771         .name = "i2c-bfin-twi",
772         .id = 0,
773         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
774         .resource = bfin_twi0_resource,
775 };
776 #endif
777
778 #ifdef CONFIG_I2C_BOARDINFO
779 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
780 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
781         {
782                 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
783                 .type = "pcf8574_lcd",
784         },
785 #endif
786 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
787         {
788                 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
789                 .type = "pcf8574_keypad",
790                 .irq = IRQ_PF8,
791         },
792 #endif
793 };
794 #endif
795
796 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
797 static struct platform_device bfin_sport0_uart_device = {
798         .name = "bfin-sport-uart",
799         .id = 0,
800 };
801
802 static struct platform_device bfin_sport1_uart_device = {
803         .name = "bfin-sport-uart",
804         .id = 1,
805 };
806 #endif
807
808 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
809 #include <linux/input.h>
810 #include <linux/gpio_keys.h>
811
812 static struct gpio_keys_button bfin_gpio_keys_table[] = {
813         {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
814 };
815
816 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
817         .buttons        = bfin_gpio_keys_table,
818         .nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
819 };
820
821 static struct platform_device bfin_device_gpiokeys = {
822         .name      = "gpio-keys",
823         .dev = {
824                 .platform_data = &bfin_gpio_keys_data,
825         },
826 };
827 #endif
828
829 static struct resource bfin_gpios_resources = {
830         .start = 0,
831         .end   = MAX_BLACKFIN_GPIOS - 1,
832         .flags = IORESOURCE_IRQ,
833 };
834
835 static struct platform_device bfin_gpios_device = {
836         .name = "simple-gpio",
837         .id = -1,
838         .num_resources = 1,
839         .resource = &bfin_gpios_resources,
840 };
841
842 static const unsigned int cclk_vlev_datasheet[] =
843 {
844         VRPAIR(VLEV_100, 400000000),
845         VRPAIR(VLEV_105, 426000000),
846         VRPAIR(VLEV_110, 500000000),
847         VRPAIR(VLEV_115, 533000000),
848         VRPAIR(VLEV_120, 600000000),
849 };
850
851 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
852         .tuple_tab = cclk_vlev_datasheet,
853         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
854         .vr_settling_time = 25 /* us */,
855 };
856
857 static struct platform_device bfin_dpmc = {
858         .name = "bfin dpmc",
859         .dev = {
860                 .platform_data = &bfin_dmpc_vreg_data,
861         },
862 };
863
864 static struct platform_device *stamp_devices[] __initdata = {
865
866         &bfin_dpmc,
867
868 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
869         &bf5xx_nand_device,
870 #endif
871
872 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
873         &bfin_pcmcia_cf_device,
874 #endif
875
876 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
877         &rtc_device,
878 #endif
879
880 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
881         &sl811_hcd_device,
882 #endif
883
884 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
885         &isp1362_hcd_device,
886 #endif
887
888 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
889         &musb_device,
890 #endif
891
892 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
893         &smc91x_device,
894 #endif
895
896 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
897         &dm9000_device,
898 #endif
899
900 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
901         &bfin_mac_device,
902 #endif
903
904 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
905         &net2272_bfin_device,
906 #endif
907
908 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
909         &bfin_spi0_device,
910 #endif
911
912 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
913         &bfin_fb_adv7393_device,
914 #endif
915
916 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
917         &bfin_uart_device,
918 #endif
919
920 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
921         &bfin_sir_device,
922 #endif
923
924 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
925         &i2c_bfin_twi_device,
926 #endif
927
928 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
929         &bfin_sport0_uart_device,
930         &bfin_sport1_uart_device,
931 #endif
932
933 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
934         &bfin_device_gpiokeys,
935 #endif
936
937 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
938         &ezkit_flash_device,
939 #endif
940
941         &bfin_gpios_device,
942 };
943
944 static int __init stamp_init(void)
945 {
946         printk(KERN_INFO "%s(): registering device resources\n", __func__);
947
948 #ifdef CONFIG_I2C_BOARDINFO
949         i2c_register_board_info(0, bfin_i2c_board_info,
950                                 ARRAY_SIZE(bfin_i2c_board_info));
951 #endif
952
953         platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
954         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
955         return 0;
956 }
957
958 arch_initcall(stamp_init);
959
960 void native_machine_restart(char *cmd)
961 {
962         /* workaround reboot hang when booting from SPI */
963         if ((bfin_read_SYSCR() & 0x7) == 0x3)
964                 bfin_gpio_reset_spi0_ssel1();
965 }
966
967 void bfin_get_ether_addr(char *addr)
968 {
969         random_ether_addr(addr);
970         printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
971 }
972 EXPORT_SYMBOL(bfin_get_ether_addr);