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