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 <linux/spi/ad7877.h>
52 * Name the Board for the /proc/cpuinfo
54 const char bfin_board_name
[] = "ADDS-BF527-EZKIT";
57 * Driver needs to know address, irq and flag pin.
60 #define ISP1761_BASE 0x203C0000
61 #define ISP1761_IRQ IRQ_PF7
63 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
64 static struct resource bfin_isp1761_resources
[] = {
66 .name
= "isp1761-regs",
67 .start
= ISP1761_BASE
+ 0x00000000,
68 .end
= ISP1761_BASE
+ 0x000fffff,
69 .flags
= IORESOURCE_MEM
,
74 .flags
= IORESOURCE_IRQ
,
78 static struct platform_device bfin_isp1761_device
= {
81 .num_resources
= ARRAY_SIZE(bfin_isp1761_resources
),
82 .resource
= bfin_isp1761_resources
,
85 static struct platform_device
*bfin_isp1761_devices
[] = {
89 int __init
bfin_isp1761_init(void)
91 unsigned int num_devices
= ARRAY_SIZE(bfin_isp1761_devices
);
93 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
94 set_irq_type(ISP1761_IRQ
, IRQF_TRIGGER_FALLING
);
96 return platform_add_devices(bfin_isp1761_devices
, num_devices
);
99 void __exit
bfin_isp1761_exit(void)
101 platform_device_unregister(&bfin_isp1761_device
);
104 arch_initcall(bfin_isp1761_init
);
107 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
108 static struct mtd_partition partition_info
[] = {
110 .name
= "Linux Kernel",
115 .name
= "File System",
116 .offset
= 4 * SIZE_1M
,
117 .size
= (256 - 4) * SIZE_1M
,
121 static struct bf5xx_nand_platform bf5xx_nand_platform
= {
122 .page_size
= NFC_PG_SIZE_256
,
123 .data_width
= NFC_NWIDTH_8
,
124 .partitions
= partition_info
,
125 .nr_partitions
= ARRAY_SIZE(partition_info
),
130 static struct resource bf5xx_nand_resources
[] = {
133 .end
= NFC_DATA_RD
+ 2,
134 .flags
= IORESOURCE_MEM
,
139 .flags
= IORESOURCE_IRQ
,
143 static struct platform_device bf5xx_nand_device
= {
144 .name
= "bf5xx-nand",
146 .num_resources
= ARRAY_SIZE(bf5xx_nand_resources
),
147 .resource
= bf5xx_nand_resources
,
149 .platform_data
= &bf5xx_nand_platform
,
154 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
155 static struct resource bfin_pcmcia_cf_resources
[] = {
157 .start
= 0x20310000, /* IO PORT */
159 .flags
= IORESOURCE_MEM
,
161 .start
= 0x20311000, /* Attribute Memory */
163 .flags
= IORESOURCE_MEM
,
167 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
169 .start
= 6, /* Card Detect PF6 */
171 .flags
= IORESOURCE_IRQ
,
175 static struct platform_device bfin_pcmcia_cf_device
= {
176 .name
= "bfin_cf_pcmcia",
178 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
179 .resource
= bfin_pcmcia_cf_resources
,
183 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
184 static struct platform_device rtc_device
= {
190 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
191 static struct resource smc91x_resources
[] = {
193 .name
= "smc91x-regs",
195 .end
= 0x20300300 + 16,
196 .flags
= IORESOURCE_MEM
,
201 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
204 static struct platform_device smc91x_device
= {
207 .num_resources
= ARRAY_SIZE(smc91x_resources
),
208 .resource
= smc91x_resources
,
212 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
213 static struct resource dm9000_resources
[] = {
216 .end
= 0x203FB800 + 8,
217 .flags
= IORESOURCE_MEM
,
222 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
),
226 static struct platform_device dm9000_device
= {
229 .num_resources
= ARRAY_SIZE(dm9000_resources
),
230 .resource
= dm9000_resources
,
234 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
235 static struct resource sl811_hcd_resources
[] = {
239 .flags
= IORESOURCE_MEM
,
243 .flags
= IORESOURCE_MEM
,
245 .start
= CONFIG_USB_SL811_BFIN_IRQ
,
246 .end
= CONFIG_USB_SL811_BFIN_IRQ
,
247 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
251 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
252 void sl811_port_power(struct device
*dev
, int is_on
)
254 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, "usb:SL811_VBUS");
255 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS
);
258 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, 1);
260 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, 0);
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_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
350 /* all SPI peripherals info goes here */
352 #if defined(CONFIG_MTD_M25P80) \
353 || defined(CONFIG_MTD_M25P80_MODULE)
354 static struct mtd_partition bfin_spi_flash_partitions
[] = {
356 .name
= "bootloader",
359 .mask_flags
= MTD_CAP_ROM
365 .name
= "file system",
367 .offset
= 0x00100000,
371 static struct flash_platform_data bfin_spi_flash_data
= {
373 .parts
= bfin_spi_flash_partitions
,
374 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
378 /* SPI flash chip (m25p64) */
379 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
380 .enable_dma
= 0, /* use dma transfer with this chip*/
385 #if defined(CONFIG_SPI_ADC_BF533) \
386 || defined(CONFIG_SPI_ADC_BF533_MODULE)
388 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
389 .enable_dma
= 1, /* use dma transfer with this chip*/
394 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
395 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
396 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
402 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
403 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
409 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
410 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
416 #if defined(CONFIG_PBX)
417 static struct bfin5xx_spi_chip spi_si3xxx_chip_info
= {
418 .ctl_reg
= 0x4, /* send zero */
421 .cs_change_per_word
= 1,
425 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
426 static struct bfin5xx_spi_chip ad5304_chip_info
= {
432 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
433 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
438 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
440 .vref_delay_usecs
= 50, /* internal, no capacitor */
443 .pressure_max
= 1000,
445 .stopacq_polarity
= 1,
446 .first_conversion_delay
= 3,
447 .acquisition_time
= 1,
449 .pen_down_acc_interval
= 1,
453 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
454 #if defined(CONFIG_MTD_M25P80) \
455 || defined(CONFIG_MTD_M25P80_MODULE)
457 /* the modalias must be the same as spi device driver name */
458 .modalias
= "m25p80", /* Name of spi_driver for this device */
459 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
460 .bus_num
= 0, /* Framework bus number */
461 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
462 .platform_data
= &bfin_spi_flash_data
,
463 .controller_data
= &spi_flash_chip_info
,
468 #if defined(CONFIG_SPI_ADC_BF533) \
469 || defined(CONFIG_SPI_ADC_BF533_MODULE)
471 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
472 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
473 .bus_num
= 0, /* Framework bus number */
474 .chip_select
= 1, /* Framework chip select. */
475 .platform_data
= NULL
, /* No spi_driver specific config */
476 .controller_data
= &spi_adc_chip_info
,
480 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
481 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
483 .modalias
= "ad1836-spi",
484 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
486 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
487 .controller_data
= &ad1836_spi_chip_info
,
490 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
492 .modalias
= "ad9960-spi",
493 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
496 .controller_data
= &ad9960_spi_chip_info
,
499 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
501 .modalias
= "spi_mmc_dummy",
502 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
505 .platform_data
= NULL
,
506 .controller_data
= &spi_mmc_chip_info
,
510 .modalias
= "spi_mmc",
511 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
513 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
514 .platform_data
= NULL
,
515 .controller_data
= &spi_mmc_chip_info
,
519 #if defined(CONFIG_PBX)
521 .modalias
= "fxs-spi",
522 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
524 .chip_select
= 8 - CONFIG_J11_JUMPER
,
525 .controller_data
= &spi_si3xxx_chip_info
,
529 .modalias
= "fxo-spi",
530 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
532 .chip_select
= 8 - CONFIG_J19_JUMPER
,
533 .controller_data
= &spi_si3xxx_chip_info
,
537 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
539 .modalias
= "ad5304_spi",
540 .max_speed_hz
= 1250000, /* max spi clock (SCK) speed in HZ */
543 .platform_data
= NULL
,
544 .controller_data
= &ad5304_chip_info
,
548 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
550 .modalias
= "ad7877",
551 .platform_data
= &bfin_ad7877_ts_info
,
553 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
556 .controller_data
= &spi_ad7877_chip_info
,
561 /* SPI controller data */
562 static struct bfin5xx_spi_master bfin_spi0_info
= {
564 .enable_dma
= 1, /* master has the ability to do dma transfer */
568 static struct resource bfin_spi0_resource
[] = {
570 .start
= SPI0_REGBASE
,
571 .end
= SPI0_REGBASE
+ 0xFF,
572 .flags
= IORESOURCE_MEM
,
577 .flags
= IORESOURCE_IRQ
,
581 static struct platform_device bfin_spi0_device
= {
583 .id
= 0, /* Bus number */
584 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
585 .resource
= bfin_spi0_resource
,
587 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
590 #endif /* spi master and devices */
592 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
593 static struct platform_device bfin_fb_device
= {
594 .name
= "bf537-lq035",
598 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
599 static struct platform_device bfin_fb_adv7393_device
= {
600 .name
= "bfin-adv7393",
604 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
605 static struct resource bfin_uart_resources
[] = {
606 #ifdef CONFIG_SERIAL_BFIN_UART0
610 .flags
= IORESOURCE_MEM
,
613 #ifdef CONFIG_SERIAL_BFIN_UART1
617 .flags
= IORESOURCE_MEM
,
622 static struct platform_device bfin_uart_device
= {
625 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
626 .resource
= bfin_uart_resources
,
630 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
631 static struct resource bfin_twi0_resource
[] = {
633 .start
= TWI0_REGBASE
,
635 .flags
= IORESOURCE_MEM
,
640 .flags
= IORESOURCE_IRQ
,
644 static struct platform_device i2c_bfin_twi_device
= {
645 .name
= "i2c-bfin-twi",
647 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
648 .resource
= bfin_twi0_resource
,
652 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
653 static struct platform_device bfin_sport0_uart_device
= {
654 .name
= "bfin-sport-uart",
658 static struct platform_device bfin_sport1_uart_device
= {
659 .name
= "bfin-sport-uart",
664 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
667 static struct pata_platform_info bfin_pata_platform_data
= {
669 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
672 static struct resource bfin_pata_resources
[] = {
676 .flags
= IORESOURCE_MEM
,
681 .flags
= IORESOURCE_MEM
,
686 .flags
= IORESOURCE_IRQ
,
690 static struct platform_device bfin_pata_device
= {
691 .name
= "pata_platform",
693 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
694 .resource
= bfin_pata_resources
,
696 .platform_data
= &bfin_pata_platform_data
,
701 static struct platform_device
*stamp_devices
[] __initdata
= {
702 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
706 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
707 &bfin_pcmcia_cf_device
,
710 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
714 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
718 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
722 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
726 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
730 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
734 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
735 &net2272_bfin_device
,
738 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
742 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
746 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
747 &bfin_fb_adv7393_device
,
750 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
754 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
755 &i2c_bfin_twi_device
,
758 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
759 &bfin_sport0_uart_device
,
760 &bfin_sport1_uart_device
,
763 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
768 static int __init
stamp_init(void)
770 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
771 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
772 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
773 spi_register_board_info(bfin_spi_board_info
,
774 ARRAY_SIZE(bfin_spi_board_info
));
777 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
778 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
783 arch_initcall(stamp_init
);
785 void native_machine_restart(char *cmd
)
787 /* workaround reboot hang when booting from SPI */
788 if ((bfin_read_SYSCR() & 0x7) == 0x3)
789 bfin_gpio_reset_spi0_ssel1();