2 * File: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2007 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38 #include <linux/usb_isp1362.h>
40 #include <linux/pata_platform.h>
41 #include <linux/irq.h>
42 #include <linux/interrupt.h>
43 #include <linux/usb_sl811.h>
46 #include <asm/bfin5xx_spi.h>
47 #include <asm/reboot.h>
49 #include <asm/portmux.h>
50 #include <linux/spi/ad7877.h>
53 * Name the Board for the /proc/cpuinfo
55 const char bfin_board_name
[] = "ADDS-BF527-EZKIT";
58 * Driver needs to know address, irq and flag pin.
61 #define ISP1761_BASE 0x203C0000
62 #define ISP1761_IRQ IRQ_PF7
64 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 static struct resource bfin_isp1761_resources
[] = {
67 .name
= "isp1761-regs",
68 .start
= ISP1761_BASE
+ 0x00000000,
69 .end
= ISP1761_BASE
+ 0x000fffff,
70 .flags
= IORESOURCE_MEM
,
75 .flags
= IORESOURCE_IRQ
,
79 static struct platform_device bfin_isp1761_device
= {
82 .num_resources
= ARRAY_SIZE(bfin_isp1761_resources
),
83 .resource
= bfin_isp1761_resources
,
86 static struct platform_device
*bfin_isp1761_devices
[] = {
90 int __init
bfin_isp1761_init(void)
92 unsigned int num_devices
= ARRAY_SIZE(bfin_isp1761_devices
);
94 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
95 set_irq_type(ISP1761_IRQ
, IRQF_TRIGGER_FALLING
);
97 return platform_add_devices(bfin_isp1761_devices
, num_devices
);
100 void __exit
bfin_isp1761_exit(void)
102 platform_device_unregister(&bfin_isp1761_device
);
105 arch_initcall(bfin_isp1761_init
);
108 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
109 static struct mtd_partition partition_info
[] = {
111 .name
= "Linux Kernel",
116 .name
= "File System",
117 .offset
= 4 * SIZE_1M
,
118 .size
= (256 - 4) * SIZE_1M
,
122 static struct bf5xx_nand_platform bf5xx_nand_platform
= {
123 .page_size
= NFC_PG_SIZE_256
,
124 .data_width
= NFC_NWIDTH_8
,
125 .partitions
= partition_info
,
126 .nr_partitions
= ARRAY_SIZE(partition_info
),
131 static struct resource bf5xx_nand_resources
[] = {
134 .end
= NFC_DATA_RD
+ 2,
135 .flags
= IORESOURCE_MEM
,
140 .flags
= IORESOURCE_IRQ
,
144 static struct platform_device bf5xx_nand_device
= {
145 .name
= "bf5xx-nand",
147 .num_resources
= ARRAY_SIZE(bf5xx_nand_resources
),
148 .resource
= bf5xx_nand_resources
,
150 .platform_data
= &bf5xx_nand_platform
,
155 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
156 static struct resource bfin_pcmcia_cf_resources
[] = {
158 .start
= 0x20310000, /* IO PORT */
160 .flags
= IORESOURCE_MEM
,
162 .start
= 0x20311000, /* Attribute Memory */
164 .flags
= IORESOURCE_MEM
,
168 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
170 .start
= 6, /* Card Detect PF6 */
172 .flags
= IORESOURCE_IRQ
,
176 static struct platform_device bfin_pcmcia_cf_device
= {
177 .name
= "bfin_cf_pcmcia",
179 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
180 .resource
= bfin_pcmcia_cf_resources
,
184 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
185 static struct platform_device rtc_device
= {
191 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
192 static struct resource smc91x_resources
[] = {
194 .name
= "smc91x-regs",
196 .end
= 0x20300300 + 16,
197 .flags
= IORESOURCE_MEM
,
202 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
205 static struct platform_device smc91x_device
= {
208 .num_resources
= ARRAY_SIZE(smc91x_resources
),
209 .resource
= smc91x_resources
,
213 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
214 static struct resource dm9000_resources
[] = {
217 .end
= 0x203FB800 + 8,
218 .flags
= IORESOURCE_MEM
,
223 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
),
227 static struct platform_device dm9000_device
= {
230 .num_resources
= ARRAY_SIZE(dm9000_resources
),
231 .resource
= dm9000_resources
,
235 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
236 static struct resource sl811_hcd_resources
[] = {
240 .flags
= IORESOURCE_MEM
,
244 .flags
= IORESOURCE_MEM
,
246 .start
= CONFIG_USB_SL811_BFIN_IRQ
,
247 .end
= CONFIG_USB_SL811_BFIN_IRQ
,
248 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
252 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
253 void sl811_port_power(struct device
*dev
, int is_on
)
255 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, "usb:SL811_VBUS");
256 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS
);
259 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, 1);
261 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, 0);
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_mac_device
= {
329 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
330 static struct resource net2272_bfin_resources
[] = {
333 .end
= 0x20300000 + 0x100,
334 .flags
= IORESOURCE_MEM
,
338 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
342 static struct platform_device net2272_bfin_device
= {
345 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
346 .resource
= net2272_bfin_resources
,
350 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
351 /* all SPI peripherals info goes here */
353 #if defined(CONFIG_MTD_M25P80) \
354 || defined(CONFIG_MTD_M25P80_MODULE)
355 static struct mtd_partition bfin_spi_flash_partitions
[] = {
357 .name
= "bootloader",
360 .mask_flags
= MTD_CAP_ROM
366 .name
= "file system",
368 .offset
= 0x00100000,
372 static struct flash_platform_data bfin_spi_flash_data
= {
374 .parts
= bfin_spi_flash_partitions
,
375 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
379 /* SPI flash chip (m25p64) */
380 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
381 .enable_dma
= 0, /* use dma transfer with this chip*/
386 #if defined(CONFIG_SPI_ADC_BF533) \
387 || defined(CONFIG_SPI_ADC_BF533_MODULE)
389 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
390 .enable_dma
= 1, /* use dma transfer with this chip*/
395 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
396 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
397 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
403 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
404 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
410 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
411 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
417 #if defined(CONFIG_PBX)
418 static struct bfin5xx_spi_chip spi_si3xxx_chip_info
= {
419 .ctl_reg
= 0x4, /* send zero */
422 .cs_change_per_word
= 1,
426 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
427 static struct bfin5xx_spi_chip ad5304_chip_info
= {
433 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
434 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
439 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
441 .vref_delay_usecs
= 50, /* internal, no capacitor */
444 .pressure_max
= 1000,
446 .stopacq_polarity
= 1,
447 .first_conversion_delay
= 3,
448 .acquisition_time
= 1,
450 .pen_down_acc_interval
= 1,
454 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) \
455 && defined(CONFIG_SND_SOC_WM8731_SPI)
456 static struct bfin5xx_spi_chip spi_wm8731_chip_info
= {
461 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
462 #if defined(CONFIG_MTD_M25P80) \
463 || defined(CONFIG_MTD_M25P80_MODULE)
465 /* the modalias must be the same as spi device driver name */
466 .modalias
= "m25p80", /* Name of spi_driver for this device */
467 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
468 .bus_num
= 0, /* Framework bus number */
469 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
470 .platform_data
= &bfin_spi_flash_data
,
471 .controller_data
= &spi_flash_chip_info
,
476 #if defined(CONFIG_SPI_ADC_BF533) \
477 || defined(CONFIG_SPI_ADC_BF533_MODULE)
479 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
480 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
481 .bus_num
= 0, /* Framework bus number */
482 .chip_select
= 1, /* Framework chip select. */
483 .platform_data
= NULL
, /* No spi_driver specific config */
484 .controller_data
= &spi_adc_chip_info
,
488 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
489 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
491 .modalias
= "ad1836-spi",
492 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
494 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
495 .controller_data
= &ad1836_spi_chip_info
,
498 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
500 .modalias
= "ad9960-spi",
501 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
504 .controller_data
= &ad9960_spi_chip_info
,
507 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
509 .modalias
= "spi_mmc_dummy",
510 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
513 .platform_data
= NULL
,
514 .controller_data
= &spi_mmc_chip_info
,
518 .modalias
= "spi_mmc",
519 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
521 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
522 .platform_data
= NULL
,
523 .controller_data
= &spi_mmc_chip_info
,
527 #if defined(CONFIG_PBX)
529 .modalias
= "fxs-spi",
530 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
532 .chip_select
= 8 - CONFIG_J11_JUMPER
,
533 .controller_data
= &spi_si3xxx_chip_info
,
537 .modalias
= "fxo-spi",
538 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
540 .chip_select
= 8 - CONFIG_J19_JUMPER
,
541 .controller_data
= &spi_si3xxx_chip_info
,
545 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
547 .modalias
= "ad5304_spi",
548 .max_speed_hz
= 1250000, /* max spi clock (SCK) speed in HZ */
551 .platform_data
= NULL
,
552 .controller_data
= &ad5304_chip_info
,
556 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
558 .modalias
= "ad7877",
559 .platform_data
= &bfin_ad7877_ts_info
,
561 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
564 .controller_data
= &spi_ad7877_chip_info
,
567 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) \
568 && defined(CONFIG_SND_SOC_WM8731_SPI)
570 .modalias
= "wm8731",
571 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
574 .controller_data
= &spi_wm8731_chip_info
,
580 /* SPI controller data */
581 static struct bfin5xx_spi_master bfin_spi0_info
= {
583 .enable_dma
= 1, /* master has the ability to do dma transfer */
584 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
588 static struct resource bfin_spi0_resource
[] = {
590 .start
= SPI0_REGBASE
,
591 .end
= SPI0_REGBASE
+ 0xFF,
592 .flags
= IORESOURCE_MEM
,
597 .flags
= IORESOURCE_IRQ
,
601 static struct platform_device bfin_spi0_device
= {
603 .id
= 0, /* Bus number */
604 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
605 .resource
= bfin_spi0_resource
,
607 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
610 #endif /* spi master and devices */
612 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
613 static struct platform_device bfin_fb_device
= {
614 .name
= "bf537-lq035",
618 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
619 static struct platform_device bfin_fb_adv7393_device
= {
620 .name
= "bfin-adv7393",
624 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
625 static struct resource bfin_uart_resources
[] = {
626 #ifdef CONFIG_SERIAL_BFIN_UART0
630 .flags
= IORESOURCE_MEM
,
633 #ifdef CONFIG_SERIAL_BFIN_UART1
637 .flags
= IORESOURCE_MEM
,
642 static struct platform_device bfin_uart_device
= {
645 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
646 .resource
= bfin_uart_resources
,
650 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
651 static struct resource bfin_twi0_resource
[] = {
653 .start
= TWI0_REGBASE
,
655 .flags
= IORESOURCE_MEM
,
660 .flags
= IORESOURCE_IRQ
,
664 static struct platform_device i2c_bfin_twi_device
= {
665 .name
= "i2c-bfin-twi",
667 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
668 .resource
= bfin_twi0_resource
,
672 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
673 static struct platform_device bfin_sport0_uart_device
= {
674 .name
= "bfin-sport-uart",
678 static struct platform_device bfin_sport1_uart_device
= {
679 .name
= "bfin-sport-uart",
684 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
687 static struct pata_platform_info bfin_pata_platform_data
= {
689 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
692 static struct resource bfin_pata_resources
[] = {
696 .flags
= IORESOURCE_MEM
,
701 .flags
= IORESOURCE_MEM
,
706 .flags
= IORESOURCE_IRQ
,
710 static struct platform_device bfin_pata_device
= {
711 .name
= "pata_platform",
713 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
714 .resource
= bfin_pata_resources
,
716 .platform_data
= &bfin_pata_platform_data
,
721 static struct platform_device
*stamp_devices
[] __initdata
= {
722 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
726 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
727 &bfin_pcmcia_cf_device
,
730 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
734 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
738 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
742 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
746 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
750 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
754 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
755 &net2272_bfin_device
,
758 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
762 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
766 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
767 &bfin_fb_adv7393_device
,
770 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
774 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
775 &i2c_bfin_twi_device
,
778 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
779 &bfin_sport0_uart_device
,
780 &bfin_sport1_uart_device
,
783 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
788 static int __init
stamp_init(void)
790 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
791 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
792 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
793 spi_register_board_info(bfin_spi_board_info
,
794 ARRAY_SIZE(bfin_spi_board_info
));
797 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
798 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
803 arch_initcall(stamp_init
);
805 void native_machine_restart(char *cmd
)
807 /* workaround reboot hang when booting from SPI */
808 if ((bfin_read_SYSCR() & 0x7) == 0x3)
809 bfin_gpio_reset_spi0_ssel1();
813 * Currently the MAC address is saved in Flash by U-Boot
815 #define FLASH_MAC 0x203f0000
816 void bfin_get_ether_addr(char *addr
)
818 *(u32
*)(&(addr
[0])) = bfin_read32(FLASH_MAC
);
819 *(u16
*)(&(addr
[4])) = bfin_read16(FLASH_MAC
+ 4);
821 EXPORT_SYMBOL(bfin_get_ether_addr
);