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-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 #include <linux/usb_isp1362.h>
38 #include <linux/irq.h>
39 #include <linux/usb_sl811.h>
40 #include <asm/bfin5xx_spi.h>
43 * Name the Board for the /proc/cpuinfo
45 char *bfin_board_name = "UNKNOWN BOARD";
48 * Driver needs to know address, irq and flag pin.
51 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
52 static struct resource bfin_pcmcia_cf_resources[] = {
54 .start = 0x20310000, /* IO PORT */
56 .flags = IORESOURCE_MEM,
58 .start = 0x20311000, /* Attribute Memory */
60 .flags = IORESOURCE_MEM,
62 .start = IRQ_PROG_INTA,
64 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
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,
99 .start = IRQ_PROG_INTB,
100 .end = IRQ_PROG_INTB,
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
104 * denotes the flag pin and is used directly if
105 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
112 static struct platform_device smc91x_device = {
115 .num_resources = ARRAY_SIZE(smc91x_resources),
116 .resource = smc91x_resources,
120 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
121 static struct resource sl811_hcd_resources[] = {
125 .flags = IORESOURCE_MEM,
129 .flags = IORESOURCE_MEM,
131 .start = IRQ_PROG_INTA,
132 .end = IRQ_PROG_INTA,
133 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
135 .start = IRQ_PF0 + CONFIG_USB_SL811_BFIN_GPIO,
136 .end = IRQ_PF0 + CONFIG_USB_SL811_BFIN_GPIO,
137 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
141 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
142 void sl811_port_power(struct device *dev, int is_on)
144 unsigned short mask = (1<<CONFIG_USB_SL811_BFIN_GPIO_VBUS);
146 bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
147 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
150 bfin_write_FIO_FLAG_S(mask);
152 bfin_write_FIO_FLAG_C(mask);
156 static struct sl811_platform_data sl811_priv = {
158 .power = 250, /* == 500mA */
159 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
160 .port_power = &sl811_port_power,
164 static struct platform_device sl811_hcd_device = {
168 .platform_data = &sl811_priv,
170 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
171 .resource = sl811_hcd_resources,
176 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
177 static struct resource isp1362_hcd_resources[] = {
181 .flags = IORESOURCE_MEM,
185 .flags = IORESOURCE_MEM,
187 .start = IRQ_PROG_INTA,
188 .end = IRQ_PROG_INTA,
189 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
191 .start = IRQ_PF0 + CONFIG_USB_ISP1362_BFIN_GPIO,
192 .end = IRQ_PF0 + CONFIG_USB_ISP1362_BFIN_GPIO,
193 .flags = IORESOURCE_IRQ,
197 static struct isp1362_platform_data isp1362_priv = {
202 .int_edge_triggered = 0,
203 .remote_wakeup_connected = 0,
204 .no_power_switching = 1,
205 .power_switching_mode = 0,
208 static struct platform_device isp1362_hcd_device = {
209 .name = "isp1362-hcd",
212 .platform_data = &isp1362_priv,
214 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
215 .resource = isp1362_hcd_resources,
219 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
220 static struct platform_device bfin_mac_device = {
225 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
226 static struct resource net2272_bfin_resources[] = {
229 .end = 0x20300000 + 0x100,
230 .flags = IORESOURCE_MEM,
234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
238 static struct platform_device net2272_bfin_device = {
241 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
242 .resource = net2272_bfin_resources,
246 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
247 /* all SPI peripherals info goes here */
249 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
250 static struct mtd_partition bfin_spi_flash_partitions[] = {
252 .name = "bootloader",
255 .mask_flags = MTD_CAP_ROM
261 .name = "file system",
263 .offset = 0x00100000,
267 static struct flash_platform_data bfin_spi_flash_data = {
269 .parts = bfin_spi_flash_partitions,
270 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
274 /* SPI flash chip (m25p64) */
275 static struct bfin5xx_spi_chip spi_flash_chip_info = {
276 .enable_dma = 0, /* use dma transfer with this chip*/
281 #if defined(CONFIG_SPI_ADC_BF533) \
282 || defined(CONFIG_SPI_ADC_BF533_MODULE)
284 static struct bfin5xx_spi_chip spi_adc_chip_info = {
285 .enable_dma = 1, /* use dma transfer with this chip*/
290 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
291 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
292 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
298 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
299 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
305 static struct spi_board_info bfin_spi_board_info[] __initdata = {
306 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
308 /* the modalias must be the same as spi device driver name */
309 .modalias = "m25p80", /* Name of spi_driver for this device */
310 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
311 .bus_num = 1, /* Framework bus number */
312 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL1*/
313 .platform_data = &bfin_spi_flash_data,
314 .controller_data = &spi_flash_chip_info,
319 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
321 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
322 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
323 .bus_num = 1, /* Framework bus number */
324 .chip_select = 1, /* Framework chip select. */
325 .platform_data = NULL, /* No spi_driver specific config */
326 .controller_data = &spi_adc_chip_info,
330 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
332 .modalias = "ad1836-spi",
333 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
335 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
336 .controller_data = &ad1836_spi_chip_info,
340 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
342 .modalias = "ad9960-spi",
343 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
346 .controller_data = &ad9960_spi_chip_info,
351 /* SPI controller data */
352 static struct bfin5xx_spi_master spi_bfin_master_info = {
354 .enable_dma = 1, /* master has the ability to do dma transfer */
357 static struct platform_device spi_bfin_master_device = {
358 .name = "bfin-spi-master",
359 .id = 1, /* Bus number */
361 .platform_data = &spi_bfin_master_info, /* Passed to driver */
364 #endif /* spi master and devices */
366 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
367 static struct platform_device bfin_fb_device = {
372 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
373 static struct resource bfin_uart_resources[] = {
377 .flags = IORESOURCE_MEM,
381 .flags = IORESOURCE_MEM,
385 static struct platform_device bfin_uart_device = {
388 .num_resources = ARRAY_SIZE(bfin_uart_resources),
389 .resource = bfin_uart_resources,
393 static struct platform_device *stamp_devices[] __initdata = {
394 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
398 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
399 &bfin_pcmcia_cf_device,
402 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
406 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
410 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
414 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
418 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
419 &net2272_bfin_device,
422 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
423 &spi_bfin_master_device,
426 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
430 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
435 static int __init stamp_init(void)
437 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
438 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
439 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
440 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
445 arch_initcall(stamp_init);