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