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