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 struct bfin5xx_spi_chip spi_ad7879_chip_info = {
585 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
586 .model = 7879, /* Model = AD7879 */
587 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
588 .pressure_max = 10000,
590 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
591 .acquisition_time = 1, /* 4us acquisition time per sample */
592 .median = 2, /* do 8 measurements */
593 .averaging = 1, /* take the average of 4 middle samples */
594 .pen_down_acc_interval = 255, /* 9.4 ms */
595 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
596 .gpio_default = 1, /* During initialization set GPIO = HIGH */
600 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
601 static struct bfin5xx_spi_chip spidev_chip_info = {
607 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
608 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
614 #if defined(CONFIG_MTD_DATAFLASH) \
615 || defined(CONFIG_MTD_DATAFLASH_MODULE)
617 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
619 .name = "bootloader(spi)",
622 .mask_flags = MTD_CAP_ROM
624 .name = "linux kernel(spi)",
626 .offset = MTDPART_OFS_APPEND,
628 .name = "file system(spi)",
629 .size = MTDPART_SIZ_FULL,
630 .offset = MTDPART_OFS_APPEND,
634 static struct flash_platform_data bfin_spi_dataflash_data = {
635 .name = "SPI Dataflash",
636 .parts = bfin_spi_dataflash_partitions,
637 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
641 static struct bfin5xx_spi_chip data_flash_chip_info = {
642 .enable_dma = 0, /* use dma transfer with this chip*/
647 static struct spi_board_info bfin_spi_board_info[] __initdata = {
648 #if defined(CONFIG_MTD_M25P80) \
649 || defined(CONFIG_MTD_M25P80_MODULE)
651 /* the modalias must be the same as spi device driver name */
652 .modalias = "m25p80", /* Name of spi_driver for this device */
653 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
654 .bus_num = 0, /* Framework bus number */
655 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
656 .platform_data = &bfin_spi_flash_data,
657 .controller_data = &spi_flash_chip_info,
661 #if defined(CONFIG_MTD_DATAFLASH) \
662 || defined(CONFIG_MTD_DATAFLASH_MODULE)
663 { /* DataFlash chip */
664 .modalias = "mtd_dataflash",
665 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
666 .bus_num = 0, /* Framework bus number */
667 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
668 .platform_data = &bfin_spi_dataflash_data,
669 .controller_data = &data_flash_chip_info,
673 #if defined(CONFIG_SPI_ADC_BF533) \
674 || defined(CONFIG_SPI_ADC_BF533_MODULE)
676 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
677 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
678 .bus_num = 0, /* Framework bus number */
679 .chip_select = 1, /* Framework chip select. */
680 .platform_data = NULL, /* No spi_driver specific config */
681 .controller_data = &spi_adc_chip_info,
685 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
686 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
688 .modalias = "ad1836-spi",
689 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
691 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
692 .controller_data = &ad1836_spi_chip_info,
695 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
697 .modalias = "ad9960-spi",
698 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
701 .controller_data = &ad9960_spi_chip_info,
704 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
706 .modalias = "spi_mmc_dummy",
707 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
710 .platform_data = NULL,
711 .controller_data = &spi_mmc_chip_info,
715 .modalias = "spi_mmc",
716 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
718 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
719 .platform_data = NULL,
720 .controller_data = &spi_mmc_chip_info,
724 #if defined(CONFIG_PBX)
726 .modalias = "fxs-spi",
727 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
729 .chip_select = 8 - CONFIG_J11_JUMPER,
730 .controller_data = &spi_si3xxx_chip_info,
734 .modalias = "fxo-spi",
735 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
737 .chip_select = 8 - CONFIG_J19_JUMPER,
738 .controller_data = &spi_si3xxx_chip_info,
742 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
744 .modalias = "ad7877",
745 .platform_data = &bfin_ad7877_ts_info,
747 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
750 .controller_data = &spi_ad7877_chip_info,
753 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
755 .modalias = "ad7879",
756 .platform_data = &bfin_ad7879_ts_info,
758 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
761 .controller_data = &spi_ad7879_chip_info,
762 .mode = SPI_CPHA | SPI_CPOL,
765 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
767 .modalias = "spidev",
768 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
771 .controller_data = &spidev_chip_info,
774 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
776 .modalias = "bfin-lq035q1-spi",
777 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
780 .controller_data = &lq035q1_spi_chip_info,
781 .mode = SPI_CPHA | SPI_CPOL,
786 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
787 /* SPI controller data */
788 static struct bfin5xx_spi_master bfin_spi0_info = {
790 .enable_dma = 1, /* master has the ability to do dma transfer */
791 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
795 static struct resource bfin_spi0_resource[] = {
797 .start = SPI0_REGBASE,
798 .end = SPI0_REGBASE + 0xFF,
799 .flags = IORESOURCE_MEM,
804 .flags = IORESOURCE_IRQ,
808 static struct platform_device bfin_spi0_device = {
810 .id = 0, /* Bus number */
811 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
812 .resource = bfin_spi0_resource,
814 .platform_data = &bfin_spi0_info, /* Passed to driver */
817 #endif /* spi master and devices */
819 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
820 static struct platform_device bfin_fb_device = {
821 .name = "bf537-lq035",
825 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
826 static struct platform_device bfin_fb_adv7393_device = {
827 .name = "bfin-adv7393",
831 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
832 #include <asm/bfin-lq035q1.h>
834 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
835 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
836 .use_bl = 0, /* let something else control the LCD Blacklight */
840 static struct resource bfin_lq035q1_resources[] = {
842 .start = IRQ_PPI_ERROR,
843 .end = IRQ_PPI_ERROR,
844 .flags = IORESOURCE_IRQ,
848 static struct platform_device bfin_lq035q1_device = {
849 .name = "bfin-lq035q1",
851 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
852 .resource = bfin_lq035q1_resources,
854 .platform_data = &bfin_lq035q1_data,
859 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
860 static struct resource bfin_uart_resources[] = {
861 #ifdef CONFIG_SERIAL_BFIN_UART0
865 .flags = IORESOURCE_MEM,
868 #ifdef CONFIG_SERIAL_BFIN_UART1
872 .flags = IORESOURCE_MEM,
877 static struct platform_device bfin_uart_device = {
880 .num_resources = ARRAY_SIZE(bfin_uart_resources),
881 .resource = bfin_uart_resources,
885 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
886 static struct resource bfin_sir_resources[] = {
887 #ifdef CONFIG_BFIN_SIR0
891 .flags = IORESOURCE_MEM,
894 #ifdef CONFIG_BFIN_SIR1
898 .flags = IORESOURCE_MEM,
903 static struct platform_device bfin_sir_device = {
906 .num_resources = ARRAY_SIZE(bfin_sir_resources),
907 .resource = bfin_sir_resources,
911 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
912 static struct resource bfin_twi0_resource[] = {
914 .start = TWI0_REGBASE,
916 .flags = IORESOURCE_MEM,
921 .flags = IORESOURCE_IRQ,
925 static struct platform_device i2c_bfin_twi_device = {
926 .name = "i2c-bfin-twi",
928 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
929 .resource = bfin_twi0_resource,
933 #ifdef CONFIG_I2C_BOARDINFO
934 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
935 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
937 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
941 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
943 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
946 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
948 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
955 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
956 static struct platform_device bfin_sport0_uart_device = {
957 .name = "bfin-sport-uart",
961 static struct platform_device bfin_sport1_uart_device = {
962 .name = "bfin-sport-uart",
967 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
968 #define PATA_INT IRQ_PF5
970 static struct pata_platform_info bfin_pata_platform_data = {
972 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
975 static struct resource bfin_pata_resources[] = {
979 .flags = IORESOURCE_MEM,
984 .flags = IORESOURCE_MEM,
989 .flags = IORESOURCE_IRQ,
993 static struct platform_device bfin_pata_device = {
994 .name = "pata_platform",
996 .num_resources = ARRAY_SIZE(bfin_pata_resources),
997 .resource = bfin_pata_resources,
999 .platform_data = &bfin_pata_platform_data,
1004 static const unsigned int cclk_vlev_datasheet[] =
1006 VRPAIR(VLEV_085, 250000000),
1007 VRPAIR(VLEV_090, 376000000),
1008 VRPAIR(VLEV_095, 426000000),
1009 VRPAIR(VLEV_100, 426000000),
1010 VRPAIR(VLEV_105, 476000000),
1011 VRPAIR(VLEV_110, 476000000),
1012 VRPAIR(VLEV_115, 476000000),
1013 VRPAIR(VLEV_120, 500000000),
1014 VRPAIR(VLEV_125, 533000000),
1015 VRPAIR(VLEV_130, 600000000),
1018 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1019 .tuple_tab = cclk_vlev_datasheet,
1020 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1021 .vr_settling_time = 25 /* us */,
1024 static struct platform_device bfin_dpmc = {
1025 .name = "bfin dpmc",
1027 .platform_data = &bfin_dmpc_vreg_data,
1031 static struct platform_device *stamp_devices[] __initdata = {
1035 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1036 &bfin_pcmcia_cf_device,
1039 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1043 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1047 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1048 &isp1362_hcd_device,
1051 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1055 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1059 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1063 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1067 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1068 &net2272_bfin_device,
1071 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1075 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1079 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1080 &bfin_lq035q1_device,
1083 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1084 &bfin_fb_adv7393_device,
1087 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1091 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1095 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1096 &i2c_bfin_twi_device,
1099 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1100 &bfin_sport0_uart_device,
1101 &bfin_sport1_uart_device,
1104 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1108 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1109 &bfin_device_gpiokeys,
1114 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1115 &bfin_async_nand_device,
1118 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1119 &stamp_flash_device,
1123 static int __init stamp_init(void)
1125 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1127 #ifdef CONFIG_I2C_BOARDINFO
1128 i2c_register_board_info(0, bfin_i2c_board_info,
1129 ARRAY_SIZE(bfin_i2c_board_info));
1132 bfin_plat_nand_init();
1133 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1134 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1136 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1137 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1143 arch_initcall(stamp_init);
1145 void native_machine_restart(char *cmd)
1147 /* workaround reboot hang when booting from SPI */
1148 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1149 bfin_gpio_reset_spi0_ssel1();
1153 * Currently the MAC address is saved in Flash by U-Boot
1155 #define FLASH_MAC 0x203f0000
1156 void bfin_get_ether_addr(char *addr)
1158 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1159 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1161 EXPORT_SYMBOL(bfin_get_ether_addr);