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>
41 #include <linux/irq.h>
42 #include <linux/interrupt.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <linux/usb_sl811.h>
46 #include <linux/spi/ad7877.h>
49 * Name the Board for the /proc/cpuinfo
51 char *bfin_board_name = "ADDS-BF537-STAMP";
54 * Driver needs to know address, irq and flag pin.
57 #define ISP1761_BASE 0x203C0000
58 #define ISP1761_IRQ IRQ_PF7
60 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
61 static struct resource bfin_isp1761_resources[] = {
63 .name = "isp1761-regs",
64 .start = ISP1761_BASE + 0x00000000,
65 .end = ISP1761_BASE + 0x000fffff,
66 .flags = IORESOURCE_MEM,
71 .flags = IORESOURCE_IRQ,
75 static struct platform_device bfin_isp1761_device = {
78 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
79 .resource = bfin_isp1761_resources,
82 static struct platform_device *bfin_isp1761_devices[] = {
86 int __init bfin_isp1761_init(void)
88 unsigned int num_devices=ARRAY_SIZE(bfin_isp1761_devices);
90 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
91 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
93 return platform_add_devices(bfin_isp1761_devices, num_devices);
96 void __exit bfin_isp1761_exit(void)
98 platform_device_unregister(&bfin_isp1761_device);
101 arch_initcall(bfin_isp1761_init);
104 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
105 static struct resource bfin_pcmcia_cf_resources[] = {
107 .start = 0x20310000, /* IO PORT */
109 .flags = IORESOURCE_MEM,
111 .start = 0x20311000, /* Attribute Memeory */
113 .flags = IORESOURCE_MEM,
117 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
119 .start = 6, /* Card Detect PF6 */
121 .flags = IORESOURCE_IRQ,
125 static struct platform_device bfin_pcmcia_cf_device = {
126 .name = "bfin_cf_pcmcia",
128 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
129 .resource = bfin_pcmcia_cf_resources,
133 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
134 static struct platform_device rtc_device = {
140 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
141 static struct resource smc91x_resources[] = {
143 .name = "smc91x-regs",
145 .end = 0x20300300 + 16,
146 .flags = IORESOURCE_MEM,
151 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
154 static struct platform_device smc91x_device = {
157 .num_resources = ARRAY_SIZE(smc91x_resources),
158 .resource = smc91x_resources,
162 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
163 static struct resource sl811_hcd_resources[] = {
167 .flags = IORESOURCE_MEM,
171 .flags = IORESOURCE_MEM,
173 .start = CONFIG_USB_SL811_BFIN_IRQ,
174 .end = CONFIG_USB_SL811_BFIN_IRQ,
175 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
179 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
180 void sl811_port_power(struct device *dev, int is_on)
182 unsigned short mask = (1 << CONFIG_USB_SL811_BFIN_GPIO_VBUS);
184 bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
185 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
188 bfin_write_FIO_FLAG_S(mask);
190 bfin_write_FIO_FLAG_C(mask);
194 static struct sl811_platform_data sl811_priv = {
196 .power = 250, /* == 500mA */
197 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
198 .port_power = &sl811_port_power,
202 static struct platform_device sl811_hcd_device = {
206 .platform_data = &sl811_priv,
208 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
209 .resource = sl811_hcd_resources,
213 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
214 static struct resource isp1362_hcd_resources[] = {
218 .flags = IORESOURCE_MEM,
222 .flags = IORESOURCE_MEM,
224 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
225 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
226 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
230 static struct isp1362_platform_data isp1362_priv = {
235 .int_edge_triggered = 0,
236 .remote_wakeup_connected = 0,
237 .no_power_switching = 1,
238 .power_switching_mode = 0,
241 static struct platform_device isp1362_hcd_device = {
242 .name = "isp1362-hcd",
245 .platform_data = &isp1362_priv,
247 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
248 .resource = isp1362_hcd_resources,
252 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
253 static struct platform_device bfin_mac_device = {
258 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
259 static struct resource net2272_bfin_resources[] = {
262 .end = 0x20300000 + 0x100,
263 .flags = IORESOURCE_MEM,
267 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
271 static struct platform_device net2272_bfin_device = {
274 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
275 .resource = net2272_bfin_resources,
279 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
280 /* all SPI peripherals info goes here */
282 #if defined(CONFIG_MTD_M25P80) \
283 || defined(CONFIG_MTD_M25P80_MODULE)
284 static struct mtd_partition bfin_spi_flash_partitions[] = {
286 .name = "bootloader",
289 .mask_flags = MTD_CAP_ROM
295 .name = "file system",
297 .offset = 0x00100000,
301 static struct flash_platform_data bfin_spi_flash_data = {
303 .parts = bfin_spi_flash_partitions,
304 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
308 /* SPI flash chip (m25p64) */
309 static struct bfin5xx_spi_chip spi_flash_chip_info = {
310 .enable_dma = 0, /* use dma transfer with this chip*/
315 #if defined(CONFIG_SPI_ADC_BF533) \
316 || defined(CONFIG_SPI_ADC_BF533_MODULE)
318 static struct bfin5xx_spi_chip spi_adc_chip_info = {
319 .enable_dma = 1, /* use dma transfer with this chip*/
324 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
325 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
326 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
332 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
333 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
339 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
340 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
346 #if defined(CONFIG_PBX)
347 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
348 .ctl_reg = 0x4, /* send zero */
351 .cs_change_per_word = 1,
355 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
356 static struct bfin5xx_spi_chip ad5304_chip_info = {
362 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
363 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
364 // .cs_change_per_word = 1,
369 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
371 .vref_delay_usecs = 50, /* internal, no capacitor */
374 .pressure_max = 1000,
376 .stopacq_polarity = 1,
377 .first_conversion_delay = 3,
378 .acquisition_time = 1,
380 .pen_down_acc_interval = 1,
384 static struct spi_board_info bfin_spi_board_info[] __initdata = {
385 #if defined(CONFIG_MTD_M25P80) \
386 || defined(CONFIG_MTD_M25P80_MODULE)
388 /* the modalias must be the same as spi device driver name */
389 .modalias = "m25p80", /* Name of spi_driver for this device */
390 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
391 .bus_num = 1, /* Framework bus number */
392 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
393 .platform_data = &bfin_spi_flash_data,
394 .controller_data = &spi_flash_chip_info,
399 #if defined(CONFIG_SPI_ADC_BF533) \
400 || defined(CONFIG_SPI_ADC_BF533_MODULE)
402 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
403 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
404 .bus_num = 1, /* Framework bus number */
405 .chip_select = 1, /* Framework chip select. */
406 .platform_data = NULL, /* No spi_driver specific config */
407 .controller_data = &spi_adc_chip_info,
411 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
412 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
414 .modalias = "ad1836-spi",
415 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
417 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
418 .controller_data = &ad1836_spi_chip_info,
421 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
423 .modalias = "ad9960-spi",
424 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
427 .controller_data = &ad9960_spi_chip_info,
430 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
432 .modalias = "spi_mmc_dummy",
433 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
436 .platform_data = NULL,
437 .controller_data = &spi_mmc_chip_info,
441 .modalias = "spi_mmc",
442 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
444 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
445 .platform_data = NULL,
446 .controller_data = &spi_mmc_chip_info,
450 #if defined(CONFIG_PBX)
452 .modalias = "fxs-spi",
453 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
456 .controller_data= &spi_si3xxx_chip_info,
460 .modalias = "fxo-spi",
461 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
464 .controller_data= &spi_si3xxx_chip_info,
468 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
470 .modalias = "ad5304_spi",
471 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
474 .platform_data = NULL,
475 .controller_data = &ad5304_chip_info,
479 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
481 .modalias = "ad7877",
482 .platform_data = &bfin_ad7877_ts_info,
484 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
487 .controller_data = &spi_ad7877_chip_info,
492 /* SPI controller data */
493 static struct bfin5xx_spi_master spi_bfin_master_info = {
495 .enable_dma = 1, /* master has the ability to do dma transfer */
498 static struct platform_device spi_bfin_master_device = {
499 .name = "bfin-spi-master",
500 .id = 1, /* Bus number */
502 .platform_data = &spi_bfin_master_info, /* Passed to driver */
505 #endif /* spi master and devices */
507 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
508 static struct platform_device bfin_fb_device = {
513 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
514 static struct resource bfin_uart_resources[] = {
518 .flags = IORESOURCE_MEM,
522 .flags = IORESOURCE_MEM,
526 static struct platform_device bfin_uart_device = {
529 .num_resources = ARRAY_SIZE(bfin_uart_resources),
530 .resource = bfin_uart_resources,
534 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
535 static struct platform_device i2c_bfin_twi_device = {
536 .name = "i2c-bfin-twi",
541 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
542 static struct platform_device bfin_sport0_uart_device = {
543 .name = "bfin-sport-uart",
547 static struct platform_device bfin_sport1_uart_device = {
548 .name = "bfin-sport-uart",
553 static struct platform_device *stamp_devices[] __initdata = {
554 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
555 &bfin_pcmcia_cf_device,
558 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
562 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
566 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
570 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
574 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
578 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
579 &net2272_bfin_device,
582 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
583 &spi_bfin_master_device,
586 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
590 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
594 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
595 &i2c_bfin_twi_device,
598 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
599 &bfin_sport0_uart_device,
600 &bfin_sport1_uart_device,
604 static int __init stamp_init(void)
606 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
607 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
608 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
609 spi_register_board_info(bfin_spi_board_info,
610 ARRAY_SIZE(bfin_spi_board_info));
615 arch_initcall(stamp_init);