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