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-2008 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/etherdevice.h>
33 #include <linux/platform_device.h>
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/partitions.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39 #include <linux/usb/isp1362.h>
41 #include <linux/irq.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <asm/portmux.h>
45 #include <linux/usb/sl811.h>
47 #include <linux/spi/ad7877.h>
50 * Name the Board for the /proc/cpuinfo
52 const char bfin_board_name
[] = "ADI PNAV-1.0";
55 * Driver needs to know address, irq and flag pin.
58 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
59 static struct resource bfin_pcmcia_cf_resources
[] = {
61 .start
= 0x20310000, /* IO PORT */
63 .flags
= IORESOURCE_MEM
,
65 .start
= 0x20311000, /* Attribute Memory */
67 .flags
= IORESOURCE_MEM
,
71 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
73 .start
= 6, /* Card Detect PF6 */
75 .flags
= IORESOURCE_IRQ
,
79 static struct platform_device bfin_pcmcia_cf_device
= {
80 .name
= "bfin_cf_pcmcia",
82 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
83 .resource
= bfin_pcmcia_cf_resources
,
87 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
88 static struct platform_device rtc_device
= {
94 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
95 static struct resource smc91x_resources
[] = {
97 .name
= "smc91x-regs",
99 .end
= 0x20300300 + 16,
100 .flags
= IORESOURCE_MEM
,
105 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
108 static struct platform_device smc91x_device
= {
111 .num_resources
= ARRAY_SIZE(smc91x_resources
),
112 .resource
= smc91x_resources
,
116 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
117 static struct resource sl811_hcd_resources
[] = {
121 .flags
= IORESOURCE_MEM
,
125 .flags
= IORESOURCE_MEM
,
127 .start
= CONFIG_USB_SL811_BFIN_IRQ
,
128 .end
= CONFIG_USB_SL811_BFIN_IRQ
,
129 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
133 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
134 void sl811_port_power(struct device
*dev
, int is_on
)
136 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, "usb:SL811_VBUS");
137 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS
, is_on
);
142 static struct sl811_platform_data sl811_priv
= {
144 .power
= 250, /* == 500mA */
145 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
146 .port_power
= &sl811_port_power
,
150 static struct platform_device sl811_hcd_device
= {
154 .platform_data
= &sl811_priv
,
156 .num_resources
= ARRAY_SIZE(sl811_hcd_resources
),
157 .resource
= sl811_hcd_resources
,
161 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
162 static struct resource isp1362_hcd_resources
[] = {
166 .flags
= IORESOURCE_MEM
,
170 .flags
= IORESOURCE_MEM
,
172 .start
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
173 .end
= CONFIG_USB_ISP1362_BFIN_GPIO_IRQ
,
174 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
178 static struct isp1362_platform_data isp1362_priv
= {
183 .int_edge_triggered
= 0,
184 .remote_wakeup_connected
= 0,
185 .no_power_switching
= 1,
186 .power_switching_mode
= 0,
189 static struct platform_device isp1362_hcd_device
= {
190 .name
= "isp1362-hcd",
193 .platform_data
= &isp1362_priv
,
195 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
196 .resource
= isp1362_hcd_resources
,
200 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
201 static struct platform_device bfin_mii_bus
= {
202 .name
= "bfin_mii_bus",
205 static struct platform_device bfin_mac_device
= {
207 .dev
.platform_data
= &bfin_mii_bus
,
211 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
212 static struct resource net2272_bfin_resources
[] = {
215 .end
= 0x20300000 + 0x100,
216 .flags
= IORESOURCE_MEM
,
220 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
224 static struct platform_device net2272_bfin_device
= {
227 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
228 .resource
= net2272_bfin_resources
,
232 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
233 /* all SPI peripherals info goes here */
235 #if defined(CONFIG_MTD_M25P80) \
236 || defined(CONFIG_MTD_M25P80_MODULE)
237 static struct mtd_partition bfin_spi_flash_partitions
[] = {
239 .name
= "bootloader(spi)",
242 .mask_flags
= MTD_CAP_ROM
244 .name
= "linux kernel(spi)",
248 .name
= "file system(spi)",
250 .offset
= 0x00100000,
254 static struct flash_platform_data bfin_spi_flash_data
= {
256 .parts
= bfin_spi_flash_partitions
,
257 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
261 /* SPI flash chip (m25p64) */
262 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
263 .enable_dma
= 0, /* use dma transfer with this chip*/
268 #if defined(CONFIG_BFIN_SPI_ADC) \
269 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
271 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
272 .enable_dma
= 1, /* use dma transfer with this chip*/
277 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
278 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
279 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
285 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
286 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
292 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
293 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
299 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
300 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
301 .cs_change_per_word
= 0,
306 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
308 .vref_delay_usecs
= 50, /* internal, no capacitor */
311 .pressure_max
= 1000,
313 .stopacq_polarity
= 1,
314 .first_conversion_delay
= 3,
315 .acquisition_time
= 1,
317 .pen_down_acc_interval
= 1,
321 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
322 #if defined(CONFIG_MTD_M25P80) \
323 || defined(CONFIG_MTD_M25P80_MODULE)
325 /* the modalias must be the same as spi device driver name */
326 .modalias
= "m25p80", /* Name of spi_driver for this device */
327 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
328 .bus_num
= 0, /* Framework bus number */
329 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
330 .platform_data
= &bfin_spi_flash_data
,
331 .controller_data
= &spi_flash_chip_info
,
336 #if defined(CONFIG_BFIN_SPI_ADC) \
337 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
339 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
340 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
341 .bus_num
= 0, /* Framework bus number */
342 .chip_select
= 1, /* Framework chip select. */
343 .platform_data
= NULL
, /* No spi_driver specific config */
344 .controller_data
= &spi_adc_chip_info
,
348 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
349 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
351 .modalias
= "ad1836-spi",
352 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
354 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
355 .controller_data
= &ad1836_spi_chip_info
,
358 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
360 .modalias
= "ad9960-spi",
361 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
364 .controller_data
= &ad9960_spi_chip_info
,
367 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
369 .modalias
= "mmc_spi",
370 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
373 .controller_data
= &mmc_spi_chip_info
,
377 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
379 .modalias
= "ad7877",
380 .platform_data
= &bfin_ad7877_ts_info
,
382 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
385 .controller_data
= &spi_ad7877_chip_info
,
392 static struct resource bfin_spi0_resource
[] = {
394 .start
= SPI0_REGBASE
,
395 .end
= SPI0_REGBASE
+ 0xFF,
396 .flags
= IORESOURCE_MEM
,
401 .flags
= IORESOURCE_DMA
,
406 .flags
= IORESOURCE_IRQ
,
410 /* SPI controller data */
411 static struct bfin5xx_spi_master bfin_spi0_info
= {
413 .enable_dma
= 1, /* master has the ability to do dma transfer */
414 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
417 static struct platform_device bfin_spi0_device
= {
419 .id
= 0, /* Bus number */
420 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
421 .resource
= bfin_spi0_resource
,
423 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
426 #endif /* spi master and devices */
428 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
429 static struct platform_device bfin_fb_device
= {
430 .name
= "bf537-lq035",
434 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
435 static struct resource bfin_uart_resources
[] = {
439 .flags
= IORESOURCE_MEM
,
443 .flags
= IORESOURCE_MEM
,
447 static struct platform_device bfin_uart_device
= {
450 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
451 .resource
= bfin_uart_resources
,
455 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
456 #ifdef CONFIG_BFIN_SIR0
457 static struct resource bfin_sir0_resources
[] = {
461 .flags
= IORESOURCE_MEM
,
464 .start
= IRQ_UART0_RX
,
465 .end
= IRQ_UART0_RX
+1,
466 .flags
= IORESOURCE_IRQ
,
469 .start
= CH_UART0_RX
,
470 .end
= CH_UART0_RX
+1,
471 .flags
= IORESOURCE_DMA
,
475 static struct platform_device bfin_sir0_device
= {
478 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
479 .resource
= bfin_sir0_resources
,
482 #ifdef CONFIG_BFIN_SIR1
483 static struct resource bfin_sir1_resources
[] = {
487 .flags
= IORESOURCE_MEM
,
490 .start
= IRQ_UART1_RX
,
491 .end
= IRQ_UART1_RX
+1,
492 .flags
= IORESOURCE_IRQ
,
495 .start
= CH_UART1_RX
,
496 .end
= CH_UART1_RX
+1,
497 .flags
= IORESOURCE_DMA
,
501 static struct platform_device bfin_sir1_device
= {
504 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
505 .resource
= bfin_sir1_resources
,
510 static struct platform_device
*stamp_devices
[] __initdata
= {
511 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
512 &bfin_pcmcia_cf_device
,
515 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
519 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
523 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
527 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
531 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
536 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
537 &net2272_bfin_device
,
540 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
544 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
548 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
552 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
553 #ifdef CONFIG_BFIN_SIR0
556 #ifdef CONFIG_BFIN_SIR1
562 static int __init
pnav_init(void)
564 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
565 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
566 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
567 spi_register_board_info(bfin_spi_board_info
,
568 ARRAY_SIZE(bfin_spi_board_info
));
573 arch_initcall(pnav_init
);
575 void bfin_get_ether_addr(char *addr
)
577 random_ether_addr(addr
);
578 printk(KERN_WARNING
"%s:%s: Setting Ethernet MAC to a random one\n", __FILE__
, __func__
);
580 EXPORT_SYMBOL(bfin_get_ether_addr
);