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 <asm/bfin5xx_spi.h>
42 #include <linux/usb_sl811.h>
44 #include <linux/spi/ad7877.h>
47 * Name the Board for the /proc/cpuinfo
49 char *bfin_board_name
= "PNAV-1.0";
52 * Driver needs to know address, irq and flag pin.
55 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
56 static struct resource bfin_pcmcia_cf_resources
[] = {
58 .start
= 0x20310000, /* IO PORT */
60 .flags
= IORESOURCE_MEM
,
62 .start
= 0x20311000, /* Attribute Memeory */
64 .flags
= IORESOURCE_MEM
,
68 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
70 .start
= 6, /* Card Detect PF6 */
72 .flags
= IORESOURCE_IRQ
,
76 static struct platform_device bfin_pcmcia_cf_device
= {
77 .name
= "bfin_cf_pcmcia",
79 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
80 .resource
= bfin_pcmcia_cf_resources
,
84 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
85 static struct platform_device rtc_device
= {
91 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
92 static struct resource smc91x_resources
[] = {
94 .name
= "smc91x-regs",
96 .end
= 0x20300300 + 16,
97 .flags
= IORESOURCE_MEM
,
102 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
105 static struct platform_device smc91x_device
= {
108 .num_resources
= ARRAY_SIZE(smc91x_resources
),
109 .resource
= smc91x_resources
,
113 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
114 static struct resource sl811_hcd_resources
[] = {
118 .flags
= IORESOURCE_MEM
,
122 .flags
= IORESOURCE_MEM
,
124 .start
= CONFIG_USB_SL811_BFIN_IRQ
,
125 .end
= CONFIG_USB_SL811_BFIN_IRQ
,
126 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
130 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
131 void sl811_port_power(struct device
*dev
, int is_on
)
133 unsigned short mask
= (1 << CONFIG_USB_SL811_BFIN_GPIO_VBUS
);
135 bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask
);
136 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask
);
139 bfin_write_FIO_FLAG_S(mask
);
141 bfin_write_FIO_FLAG_C(mask
);
145 static struct sl811_platform_data sl811_priv
= {
147 .power
= 250, /* == 500mA */
148 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
149 .port_power
= &sl811_port_power
,
153 static struct platform_device sl811_hcd_device
= {
157 .platform_data
= &sl811_priv
,
159 .num_resources
= ARRAY_SIZE(sl811_hcd_resources
),
160 .resource
= sl811_hcd_resources
,
164 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
165 static struct resource isp1362_hcd_resources
[] = {
169 .flags
= IORESOURCE_MEM
,
173 .flags
= IORESOURCE_MEM
,
175 .start
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
176 .end
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
177 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
181 static struct isp1362_platform_data isp1362_priv
= {
186 .int_edge_triggered
= 0,
187 .remote_wakeup_connected
= 0,
188 .no_power_switching
= 1,
189 .power_switching_mode
= 0,
192 static struct platform_device isp1362_hcd_device
= {
193 .name
= "isp1362-hcd",
196 .platform_data
= &isp1362_priv
,
198 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
199 .resource
= isp1362_hcd_resources
,
203 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
204 static struct platform_device bfin_mac_device
= {
209 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
210 static struct resource net2272_bfin_resources
[] = {
213 .end
= 0x20300000 + 0x100,
214 .flags
= IORESOURCE_MEM
,
218 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
222 static struct platform_device net2272_bfin_device
= {
225 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
226 .resource
= net2272_bfin_resources
,
230 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
231 /* all SPI peripherals info goes here */
233 #if defined(CONFIG_MTD_M25P80) \
234 || defined(CONFIG_MTD_M25P80_MODULE)
235 static struct mtd_partition bfin_spi_flash_partitions
[] = {
237 .name
= "bootloader",
240 .mask_flags
= MTD_CAP_ROM
246 .name
= "file system",
248 .offset
= 0x00100000,
252 static struct flash_platform_data bfin_spi_flash_data
= {
254 .parts
= bfin_spi_flash_partitions
,
255 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
259 /* SPI flash chip (m25p64) */
260 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
261 .enable_dma
= 0, /* use dma transfer with this chip*/
266 #if defined(CONFIG_SPI_ADC_BF533) \
267 || defined(CONFIG_SPI_ADC_BF533_MODULE)
269 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
270 .enable_dma
= 1, /* use dma transfer with this chip*/
275 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
276 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
277 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
283 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
284 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
290 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
291 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
297 #if defined(CONFIG_PBX)
298 static struct bfin5xx_spi_chip spi_si3xxx_chip_info
= {
299 .ctl_reg
= 0x4, /* send zero */
302 .cs_change_per_word
= 1,
307 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
308 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
309 .cs_change_per_word
= 1,
314 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
316 .vref_delay_usecs
= 50, /* internal, no capacitor */
319 .pressure_max
= 1000,
321 .stopacq_polarity
= 1,
322 .first_conversion_delay
= 3,
323 .acquisition_time
= 1,
325 .pen_down_acc_interval
= 1,
329 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
330 #if defined(CONFIG_MTD_M25P80) \
331 || defined(CONFIG_MTD_M25P80_MODULE)
333 /* the modalias must be the same as spi device driver name */
334 .modalias
= "m25p80", /* Name of spi_driver for this device */
335 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
336 .bus_num
= 1, /* Framework bus number */
337 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
338 .platform_data
= &bfin_spi_flash_data
,
339 .controller_data
= &spi_flash_chip_info
,
344 #if defined(CONFIG_SPI_ADC_BF533) \
345 || defined(CONFIG_SPI_ADC_BF533_MODULE)
347 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
348 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
349 .bus_num
= 1, /* Framework bus number */
350 .chip_select
= 1, /* Framework chip select. */
351 .platform_data
= NULL
, /* No spi_driver specific config */
352 .controller_data
= &spi_adc_chip_info
,
356 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
357 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
359 .modalias
= "ad1836-spi",
360 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
362 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
363 .controller_data
= &ad1836_spi_chip_info
,
366 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
368 .modalias
= "ad9960-spi",
369 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
372 .controller_data
= &ad9960_spi_chip_info
,
375 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
377 .modalias
= "spi_mmc_dummy",
378 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
381 .platform_data
= NULL
,
382 .controller_data
= &spi_mmc_chip_info
,
386 .modalias
= "spi_mmc",
387 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
389 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
390 .platform_data
= NULL
,
391 .controller_data
= &spi_mmc_chip_info
,
395 #if defined(CONFIG_PBX)
397 .modalias
= "fxs-spi",
398 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
401 .controller_data
= &spi_si3xxx_chip_info
,
405 .modalias
= "fxo-spi",
406 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
409 .controller_data
= &spi_si3xxx_chip_info
,
413 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
415 .modalias
= "ad7877",
416 .platform_data
= &bfin_ad7877_ts_info
,
418 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
421 .controller_data
= &spi_ad7877_chip_info
,
427 /* SPI controller data */
428 static struct bfin5xx_spi_master spi_bfin_master_info
= {
430 .enable_dma
= 1, /* master has the ability to do dma transfer */
433 static struct platform_device spi_bfin_master_device
= {
434 .name
= "bfin-spi-master",
435 .id
= 1, /* Bus number */
437 .platform_data
= &spi_bfin_master_info
, /* Passed to driver */
440 #endif /* spi master and devices */
442 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
443 static struct platform_device bfin_fb_device
= {
448 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
449 static struct resource bfin_uart_resources
[] = {
453 .flags
= IORESOURCE_MEM
,
457 .flags
= IORESOURCE_MEM
,
461 static struct platform_device bfin_uart_device
= {
464 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
465 .resource
= bfin_uart_resources
,
470 static struct platform_device
*stamp_devices
[] __initdata
= {
471 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
472 &bfin_pcmcia_cf_device
,
475 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
479 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
483 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
487 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
491 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
495 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
496 &net2272_bfin_device
,
499 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
500 &spi_bfin_master_device
,
503 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
507 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
512 static int __init
stamp_init(void)
514 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
515 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
516 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
517 spi_register_board_info(bfin_spi_board_info
,
518 ARRAY_SIZE(bfin_spi_board_info
));
523 arch_initcall(stamp_init
);