Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / blackfin / mach-bf537 / boards / stamp.c
blob82a7950bc2ab77a7ec18af72c6328a178458d93e
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>
6 * Created:
7 * Description:
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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.
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.
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
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/mtd/physmap.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>
52 * Name the Board for the /proc/cpuinfo
54 const char bfin_board_name[] = "ADDS-BF537-STAMP";
57 * Driver needs to know address, irq and flag pin.
60 #define ISP1761_BASE 0x203C0000
61 #define ISP1761_IRQ IRQ_PF7
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,
71 [1] = {
72 .start = ISP1761_IRQ,
73 .end = ISP1761_IRQ,
74 .flags = IORESOURCE_IRQ,
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,
85 static struct platform_device *bfin_isp1761_devices[] = {
86 &bfin_isp1761_device,
89 int __init bfin_isp1761_init(void)
91 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
93 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
94 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
96 return platform_add_devices(bfin_isp1761_devices, num_devices);
99 void __exit bfin_isp1761_exit(void)
101 platform_device_unregister(&bfin_isp1761_device);
104 arch_initcall(bfin_isp1761_init);
105 #endif
107 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
108 #include <linux/input.h>
109 #include <linux/gpio_keys.h>
111 static struct gpio_keys_button bfin_gpio_keys_table[] = {
112 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
113 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
114 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
115 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
118 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
119 .buttons = bfin_gpio_keys_table,
120 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
123 static struct platform_device bfin_device_gpiokeys = {
124 .name = "gpio-keys",
125 .dev = {
126 .platform_data = &bfin_gpio_keys_data,
129 #endif
131 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
132 =======
133 static struct resource bfin_gpios_resources = {
134 .start = 0,
135 .end = MAX_BLACKFIN_GPIOS - 1,
136 .flags = IORESOURCE_IRQ,
139 static struct platform_device bfin_gpios_device = {
140 .name = "simple-gpio",
141 .id = -1,
142 .num_resources = 1,
143 .resource = &bfin_gpios_resources,
146 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
147 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
148 static struct resource bfin_pcmcia_cf_resources[] = {
150 .start = 0x20310000, /* IO PORT */
151 .end = 0x20312000,
152 .flags = IORESOURCE_MEM,
153 }, {
154 .start = 0x20311000, /* Attribute Memory */
155 .end = 0x20311FFF,
156 .flags = IORESOURCE_MEM,
157 }, {
158 .start = IRQ_PF4,
159 .end = IRQ_PF4,
160 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
161 }, {
162 .start = 6, /* Card Detect PF6 */
163 .end = 6,
164 .flags = IORESOURCE_IRQ,
168 static struct platform_device bfin_pcmcia_cf_device = {
169 .name = "bfin_cf_pcmcia",
170 .id = -1,
171 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
172 .resource = bfin_pcmcia_cf_resources,
174 #endif
176 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
177 static struct platform_device rtc_device = {
178 .name = "rtc-bfin",
179 .id = -1,
181 #endif
183 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
184 static struct resource smc91x_resources[] = {
186 .name = "smc91x-regs",
187 .start = 0x20300300,
188 .end = 0x20300300 + 16,
189 .flags = IORESOURCE_MEM,
190 }, {
192 .start = IRQ_PF7,
193 .end = IRQ_PF7,
194 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
197 static struct platform_device smc91x_device = {
198 .name = "smc91x",
199 .id = 0,
200 .num_resources = ARRAY_SIZE(smc91x_resources),
201 .resource = smc91x_resources,
203 #endif
205 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
206 static struct resource dm9000_resources[] = {
207 [0] = {
208 .start = 0x203FB800,
209 .end = 0x203FB800 + 8,
210 .flags = IORESOURCE_MEM,
212 [1] = {
213 .start = IRQ_PF9,
214 .end = IRQ_PF9,
215 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
219 static struct platform_device dm9000_device = {
220 .name = "dm9000",
221 .id = -1,
222 .num_resources = ARRAY_SIZE(dm9000_resources),
223 .resource = dm9000_resources,
225 #endif
227 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
228 static struct resource ax88180_resources[] = {
229 [0] = {
230 .start = 0x20300000,
231 .end = 0x20300000 + 0x8000,
232 .flags = IORESOURCE_MEM,
234 [1] = {
235 .start = IRQ_PF7,
236 .end = IRQ_PF7,
237 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
241 static struct platform_device ax88180_device = {
242 .name = "ax88180",
243 .id = -1,
244 .num_resources = ARRAY_SIZE(ax88180_resources),
245 .resource = ax88180_resources,
247 #endif
249 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
250 static struct resource sl811_hcd_resources[] = {
252 .start = 0x20340000,
253 .end = 0x20340000,
254 .flags = IORESOURCE_MEM,
255 }, {
256 .start = 0x20340004,
257 .end = 0x20340004,
258 .flags = IORESOURCE_MEM,
259 }, {
260 .start = CONFIG_USB_SL811_BFIN_IRQ,
261 .end = CONFIG_USB_SL811_BFIN_IRQ,
262 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
266 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
267 void sl811_port_power(struct device *dev, int is_on)
269 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
270 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
272 #endif
274 static struct sl811_platform_data sl811_priv = {
275 .potpg = 10,
276 .power = 250, /* == 500mA */
277 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
278 .port_power = &sl811_port_power,
279 #endif
282 static struct platform_device sl811_hcd_device = {
283 .name = "sl811-hcd",
284 .id = 0,
285 .dev = {
286 .platform_data = &sl811_priv,
288 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
289 .resource = sl811_hcd_resources,
291 #endif
293 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
294 static struct resource isp1362_hcd_resources[] = {
296 .start = 0x20360000,
297 .end = 0x20360000,
298 .flags = IORESOURCE_MEM,
299 }, {
300 .start = 0x20360004,
301 .end = 0x20360004,
302 .flags = IORESOURCE_MEM,
303 }, {
304 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
305 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
306 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
310 static struct isp1362_platform_data isp1362_priv = {
311 .sel15Kres = 1,
312 .clknotstop = 0,
313 .oc_enable = 0,
314 .int_act_high = 0,
315 .int_edge_triggered = 0,
316 .remote_wakeup_connected = 0,
317 .no_power_switching = 1,
318 .power_switching_mode = 0,
321 static struct platform_device isp1362_hcd_device = {
322 .name = "isp1362-hcd",
323 .id = 0,
324 .dev = {
325 .platform_data = &isp1362_priv,
327 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
328 .resource = isp1362_hcd_resources,
330 #endif
332 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
333 static struct platform_device bfin_mac_device = {
334 .name = "bfin_mac",
336 #endif
338 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
339 static struct resource net2272_bfin_resources[] = {
341 .start = 0x20300000,
342 .end = 0x20300000 + 0x100,
343 .flags = IORESOURCE_MEM,
344 }, {
345 .start = IRQ_PF7,
346 .end = IRQ_PF7,
347 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
351 static struct platform_device net2272_bfin_device = {
352 .name = "net2272",
353 .id = -1,
354 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
355 .resource = net2272_bfin_resources,
357 #endif
359 static struct mtd_partition stamp_partitions[] = {
361 .name = "Bootloader",
362 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
363 .size = 0x20000,
364 =======
365 .size = 0x40000,
366 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
367 .offset = 0,
368 }, {
369 .name = "Kernel",
370 .size = 0xE0000,
371 .offset = MTDPART_OFS_APPEND,
372 }, {
373 .name = "RootFS",
374 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
375 .size = 0x400000 - 0x20000 - 0xE0000 - 0x10000,
376 =======
377 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
378 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
379 .offset = MTDPART_OFS_APPEND,
380 }, {
381 .name = "MAC Address",
382 .size = MTDPART_SIZ_FULL,
383 .offset = 0x3F0000,
384 .mask_flags = MTD_WRITEABLE,
388 static struct physmap_flash_data stamp_flash_data = {
389 .width = 2,
390 .parts = stamp_partitions,
391 .nr_parts = ARRAY_SIZE(stamp_partitions),
394 static struct resource stamp_flash_resource = {
395 .start = 0x20000000,
396 .end = 0x203fffff,
397 .flags = IORESOURCE_MEM,
400 static struct platform_device stamp_flash_device = {
401 .name = "physmap-flash",
402 .id = 0,
403 .dev = {
404 .platform_data = &stamp_flash_data,
406 .num_resources = 1,
407 .resource = &stamp_flash_resource,
410 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
411 /* all SPI peripherals info goes here */
413 #if defined(CONFIG_MTD_M25P80) \
414 || defined(CONFIG_MTD_M25P80_MODULE)
415 static struct mtd_partition bfin_spi_flash_partitions[] = {
417 .name = "bootloader",
418 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
419 .size = 0x00020000,
420 =======
421 .size = 0x00040000,
422 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
423 .offset = 0,
424 .mask_flags = MTD_CAP_ROM
425 }, {
426 .name = "kernel",
427 .size = 0xe0000,
428 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
429 .offset = 0x20000
430 =======
431 .offset = MTDPART_OFS_APPEND,
432 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
433 }, {
434 .name = "file system",
435 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
436 .size = 0x700000,
437 .offset = 0x00100000,
438 =======
439 .size = MTDPART_SIZ_FULL,
440 .offset = MTDPART_OFS_APPEND,
441 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
445 static struct flash_platform_data bfin_spi_flash_data = {
446 .name = "m25p80",
447 .parts = bfin_spi_flash_partitions,
448 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
449 .type = "m25p64",
452 /* SPI flash chip (m25p64) */
453 static struct bfin5xx_spi_chip spi_flash_chip_info = {
454 .enable_dma = 0, /* use dma transfer with this chip*/
455 .bits_per_word = 8,
457 #endif
459 #if defined(CONFIG_SPI_ADC_BF533) \
460 || defined(CONFIG_SPI_ADC_BF533_MODULE)
461 /* SPI ADC chip */
462 static struct bfin5xx_spi_chip spi_adc_chip_info = {
463 .enable_dma = 1, /* use dma transfer with this chip*/
464 .bits_per_word = 16,
466 #endif
468 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
469 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
470 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
471 .enable_dma = 0,
472 .bits_per_word = 16,
474 #endif
476 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
477 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
478 .enable_dma = 0,
479 .bits_per_word = 16,
481 #endif
483 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
484 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
485 .enable_dma = 1,
486 .bits_per_word = 8,
488 #endif
490 #if defined(CONFIG_PBX)
491 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
492 .ctl_reg = 0x4, /* send zero */
493 .enable_dma = 0,
494 .bits_per_word = 8,
495 .cs_change_per_word = 1,
497 #endif
499 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
500 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
501 static struct bfin5xx_spi_chip ad5304_chip_info = {
502 .enable_dma = 0,
503 .bits_per_word = 16,
505 #endif
507 =======
508 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
509 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
510 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
511 .enable_dma = 0,
512 .bits_per_word = 16,
515 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
516 .model = 7877,
517 .vref_delay_usecs = 50, /* internal, no capacitor */
518 .x_plate_ohms = 419,
519 .y_plate_ohms = 486,
520 .pressure_max = 1000,
521 .pressure_min = 0,
522 .stopacq_polarity = 1,
523 .first_conversion_delay = 3,
524 .acquisition_time = 1,
525 .averaging = 1,
526 .pen_down_acc_interval = 1,
528 #endif
530 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
531 static struct bfin5xx_spi_chip spidev_chip_info = {
532 .enable_dma = 0,
533 .bits_per_word = 8,
535 #endif
537 static struct spi_board_info bfin_spi_board_info[] __initdata = {
538 #if defined(CONFIG_MTD_M25P80) \
539 || defined(CONFIG_MTD_M25P80_MODULE)
541 /* the modalias must be the same as spi device driver name */
542 .modalias = "m25p80", /* Name of spi_driver for this device */
543 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
544 .bus_num = 0, /* Framework bus number */
545 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
546 .platform_data = &bfin_spi_flash_data,
547 .controller_data = &spi_flash_chip_info,
548 .mode = SPI_MODE_3,
550 #endif
552 #if defined(CONFIG_SPI_ADC_BF533) \
553 || defined(CONFIG_SPI_ADC_BF533_MODULE)
555 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
556 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
557 .bus_num = 0, /* Framework bus number */
558 .chip_select = 1, /* Framework chip select. */
559 .platform_data = NULL, /* No spi_driver specific config */
560 .controller_data = &spi_adc_chip_info,
562 #endif
564 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
565 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
567 .modalias = "ad1836-spi",
568 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
569 .bus_num = 0,
570 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
571 .controller_data = &ad1836_spi_chip_info,
573 #endif
574 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
576 .modalias = "ad9960-spi",
577 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
578 .bus_num = 0,
579 .chip_select = 1,
580 .controller_data = &ad9960_spi_chip_info,
582 #endif
583 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
585 .modalias = "spi_mmc_dummy",
586 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
587 .bus_num = 0,
588 .chip_select = 0,
589 .platform_data = NULL,
590 .controller_data = &spi_mmc_chip_info,
591 .mode = SPI_MODE_3,
594 .modalias = "spi_mmc",
595 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
596 .bus_num = 0,
597 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
598 .platform_data = NULL,
599 .controller_data = &spi_mmc_chip_info,
600 .mode = SPI_MODE_3,
602 #endif
603 #if defined(CONFIG_PBX)
605 .modalias = "fxs-spi",
606 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
607 .bus_num = 0,
608 .chip_select = 8 - CONFIG_J11_JUMPER,
609 .controller_data = &spi_si3xxx_chip_info,
610 .mode = SPI_MODE_3,
613 .modalias = "fxo-spi",
614 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
615 .bus_num = 0,
616 .chip_select = 8 - CONFIG_J19_JUMPER,
617 .controller_data = &spi_si3xxx_chip_info,
618 .mode = SPI_MODE_3,
620 #endif
621 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
622 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
624 .modalias = "ad5304_spi",
625 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
626 .bus_num = 0,
627 .chip_select = 2,
628 .platform_data = NULL,
629 .controller_data = &ad5304_chip_info,
630 .mode = SPI_MODE_2,
632 #endif
633 =======
634 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
635 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
637 .modalias = "ad7877",
638 .platform_data = &bfin_ad7877_ts_info,
639 .irq = IRQ_PF6,
640 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
641 .bus_num = 0,
642 .chip_select = 1,
643 .controller_data = &spi_ad7877_chip_info,
645 #endif
646 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
648 .modalias = "spidev",
649 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
650 .bus_num = 0,
651 .chip_select = 1,
652 .controller_data = &spidev_chip_info,
654 #endif
657 /* SPI controller data */
658 static struct bfin5xx_spi_master bfin_spi0_info = {
659 .num_chipselect = 8,
660 .enable_dma = 1, /* master has the ability to do dma transfer */
661 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
664 /* SPI (0) */
665 static struct resource bfin_spi0_resource[] = {
666 [0] = {
667 .start = SPI0_REGBASE,
668 .end = SPI0_REGBASE + 0xFF,
669 .flags = IORESOURCE_MEM,
671 [1] = {
672 .start = CH_SPI,
673 .end = CH_SPI,
674 .flags = IORESOURCE_IRQ,
678 static struct platform_device bfin_spi0_device = {
679 .name = "bfin-spi",
680 .id = 0, /* Bus number */
681 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
682 .resource = bfin_spi0_resource,
683 .dev = {
684 .platform_data = &bfin_spi0_info, /* Passed to driver */
687 #endif /* spi master and devices */
689 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
690 static struct platform_device bfin_fb_device = {
691 .name = "bf537-lq035",
693 #endif
695 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
696 static struct platform_device bfin_fb_adv7393_device = {
697 .name = "bfin-adv7393",
699 #endif
701 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
702 static struct resource bfin_uart_resources[] = {
703 #ifdef CONFIG_SERIAL_BFIN_UART0
705 .start = 0xFFC00400,
706 .end = 0xFFC004FF,
707 .flags = IORESOURCE_MEM,
709 #endif
710 #ifdef CONFIG_SERIAL_BFIN_UART1
712 .start = 0xFFC02000,
713 .end = 0xFFC020FF,
714 .flags = IORESOURCE_MEM,
716 #endif
719 static struct platform_device bfin_uart_device = {
720 .name = "bfin-uart",
721 .id = 1,
722 .num_resources = ARRAY_SIZE(bfin_uart_resources),
723 .resource = bfin_uart_resources,
725 #endif
727 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
728 static struct resource bfin_twi0_resource[] = {
729 [0] = {
730 .start = TWI0_REGBASE,
731 .end = TWI0_REGBASE,
732 .flags = IORESOURCE_MEM,
734 [1] = {
735 .start = IRQ_TWI,
736 .end = IRQ_TWI,
737 .flags = IORESOURCE_IRQ,
741 static struct platform_device i2c_bfin_twi_device = {
742 .name = "i2c-bfin-twi",
743 .id = 0,
744 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
745 .resource = bfin_twi0_resource,
747 #endif
749 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
750 static struct platform_device bfin_sport0_uart_device = {
751 .name = "bfin-sport-uart",
752 .id = 0,
755 static struct platform_device bfin_sport1_uart_device = {
756 .name = "bfin-sport-uart",
757 .id = 1,
759 #endif
761 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
762 #define PATA_INT 55
764 static struct pata_platform_info bfin_pata_platform_data = {
765 .ioport_shift = 1,
766 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
769 static struct resource bfin_pata_resources[] = {
771 .start = 0x20314020,
772 .end = 0x2031403F,
773 .flags = IORESOURCE_MEM,
776 .start = 0x2031401C,
777 .end = 0x2031401F,
778 .flags = IORESOURCE_MEM,
781 .start = PATA_INT,
782 .end = PATA_INT,
783 .flags = IORESOURCE_IRQ,
787 static struct platform_device bfin_pata_device = {
788 .name = "pata_platform",
789 .id = -1,
790 .num_resources = ARRAY_SIZE(bfin_pata_resources),
791 .resource = bfin_pata_resources,
792 .dev = {
793 .platform_data = &bfin_pata_platform_data,
796 #endif
798 static struct platform_device *stamp_devices[] __initdata = {
799 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
800 &bfin_pcmcia_cf_device,
801 #endif
803 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
804 &rtc_device,
805 #endif
807 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
808 &sl811_hcd_device,
809 #endif
811 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
812 &isp1362_hcd_device,
813 #endif
815 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
816 &smc91x_device,
817 #endif
819 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
820 &dm9000_device,
821 #endif
823 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
824 &ax88180_device,
825 #endif
827 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
828 &bfin_mac_device,
829 #endif
831 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
832 &net2272_bfin_device,
833 #endif
835 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
836 &bfin_spi0_device,
837 #endif
839 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
840 &bfin_fb_device,
841 #endif
843 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
844 &bfin_fb_adv7393_device,
845 #endif
847 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
848 &bfin_uart_device,
849 #endif
851 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
852 &i2c_bfin_twi_device,
853 #endif
855 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
856 &bfin_sport0_uart_device,
857 &bfin_sport1_uart_device,
858 #endif
860 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
861 &bfin_pata_device,
862 #endif
864 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
865 &bfin_device_gpiokeys,
866 #endif
867 <<<<<<< HEAD:arch/blackfin/mach-bf537/boards/stamp.c
868 =======
870 &bfin_gpios_device,
871 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf537/boards/stamp.c
872 &stamp_flash_device,
875 static int __init stamp_init(void)
877 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
878 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
879 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
880 spi_register_board_info(bfin_spi_board_info,
881 ARRAY_SIZE(bfin_spi_board_info));
882 #endif
884 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
885 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
886 #endif
887 return 0;
890 arch_initcall(stamp_init);
892 void native_machine_restart(char *cmd)
894 /* workaround reboot hang when booting from SPI */
895 if ((bfin_read_SYSCR() & 0x7) == 0x3)
896 bfin_gpio_reset_spi0_ssel1();
900 * Currently the MAC address is saved in Flash by U-Boot
902 #define FLASH_MAC 0x203f0000
903 void bfin_get_ether_addr(char *addr)
905 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
906 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
908 EXPORT_SYMBOL(bfin_get_ether_addr);