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>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/portmux.h>
27 * Name the Board for the /proc/cpuinfo
29 const char bfin_board_name
[] = "IP04/IP08";
32 * Driver needs to know address, irq and flag pin.
34 #if defined(CONFIG_BFIN532_IP0X)
35 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
37 #include <linux/dm9000.h>
39 static struct resource dm9000_resource1
[] = {
42 .end
= 0x20100000 + 1,
43 .flags
= IORESOURCE_MEM
45 .start
= 0x20100000 + 2,
46 .end
= 0x20100000 + 3,
47 .flags
= IORESOURCE_MEM
51 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
55 static struct resource dm9000_resource2
[] = {
58 .end
= 0x20200000 + 1,
59 .flags
= IORESOURCE_MEM
61 .start
= 0x20200000 + 2,
62 .end
= 0x20200000 + 3,
63 .flags
= IORESOURCE_MEM
67 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
72 * for the moment we limit ourselves to 16bit IO until some
73 * better IO routines can be written and tested
75 static struct dm9000_plat_data dm9000_platdata1
= {
76 .flags
= DM9000_PLATF_16BITONLY
,
79 static struct platform_device dm9000_device1
= {
82 .num_resources
= ARRAY_SIZE(dm9000_resource1
),
83 .resource
= dm9000_resource1
,
85 .platform_data
= &dm9000_platdata1
,
89 static struct dm9000_plat_data dm9000_platdata2
= {
90 .flags
= DM9000_PLATF_16BITONLY
,
93 static struct platform_device dm9000_device2
= {
96 .num_resources
= ARRAY_SIZE(dm9000_resource2
),
97 .resource
= dm9000_resource2
,
99 .platform_data
= &dm9000_platdata2
,
107 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
108 /* all SPI peripherals info goes here */
110 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
111 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
112 .enable_dma
= 0, /* if 1 - block!!! */
117 /* Notice: for blackfin, the speed_hz is the value of register
118 * SPI_BAUD, not the real baudrate */
119 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
120 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
122 .modalias
= "mmc_spi",
126 .controller_data
= &mmc_spi_chip_info
,
131 /* SPI controller data */
132 static struct bfin5xx_spi_master spi_bfin_master_info
= {
134 .enable_dma
= 1, /* master has the ability to do dma transfer */
137 static struct platform_device spi_bfin_master_device
= {
138 .name
= "bfin-spi-master",
139 .id
= 1, /* Bus number */
141 .platform_data
= &spi_bfin_master_info
, /* Passed to driver */
144 #endif /* spi master and devices */
146 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
147 #ifdef CONFIG_SERIAL_BFIN_UART0
148 static struct resource bfin_uart0_resources
[] = {
150 .start
= BFIN_UART_THR
,
151 .end
= BFIN_UART_GCTL
+2,
152 .flags
= IORESOURCE_MEM
,
155 .start
= IRQ_UART0_RX
,
156 .end
= IRQ_UART0_RX
+ 1,
157 .flags
= IORESOURCE_IRQ
,
160 .start
= IRQ_UART0_ERROR
,
161 .end
= IRQ_UART0_ERROR
,
162 .flags
= IORESOURCE_IRQ
,
165 .start
= CH_UART0_TX
,
167 .flags
= IORESOURCE_DMA
,
170 .start
= CH_UART0_RX
,
172 .flags
= IORESOURCE_DMA
,
176 static unsigned short bfin_uart0_peripherals
[] = {
177 P_UART0_TX
, P_UART0_RX
, 0
180 static struct platform_device bfin_uart0_device
= {
183 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
184 .resource
= bfin_uart0_resources
,
186 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
192 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
193 #ifdef CONFIG_BFIN_SIR0
194 static struct resource bfin_sir0_resources
[] = {
198 .flags
= IORESOURCE_MEM
,
201 .start
= IRQ_UART0_RX
,
202 .end
= IRQ_UART0_RX
+1,
203 .flags
= IORESOURCE_IRQ
,
206 .start
= CH_UART0_RX
,
207 .end
= CH_UART0_RX
+1,
208 .flags
= IORESOURCE_DMA
,
212 static struct platform_device bfin_sir0_device
= {
215 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
216 .resource
= bfin_sir0_resources
,
221 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
222 static struct resource isp1362_hcd_resources
[] = {
225 .end
= 0x20300000 + 1,
226 .flags
= IORESOURCE_MEM
,
228 .start
= 0x20300000 + 2,
229 .end
= 0x20300000 + 3,
230 .flags
= IORESOURCE_MEM
,
234 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWEDGE
,
238 static struct isp1362_platform_data isp1362_priv
= {
241 .oc_enable
= 0, /* external OC */
243 .int_edge_triggered
= 0,
244 .remote_wakeup_connected
= 0,
245 .no_power_switching
= 1,
246 .power_switching_mode
= 0,
249 static struct platform_device isp1362_hcd_device
= {
250 .name
= "isp1362-hcd",
253 .platform_data
= &isp1362_priv
,
255 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
256 .resource
= isp1362_hcd_resources
,
261 static struct platform_device
*ip0x_devices
[] __initdata
= {
262 #if defined(CONFIG_BFIN532_IP0X)
263 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
269 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
270 &spi_bfin_master_device
,
273 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
274 #ifdef CONFIG_SERIAL_BFIN_UART0
279 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
280 #ifdef CONFIG_BFIN_SIR0
285 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
290 static int __init
ip0x_init(void)
294 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
295 platform_add_devices(ip0x_devices
, ARRAY_SIZE(ip0x_devices
));
297 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
302 arch_initcall(ip0x_init
);
304 static struct platform_device
*ip0x_early_devices
[] __initdata
= {
305 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
306 #ifdef CONFIG_SERIAL_BFIN_UART0
312 void __init
native_machine_early_platform_add_devices(void)
314 printk(KERN_INFO
"register early platform devices\n");
315 early_platform_add_devices(ip0x_early_devices
,
316 ARRAY_SIZE(ip0x_early_devices
));