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>
49 #include <linux/spi/mmc_spi.h>
51 #include <asm/bfin5xx_spi.h>
52 #include <asm/reboot.h>
53 #include <asm/portmux.h>
57 * Name the Board for the /proc/cpuinfo
59 const char bfin_board_name[] = "ADI BF537-STAMP";
62 * Driver needs to know address, irq and flag pin.
65 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
66 #include <linux/usb/isp1760.h>
67 static struct resource bfin_isp1760_resources[] = {
70 .end = 0x203C0000 + 0x000fffff,
71 .flags = IORESOURCE_MEM,
76 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
80 static struct isp1760_platform_data isp1760_priv = {
86 .dack_polarity_high = 0,
87 .dreq_polarity_high = 0,
90 static struct platform_device bfin_isp1760_device = {
91 .name = "isp1760-hcd",
94 .platform_data = &isp1760_priv,
96 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
97 .resource = bfin_isp1760_resources,
101 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
102 #include <linux/input.h>
103 #include <linux/gpio_keys.h>
105 static struct gpio_keys_button bfin_gpio_keys_table[] = {
106 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
107 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
108 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
109 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
112 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
113 .buttons = bfin_gpio_keys_table,
114 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
117 static struct platform_device bfin_device_gpiokeys = {
120 .platform_data = &bfin_gpio_keys_data,
125 static struct resource bfin_gpios_resources = {
127 .end = MAX_BLACKFIN_GPIOS - 1,
128 .flags = IORESOURCE_IRQ,
131 static struct platform_device bfin_gpios_device = {
132 .name = "simple-gpio",
135 .resource = &bfin_gpios_resources,
138 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
139 static struct resource bfin_pcmcia_cf_resources[] = {
141 .start = 0x20310000, /* IO PORT */
143 .flags = IORESOURCE_MEM,
145 .start = 0x20311000, /* Attribute Memory */
147 .flags = IORESOURCE_MEM,
151 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
153 .start = 6, /* Card Detect PF6 */
155 .flags = IORESOURCE_IRQ,
159 static struct platform_device bfin_pcmcia_cf_device = {
160 .name = "bfin_cf_pcmcia",
162 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
163 .resource = bfin_pcmcia_cf_resources,
167 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
168 static struct platform_device rtc_device = {
174 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
175 static struct resource smc91x_resources[] = {
177 .name = "smc91x-regs",
179 .end = 0x20300300 + 16,
180 .flags = IORESOURCE_MEM,
185 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
188 static struct platform_device smc91x_device = {
191 .num_resources = ARRAY_SIZE(smc91x_resources),
192 .resource = smc91x_resources,
196 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
197 static struct resource dm9000_resources[] = {
200 .end = 0x203FB800 + 8,
201 .flags = IORESOURCE_MEM,
206 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
210 static struct platform_device dm9000_device = {
213 .num_resources = ARRAY_SIZE(dm9000_resources),
214 .resource = dm9000_resources,
218 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
219 static struct resource ax88180_resources[] = {
222 .end = 0x20300000 + 0x8000,
223 .flags = IORESOURCE_MEM,
228 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
232 static struct platform_device ax88180_device = {
235 .num_resources = ARRAY_SIZE(ax88180_resources),
236 .resource = ax88180_resources,
240 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
241 static struct resource sl811_hcd_resources[] = {
245 .flags = IORESOURCE_MEM,
249 .flags = IORESOURCE_MEM,
251 .start = CONFIG_USB_SL811_BFIN_IRQ,
252 .end = CONFIG_USB_SL811_BFIN_IRQ,
253 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
257 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
258 void sl811_port_power(struct device *dev, int is_on)
260 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
261 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
265 static struct sl811_platform_data sl811_priv = {
267 .power = 250, /* == 500mA */
268 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
269 .port_power = &sl811_port_power,
273 static struct platform_device sl811_hcd_device = {
277 .platform_data = &sl811_priv,
279 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
280 .resource = sl811_hcd_resources,
284 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
285 static struct resource isp1362_hcd_resources[] = {
289 .flags = IORESOURCE_MEM,
293 .flags = IORESOURCE_MEM,
295 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
296 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
297 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
301 static struct isp1362_platform_data isp1362_priv = {
306 .int_edge_triggered = 0,
307 .remote_wakeup_connected = 0,
308 .no_power_switching = 1,
309 .power_switching_mode = 0,
312 static struct platform_device isp1362_hcd_device = {
313 .name = "isp1362-hcd",
316 .platform_data = &isp1362_priv,
318 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
319 .resource = isp1362_hcd_resources,
323 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
324 static struct platform_device bfin_mii_bus = {
325 .name = "bfin_mii_bus",
328 static struct platform_device bfin_mac_device = {
330 .dev.platform_data = &bfin_mii_bus,
334 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
335 static struct resource net2272_bfin_resources[] = {
338 .end = 0x20300000 + 0x100,
339 .flags = IORESOURCE_MEM,
343 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
347 static struct platform_device net2272_bfin_device = {
350 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
351 .resource = net2272_bfin_resources,
355 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
356 #ifdef CONFIG_MTD_PARTITIONS
357 const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
359 static struct mtd_partition bfin_plat_nand_partitions[] = {
361 .name = "linux kernel(nand)",
365 .name = "file system(nand)",
366 .size = MTDPART_SIZ_FULL,
367 .offset = MTDPART_OFS_APPEND,
372 #define BFIN_NAND_PLAT_CLE 2
373 #define BFIN_NAND_PLAT_ALE 1
374 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
376 struct nand_chip *this = mtd->priv;
378 if (cmd == NAND_CMD_NONE)
382 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
384 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
387 #define BFIN_NAND_PLAT_READY GPIO_PF3
388 static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
390 return gpio_get_value(BFIN_NAND_PLAT_READY);
393 static struct platform_nand_data bfin_plat_nand_data = {
396 #ifdef CONFIG_MTD_PARTITIONS
397 .part_probe_types = part_probes,
398 .partitions = bfin_plat_nand_partitions,
399 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
403 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
404 .dev_ready = bfin_plat_nand_dev_ready,
408 #define MAX(x, y) (x > y ? x : y)
409 static struct resource bfin_plat_nand_resources = {
411 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
412 .flags = IORESOURCE_IO,
415 static struct platform_device bfin_async_nand_device = {
419 .resource = &bfin_plat_nand_resources,
421 .platform_data = &bfin_plat_nand_data,
425 static void bfin_plat_nand_init(void)
427 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
430 static void bfin_plat_nand_init(void) {}
433 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
434 static struct mtd_partition stamp_partitions[] = {
436 .name = "bootloader(nor)",
440 .name = "linux kernel(nor)",
442 .offset = MTDPART_OFS_APPEND,
444 .name = "file system(nor)",
445 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
446 .offset = MTDPART_OFS_APPEND,
448 .name = "MAC Address(nor)",
449 .size = MTDPART_SIZ_FULL,
451 .mask_flags = MTD_WRITEABLE,
455 static struct physmap_flash_data stamp_flash_data = {
457 .parts = stamp_partitions,
458 .nr_parts = ARRAY_SIZE(stamp_partitions),
461 static struct resource stamp_flash_resource = {
464 .flags = IORESOURCE_MEM,
467 static struct platform_device stamp_flash_device = {
468 .name = "physmap-flash",
471 .platform_data = &stamp_flash_data,
474 .resource = &stamp_flash_resource,
478 #if defined(CONFIG_MTD_M25P80) \
479 || defined(CONFIG_MTD_M25P80_MODULE)
480 static struct mtd_partition bfin_spi_flash_partitions[] = {
482 .name = "bootloader(spi)",
485 .mask_flags = MTD_CAP_ROM
487 .name = "linux kernel(spi)",
489 .offset = MTDPART_OFS_APPEND,
491 .name = "file system(spi)",
492 .size = MTDPART_SIZ_FULL,
493 .offset = MTDPART_OFS_APPEND,
497 static struct flash_platform_data bfin_spi_flash_data = {
499 .parts = bfin_spi_flash_partitions,
500 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
501 /* .type = "m25p64", */
504 /* SPI flash chip (m25p64) */
505 static struct bfin5xx_spi_chip spi_flash_chip_info = {
506 .enable_dma = 0, /* use dma transfer with this chip*/
511 #if defined(CONFIG_SPI_ADC_BF533) \
512 || defined(CONFIG_SPI_ADC_BF533_MODULE)
514 static struct bfin5xx_spi_chip spi_adc_chip_info = {
515 .enable_dma = 1, /* use dma transfer with this chip*/
520 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
521 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
522 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
528 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
529 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
535 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
536 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
538 static int bfin_mmc_spi_init(struct device *dev,
539 irqreturn_t (*detect_int)(int, void *), void *data)
541 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
542 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
545 static void bfin_mmc_spi_exit(struct device *dev, void *data)
547 free_irq(MMC_SPI_CARD_DETECT_INT, data);
550 static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
551 .init = bfin_mmc_spi_init,
552 .exit = bfin_mmc_spi_exit,
553 .detect_delay = 100, /* msecs */
556 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
562 #if defined(CONFIG_PBX)
563 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
564 .ctl_reg = 0x4, /* send zero */
567 .cs_change_per_word = 1,
571 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
572 #include <linux/spi/ad7877.h>
573 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
578 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
580 .vref_delay_usecs = 50, /* internal, no capacitor */
583 .pressure_max = 1000,
585 .stopacq_polarity = 1,
586 .first_conversion_delay = 3,
587 .acquisition_time = 1,
589 .pen_down_acc_interval = 1,
593 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
594 #include <linux/spi/ad7879.h>
595 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
596 .model = 7879, /* Model = AD7879 */
597 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
598 .pressure_max = 10000,
600 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
601 .acquisition_time = 1, /* 4us acquisition time per sample */
602 .median = 2, /* do 8 measurements */
603 .averaging = 1, /* take the average of 4 middle samples */
604 .pen_down_acc_interval = 255, /* 9.4 ms */
605 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
606 .gpio_default = 1, /* During initialization set GPIO = HIGH */
610 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
611 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
617 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
618 static struct bfin5xx_spi_chip spidev_chip_info = {
624 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
625 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
631 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
632 static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
635 .cs_gpio = GPIO_PF10,
639 #if defined(CONFIG_MTD_DATAFLASH) \
640 || defined(CONFIG_MTD_DATAFLASH_MODULE)
642 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
644 .name = "bootloader(spi)",
647 .mask_flags = MTD_CAP_ROM
649 .name = "linux kernel(spi)",
651 .offset = MTDPART_OFS_APPEND,
653 .name = "file system(spi)",
654 .size = MTDPART_SIZ_FULL,
655 .offset = MTDPART_OFS_APPEND,
659 static struct flash_platform_data bfin_spi_dataflash_data = {
660 .name = "SPI Dataflash",
661 .parts = bfin_spi_dataflash_partitions,
662 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
666 static struct bfin5xx_spi_chip data_flash_chip_info = {
667 .enable_dma = 0, /* use dma transfer with this chip*/
672 static struct spi_board_info bfin_spi_board_info[] __initdata = {
673 #if defined(CONFIG_MTD_M25P80) \
674 || defined(CONFIG_MTD_M25P80_MODULE)
676 /* the modalias must be the same as spi device driver name */
677 .modalias = "m25p80", /* Name of spi_driver for this device */
678 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
679 .bus_num = 0, /* Framework bus number */
680 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
681 .platform_data = &bfin_spi_flash_data,
682 .controller_data = &spi_flash_chip_info,
686 #if defined(CONFIG_MTD_DATAFLASH) \
687 || defined(CONFIG_MTD_DATAFLASH_MODULE)
688 { /* DataFlash chip */
689 .modalias = "mtd_dataflash",
690 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
691 .bus_num = 0, /* Framework bus number */
692 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
693 .platform_data = &bfin_spi_dataflash_data,
694 .controller_data = &data_flash_chip_info,
698 #if defined(CONFIG_SPI_ADC_BF533) \
699 || defined(CONFIG_SPI_ADC_BF533_MODULE)
701 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
702 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
703 .bus_num = 0, /* Framework bus number */
704 .chip_select = 1, /* Framework chip select. */
705 .platform_data = NULL, /* No spi_driver specific config */
706 .controller_data = &spi_adc_chip_info,
710 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
711 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
713 .modalias = "ad1836-spi",
714 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
716 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
717 .controller_data = &ad1836_spi_chip_info,
720 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
722 .modalias = "ad9960-spi",
723 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
726 .controller_data = &ad9960_spi_chip_info,
729 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
731 .modalias = "mmc_spi",
732 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
735 .platform_data = &bfin_mmc_spi_pdata,
736 .controller_data = &mmc_spi_chip_info,
740 #if defined(CONFIG_PBX)
742 .modalias = "fxs-spi",
743 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
745 .chip_select = 8 - CONFIG_J11_JUMPER,
746 .controller_data = &spi_si3xxx_chip_info,
750 .modalias = "fxo-spi",
751 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
753 .chip_select = 8 - CONFIG_J19_JUMPER,
754 .controller_data = &spi_si3xxx_chip_info,
758 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
760 .modalias = "ad7877",
761 .platform_data = &bfin_ad7877_ts_info,
763 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
766 .controller_data = &spi_ad7877_chip_info,
769 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
771 .modalias = "ad7879",
772 .platform_data = &bfin_ad7879_ts_info,
774 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
777 .controller_data = &spi_ad7879_chip_info,
778 .mode = SPI_CPHA | SPI_CPOL,
781 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
783 .modalias = "spidev",
784 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
787 .controller_data = &spidev_chip_info,
790 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
792 .modalias = "bfin-lq035q1-spi",
793 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
796 .controller_data = &lq035q1_spi_chip_info,
797 .mode = SPI_CPHA | SPI_CPOL,
800 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
802 .modalias = "enc28j60",
803 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
806 .chip_select = 0, /* GPIO controlled SSEL */
807 .controller_data = &enc28j60_spi_chip_info,
813 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
814 /* SPI controller data */
815 static struct bfin5xx_spi_master bfin_spi0_info = {
817 .enable_dma = 1, /* master has the ability to do dma transfer */
818 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
822 static struct resource bfin_spi0_resource[] = {
824 .start = SPI0_REGBASE,
825 .end = SPI0_REGBASE + 0xFF,
826 .flags = IORESOURCE_MEM,
831 .flags = IORESOURCE_IRQ,
835 static struct platform_device bfin_spi0_device = {
837 .id = 0, /* Bus number */
838 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
839 .resource = bfin_spi0_resource,
841 .platform_data = &bfin_spi0_info, /* Passed to driver */
844 #endif /* spi master and devices */
846 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
847 static struct platform_device bfin_fb_device = {
848 .name = "bf537-lq035",
852 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
853 static struct platform_device bfin_fb_adv7393_device = {
854 .name = "bfin-adv7393",
858 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
859 #include <asm/bfin-lq035q1.h>
861 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
862 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
863 .use_bl = 0, /* let something else control the LCD Blacklight */
867 static struct resource bfin_lq035q1_resources[] = {
869 .start = IRQ_PPI_ERROR,
870 .end = IRQ_PPI_ERROR,
871 .flags = IORESOURCE_IRQ,
875 static struct platform_device bfin_lq035q1_device = {
876 .name = "bfin-lq035q1",
878 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
879 .resource = bfin_lq035q1_resources,
881 .platform_data = &bfin_lq035q1_data,
886 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
887 static struct resource bfin_uart_resources[] = {
888 #ifdef CONFIG_SERIAL_BFIN_UART0
892 .flags = IORESOURCE_MEM,
895 #ifdef CONFIG_SERIAL_BFIN_UART1
899 .flags = IORESOURCE_MEM,
904 static struct platform_device bfin_uart_device = {
907 .num_resources = ARRAY_SIZE(bfin_uart_resources),
908 .resource = bfin_uart_resources,
912 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
913 #ifdef CONFIG_BFIN_SIR0
914 static struct resource bfin_sir0_resources[] = {
918 .flags = IORESOURCE_MEM,
921 .start = IRQ_UART0_RX,
922 .end = IRQ_UART0_RX+1,
923 .flags = IORESOURCE_IRQ,
926 .start = CH_UART0_RX,
927 .end = CH_UART0_RX+1,
928 .flags = IORESOURCE_DMA,
932 static struct platform_device bfin_sir0_device = {
935 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
936 .resource = bfin_sir0_resources,
939 #ifdef CONFIG_BFIN_SIR1
940 static struct resource bfin_sir1_resources[] = {
944 .flags = IORESOURCE_MEM,
947 .start = IRQ_UART1_RX,
948 .end = IRQ_UART1_RX+1,
949 .flags = IORESOURCE_IRQ,
952 .start = CH_UART1_RX,
953 .end = CH_UART1_RX+1,
954 .flags = IORESOURCE_DMA,
958 static struct platform_device bfin_sir1_device = {
961 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
962 .resource = bfin_sir1_resources,
967 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
968 static struct resource bfin_twi0_resource[] = {
970 .start = TWI0_REGBASE,
972 .flags = IORESOURCE_MEM,
977 .flags = IORESOURCE_IRQ,
981 static struct platform_device i2c_bfin_twi_device = {
982 .name = "i2c-bfin-twi",
984 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
985 .resource = bfin_twi0_resource,
989 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
990 #include <linux/input.h>
991 #include <linux/i2c/adp5588_keys.h>
992 static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1006 [13] = KEY_BACKSLASH,
1018 [26] = KEY_LEFTBRACE,
1019 [27] = KEY_RIGHTBRACE,
1032 [41] = KEY_SEMICOLON,
1033 [42] = KEY_APOSTROPHE,
1034 [43] = KEY_BACKSLASH,
1054 [65] = KEY_BACKSPACE,
1067 static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1070 .keymap = adp5588_keymap,
1071 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1076 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1077 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
1079 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
1083 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
1085 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1088 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
1090 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1094 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1096 I2C_BOARD_INFO("ad7879", 0x2F),
1098 .platform_data = (void *)&bfin_ad7879_ts_info,
1101 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1103 I2C_BOARD_INFO("adp5588-keys", 0x34),
1105 .platform_data = (void *)&adp5588_kpad_data,
1110 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1111 static struct platform_device bfin_sport0_uart_device = {
1112 .name = "bfin-sport-uart",
1116 static struct platform_device bfin_sport1_uart_device = {
1117 .name = "bfin-sport-uart",
1122 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1123 #define PATA_INT IRQ_PF5
1125 static struct pata_platform_info bfin_pata_platform_data = {
1127 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
1130 static struct resource bfin_pata_resources[] = {
1132 .start = 0x20314020,
1134 .flags = IORESOURCE_MEM,
1137 .start = 0x2031401C,
1139 .flags = IORESOURCE_MEM,
1144 .flags = IORESOURCE_IRQ,
1148 static struct platform_device bfin_pata_device = {
1149 .name = "pata_platform",
1151 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1152 .resource = bfin_pata_resources,
1154 .platform_data = &bfin_pata_platform_data,
1159 static const unsigned int cclk_vlev_datasheet[] =
1161 VRPAIR(VLEV_085, 250000000),
1162 VRPAIR(VLEV_090, 376000000),
1163 VRPAIR(VLEV_095, 426000000),
1164 VRPAIR(VLEV_100, 426000000),
1165 VRPAIR(VLEV_105, 476000000),
1166 VRPAIR(VLEV_110, 476000000),
1167 VRPAIR(VLEV_115, 476000000),
1168 VRPAIR(VLEV_120, 500000000),
1169 VRPAIR(VLEV_125, 533000000),
1170 VRPAIR(VLEV_130, 600000000),
1173 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1174 .tuple_tab = cclk_vlev_datasheet,
1175 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1176 .vr_settling_time = 25 /* us */,
1179 static struct platform_device bfin_dpmc = {
1180 .name = "bfin dpmc",
1182 .platform_data = &bfin_dmpc_vreg_data,
1186 static struct platform_device *stamp_devices[] __initdata = {
1190 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1191 &bfin_pcmcia_cf_device,
1194 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1198 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1202 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1203 &isp1362_hcd_device,
1206 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1207 &bfin_isp1760_device,
1210 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1214 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1218 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1222 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1227 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1228 &net2272_bfin_device,
1231 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1235 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1239 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1240 &bfin_lq035q1_device,
1243 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1244 &bfin_fb_adv7393_device,
1247 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1251 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1252 #ifdef CONFIG_BFIN_SIR0
1255 #ifdef CONFIG_BFIN_SIR1
1260 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1261 &i2c_bfin_twi_device,
1264 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1265 &bfin_sport0_uart_device,
1266 &bfin_sport1_uart_device,
1269 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1273 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1274 &bfin_device_gpiokeys,
1279 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1280 &bfin_async_nand_device,
1283 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1284 &stamp_flash_device,
1288 static int __init stamp_init(void)
1290 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1291 i2c_register_board_info(0, bfin_i2c_board_info,
1292 ARRAY_SIZE(bfin_i2c_board_info));
1293 bfin_plat_nand_init();
1294 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1295 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1297 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1298 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1304 arch_initcall(stamp_init);
1306 void native_machine_restart(char *cmd)
1308 /* workaround reboot hang when booting from SPI */
1309 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1310 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1314 * Currently the MAC address is saved in Flash by U-Boot
1316 #define FLASH_MAC 0x203f0000
1317 void bfin_get_ether_addr(char *addr)
1319 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1320 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1322 EXPORT_SYMBOL(bfin_get_ether_addr);