2 * File: arch/blackfin/mach-bf561/ezkit.c
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/partitions.h>
34 #include <linux/mtd/physmap.h>
35 #include <linux/spi/spi.h>
36 #include <linux/irq.h>
37 #include <linux/interrupt.h>
39 #include <asm/bfin5xx_spi.h>
40 #include <asm/portmux.h>
44 * Name the Board for the /proc/cpuinfo
46 const char bfin_board_name
[] = "ADI BF561-EZKIT";
48 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
49 #include <linux/usb/isp1760.h>
50 static struct resource bfin_isp1760_resources
[] = {
53 .end
= 0x203C0000 + 0xfffff,
54 .flags
= IORESOURCE_MEM
,
59 .flags
= IORESOURCE_IRQ
,
63 static struct isp1760_platform_data isp1760_priv
= {
69 .dack_polarity_high
= 0,
70 .dreq_polarity_high
= 0,
73 static struct platform_device bfin_isp1760_device
= {
74 .name
= "isp1760-hcd",
77 .platform_data
= &isp1760_priv
,
79 .num_resources
= ARRAY_SIZE(bfin_isp1760_resources
),
80 .resource
= bfin_isp1760_resources
,
84 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
85 #include <linux/usb/isp1362.h>
87 static struct resource isp1362_hcd_resources
[] = {
91 .flags
= IORESOURCE_MEM
,
95 .flags
= IORESOURCE_MEM
,
99 .flags
= IORESOURCE_IRQ
,
103 static struct isp1362_platform_data isp1362_priv
= {
108 .int_edge_triggered
= 0,
109 .remote_wakeup_connected
= 0,
110 .no_power_switching
= 1,
111 .power_switching_mode
= 0,
114 static struct platform_device isp1362_hcd_device
= {
115 .name
= "isp1362-hcd",
118 .platform_data
= &isp1362_priv
,
120 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
121 .resource
= isp1362_hcd_resources
,
125 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
126 static struct resource net2272_bfin_resources
[] = {
129 .end
= 0x2C000000 + 0x7F,
130 .flags
= IORESOURCE_MEM
,
134 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
138 static struct platform_device net2272_bfin_device
= {
141 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
142 .resource
= net2272_bfin_resources
,
147 * USB-LAN EzExtender board
148 * Driver needs to know address, irq and flag pin.
150 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
151 static struct resource smc91x_resources
[] = {
153 .name
= "smc91x-regs",
155 .end
= 0x2C010300 + 16,
156 .flags
= IORESOURCE_MEM
,
161 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
165 static struct platform_device smc91x_device
= {
168 .num_resources
= ARRAY_SIZE(smc91x_resources
),
169 .resource
= smc91x_resources
,
173 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
174 static struct resource ax88180_resources
[] = {
177 .end
= 0x2c000000 + 0x8000,
178 .flags
= IORESOURCE_MEM
,
183 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
),
187 static struct platform_device ax88180_device
= {
190 .num_resources
= ARRAY_SIZE(ax88180_resources
),
191 .resource
= ax88180_resources
,
195 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
196 static struct resource bfin_uart_resources
[] = {
200 .flags
= IORESOURCE_MEM
,
204 static struct platform_device bfin_uart_device
= {
207 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
208 .resource
= bfin_uart_resources
,
212 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
213 #ifdef CONFIG_BFIN_SIR0
214 static struct resource bfin_sir0_resources
[] = {
218 .flags
= IORESOURCE_MEM
,
221 .start
= IRQ_UART0_RX
,
222 .end
= IRQ_UART0_RX
+1,
223 .flags
= IORESOURCE_IRQ
,
226 .start
= CH_UART0_RX
,
227 .end
= CH_UART0_RX
+1,
228 .flags
= IORESOURCE_DMA
,
232 static struct platform_device bfin_sir0_device
= {
235 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
236 .resource
= bfin_sir0_resources
,
241 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
242 static struct mtd_partition ezkit_partitions
[] = {
244 .name
= "bootloader(nor)",
248 .name
= "linux kernel(nor)",
250 .offset
= MTDPART_OFS_APPEND
,
252 .name
= "file system(nor)",
253 .size
= MTDPART_SIZ_FULL
,
254 .offset
= MTDPART_OFS_APPEND
,
258 static struct physmap_flash_data ezkit_flash_data
= {
260 .parts
= ezkit_partitions
,
261 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
264 static struct resource ezkit_flash_resource
= {
267 .flags
= IORESOURCE_MEM
,
270 static struct platform_device ezkit_flash_device
= {
271 .name
= "physmap-flash",
274 .platform_data
= &ezkit_flash_data
,
277 .resource
= &ezkit_flash_resource
,
281 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
282 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
283 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
289 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
290 static struct bfin5xx_spi_chip spidev_chip_info
= {
296 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
298 static struct resource bfin_spi0_resource
[] = {
300 .start
= SPI0_REGBASE
,
301 .end
= SPI0_REGBASE
+ 0xFF,
302 .flags
= IORESOURCE_MEM
,
307 .flags
= IORESOURCE_IRQ
,
311 /* SPI controller data */
312 static struct bfin5xx_spi_master bfin_spi0_info
= {
314 .enable_dma
= 1, /* master has the ability to do dma transfer */
315 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
318 static struct platform_device bfin_spi0_device
= {
320 .id
= 0, /* Bus number */
321 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
322 .resource
= bfin_spi0_resource
,
324 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
329 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
330 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
331 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
333 .modalias
= "ad1836-spi",
334 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
336 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
337 .controller_data
= &ad1836_spi_chip_info
,
340 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
342 .modalias
= "spidev",
343 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
346 .controller_data
= &spidev_chip_info
,
351 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
352 #include <linux/input.h>
353 #include <linux/gpio_keys.h>
355 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
356 {BTN_0
, GPIO_PF5
, 1, "gpio-keys: BTN0"},
357 {BTN_1
, GPIO_PF6
, 1, "gpio-keys: BTN1"},
358 {BTN_2
, GPIO_PF7
, 1, "gpio-keys: BTN2"},
359 {BTN_3
, GPIO_PF8
, 1, "gpio-keys: BTN3"},
362 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
363 .buttons
= bfin_gpio_keys_table
,
364 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
367 static struct platform_device bfin_device_gpiokeys
= {
370 .platform_data
= &bfin_gpio_keys_data
,
375 static struct resource bfin_gpios_resources
= {
377 .end
= MAX_BLACKFIN_GPIOS
- 1,
378 .flags
= IORESOURCE_IRQ
,
381 static struct platform_device bfin_gpios_device
= {
382 .name
= "simple-gpio",
385 .resource
= &bfin_gpios_resources
,
388 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
389 #include <linux/i2c-gpio.h>
391 static struct i2c_gpio_platform_data i2c_gpio_data
= {
394 .sda_is_open_drain
= 0,
395 .scl_is_open_drain
= 0,
399 static struct platform_device i2c_gpio_device
= {
403 .platform_data
= &i2c_gpio_data
,
408 static const unsigned int cclk_vlev_datasheet
[] =
410 VRPAIR(VLEV_085
, 250000000),
411 VRPAIR(VLEV_090
, 300000000),
412 VRPAIR(VLEV_095
, 313000000),
413 VRPAIR(VLEV_100
, 350000000),
414 VRPAIR(VLEV_105
, 400000000),
415 VRPAIR(VLEV_110
, 444000000),
416 VRPAIR(VLEV_115
, 450000000),
417 VRPAIR(VLEV_120
, 475000000),
418 VRPAIR(VLEV_125
, 500000000),
419 VRPAIR(VLEV_130
, 600000000),
422 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
423 .tuple_tab
= cclk_vlev_datasheet
,
424 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
425 .vr_settling_time
= 25 /* us */,
428 static struct platform_device bfin_dpmc
= {
431 .platform_data
= &bfin_dmpc_vreg_data
,
435 static struct platform_device
*ezkit_devices
[] __initdata
= {
439 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
443 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
447 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
448 &net2272_bfin_device
,
451 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
452 &bfin_isp1760_device
,
455 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
459 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
463 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
464 #ifdef CONFIG_BFIN_SIR0
469 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
470 &bfin_device_gpiokeys
,
473 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
477 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
483 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
488 static int __init
ezkit_init(void)
492 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
494 ret
= platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
498 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
499 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
503 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
507 arch_initcall(ezkit_init
);