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>
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/kernel.h>
33 #include <linux/platform_device.h>
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/nand.h>
36 #include <linux/mtd/partitions.h>
37 #include <linux/mtd/plat-ram.h>
38 #include <linux/mtd/physmap.h>
39 #include <linux/spi/spi.h>
40 #include <linux/spi/flash.h>
41 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
42 #include <linux/usb/isp1362.h>
44 #include <linux/ata_platform.h>
45 #include <linux/irq.h>
46 #include <linux/interrupt.h>
47 #include <linux/i2c.h>
48 #include <linux/usb/sl811.h>
50 #include <asm/bfin5xx_spi.h>
51 #include <asm/reboot.h>
52 #include <asm/portmux.h>
56 * Name the Board for the /proc/cpuinfo
58 const char bfin_board_name[] = "ADDS-BF537-STAMP";
61 * Driver needs to know address, irq and flag pin.
64 #define ISP1761_BASE 0x203C0000
65 #define ISP1761_IRQ IRQ_PF7
67 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
68 static struct resource bfin_isp1761_resources[] = {
70 .name = "isp1761-regs",
71 .start = ISP1761_BASE + 0x00000000,
72 .end = ISP1761_BASE + 0x000fffff,
73 .flags = IORESOURCE_MEM,
78 .flags = IORESOURCE_IRQ,
82 static struct platform_device bfin_isp1761_device = {
85 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
86 .resource = bfin_isp1761_resources,
89 static struct platform_device *bfin_isp1761_devices[] = {
93 int __init bfin_isp1761_init(void)
95 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
97 printk(KERN_INFO "%s(): registering device resources\n", __func__);
98 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
100 return platform_add_devices(bfin_isp1761_devices, num_devices);
103 void __exit bfin_isp1761_exit(void)
105 platform_device_unregister(&bfin_isp1761_device);
108 arch_initcall(bfin_isp1761_init);
111 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
112 #include <linux/input.h>
113 #include <linux/gpio_keys.h>
115 static struct gpio_keys_button bfin_gpio_keys_table[] = {
116 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
117 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
118 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
119 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
122 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
123 .buttons = bfin_gpio_keys_table,
124 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
127 static struct platform_device bfin_device_gpiokeys = {
130 .platform_data = &bfin_gpio_keys_data,
135 static struct resource bfin_gpios_resources = {
137 .end = MAX_BLACKFIN_GPIOS - 1,
138 .flags = IORESOURCE_IRQ,
141 static struct platform_device bfin_gpios_device = {
142 .name = "simple-gpio",
145 .resource = &bfin_gpios_resources,
148 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
149 static struct resource bfin_pcmcia_cf_resources[] = {
151 .start = 0x20310000, /* IO PORT */
153 .flags = IORESOURCE_MEM,
155 .start = 0x20311000, /* Attribute Memory */
157 .flags = IORESOURCE_MEM,
161 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
163 .start = 6, /* Card Detect PF6 */
165 .flags = IORESOURCE_IRQ,
169 static struct platform_device bfin_pcmcia_cf_device = {
170 .name = "bfin_cf_pcmcia",
172 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
173 .resource = bfin_pcmcia_cf_resources,
177 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
178 static struct platform_device rtc_device = {
184 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
185 static struct resource smc91x_resources[] = {
187 .name = "smc91x-regs",
189 .end = 0x20300300 + 16,
190 .flags = IORESOURCE_MEM,
195 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
198 static struct platform_device smc91x_device = {
201 .num_resources = ARRAY_SIZE(smc91x_resources),
202 .resource = smc91x_resources,
206 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
207 static struct resource dm9000_resources[] = {
210 .end = 0x203FB800 + 8,
211 .flags = IORESOURCE_MEM,
216 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
220 static struct platform_device dm9000_device = {
223 .num_resources = ARRAY_SIZE(dm9000_resources),
224 .resource = dm9000_resources,
228 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
229 static struct resource ax88180_resources[] = {
232 .end = 0x20300000 + 0x8000,
233 .flags = IORESOURCE_MEM,
238 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
242 static struct platform_device ax88180_device = {
245 .num_resources = ARRAY_SIZE(ax88180_resources),
246 .resource = ax88180_resources,
250 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
251 static struct resource sl811_hcd_resources[] = {
255 .flags = IORESOURCE_MEM,
259 .flags = IORESOURCE_MEM,
261 .start = CONFIG_USB_SL811_BFIN_IRQ,
262 .end = CONFIG_USB_SL811_BFIN_IRQ,
263 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
267 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
268 void sl811_port_power(struct device *dev, int is_on)
270 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
271 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
275 static struct sl811_platform_data sl811_priv = {
277 .power = 250, /* == 500mA */
278 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
279 .port_power = &sl811_port_power,
283 static struct platform_device sl811_hcd_device = {
287 .platform_data = &sl811_priv,
289 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
290 .resource = sl811_hcd_resources,
294 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
295 static struct resource isp1362_hcd_resources[] = {
299 .flags = IORESOURCE_MEM,
303 .flags = IORESOURCE_MEM,
305 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
306 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
307 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
311 static struct isp1362_platform_data isp1362_priv = {
316 .int_edge_triggered = 0,
317 .remote_wakeup_connected = 0,
318 .no_power_switching = 1,
319 .power_switching_mode = 0,
322 static struct platform_device isp1362_hcd_device = {
323 .name = "isp1362-hcd",
326 .platform_data = &isp1362_priv,
328 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
329 .resource = isp1362_hcd_resources,
333 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
334 static struct platform_device bfin_mac_device = {
339 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
340 static struct resource net2272_bfin_resources[] = {
343 .end = 0x20300000 + 0x100,
344 .flags = IORESOURCE_MEM,
348 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
352 static struct platform_device net2272_bfin_device = {
355 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
356 .resource = net2272_bfin_resources,
360 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
361 #ifdef CONFIG_MTD_PARTITIONS
362 const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
364 static struct mtd_partition bfin_plat_nand_partitions[] = {
366 .name = "linux kernel(nand)",
370 .name = "file system(nand)",
371 .size = MTDPART_SIZ_FULL,
372 .offset = MTDPART_OFS_APPEND,
377 #define BFIN_NAND_PLAT_CLE 2
378 #define BFIN_NAND_PLAT_ALE 1
379 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
381 struct nand_chip *this = mtd->priv;
383 if (cmd == NAND_CMD_NONE)
387 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
389 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
392 #define BFIN_NAND_PLAT_READY GPIO_PF3
393 static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
395 return gpio_get_value(BFIN_NAND_PLAT_READY);
398 static struct platform_nand_data bfin_plat_nand_data = {
401 #ifdef CONFIG_MTD_PARTITIONS
402 .part_probe_types = part_probes,
403 .partitions = bfin_plat_nand_partitions,
404 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
408 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
409 .dev_ready = bfin_plat_nand_dev_ready,
413 #define MAX(x, y) (x > y ? x : y)
414 static struct resource bfin_plat_nand_resources = {
416 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
417 .flags = IORESOURCE_IO,
420 static struct platform_device bfin_async_nand_device = {
424 .resource = &bfin_plat_nand_resources,
426 .platform_data = &bfin_plat_nand_data,
430 static void bfin_plat_nand_init(void)
432 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
435 static void bfin_plat_nand_init(void) {}
438 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
439 static struct mtd_partition stamp_partitions[] = {
441 .name = "bootloader(nor)",
445 .name = "linux kernel(nor)",
447 .offset = MTDPART_OFS_APPEND,
449 .name = "file system(nor)",
450 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
451 .offset = MTDPART_OFS_APPEND,
453 .name = "MAC Address(nor)",
454 .size = MTDPART_SIZ_FULL,
456 .mask_flags = MTD_WRITEABLE,
460 static struct physmap_flash_data stamp_flash_data = {
462 .parts = stamp_partitions,
463 .nr_parts = ARRAY_SIZE(stamp_partitions),
466 static struct resource stamp_flash_resource = {
469 .flags = IORESOURCE_MEM,
472 static struct platform_device stamp_flash_device = {
473 .name = "physmap-flash",
476 .platform_data = &stamp_flash_data,
479 .resource = &stamp_flash_resource,
483 #if defined(CONFIG_MTD_M25P80) \
484 || defined(CONFIG_MTD_M25P80_MODULE)
485 static struct mtd_partition bfin_spi_flash_partitions[] = {
487 .name = "bootloader(spi)",
490 .mask_flags = MTD_CAP_ROM
492 .name = "linux kernel(spi)",
494 .offset = MTDPART_OFS_APPEND,
496 .name = "file system(spi)",
497 .size = MTDPART_SIZ_FULL,
498 .offset = MTDPART_OFS_APPEND,
502 static struct flash_platform_data bfin_spi_flash_data = {
504 .parts = bfin_spi_flash_partitions,
505 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
509 /* SPI flash chip (m25p64) */
510 static struct bfin5xx_spi_chip spi_flash_chip_info = {
511 .enable_dma = 0, /* use dma transfer with this chip*/
516 #if defined(CONFIG_SPI_ADC_BF533) \
517 || defined(CONFIG_SPI_ADC_BF533_MODULE)
519 static struct bfin5xx_spi_chip spi_adc_chip_info = {
520 .enable_dma = 1, /* use dma transfer with this chip*/
525 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
526 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
527 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
533 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
534 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
540 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
541 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
547 #if defined(CONFIG_PBX)
548 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
549 .ctl_reg = 0x4, /* send zero */
552 .cs_change_per_word = 1,
556 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
557 #include <linux/spi/ad7877.h>
558 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
563 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
565 .vref_delay_usecs = 50, /* internal, no capacitor */
568 .pressure_max = 1000,
570 .stopacq_polarity = 1,
571 .first_conversion_delay = 3,
572 .acquisition_time = 1,
574 .pen_down_acc_interval = 1,
578 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
579 #include <linux/spi/ad7879.h>
580 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
581 .model = 7879, /* Model = AD7879 */
582 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
583 .pressure_max = 10000,
585 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
586 .acquisition_time = 1, /* 4us acquisition time per sample */
587 .median = 2, /* do 8 measurements */
588 .averaging = 1, /* take the average of 4 middle samples */
589 .pen_down_acc_interval = 255, /* 9.4 ms */
590 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
591 .gpio_default = 1, /* During initialization set GPIO = HIGH */
595 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
596 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
602 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
603 static struct bfin5xx_spi_chip spidev_chip_info = {
609 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
610 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
616 #if defined(CONFIG_MTD_DATAFLASH) \
617 || defined(CONFIG_MTD_DATAFLASH_MODULE)
619 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
621 .name = "bootloader(spi)",
624 .mask_flags = MTD_CAP_ROM
626 .name = "linux kernel(spi)",
628 .offset = MTDPART_OFS_APPEND,
630 .name = "file system(spi)",
631 .size = MTDPART_SIZ_FULL,
632 .offset = MTDPART_OFS_APPEND,
636 static struct flash_platform_data bfin_spi_dataflash_data = {
637 .name = "SPI Dataflash",
638 .parts = bfin_spi_dataflash_partitions,
639 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
643 static struct bfin5xx_spi_chip data_flash_chip_info = {
644 .enable_dma = 0, /* use dma transfer with this chip*/
649 static struct spi_board_info bfin_spi_board_info[] __initdata = {
650 #if defined(CONFIG_MTD_M25P80) \
651 || defined(CONFIG_MTD_M25P80_MODULE)
653 /* the modalias must be the same as spi device driver name */
654 .modalias = "m25p80", /* Name of spi_driver for this device */
655 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
656 .bus_num = 0, /* Framework bus number */
657 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
658 .platform_data = &bfin_spi_flash_data,
659 .controller_data = &spi_flash_chip_info,
663 #if defined(CONFIG_MTD_DATAFLASH) \
664 || defined(CONFIG_MTD_DATAFLASH_MODULE)
665 { /* DataFlash chip */
666 .modalias = "mtd_dataflash",
667 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
668 .bus_num = 0, /* Framework bus number */
669 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
670 .platform_data = &bfin_spi_dataflash_data,
671 .controller_data = &data_flash_chip_info,
675 #if defined(CONFIG_SPI_ADC_BF533) \
676 || defined(CONFIG_SPI_ADC_BF533_MODULE)
678 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
679 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
680 .bus_num = 0, /* Framework bus number */
681 .chip_select = 1, /* Framework chip select. */
682 .platform_data = NULL, /* No spi_driver specific config */
683 .controller_data = &spi_adc_chip_info,
687 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
688 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
690 .modalias = "ad1836-spi",
691 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
693 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
694 .controller_data = &ad1836_spi_chip_info,
697 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
699 .modalias = "ad9960-spi",
700 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
703 .controller_data = &ad9960_spi_chip_info,
706 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
708 .modalias = "spi_mmc_dummy",
709 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
712 .platform_data = NULL,
713 .controller_data = &spi_mmc_chip_info,
717 .modalias = "spi_mmc",
718 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
720 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
721 .platform_data = NULL,
722 .controller_data = &spi_mmc_chip_info,
726 #if defined(CONFIG_PBX)
728 .modalias = "fxs-spi",
729 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
731 .chip_select = 8 - CONFIG_J11_JUMPER,
732 .controller_data = &spi_si3xxx_chip_info,
736 .modalias = "fxo-spi",
737 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
739 .chip_select = 8 - CONFIG_J19_JUMPER,
740 .controller_data = &spi_si3xxx_chip_info,
744 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
746 .modalias = "ad7877",
747 .platform_data = &bfin_ad7877_ts_info,
749 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
752 .controller_data = &spi_ad7877_chip_info,
755 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
757 .modalias = "ad7879",
758 .platform_data = &bfin_ad7879_ts_info,
760 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
763 .controller_data = &spi_ad7879_chip_info,
764 .mode = SPI_CPHA | SPI_CPOL,
767 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
769 .modalias = "spidev",
770 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
773 .controller_data = &spidev_chip_info,
776 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
778 .modalias = "bfin-lq035q1-spi",
779 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
782 .controller_data = &lq035q1_spi_chip_info,
783 .mode = SPI_CPHA | SPI_CPOL,
788 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
789 /* SPI controller data */
790 static struct bfin5xx_spi_master bfin_spi0_info = {
792 .enable_dma = 1, /* master has the ability to do dma transfer */
793 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
797 static struct resource bfin_spi0_resource[] = {
799 .start = SPI0_REGBASE,
800 .end = SPI0_REGBASE + 0xFF,
801 .flags = IORESOURCE_MEM,
806 .flags = IORESOURCE_IRQ,
810 static struct platform_device bfin_spi0_device = {
812 .id = 0, /* Bus number */
813 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
814 .resource = bfin_spi0_resource,
816 .platform_data = &bfin_spi0_info, /* Passed to driver */
819 #endif /* spi master and devices */
821 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
822 static struct platform_device bfin_fb_device = {
823 .name = "bf537-lq035",
827 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
828 static struct platform_device bfin_fb_adv7393_device = {
829 .name = "bfin-adv7393",
833 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
834 #include <asm/bfin-lq035q1.h>
836 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
837 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
838 .use_bl = 0, /* let something else control the LCD Blacklight */
842 static struct resource bfin_lq035q1_resources[] = {
844 .start = IRQ_PPI_ERROR,
845 .end = IRQ_PPI_ERROR,
846 .flags = IORESOURCE_IRQ,
850 static struct platform_device bfin_lq035q1_device = {
851 .name = "bfin-lq035q1",
853 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
854 .resource = bfin_lq035q1_resources,
856 .platform_data = &bfin_lq035q1_data,
861 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
862 static struct resource bfin_uart_resources[] = {
863 #ifdef CONFIG_SERIAL_BFIN_UART0
867 .flags = IORESOURCE_MEM,
870 #ifdef CONFIG_SERIAL_BFIN_UART1
874 .flags = IORESOURCE_MEM,
879 static struct platform_device bfin_uart_device = {
882 .num_resources = ARRAY_SIZE(bfin_uart_resources),
883 .resource = bfin_uart_resources,
887 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
888 static struct resource bfin_sir_resources[] = {
889 #ifdef CONFIG_BFIN_SIR0
893 .flags = IORESOURCE_MEM,
896 #ifdef CONFIG_BFIN_SIR1
900 .flags = IORESOURCE_MEM,
905 static struct platform_device bfin_sir_device = {
908 .num_resources = ARRAY_SIZE(bfin_sir_resources),
909 .resource = bfin_sir_resources,
913 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
914 static struct resource bfin_twi0_resource[] = {
916 .start = TWI0_REGBASE,
918 .flags = IORESOURCE_MEM,
923 .flags = IORESOURCE_IRQ,
927 static struct platform_device i2c_bfin_twi_device = {
928 .name = "i2c-bfin-twi",
930 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
931 .resource = bfin_twi0_resource,
935 #ifdef CONFIG_I2C_BOARDINFO
936 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
937 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
939 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
943 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
945 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
948 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
950 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
954 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
956 I2C_BOARD_INFO("ad7879", 0x2F),
958 .platform_data = (void *)&bfin_ad7879_ts_info,
964 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
965 static struct platform_device bfin_sport0_uart_device = {
966 .name = "bfin-sport-uart",
970 static struct platform_device bfin_sport1_uart_device = {
971 .name = "bfin-sport-uart",
976 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
977 #define PATA_INT IRQ_PF5
979 static struct pata_platform_info bfin_pata_platform_data = {
981 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
984 static struct resource bfin_pata_resources[] = {
988 .flags = IORESOURCE_MEM,
993 .flags = IORESOURCE_MEM,
998 .flags = IORESOURCE_IRQ,
1002 static struct platform_device bfin_pata_device = {
1003 .name = "pata_platform",
1005 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1006 .resource = bfin_pata_resources,
1008 .platform_data = &bfin_pata_platform_data,
1013 static const unsigned int cclk_vlev_datasheet[] =
1015 VRPAIR(VLEV_085, 250000000),
1016 VRPAIR(VLEV_090, 376000000),
1017 VRPAIR(VLEV_095, 426000000),
1018 VRPAIR(VLEV_100, 426000000),
1019 VRPAIR(VLEV_105, 476000000),
1020 VRPAIR(VLEV_110, 476000000),
1021 VRPAIR(VLEV_115, 476000000),
1022 VRPAIR(VLEV_120, 500000000),
1023 VRPAIR(VLEV_125, 533000000),
1024 VRPAIR(VLEV_130, 600000000),
1027 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1028 .tuple_tab = cclk_vlev_datasheet,
1029 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1030 .vr_settling_time = 25 /* us */,
1033 static struct platform_device bfin_dpmc = {
1034 .name = "bfin dpmc",
1036 .platform_data = &bfin_dmpc_vreg_data,
1040 static struct platform_device *stamp_devices[] __initdata = {
1044 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1045 &bfin_pcmcia_cf_device,
1048 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1052 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1056 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1057 &isp1362_hcd_device,
1060 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1064 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1068 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1072 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1076 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1077 &net2272_bfin_device,
1080 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1084 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1088 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1089 &bfin_lq035q1_device,
1092 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1093 &bfin_fb_adv7393_device,
1096 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1100 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1104 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1105 &i2c_bfin_twi_device,
1108 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1109 &bfin_sport0_uart_device,
1110 &bfin_sport1_uart_device,
1113 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1117 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1118 &bfin_device_gpiokeys,
1123 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1124 &bfin_async_nand_device,
1127 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1128 &stamp_flash_device,
1132 static int __init stamp_init(void)
1134 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1136 #ifdef CONFIG_I2C_BOARDINFO
1137 i2c_register_board_info(0, bfin_i2c_board_info,
1138 ARRAY_SIZE(bfin_i2c_board_info));
1141 bfin_plat_nand_init();
1142 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1143 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1145 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1146 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1152 arch_initcall(stamp_init);
1154 void native_machine_restart(char *cmd)
1156 /* workaround reboot hang when booting from SPI */
1157 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1158 bfin_gpio_reset_spi0_ssel1();
1162 * Currently the MAC address is saved in Flash by U-Boot
1164 #define FLASH_MAC 0x203f0000
1165 void bfin_get_ether_addr(char *addr)
1167 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1168 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1170 EXPORT_SYMBOL(bfin_get_ether_addr);