2 * Copyright 2004-2009 Analog Devices Inc.
5 * Ivan Danov <idanov@gmail.com>
6 * 2005 National ICT Australia (NICTA)
7 * Aidan Williams <aidan@nicta.com.au>
9 * Licensed under the GPL-2 or later.
12 #include <linux/device.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/spi/spi.h>
17 #include <linux/spi/flash.h>
18 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19 #include <linux/usb/isp1362.h>
22 #include <asm/bfin5xx_spi.h>
23 #include <asm/portmux.h>
26 * Name the Board for the /proc/cpuinfo
28 const char bfin_board_name[] = "IP04/IP08";
31 * Driver needs to know address, irq and flag pin.
33 #if defined(CONFIG_BFIN532_IP0X)
34 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
36 #include <linux/dm9000.h>
38 static struct resource dm9000_resource1[] = {
41 .end = 0x20100000 + 1,
42 .flags = IORESOURCE_MEM
44 .start = 0x20100000 + 2,
45 .end = 0x20100000 + 3,
46 .flags = IORESOURCE_MEM
50 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
54 static struct resource dm9000_resource2[] = {
57 .end = 0x20200000 + 1,
58 .flags = IORESOURCE_MEM
60 .start = 0x20200000 + 2,
61 .end = 0x20200000 + 3,
62 .flags = IORESOURCE_MEM
66 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
71 * for the moment we limit ourselves to 16bit IO until some
72 * better IO routines can be written and tested
74 static struct dm9000_plat_data dm9000_platdata1 = {
75 .flags = DM9000_PLATF_16BITONLY,
78 static struct platform_device dm9000_device1 = {
81 .num_resources = ARRAY_SIZE(dm9000_resource1),
82 .resource = dm9000_resource1,
84 .platform_data = &dm9000_platdata1,
88 static struct dm9000_plat_data dm9000_platdata2 = {
89 .flags = DM9000_PLATF_16BITONLY,
92 static struct platform_device dm9000_device2 = {
95 .num_resources = ARRAY_SIZE(dm9000_resource2),
96 .resource = dm9000_resource2,
98 .platform_data = &dm9000_platdata2,
106 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
107 /* all SPI peripherals info goes here */
109 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
110 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
111 .enable_dma = 0, /* if 1 - block!!! */
116 /* Notice: for blackfin, the speed_hz is the value of register
117 * SPI_BAUD, not the real baudrate */
118 static struct spi_board_info bfin_spi_board_info[] __initdata = {
119 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
121 .modalias = "mmc_spi",
125 .controller_data = &mmc_spi_chip_info,
130 /* SPI controller data */
131 static struct bfin5xx_spi_master spi_bfin_master_info = {
133 .enable_dma = 1, /* master has the ability to do dma transfer */
136 static struct platform_device spi_bfin_master_device = {
137 .name = "bfin-spi-master",
138 .id = 1, /* Bus number */
140 .platform_data = &spi_bfin_master_info, /* Passed to driver */
143 #endif /* spi master and devices */
145 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
146 static struct resource bfin_uart_resources[] = {
150 .flags = IORESOURCE_MEM,
154 static struct platform_device bfin_uart_device = {
157 .num_resources = ARRAY_SIZE(bfin_uart_resources),
158 .resource = bfin_uart_resources,
162 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
163 #ifdef CONFIG_BFIN_SIR0
164 static struct resource bfin_sir0_resources[] = {
168 .flags = IORESOURCE_MEM,
171 .start = IRQ_UART0_RX,
172 .end = IRQ_UART0_RX+1,
173 .flags = IORESOURCE_IRQ,
176 .start = CH_UART0_RX,
177 .end = CH_UART0_RX+1,
178 .flags = IORESOURCE_DMA,
182 static struct platform_device bfin_sir0_device = {
185 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
186 .resource = bfin_sir0_resources,
191 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
192 static struct resource isp1362_hcd_resources[] = {
195 .end = 0x20300000 + 1,
196 .flags = IORESOURCE_MEM,
198 .start = 0x20300000 + 2,
199 .end = 0x20300000 + 3,
200 .flags = IORESOURCE_MEM,
204 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
208 static struct isp1362_platform_data isp1362_priv = {
211 .oc_enable = 0, /* external OC */
213 .int_edge_triggered = 0,
214 .remote_wakeup_connected = 0,
215 .no_power_switching = 1,
216 .power_switching_mode = 0,
219 static struct platform_device isp1362_hcd_device = {
220 .name = "isp1362-hcd",
223 .platform_data = &isp1362_priv,
225 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
226 .resource = isp1362_hcd_resources,
231 static struct platform_device *ip0x_devices[] __initdata = {
232 #if defined(CONFIG_BFIN532_IP0X)
233 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
239 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
240 &spi_bfin_master_device,
243 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
247 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
248 #ifdef CONFIG_BFIN_SIR0
253 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
258 static int __init ip0x_init(void)
262 printk(KERN_INFO "%s(): registering device resources\n", __func__);
263 platform_add_devices(ip0x_devices, ARRAY_SIZE(ip0x_devices));
265 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
266 for (i = 0; i < ARRAY_SIZE(bfin_spi_board_info); ++i) {
267 int j = 1 << bfin_spi_board_info[i].chip_select;
268 /* set spi cs to 1 */
269 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | j);
270 bfin_write_FIO_FLAG_S(j);
272 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
278 arch_initcall(ip0x_init);