2 * File: arch/blackfin/mach-bf537/boards/generic_board.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-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>
45 #include <asm/bfin5xx_spi.h>
46 #include <asm/reboot.h>
47 #include <linux/spi/ad7877.h>
50 * Name the Board for the /proc/cpuinfo
52 char *bfin_board_name = "GENERIC Board";
55 * Driver needs to know address, irq and flag pin.
58 #define ISP1761_BASE 0x203C0000
59 #define ISP1761_IRQ IRQ_PF7
61 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
62 static struct resource bfin_isp1761_resources[] = {
64 .name = "isp1761-regs",
65 .start = ISP1761_BASE + 0x00000000,
66 .end = ISP1761_BASE + 0x000fffff,
67 .flags = IORESOURCE_MEM,
72 .flags = IORESOURCE_IRQ,
76 static struct platform_device bfin_isp1761_device = {
79 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
80 .resource = bfin_isp1761_resources,
83 static struct platform_device *bfin_isp1761_devices[] = {
87 int __init bfin_isp1761_init(void)
89 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
91 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
92 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
94 return platform_add_devices(bfin_isp1761_devices, num_devices);
97 void __exit bfin_isp1761_exit(void)
99 platform_device_unregister(&bfin_isp1761_device);
102 arch_initcall(bfin_isp1761_init);
105 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
106 static struct resource bfin_pcmcia_cf_resources[] = {
108 .start = 0x20310000, /* IO PORT */
110 .flags = IORESOURCE_MEM,
112 .start = 0x20311000, /* Attribute Memory */
114 .flags = IORESOURCE_MEM,
118 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
120 .start = 6, /* Card Detect PF6 */
122 .flags = IORESOURCE_IRQ,
126 static struct platform_device bfin_pcmcia_cf_device = {
127 .name = "bfin_cf_pcmcia",
129 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
130 .resource = bfin_pcmcia_cf_resources,
134 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
135 static struct platform_device rtc_device = {
141 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
142 static struct resource smc91x_resources[] = {
144 .name = "smc91x-regs",
146 .end = 0x20300300 + 16,
147 .flags = IORESOURCE_MEM,
152 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
155 static struct platform_device smc91x_device = {
158 .num_resources = ARRAY_SIZE(smc91x_resources),
159 .resource = smc91x_resources,
163 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
164 static struct resource dm9000_resources[] = {
167 .end = 0x203FB800 + 8,
168 .flags = IORESOURCE_MEM,
173 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
177 static struct platform_device dm9000_device = {
180 .num_resources = ARRAY_SIZE(dm9000_resources),
181 .resource = dm9000_resources,
185 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
186 static struct resource sl811_hcd_resources[] = {
190 .flags = IORESOURCE_MEM,
194 .flags = IORESOURCE_MEM,
196 .start = CONFIG_USB_SL811_BFIN_IRQ,
197 .end = CONFIG_USB_SL811_BFIN_IRQ,
198 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
202 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
203 void sl811_port_power(struct device *dev, int is_on)
205 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
206 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS);
209 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
211 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
215 static struct sl811_platform_data sl811_priv = {
217 .power = 250, /* == 500mA */
218 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
219 .port_power = &sl811_port_power,
223 static struct platform_device sl811_hcd_device = {
227 .platform_data = &sl811_priv,
229 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
230 .resource = sl811_hcd_resources,
234 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
235 static struct resource isp1362_hcd_resources[] = {
239 .flags = IORESOURCE_MEM,
243 .flags = IORESOURCE_MEM,
245 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
246 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
247 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
251 static struct isp1362_platform_data isp1362_priv = {
256 .int_edge_triggered = 0,
257 .remote_wakeup_connected = 0,
258 .no_power_switching = 1,
259 .power_switching_mode = 0,
262 static struct platform_device isp1362_hcd_device = {
263 .name = "isp1362-hcd",
266 .platform_data = &isp1362_priv,
268 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
269 .resource = isp1362_hcd_resources,
273 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
274 static struct platform_device bfin_mac_device = {
279 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
280 static struct resource net2272_bfin_resources[] = {
283 .end = 0x20300000 + 0x100,
284 .flags = IORESOURCE_MEM,
288 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
292 static struct platform_device net2272_bfin_device = {
295 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
296 .resource = net2272_bfin_resources,
300 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
301 /* all SPI peripherals info goes here */
303 #if defined(CONFIG_MTD_M25P80) \
304 || defined(CONFIG_MTD_M25P80_MODULE)
305 static struct mtd_partition bfin_spi_flash_partitions[] = {
307 .name = "bootloader",
310 .mask_flags = MTD_CAP_ROM
316 .name = "file system",
318 .offset = 0x00100000,
322 static struct flash_platform_data bfin_spi_flash_data = {
324 .parts = bfin_spi_flash_partitions,
325 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
329 /* SPI flash chip (m25p64) */
330 static struct bfin5xx_spi_chip spi_flash_chip_info = {
331 .enable_dma = 0, /* use dma transfer with this chip*/
336 #if defined(CONFIG_SPI_ADC_BF533) \
337 || defined(CONFIG_SPI_ADC_BF533_MODULE)
339 static struct bfin5xx_spi_chip spi_adc_chip_info = {
340 .enable_dma = 1, /* use dma transfer with this chip*/
345 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
346 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
347 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
353 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
354 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
360 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
361 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
367 #if defined(CONFIG_PBX)
368 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
369 .ctl_reg = 0x4, /* send zero */
372 .cs_change_per_word = 1,
376 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
377 static struct bfin5xx_spi_chip ad5304_chip_info = {
383 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
384 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
389 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
391 .vref_delay_usecs = 50, /* internal, no capacitor */
394 .pressure_max = 1000,
396 .stopacq_polarity = 1,
397 .first_conversion_delay = 3,
398 .acquisition_time = 1,
400 .pen_down_acc_interval = 1,
404 static struct spi_board_info bfin_spi_board_info[] __initdata = {
405 #if defined(CONFIG_MTD_M25P80) \
406 || defined(CONFIG_MTD_M25P80_MODULE)
408 /* the modalias must be the same as spi device driver name */
409 .modalias = "m25p80", /* Name of spi_driver for this device */
410 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
411 .bus_num = 0, /* Framework bus number */
412 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
413 .platform_data = &bfin_spi_flash_data,
414 .controller_data = &spi_flash_chip_info,
419 #if defined(CONFIG_SPI_ADC_BF533) \
420 || defined(CONFIG_SPI_ADC_BF533_MODULE)
422 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
423 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
424 .bus_num = 0, /* Framework bus number */
425 .chip_select = 1, /* Framework chip select. */
426 .platform_data = NULL, /* No spi_driver specific config */
427 .controller_data = &spi_adc_chip_info,
431 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
432 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
434 .modalias = "ad1836-spi",
435 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
437 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
438 .controller_data = &ad1836_spi_chip_info,
441 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
443 .modalias = "ad9960-spi",
444 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
447 .controller_data = &ad9960_spi_chip_info,
450 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
452 .modalias = "spi_mmc_dummy",
453 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
456 .platform_data = NULL,
457 .controller_data = &spi_mmc_chip_info,
461 .modalias = "spi_mmc",
462 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
464 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
465 .platform_data = NULL,
466 .controller_data = &spi_mmc_chip_info,
470 #if defined(CONFIG_PBX)
472 .modalias = "fxs-spi",
473 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
475 .chip_select = 8 - CONFIG_J11_JUMPER,
476 .controller_data = &spi_si3xxx_chip_info,
480 .modalias = "fxo-spi",
481 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
483 .chip_select = 8 - CONFIG_J19_JUMPER,
484 .controller_data = &spi_si3xxx_chip_info,
488 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
490 .modalias = "ad5304_spi",
491 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
494 .platform_data = NULL,
495 .controller_data = &ad5304_chip_info,
499 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
501 .modalias = "ad7877",
502 .platform_data = &bfin_ad7877_ts_info,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
507 .controller_data = &spi_ad7877_chip_info,
512 /* SPI controller data */
513 static struct bfin5xx_spi_master bfin_spi0_info = {
515 .enable_dma = 1, /* master has the ability to do dma transfer */
519 static struct resource bfin_spi0_resource[] = {
521 .start = SPI0_REGBASE,
522 .end = SPI0_REGBASE + 0xFF,
523 .flags = IORESOURCE_MEM,
528 .flags = IORESOURCE_IRQ,
532 static struct platform_device bfin_spi0_device = {
534 .id = 0, /* Bus number */
535 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
536 .resource = bfin_spi0_resource,
538 .platform_data = &bfin_spi0_info, /* Passed to driver */
541 #endif /* spi master and devices */
543 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
544 static struct platform_device bfin_fb_device = {
545 .name = "bf537-lq035",
549 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
550 static struct platform_device bfin_fb_adv7393_device = {
551 .name = "bfin-adv7393",
555 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
556 static struct resource bfin_uart_resources[] = {
560 .flags = IORESOURCE_MEM,
564 .flags = IORESOURCE_MEM,
568 static struct platform_device bfin_uart_device = {
571 .num_resources = ARRAY_SIZE(bfin_uart_resources),
572 .resource = bfin_uart_resources,
576 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
577 static struct resource bfin_twi0_resource[] = {
579 .start = TWI0_REGBASE,
580 .end = TWI0_REGBASE + 0xFF,
581 .flags = IORESOURCE_MEM,
586 .flags = IORESOURCE_IRQ,
590 static struct platform_device i2c_bfin_twi_device = {
591 .name = "i2c-bfin-twi",
593 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
594 .resource = bfin_twi0_resource,
598 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
599 static struct platform_device bfin_sport0_uart_device = {
600 .name = "bfin-sport-uart",
604 static struct platform_device bfin_sport1_uart_device = {
605 .name = "bfin-sport-uart",
610 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
613 static struct pata_platform_info bfin_pata_platform_data = {
615 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
618 static struct resource bfin_pata_resources[] = {
622 .flags = IORESOURCE_MEM,
627 .flags = IORESOURCE_MEM,
632 .flags = IORESOURCE_IRQ,
636 static struct platform_device bfin_pata_device = {
637 .name = "pata_platform",
639 .num_resources = ARRAY_SIZE(bfin_pata_resources),
640 .resource = bfin_pata_resources,
642 .platform_data = &bfin_pata_platform_data,
647 static struct platform_device *stamp_devices[] __initdata = {
648 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
649 &bfin_pcmcia_cf_device,
652 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
656 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
660 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
664 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
668 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
672 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
676 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
677 &net2272_bfin_device,
680 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
684 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
688 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
689 &bfin_fb_adv7393_device,
692 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
696 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
697 &i2c_bfin_twi_device,
700 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
701 &bfin_sport0_uart_device,
702 &bfin_sport1_uart_device,
705 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
710 static int __init stamp_init(void)
712 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
713 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
714 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
715 spi_register_board_info(bfin_spi_board_info,
716 ARRAY_SIZE(bfin_spi_board_info));
719 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
720 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
725 arch_initcall(stamp_init);
727 void native_machine_restart(char *cmd)
729 /* workaround reboot hang when booting from SPI */
730 if ((bfin_read_SYSCR() & 0x7) == 0x3)
731 bfin_gpio_reset_spi0_ssel1();