Blackfin arch: move hard coded pin_req to board file
[safe/jmp/linux-2.6] / arch / blackfin / mach-bf527 / boards / ezkit.c
1 /*
2  * File:         arch/blackfin/mach-bf527/boards/ezkit.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-2007 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/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38 #include <linux/usb_isp1362.h>
39 #endif
40 #include <linux/pata_platform.h>
41 #include <linux/irq.h>
42 #include <linux/interrupt.h>
43 #include <linux/usb_sl811.h>
44 #include <asm/cplb.h>
45 #include <asm/dma.h>
46 #include <asm/bfin5xx_spi.h>
47 #include <asm/reboot.h>
48 #include <asm/nand.h>
49 #include <asm/portmux.h>
50 #include <linux/spi/ad7877.h>
51
52 /*
53  * Name the Board for the /proc/cpuinfo
54  */
55 const char bfin_board_name[] = "ADDS-BF527-EZKIT";
56
57 /*
58  *  Driver needs to know address, irq and flag pin.
59  */
60
61 #define ISP1761_BASE       0x203C0000
62 #define ISP1761_IRQ        IRQ_PF7
63
64 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 static struct resource bfin_isp1761_resources[] = {
66         [0] = {
67                 .name   = "isp1761-regs",
68                 .start  = ISP1761_BASE + 0x00000000,
69                 .end    = ISP1761_BASE + 0x000fffff,
70                 .flags  = IORESOURCE_MEM,
71         },
72         [1] = {
73                 .start  = ISP1761_IRQ,
74                 .end    = ISP1761_IRQ,
75                 .flags  = IORESOURCE_IRQ,
76         },
77 };
78
79 static struct platform_device bfin_isp1761_device = {
80         .name           = "isp1761",
81         .id             = 0,
82         .num_resources  = ARRAY_SIZE(bfin_isp1761_resources),
83         .resource       = bfin_isp1761_resources,
84 };
85
86 static struct platform_device *bfin_isp1761_devices[] = {
87         &bfin_isp1761_device,
88 };
89
90 int __init bfin_isp1761_init(void)
91 {
92         unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
93
94         printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
95         set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
96
97         return platform_add_devices(bfin_isp1761_devices, num_devices);
98 }
99
100 void __exit bfin_isp1761_exit(void)
101 {
102         platform_device_unregister(&bfin_isp1761_device);
103 }
104
105 arch_initcall(bfin_isp1761_init);
106 #endif
107
108 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
109 static struct mtd_partition partition_info[] = {
110         {
111                 .name = "Linux Kernel",
112                 .offset = 0,
113                 .size = 4 * SIZE_1M,
114         },
115         {
116                 .name = "File System",
117                 .offset = 4 * SIZE_1M,
118                 .size = (256 - 4) * SIZE_1M,
119         },
120 };
121
122 static struct bf5xx_nand_platform bf5xx_nand_platform = {
123         .page_size = NFC_PG_SIZE_256,
124         .data_width = NFC_NWIDTH_8,
125         .partitions = partition_info,
126         .nr_partitions = ARRAY_SIZE(partition_info),
127         .rd_dly = 3,
128         .wr_dly = 3,
129 };
130
131 static struct resource bf5xx_nand_resources[] = {
132         {
133                 .start = NFC_CTL,
134                 .end = NFC_DATA_RD + 2,
135                 .flags = IORESOURCE_MEM,
136         },
137         {
138                 .start = CH_NFC,
139                 .end = CH_NFC,
140                 .flags = IORESOURCE_IRQ,
141         },
142 };
143
144 static struct platform_device bf5xx_nand_device = {
145         .name = "bf5xx-nand",
146         .id = 0,
147         .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
148         .resource = bf5xx_nand_resources,
149         .dev = {
150                 .platform_data = &bf5xx_nand_platform,
151         },
152 };
153 #endif
154
155 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
156 static struct resource bfin_pcmcia_cf_resources[] = {
157         {
158                 .start = 0x20310000, /* IO PORT */
159                 .end = 0x20312000,
160                 .flags = IORESOURCE_MEM,
161         }, {
162                 .start = 0x20311000, /* Attribute Memory */
163                 .end = 0x20311FFF,
164                 .flags = IORESOURCE_MEM,
165         }, {
166                 .start = IRQ_PF4,
167                 .end = IRQ_PF4,
168                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
169         }, {
170                 .start = 6, /* Card Detect PF6 */
171                 .end = 6,
172                 .flags = IORESOURCE_IRQ,
173         },
174 };
175
176 static struct platform_device bfin_pcmcia_cf_device = {
177         .name = "bfin_cf_pcmcia",
178         .id = -1,
179         .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
180         .resource = bfin_pcmcia_cf_resources,
181 };
182 #endif
183
184 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
185 static struct platform_device rtc_device = {
186         .name = "rtc-bfin",
187         .id   = -1,
188 };
189 #endif
190
191 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
192 static struct resource smc91x_resources[] = {
193         {
194                 .name = "smc91x-regs",
195                 .start = 0x20300300,
196                 .end = 0x20300300 + 16,
197                 .flags = IORESOURCE_MEM,
198         }, {
199
200                 .start = IRQ_PF7,
201                 .end = IRQ_PF7,
202                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
203         },
204 };
205 static struct platform_device smc91x_device = {
206         .name = "smc91x",
207         .id = 0,
208         .num_resources = ARRAY_SIZE(smc91x_resources),
209         .resource = smc91x_resources,
210 };
211 #endif
212
213 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
214 static struct resource dm9000_resources[] = {
215         [0] = {
216                 .start  = 0x203FB800,
217                 .end    = 0x203FB800 + 8,
218                 .flags  = IORESOURCE_MEM,
219         },
220         [1] = {
221                 .start  = IRQ_PF9,
222                 .end    = IRQ_PF9,
223                 .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
224         },
225 };
226
227 static struct platform_device dm9000_device = {
228         .name           = "dm9000",
229         .id             = -1,
230         .num_resources  = ARRAY_SIZE(dm9000_resources),
231         .resource       = dm9000_resources,
232 };
233 #endif
234
235 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
236 static struct resource sl811_hcd_resources[] = {
237         {
238                 .start = 0x20340000,
239                 .end = 0x20340000,
240                 .flags = IORESOURCE_MEM,
241         }, {
242                 .start = 0x20340004,
243                 .end = 0x20340004,
244                 .flags = IORESOURCE_MEM,
245         }, {
246                 .start = CONFIG_USB_SL811_BFIN_IRQ,
247                 .end = CONFIG_USB_SL811_BFIN_IRQ,
248                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
249         },
250 };
251
252 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
253 void sl811_port_power(struct device *dev, int is_on)
254 {
255         gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
256         gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS);
257
258         if (is_on)
259                 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
260         else
261                 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
262 }
263 #endif
264
265 static struct sl811_platform_data sl811_priv = {
266         .potpg = 10,
267         .power = 250,       /* == 500mA */
268 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
269         .port_power = &sl811_port_power,
270 #endif
271 };
272
273 static struct platform_device sl811_hcd_device = {
274         .name = "sl811-hcd",
275         .id = 0,
276         .dev = {
277                 .platform_data = &sl811_priv,
278         },
279         .num_resources = ARRAY_SIZE(sl811_hcd_resources),
280         .resource = sl811_hcd_resources,
281 };
282 #endif
283
284 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
285 static struct resource isp1362_hcd_resources[] = {
286         {
287                 .start = 0x20360000,
288                 .end = 0x20360000,
289                 .flags = IORESOURCE_MEM,
290         }, {
291                 .start = 0x20360004,
292                 .end = 0x20360004,
293                 .flags = IORESOURCE_MEM,
294         }, {
295                 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
296                 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
297                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
298         },
299 };
300
301 static struct isp1362_platform_data isp1362_priv = {
302         .sel15Kres = 1,
303         .clknotstop = 0,
304         .oc_enable = 0,
305         .int_act_high = 0,
306         .int_edge_triggered = 0,
307         .remote_wakeup_connected = 0,
308         .no_power_switching = 1,
309         .power_switching_mode = 0,
310 };
311
312 static struct platform_device isp1362_hcd_device = {
313         .name = "isp1362-hcd",
314         .id = 0,
315         .dev = {
316                 .platform_data = &isp1362_priv,
317         },
318         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
319         .resource = isp1362_hcd_resources,
320 };
321 #endif
322
323 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
324 static struct platform_device bfin_mac_device = {
325         .name = "bfin_mac",
326 };
327 #endif
328
329 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
330 static struct resource net2272_bfin_resources[] = {
331         {
332                 .start = 0x20300000,
333                 .end = 0x20300000 + 0x100,
334                 .flags = IORESOURCE_MEM,
335         }, {
336                 .start = IRQ_PF7,
337                 .end = IRQ_PF7,
338                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
339         },
340 };
341
342 static struct platform_device net2272_bfin_device = {
343         .name = "net2272",
344         .id = -1,
345         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
346         .resource = net2272_bfin_resources,
347 };
348 #endif
349
350 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
351 /* all SPI peripherals info goes here */
352
353 #if defined(CONFIG_MTD_M25P80) \
354         || defined(CONFIG_MTD_M25P80_MODULE)
355 static struct mtd_partition bfin_spi_flash_partitions[] = {
356         {
357                 .name = "bootloader",
358                 .size = 0x00020000,
359                 .offset = 0,
360                 .mask_flags = MTD_CAP_ROM
361         }, {
362                 .name = "kernel",
363                 .size = 0xe0000,
364                 .offset = 0x20000
365         }, {
366                 .name = "file system",
367                 .size = 0x700000,
368                 .offset = 0x00100000,
369         }
370 };
371
372 static struct flash_platform_data bfin_spi_flash_data = {
373         .name = "m25p80",
374         .parts = bfin_spi_flash_partitions,
375         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
376         .type = "m25p64",
377 };
378
379 /* SPI flash chip (m25p64) */
380 static struct bfin5xx_spi_chip spi_flash_chip_info = {
381         .enable_dma = 0,         /* use dma transfer with this chip*/
382         .bits_per_word = 8,
383 };
384 #endif
385
386 #if defined(CONFIG_SPI_ADC_BF533) \
387         || defined(CONFIG_SPI_ADC_BF533_MODULE)
388 /* SPI ADC chip */
389 static struct bfin5xx_spi_chip spi_adc_chip_info = {
390         .enable_dma = 1,         /* use dma transfer with this chip*/
391         .bits_per_word = 16,
392 };
393 #endif
394
395 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
396         || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
397 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
398         .enable_dma = 0,
399         .bits_per_word = 16,
400 };
401 #endif
402
403 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
404 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
405         .enable_dma = 0,
406         .bits_per_word = 16,
407 };
408 #endif
409
410 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
411 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
412         .enable_dma = 1,
413         .bits_per_word = 8,
414 };
415 #endif
416
417 #if defined(CONFIG_PBX)
418 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
419         .ctl_reg        = 0x4, /* send zero */
420         .enable_dma     = 0,
421         .bits_per_word  = 8,
422         .cs_change_per_word = 1,
423 };
424 #endif
425
426 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
427 static struct bfin5xx_spi_chip ad5304_chip_info = {
428         .enable_dma = 0,
429         .bits_per_word = 16,
430 };
431 #endif
432
433 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
434 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
435         .enable_dma = 0,
436         .bits_per_word = 16,
437 };
438
439 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
440         .model                  = 7877,
441         .vref_delay_usecs       = 50,   /* internal, no capacitor */
442         .x_plate_ohms           = 419,
443         .y_plate_ohms           = 486,
444         .pressure_max           = 1000,
445         .pressure_min           = 0,
446         .stopacq_polarity       = 1,
447         .first_conversion_delay = 3,
448         .acquisition_time       = 1,
449         .averaging              = 1,
450         .pen_down_acc_interval  = 1,
451 };
452 #endif
453
454 static struct spi_board_info bfin_spi_board_info[] __initdata = {
455 #if defined(CONFIG_MTD_M25P80) \
456         || defined(CONFIG_MTD_M25P80_MODULE)
457         {
458                 /* the modalias must be the same as spi device driver name */
459                 .modalias = "m25p80", /* Name of spi_driver for this device */
460                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
461                 .bus_num = 0, /* Framework bus number */
462                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
463                 .platform_data = &bfin_spi_flash_data,
464                 .controller_data = &spi_flash_chip_info,
465                 .mode = SPI_MODE_3,
466         },
467 #endif
468
469 #if defined(CONFIG_SPI_ADC_BF533) \
470         || defined(CONFIG_SPI_ADC_BF533_MODULE)
471         {
472                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
473                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
474                 .bus_num = 0, /* Framework bus number */
475                 .chip_select = 1, /* Framework chip select. */
476                 .platform_data = NULL, /* No spi_driver specific config */
477                 .controller_data = &spi_adc_chip_info,
478         },
479 #endif
480
481 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
482         || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
483         {
484                 .modalias = "ad1836-spi",
485                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
486                 .bus_num = 0,
487                 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
488                 .controller_data = &ad1836_spi_chip_info,
489         },
490 #endif
491 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
492         {
493                 .modalias = "ad9960-spi",
494                 .max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
495                 .bus_num = 0,
496                 .chip_select = 1,
497                 .controller_data = &ad9960_spi_chip_info,
498         },
499 #endif
500 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
501         {
502                 .modalias = "spi_mmc_dummy",
503                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
504                 .bus_num = 0,
505                 .chip_select = 0,
506                 .platform_data = NULL,
507                 .controller_data = &spi_mmc_chip_info,
508                 .mode = SPI_MODE_3,
509         },
510         {
511                 .modalias = "spi_mmc",
512                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
513                 .bus_num = 0,
514                 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
515                 .platform_data = NULL,
516                 .controller_data = &spi_mmc_chip_info,
517                 .mode = SPI_MODE_3,
518         },
519 #endif
520 #if defined(CONFIG_PBX)
521         {
522                 .modalias = "fxs-spi",
523                 .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
524                 .bus_num = 0,
525                 .chip_select = 8 - CONFIG_J11_JUMPER,
526                 .controller_data = &spi_si3xxx_chip_info,
527                 .mode = SPI_MODE_3,
528         },
529         {
530                 .modalias = "fxo-spi",
531                 .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
532                 .bus_num = 0,
533                 .chip_select = 8 - CONFIG_J19_JUMPER,
534                 .controller_data = &spi_si3xxx_chip_info,
535                 .mode = SPI_MODE_3,
536         },
537 #endif
538 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
539         {
540                 .modalias = "ad5304_spi",
541                 .max_speed_hz = 1250000,     /* max spi clock (SCK) speed in HZ */
542                 .bus_num = 0,
543                 .chip_select = 2,
544                 .platform_data = NULL,
545                 .controller_data = &ad5304_chip_info,
546                 .mode = SPI_MODE_2,
547         },
548 #endif
549 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
550         {
551                 .modalias               = "ad7877",
552                 .platform_data          = &bfin_ad7877_ts_info,
553                 .irq                    = IRQ_PF6,
554                 .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
555                 .bus_num        = 1,
556                 .chip_select  = 1,
557                 .controller_data = &spi_ad7877_chip_info,
558         },
559 #endif
560 };
561
562 /* SPI controller data */
563 static struct bfin5xx_spi_master bfin_spi0_info = {
564         .num_chipselect = 8,
565         .enable_dma = 1,  /* master has the ability to do dma transfer */
566         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
567 };
568
569 /* SPI (0) */
570 static struct resource bfin_spi0_resource[] = {
571         [0] = {
572                 .start = SPI0_REGBASE,
573                 .end   = SPI0_REGBASE + 0xFF,
574                 .flags = IORESOURCE_MEM,
575                 },
576         [1] = {
577                 .start = CH_SPI,
578                 .end   = CH_SPI,
579                 .flags = IORESOURCE_IRQ,
580         },
581 };
582
583 static struct platform_device bfin_spi0_device = {
584         .name = "bfin-spi",
585         .id = 0, /* Bus number */
586         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
587         .resource = bfin_spi0_resource,
588         .dev = {
589                 .platform_data = &bfin_spi0_info, /* Passed to driver */
590         },
591 };
592 #endif  /* spi master and devices */
593
594 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
595 static struct platform_device bfin_fb_device = {
596         .name = "bf537-lq035",
597 };
598 #endif
599
600 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
601 static struct platform_device bfin_fb_adv7393_device = {
602         .name = "bfin-adv7393",
603 };
604 #endif
605
606 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
607 static struct resource bfin_uart_resources[] = {
608 #ifdef CONFIG_SERIAL_BFIN_UART0
609         {
610                 .start = 0xFFC00400,
611                 .end = 0xFFC004FF,
612                 .flags = IORESOURCE_MEM,
613         },
614 #endif
615 #ifdef CONFIG_SERIAL_BFIN_UART1
616         {
617                 .start = 0xFFC02000,
618                 .end = 0xFFC020FF,
619                 .flags = IORESOURCE_MEM,
620         },
621 #endif
622 };
623
624 static struct platform_device bfin_uart_device = {
625         .name = "bfin-uart",
626         .id = 1,
627         .num_resources = ARRAY_SIZE(bfin_uart_resources),
628         .resource = bfin_uart_resources,
629 };
630 #endif
631
632 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
633 static struct resource bfin_twi0_resource[] = {
634         [0] = {
635                 .start = TWI0_REGBASE,
636                 .end   = TWI0_REGBASE,
637                 .flags = IORESOURCE_MEM,
638         },
639         [1] = {
640                 .start = IRQ_TWI,
641                 .end   = IRQ_TWI,
642                 .flags = IORESOURCE_IRQ,
643         },
644 };
645
646 static struct platform_device i2c_bfin_twi_device = {
647         .name = "i2c-bfin-twi",
648         .id = 0,
649         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
650         .resource = bfin_twi0_resource,
651 };
652 #endif
653
654 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
655 static struct platform_device bfin_sport0_uart_device = {
656         .name = "bfin-sport-uart",
657         .id = 0,
658 };
659
660 static struct platform_device bfin_sport1_uart_device = {
661         .name = "bfin-sport-uart",
662         .id = 1,
663 };
664 #endif
665
666 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
667 #define PATA_INT        55
668
669 static struct pata_platform_info bfin_pata_platform_data = {
670         .ioport_shift = 1,
671         .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
672 };
673
674 static struct resource bfin_pata_resources[] = {
675         {
676                 .start = 0x20314020,
677                 .end = 0x2031403F,
678                 .flags = IORESOURCE_MEM,
679         },
680         {
681                 .start = 0x2031401C,
682                 .end = 0x2031401F,
683                 .flags = IORESOURCE_MEM,
684         },
685         {
686                 .start = PATA_INT,
687                 .end = PATA_INT,
688                 .flags = IORESOURCE_IRQ,
689         },
690 };
691
692 static struct platform_device bfin_pata_device = {
693         .name = "pata_platform",
694         .id = -1,
695         .num_resources = ARRAY_SIZE(bfin_pata_resources),
696         .resource = bfin_pata_resources,
697         .dev = {
698                 .platform_data = &bfin_pata_platform_data,
699         }
700 };
701 #endif
702
703 static struct platform_device *stamp_devices[] __initdata = {
704 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
705         &bf5xx_nand_device,
706 #endif
707
708 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
709         &bfin_pcmcia_cf_device,
710 #endif
711
712 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
713         &rtc_device,
714 #endif
715
716 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
717         &sl811_hcd_device,
718 #endif
719
720 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
721         &isp1362_hcd_device,
722 #endif
723
724 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
725         &smc91x_device,
726 #endif
727
728 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
729         &dm9000_device,
730 #endif
731
732 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
733         &bfin_mac_device,
734 #endif
735
736 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
737         &net2272_bfin_device,
738 #endif
739
740 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
741         &bfin_spi0_device,
742 #endif
743
744 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
745         &bfin_fb_device,
746 #endif
747
748 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
749         &bfin_fb_adv7393_device,
750 #endif
751
752 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
753         &bfin_uart_device,
754 #endif
755
756 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
757         &i2c_bfin_twi_device,
758 #endif
759
760 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
761         &bfin_sport0_uart_device,
762         &bfin_sport1_uart_device,
763 #endif
764
765 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
766         &bfin_pata_device,
767 #endif
768 };
769
770 static int __init stamp_init(void)
771 {
772         printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
773         platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
774 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
775         spi_register_board_info(bfin_spi_board_info,
776                                 ARRAY_SIZE(bfin_spi_board_info));
777 #endif
778
779 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
780         irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
781 #endif
782         return 0;
783 }
784
785 arch_initcall(stamp_init);
786
787 void native_machine_restart(char *cmd)
788 {
789         /* workaround reboot hang when booting from SPI */
790         if ((bfin_read_SYSCR() & 0x7) == 0x3)
791                 bfin_gpio_reset_spi0_ssel1();
792 }