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/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/irq.h>
41 #include <linux/interrupt.h>
42 #include <linux/usb_sl811.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <linux/spi/ad7877.h>
47 * Name the Board for the /proc/cpuinfo
49 char *bfin_board_name = "ADDS-BF537-STAMP";
52 * Driver needs to know address, irq and flag pin.
55 #define ISP1761_BASE 0x203C0000
56 #define ISP1761_IRQ IRQ_PF7
58 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
59 static struct resource bfin_isp1761_resources[] = {
61 .name = "isp1761-regs",
62 .start = ISP1761_BASE + 0x00000000,
63 .end = ISP1761_BASE + 0x000fffff,
64 .flags = IORESOURCE_MEM,
69 .flags = IORESOURCE_IRQ,
73 static struct platform_device bfin_isp1761_device = {
76 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
77 .resource = bfin_isp1761_resources,
80 static struct platform_device *bfin_isp1761_devices[] = {
84 int __init bfin_isp1761_init(void)
86 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
88 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
89 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
91 return platform_add_devices(bfin_isp1761_devices, num_devices);
94 void __exit bfin_isp1761_exit(void)
96 platform_device_unregister(&bfin_isp1761_device);
99 arch_initcall(bfin_isp1761_init);
102 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
103 static struct resource bfin_pcmcia_cf_resources[] = {
105 .start = 0x20310000, /* IO PORT */
107 .flags = IORESOURCE_MEM,
109 .start = 0x20311000, /* Attribute Memory */
111 .flags = IORESOURCE_MEM,
115 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
117 .start = 6, /* Card Detect PF6 */
119 .flags = IORESOURCE_IRQ,
123 static struct platform_device bfin_pcmcia_cf_device = {
124 .name = "bfin_cf_pcmcia",
126 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
127 .resource = bfin_pcmcia_cf_resources,
131 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
132 static struct platform_device rtc_device = {
138 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
139 static struct resource smc91x_resources[] = {
141 .name = "smc91x-regs",
143 .end = 0x20300300 + 16,
144 .flags = IORESOURCE_MEM,
149 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
152 static struct platform_device smc91x_device = {
155 .num_resources = ARRAY_SIZE(smc91x_resources),
156 .resource = smc91x_resources,
160 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
161 static struct resource dm9000_resources[] = {
164 .end = 0x203FB800 + 8,
165 .flags = IORESOURCE_MEM,
170 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
174 static struct platform_device dm9000_device = {
177 .num_resources = ARRAY_SIZE(dm9000_resources),
178 .resource = dm9000_resources,
182 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
183 static struct resource sl811_hcd_resources[] = {
187 .flags = IORESOURCE_MEM,
191 .flags = IORESOURCE_MEM,
193 .start = CONFIG_USB_SL811_BFIN_IRQ,
194 .end = CONFIG_USB_SL811_BFIN_IRQ,
195 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
199 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
200 void sl811_port_power(struct device *dev, int is_on)
202 unsigned short mask = (1 << CONFIG_USB_SL811_BFIN_GPIO_VBUS);
204 bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
205 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
208 bfin_write_FIO_FLAG_S(mask);
210 bfin_write_FIO_FLAG_C(mask);
214 static struct sl811_platform_data sl811_priv = {
216 .power = 250, /* == 500mA */
217 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
218 .port_power = &sl811_port_power,
222 static struct platform_device sl811_hcd_device = {
226 .platform_data = &sl811_priv,
228 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
229 .resource = sl811_hcd_resources,
233 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
234 static struct resource isp1362_hcd_resources[] = {
238 .flags = IORESOURCE_MEM,
242 .flags = IORESOURCE_MEM,
244 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
245 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
246 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
250 static struct isp1362_platform_data isp1362_priv = {
255 .int_edge_triggered = 0,
256 .remote_wakeup_connected = 0,
257 .no_power_switching = 1,
258 .power_switching_mode = 0,
261 static struct platform_device isp1362_hcd_device = {
262 .name = "isp1362-hcd",
265 .platform_data = &isp1362_priv,
267 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
268 .resource = isp1362_hcd_resources,
272 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
273 static struct platform_device bfin_mac_device = {
278 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
279 static struct resource net2272_bfin_resources[] = {
282 .end = 0x20300000 + 0x100,
283 .flags = IORESOURCE_MEM,
287 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
291 static struct platform_device net2272_bfin_device = {
294 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
295 .resource = net2272_bfin_resources,
299 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
300 /* all SPI peripherals info goes here */
302 #if defined(CONFIG_MTD_M25P80) \
303 || defined(CONFIG_MTD_M25P80_MODULE)
304 static struct mtd_partition bfin_spi_flash_partitions[] = {
306 .name = "bootloader",
309 .mask_flags = MTD_CAP_ROM
315 .name = "file system",
317 .offset = 0x00100000,
321 static struct flash_platform_data bfin_spi_flash_data = {
323 .parts = bfin_spi_flash_partitions,
324 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
328 /* SPI flash chip (m25p64) */
329 static struct bfin5xx_spi_chip spi_flash_chip_info = {
330 .enable_dma = 0, /* use dma transfer with this chip*/
335 #if defined(CONFIG_SPI_ADC_BF533) \
336 || defined(CONFIG_SPI_ADC_BF533_MODULE)
338 static struct bfin5xx_spi_chip spi_adc_chip_info = {
339 .enable_dma = 1, /* use dma transfer with this chip*/
344 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
345 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
346 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
352 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
353 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
359 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
360 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
366 #if defined(CONFIG_PBX)
367 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
368 .ctl_reg = 0x4, /* send zero */
371 .cs_change_per_word = 1,
375 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
376 static struct bfin5xx_spi_chip ad5304_chip_info = {
382 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
383 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
388 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
390 .vref_delay_usecs = 50, /* internal, no capacitor */
393 .pressure_max = 1000,
395 .stopacq_polarity = 1,
396 .first_conversion_delay = 3,
397 .acquisition_time = 1,
399 .pen_down_acc_interval = 1,
403 static struct spi_board_info bfin_spi_board_info[] __initdata = {
404 #if defined(CONFIG_MTD_M25P80) \
405 || defined(CONFIG_MTD_M25P80_MODULE)
407 /* the modalias must be the same as spi device driver name */
408 .modalias = "m25p80", /* Name of spi_driver for this device */
409 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
410 .bus_num = 1, /* Framework bus number */
411 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
412 .platform_data = &bfin_spi_flash_data,
413 .controller_data = &spi_flash_chip_info,
418 #if defined(CONFIG_SPI_ADC_BF533) \
419 || defined(CONFIG_SPI_ADC_BF533_MODULE)
421 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
422 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
423 .bus_num = 1, /* Framework bus number */
424 .chip_select = 1, /* Framework chip select. */
425 .platform_data = NULL, /* No spi_driver specific config */
426 .controller_data = &spi_adc_chip_info,
430 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
431 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
433 .modalias = "ad1836-spi",
434 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
436 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
437 .controller_data = &ad1836_spi_chip_info,
440 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
442 .modalias = "ad9960-spi",
443 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
446 .controller_data = &ad9960_spi_chip_info,
449 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
451 .modalias = "spi_mmc_dummy",
452 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
455 .platform_data = NULL,
456 .controller_data = &spi_mmc_chip_info,
460 .modalias = "spi_mmc",
461 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
463 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
464 .platform_data = NULL,
465 .controller_data = &spi_mmc_chip_info,
469 #if defined(CONFIG_PBX)
471 .modalias = "fxs-spi",
472 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
475 .controller_data = &spi_si3xxx_chip_info,
479 .modalias = "fxo-spi",
480 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
483 .controller_data = &spi_si3xxx_chip_info,
487 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
489 .modalias = "ad5304_spi",
490 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
493 .platform_data = NULL,
494 .controller_data = &ad5304_chip_info,
498 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
500 .modalias = "ad7877",
501 .platform_data = &bfin_ad7877_ts_info,
503 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
506 .controller_data = &spi_ad7877_chip_info,
511 /* SPI controller data */
512 static struct bfin5xx_spi_master spi_bfin_master_info = {
514 .enable_dma = 1, /* master has the ability to do dma transfer */
517 static struct platform_device spi_bfin_master_device = {
518 .name = "bfin-spi-master",
519 .id = 1, /* Bus number */
521 .platform_data = &spi_bfin_master_info, /* Passed to driver */
524 #endif /* spi master and devices */
526 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
527 static struct platform_device bfin_fb_device = {
532 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
533 static struct resource bfin_uart_resources[] = {
537 .flags = IORESOURCE_MEM,
541 .flags = IORESOURCE_MEM,
545 static struct platform_device bfin_uart_device = {
548 .num_resources = ARRAY_SIZE(bfin_uart_resources),
549 .resource = bfin_uart_resources,
553 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
554 static struct platform_device i2c_bfin_twi_device = {
555 .name = "i2c-bfin-twi",
560 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
561 static struct platform_device bfin_sport0_uart_device = {
562 .name = "bfin-sport-uart",
566 static struct platform_device bfin_sport1_uart_device = {
567 .name = "bfin-sport-uart",
572 static struct platform_device *stamp_devices[] __initdata = {
573 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
574 &bfin_pcmcia_cf_device,
577 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
581 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
585 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
589 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
593 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
597 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
601 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
602 &net2272_bfin_device,
605 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
606 &spi_bfin_master_device,
609 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
613 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
617 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
618 &i2c_bfin_twi_device,
621 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
622 &bfin_sport0_uart_device,
623 &bfin_sport1_uart_device,
627 static int __init stamp_init(void)
629 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
630 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
631 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
632 spi_register_board_info(bfin_spi_board_info,
633 ARRAY_SIZE(bfin_spi_board_info));
638 arch_initcall(stamp_init);