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 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 #include <linux/usb/isp1760.h>
66 static struct resource bfin_isp1760_resources
[] = {
69 .end
= 0x203C0000 + 0x000fffff,
70 .flags
= IORESOURCE_MEM
,
75 .flags
= IORESOURCE_IRQ
,
79 static struct isp1760_platform_data isp1760_priv
= {
85 .dack_polarity_high
= 0,
86 .dreq_polarity_high
= 0,
89 static struct platform_device bfin_isp1760_device
= {
90 .name
= "isp1760-hcd",
93 .platform_data
= &isp1760_priv
,
95 .num_resources
= ARRAY_SIZE(bfin_isp1760_resources
),
96 .resource
= bfin_isp1760_resources
,
100 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
101 #include <linux/input.h>
102 #include <linux/gpio_keys.h>
104 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
105 {BTN_0
, GPIO_PF2
, 1, "gpio-keys: BTN0"},
106 {BTN_1
, GPIO_PF3
, 1, "gpio-keys: BTN1"},
107 {BTN_2
, GPIO_PF4
, 1, "gpio-keys: BTN2"},
108 {BTN_3
, GPIO_PF5
, 1, "gpio-keys: BTN3"},
111 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
112 .buttons
= bfin_gpio_keys_table
,
113 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
116 static struct platform_device bfin_device_gpiokeys
= {
119 .platform_data
= &bfin_gpio_keys_data
,
124 static struct resource bfin_gpios_resources
= {
126 .end
= MAX_BLACKFIN_GPIOS
- 1,
127 .flags
= IORESOURCE_IRQ
,
130 static struct platform_device bfin_gpios_device
= {
131 .name
= "simple-gpio",
134 .resource
= &bfin_gpios_resources
,
137 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
138 static struct resource bfin_pcmcia_cf_resources
[] = {
140 .start
= 0x20310000, /* IO PORT */
142 .flags
= IORESOURCE_MEM
,
144 .start
= 0x20311000, /* Attribute Memory */
146 .flags
= IORESOURCE_MEM
,
150 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
152 .start
= 6, /* Card Detect PF6 */
154 .flags
= IORESOURCE_IRQ
,
158 static struct platform_device bfin_pcmcia_cf_device
= {
159 .name
= "bfin_cf_pcmcia",
161 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
162 .resource
= bfin_pcmcia_cf_resources
,
166 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
167 static struct platform_device rtc_device
= {
173 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
174 static struct resource smc91x_resources
[] = {
176 .name
= "smc91x-regs",
178 .end
= 0x20300300 + 16,
179 .flags
= IORESOURCE_MEM
,
184 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
187 static struct platform_device smc91x_device
= {
190 .num_resources
= ARRAY_SIZE(smc91x_resources
),
191 .resource
= smc91x_resources
,
195 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
196 static struct resource dm9000_resources
[] = {
199 .end
= 0x203FB800 + 8,
200 .flags
= IORESOURCE_MEM
,
205 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
),
209 static struct platform_device dm9000_device
= {
212 .num_resources
= ARRAY_SIZE(dm9000_resources
),
213 .resource
= dm9000_resources
,
217 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
218 static struct resource ax88180_resources
[] = {
221 .end
= 0x20300000 + 0x8000,
222 .flags
= IORESOURCE_MEM
,
227 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
),
231 static struct platform_device ax88180_device
= {
234 .num_resources
= ARRAY_SIZE(ax88180_resources
),
235 .resource
= ax88180_resources
,
239 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
240 static struct resource sl811_hcd_resources
[] = {
244 .flags
= IORESOURCE_MEM
,
248 .flags
= IORESOURCE_MEM
,
250 .start
= CONFIG_USB_SL811_BFIN_IRQ
,
251 .end
= CONFIG_USB_SL811_BFIN_IRQ
,
252 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
256 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
257 void sl811_port_power(struct device
*dev
, int is_on
)
259 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, "usb:SL811_VBUS");
260 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, is_on
);
264 static struct sl811_platform_data sl811_priv
= {
266 .power
= 250, /* == 500mA */
267 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
268 .port_power
= &sl811_port_power
,
272 static struct platform_device sl811_hcd_device
= {
276 .platform_data
= &sl811_priv
,
278 .num_resources
= ARRAY_SIZE(sl811_hcd_resources
),
279 .resource
= sl811_hcd_resources
,
283 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
284 static struct resource isp1362_hcd_resources
[] = {
288 .flags
= IORESOURCE_MEM
,
292 .flags
= IORESOURCE_MEM
,
294 .start
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
295 .end
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
296 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
300 static struct isp1362_platform_data isp1362_priv
= {
305 .int_edge_triggered
= 0,
306 .remote_wakeup_connected
= 0,
307 .no_power_switching
= 1,
308 .power_switching_mode
= 0,
311 static struct platform_device isp1362_hcd_device
= {
312 .name
= "isp1362-hcd",
315 .platform_data
= &isp1362_priv
,
317 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
318 .resource
= isp1362_hcd_resources
,
322 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
323 static struct platform_device bfin_mac_device
= {
328 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
329 static struct resource net2272_bfin_resources
[] = {
332 .end
= 0x20300000 + 0x100,
333 .flags
= IORESOURCE_MEM
,
337 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
341 static struct platform_device net2272_bfin_device
= {
344 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
345 .resource
= net2272_bfin_resources
,
349 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
350 #ifdef CONFIG_MTD_PARTITIONS
351 const char *part_probes
[] = { "cmdlinepart", "RedBoot", NULL
};
353 static struct mtd_partition bfin_plat_nand_partitions
[] = {
355 .name
= "linux kernel(nand)",
359 .name
= "file system(nand)",
360 .size
= MTDPART_SIZ_FULL
,
361 .offset
= MTDPART_OFS_APPEND
,
366 #define BFIN_NAND_PLAT_CLE 2
367 #define BFIN_NAND_PLAT_ALE 1
368 static void bfin_plat_nand_cmd_ctrl(struct mtd_info
*mtd
, int cmd
, unsigned int ctrl
)
370 struct nand_chip
*this = mtd
->priv
;
372 if (cmd
== NAND_CMD_NONE
)
376 writeb(cmd
, this->IO_ADDR_W
+ (1 << BFIN_NAND_PLAT_CLE
));
378 writeb(cmd
, this->IO_ADDR_W
+ (1 << BFIN_NAND_PLAT_ALE
));
381 #define BFIN_NAND_PLAT_READY GPIO_PF3
382 static int bfin_plat_nand_dev_ready(struct mtd_info
*mtd
)
384 return gpio_get_value(BFIN_NAND_PLAT_READY
);
387 static struct platform_nand_data bfin_plat_nand_data
= {
390 #ifdef CONFIG_MTD_PARTITIONS
391 .part_probe_types
= part_probes
,
392 .partitions
= bfin_plat_nand_partitions
,
393 .nr_partitions
= ARRAY_SIZE(bfin_plat_nand_partitions
),
397 .cmd_ctrl
= bfin_plat_nand_cmd_ctrl
,
398 .dev_ready
= bfin_plat_nand_dev_ready
,
402 #define MAX(x, y) (x > y ? x : y)
403 static struct resource bfin_plat_nand_resources
= {
405 .end
= 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE
, BFIN_NAND_PLAT_ALE
)),
406 .flags
= IORESOURCE_IO
,
409 static struct platform_device bfin_async_nand_device
= {
413 .resource
= &bfin_plat_nand_resources
,
415 .platform_data
= &bfin_plat_nand_data
,
419 static void bfin_plat_nand_init(void)
421 gpio_request(BFIN_NAND_PLAT_READY
, "bfin_nand_plat");
424 static void bfin_plat_nand_init(void) {}
427 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
428 static struct mtd_partition stamp_partitions
[] = {
430 .name
= "bootloader(nor)",
434 .name
= "linux kernel(nor)",
436 .offset
= MTDPART_OFS_APPEND
,
438 .name
= "file system(nor)",
439 .size
= 0x400000 - 0x40000 - 0xE0000 - 0x10000,
440 .offset
= MTDPART_OFS_APPEND
,
442 .name
= "MAC Address(nor)",
443 .size
= MTDPART_SIZ_FULL
,
445 .mask_flags
= MTD_WRITEABLE
,
449 static struct physmap_flash_data stamp_flash_data
= {
451 .parts
= stamp_partitions
,
452 .nr_parts
= ARRAY_SIZE(stamp_partitions
),
455 static struct resource stamp_flash_resource
= {
458 .flags
= IORESOURCE_MEM
,
461 static struct platform_device stamp_flash_device
= {
462 .name
= "physmap-flash",
465 .platform_data
= &stamp_flash_data
,
468 .resource
= &stamp_flash_resource
,
472 #if defined(CONFIG_MTD_M25P80) \
473 || defined(CONFIG_MTD_M25P80_MODULE)
474 static struct mtd_partition bfin_spi_flash_partitions
[] = {
476 .name
= "bootloader(spi)",
479 .mask_flags
= MTD_CAP_ROM
481 .name
= "linux kernel(spi)",
483 .offset
= MTDPART_OFS_APPEND
,
485 .name
= "file system(spi)",
486 .size
= MTDPART_SIZ_FULL
,
487 .offset
= MTDPART_OFS_APPEND
,
491 static struct flash_platform_data bfin_spi_flash_data
= {
493 .parts
= bfin_spi_flash_partitions
,
494 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
495 /* .type = "m25p64", */
498 /* SPI flash chip (m25p64) */
499 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
500 .enable_dma
= 0, /* use dma transfer with this chip*/
505 #if defined(CONFIG_SPI_ADC_BF533) \
506 || defined(CONFIG_SPI_ADC_BF533_MODULE)
508 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
509 .enable_dma
= 1, /* use dma transfer with this chip*/
514 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
515 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
516 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
522 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
523 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
529 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
530 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
536 #if defined(CONFIG_PBX)
537 static struct bfin5xx_spi_chip spi_si3xxx_chip_info
= {
538 .ctl_reg
= 0x4, /* send zero */
541 .cs_change_per_word
= 1,
545 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
546 #include <linux/spi/ad7877.h>
547 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
552 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
554 .vref_delay_usecs
= 50, /* internal, no capacitor */
557 .pressure_max
= 1000,
559 .stopacq_polarity
= 1,
560 .first_conversion_delay
= 3,
561 .acquisition_time
= 1,
563 .pen_down_acc_interval
= 1,
567 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
568 #include <linux/spi/ad7879.h>
569 static const struct ad7879_platform_data bfin_ad7879_ts_info
= {
570 .model
= 7879, /* Model = AD7879 */
571 .x_plate_ohms
= 620, /* 620 Ohm from the touch datasheet */
572 .pressure_max
= 10000,
574 .first_conversion_delay
= 3, /* wait 512us before do a first conversion */
575 .acquisition_time
= 1, /* 4us acquisition time per sample */
576 .median
= 2, /* do 8 measurements */
577 .averaging
= 1, /* take the average of 4 middle samples */
578 .pen_down_acc_interval
= 255, /* 9.4 ms */
579 .gpio_output
= 1, /* configure AUX/VBAT/GPIO as GPIO output */
580 .gpio_default
= 1, /* During initialization set GPIO = HIGH */
584 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
585 static struct bfin5xx_spi_chip spi_ad7879_chip_info
= {
591 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
592 static struct bfin5xx_spi_chip spidev_chip_info
= {
598 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
599 static struct bfin5xx_spi_chip lq035q1_spi_chip_info
= {
605 #if defined(CONFIG_MTD_DATAFLASH) \
606 || defined(CONFIG_MTD_DATAFLASH_MODULE)
608 static struct mtd_partition bfin_spi_dataflash_partitions
[] = {
610 .name
= "bootloader(spi)",
613 .mask_flags
= MTD_CAP_ROM
615 .name
= "linux kernel(spi)",
617 .offset
= MTDPART_OFS_APPEND
,
619 .name
= "file system(spi)",
620 .size
= MTDPART_SIZ_FULL
,
621 .offset
= MTDPART_OFS_APPEND
,
625 static struct flash_platform_data bfin_spi_dataflash_data
= {
626 .name
= "SPI Dataflash",
627 .parts
= bfin_spi_dataflash_partitions
,
628 .nr_parts
= ARRAY_SIZE(bfin_spi_dataflash_partitions
),
632 static struct bfin5xx_spi_chip data_flash_chip_info
= {
633 .enable_dma
= 0, /* use dma transfer with this chip*/
638 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
639 #if defined(CONFIG_MTD_M25P80) \
640 || defined(CONFIG_MTD_M25P80_MODULE)
642 /* the modalias must be the same as spi device driver name */
643 .modalias
= "m25p80", /* Name of spi_driver for this device */
644 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
645 .bus_num
= 0, /* Framework bus number */
646 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
647 .platform_data
= &bfin_spi_flash_data
,
648 .controller_data
= &spi_flash_chip_info
,
652 #if defined(CONFIG_MTD_DATAFLASH) \
653 || defined(CONFIG_MTD_DATAFLASH_MODULE)
654 { /* DataFlash chip */
655 .modalias
= "mtd_dataflash",
656 .max_speed_hz
= 33250000, /* max spi clock (SCK) speed in HZ */
657 .bus_num
= 0, /* Framework bus number */
658 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
659 .platform_data
= &bfin_spi_dataflash_data
,
660 .controller_data
= &data_flash_chip_info
,
664 #if defined(CONFIG_SPI_ADC_BF533) \
665 || defined(CONFIG_SPI_ADC_BF533_MODULE)
667 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
668 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
669 .bus_num
= 0, /* Framework bus number */
670 .chip_select
= 1, /* Framework chip select. */
671 .platform_data
= NULL
, /* No spi_driver specific config */
672 .controller_data
= &spi_adc_chip_info
,
676 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
677 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
679 .modalias
= "ad1836-spi",
680 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
682 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
683 .controller_data
= &ad1836_spi_chip_info
,
686 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
688 .modalias
= "ad9960-spi",
689 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
692 .controller_data
= &ad9960_spi_chip_info
,
695 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
697 .modalias
= "spi_mmc_dummy",
698 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
701 .platform_data
= NULL
,
702 .controller_data
= &spi_mmc_chip_info
,
706 .modalias
= "spi_mmc",
707 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
709 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
710 .platform_data
= NULL
,
711 .controller_data
= &spi_mmc_chip_info
,
715 #if defined(CONFIG_PBX)
717 .modalias
= "fxs-spi",
718 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
720 .chip_select
= 8 - CONFIG_J11_JUMPER
,
721 .controller_data
= &spi_si3xxx_chip_info
,
725 .modalias
= "fxo-spi",
726 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
728 .chip_select
= 8 - CONFIG_J19_JUMPER
,
729 .controller_data
= &spi_si3xxx_chip_info
,
733 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
735 .modalias
= "ad7877",
736 .platform_data
= &bfin_ad7877_ts_info
,
738 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
741 .controller_data
= &spi_ad7877_chip_info
,
744 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
746 .modalias
= "ad7879",
747 .platform_data
= &bfin_ad7879_ts_info
,
749 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
752 .controller_data
= &spi_ad7879_chip_info
,
753 .mode
= SPI_CPHA
| SPI_CPOL
,
756 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
758 .modalias
= "spidev",
759 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
762 .controller_data
= &spidev_chip_info
,
765 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
767 .modalias
= "bfin-lq035q1-spi",
768 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
771 .controller_data
= &lq035q1_spi_chip_info
,
772 .mode
= SPI_CPHA
| SPI_CPOL
,
777 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
778 /* SPI controller data */
779 static struct bfin5xx_spi_master bfin_spi0_info
= {
781 .enable_dma
= 1, /* master has the ability to do dma transfer */
782 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
786 static struct resource bfin_spi0_resource
[] = {
788 .start
= SPI0_REGBASE
,
789 .end
= SPI0_REGBASE
+ 0xFF,
790 .flags
= IORESOURCE_MEM
,
795 .flags
= IORESOURCE_IRQ
,
799 static struct platform_device bfin_spi0_device
= {
801 .id
= 0, /* Bus number */
802 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
803 .resource
= bfin_spi0_resource
,
805 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
808 #endif /* spi master and devices */
810 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
811 static struct platform_device bfin_fb_device
= {
812 .name
= "bf537-lq035",
816 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
817 static struct platform_device bfin_fb_adv7393_device
= {
818 .name
= "bfin-adv7393",
822 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
823 #include <asm/bfin-lq035q1.h>
825 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data
= {
826 .mode
= LQ035_NORM
| LQ035_RGB
| LQ035_RL
| LQ035_TB
,
827 .use_bl
= 0, /* let something else control the LCD Blacklight */
831 static struct resource bfin_lq035q1_resources
[] = {
833 .start
= IRQ_PPI_ERROR
,
834 .end
= IRQ_PPI_ERROR
,
835 .flags
= IORESOURCE_IRQ
,
839 static struct platform_device bfin_lq035q1_device
= {
840 .name
= "bfin-lq035q1",
842 .num_resources
= ARRAY_SIZE(bfin_lq035q1_resources
),
843 .resource
= bfin_lq035q1_resources
,
845 .platform_data
= &bfin_lq035q1_data
,
850 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
851 static struct resource bfin_uart_resources
[] = {
852 #ifdef CONFIG_SERIAL_BFIN_UART0
856 .flags
= IORESOURCE_MEM
,
859 #ifdef CONFIG_SERIAL_BFIN_UART1
863 .flags
= IORESOURCE_MEM
,
868 static struct platform_device bfin_uart_device
= {
871 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
872 .resource
= bfin_uart_resources
,
876 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
877 static struct resource bfin_sir_resources
[] = {
878 #ifdef CONFIG_BFIN_SIR0
882 .flags
= IORESOURCE_MEM
,
885 #ifdef CONFIG_BFIN_SIR1
889 .flags
= IORESOURCE_MEM
,
894 static struct platform_device bfin_sir_device
= {
897 .num_resources
= ARRAY_SIZE(bfin_sir_resources
),
898 .resource
= bfin_sir_resources
,
902 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
903 static struct resource bfin_twi0_resource
[] = {
905 .start
= TWI0_REGBASE
,
907 .flags
= IORESOURCE_MEM
,
912 .flags
= IORESOURCE_IRQ
,
916 static struct platform_device i2c_bfin_twi_device
= {
917 .name
= "i2c-bfin-twi",
919 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
920 .resource
= bfin_twi0_resource
,
924 #ifdef CONFIG_I2C_BOARDINFO
925 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
926 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
928 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
932 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
934 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
937 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
939 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
943 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
945 I2C_BOARD_INFO("ad7879", 0x2F),
947 .platform_data
= (void *)&bfin_ad7879_ts_info
,
953 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
954 static struct platform_device bfin_sport0_uart_device
= {
955 .name
= "bfin-sport-uart",
959 static struct platform_device bfin_sport1_uart_device
= {
960 .name
= "bfin-sport-uart",
965 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
966 #define PATA_INT IRQ_PF5
968 static struct pata_platform_info bfin_pata_platform_data
= {
970 .irq_flags
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
973 static struct resource bfin_pata_resources
[] = {
977 .flags
= IORESOURCE_MEM
,
982 .flags
= IORESOURCE_MEM
,
987 .flags
= IORESOURCE_IRQ
,
991 static struct platform_device bfin_pata_device
= {
992 .name
= "pata_platform",
994 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
995 .resource
= bfin_pata_resources
,
997 .platform_data
= &bfin_pata_platform_data
,
1002 static const unsigned int cclk_vlev_datasheet
[] =
1004 VRPAIR(VLEV_085
, 250000000),
1005 VRPAIR(VLEV_090
, 376000000),
1006 VRPAIR(VLEV_095
, 426000000),
1007 VRPAIR(VLEV_100
, 426000000),
1008 VRPAIR(VLEV_105
, 476000000),
1009 VRPAIR(VLEV_110
, 476000000),
1010 VRPAIR(VLEV_115
, 476000000),
1011 VRPAIR(VLEV_120
, 500000000),
1012 VRPAIR(VLEV_125
, 533000000),
1013 VRPAIR(VLEV_130
, 600000000),
1016 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1017 .tuple_tab
= cclk_vlev_datasheet
,
1018 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1019 .vr_settling_time
= 25 /* us */,
1022 static struct platform_device bfin_dpmc
= {
1023 .name
= "bfin dpmc",
1025 .platform_data
= &bfin_dmpc_vreg_data
,
1029 static struct platform_device
*stamp_devices
[] __initdata
= {
1033 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1034 &bfin_pcmcia_cf_device
,
1037 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1041 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1045 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1046 &isp1362_hcd_device
,
1049 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1050 &bfin_isp1760_device
,
1053 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1057 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1061 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1065 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1069 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1070 &net2272_bfin_device
,
1073 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1077 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1081 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1082 &bfin_lq035q1_device
,
1085 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1086 &bfin_fb_adv7393_device
,
1089 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1093 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1097 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1098 &i2c_bfin_twi_device
,
1101 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1102 &bfin_sport0_uart_device
,
1103 &bfin_sport1_uart_device
,
1106 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1110 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1111 &bfin_device_gpiokeys
,
1116 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1117 &bfin_async_nand_device
,
1120 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1121 &stamp_flash_device
,
1125 static int __init
stamp_init(void)
1127 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
1129 #ifdef CONFIG_I2C_BOARDINFO
1130 i2c_register_board_info(0, bfin_i2c_board_info
,
1131 ARRAY_SIZE(bfin_i2c_board_info
));
1134 bfin_plat_nand_init();
1135 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
1136 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
1138 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1139 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
1145 arch_initcall(stamp_init
);
1147 void native_machine_restart(char *cmd
)
1149 /* workaround reboot hang when booting from SPI */
1150 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1151 bfin_gpio_reset_spi0_ssel1();
1155 * Currently the MAC address is saved in Flash by U-Boot
1157 #define FLASH_MAC 0x203f0000
1158 void bfin_get_ether_addr(char *addr
)
1160 *(u32
*)(&(addr
[0])) = bfin_read32(FLASH_MAC
);
1161 *(u16
*)(&(addr
[4])) = bfin_read16(FLASH_MAC
+ 4);
1163 EXPORT_SYMBOL(bfin_get_ether_addr
);