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>
38 #include <linux/ata_platform.h>
40 #include <asm/bfin5xx_spi.h>
41 #include <asm/portmux.h>
44 * Name the Board for the /proc/cpuinfo
46 const char bfin_board_name[] = "ADDS-BF561-EZKIT";
48 #define ISP1761_BASE 0x2C0F0000
49 #define ISP1761_IRQ IRQ_PF10
51 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
52 static struct resource bfin_isp1761_resources[] = {
54 .name = "isp1761-regs",
55 .start = ISP1761_BASE + 0x00000000,
56 .end = ISP1761_BASE + 0x000fffff,
57 .flags = IORESOURCE_MEM,
62 .flags = IORESOURCE_IRQ,
66 static struct platform_device bfin_isp1761_device = {
69 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
70 .resource = bfin_isp1761_resources,
73 static struct platform_device *bfin_isp1761_devices[] = {
77 int __init bfin_isp1761_init(void)
79 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
81 printk(KERN_INFO "%s(): registering device resources\n", __func__);
82 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
84 return platform_add_devices(bfin_isp1761_devices, num_devices);
87 void __exit bfin_isp1761_exit(void)
89 platform_device_unregister(&bfin_isp1761_device);
92 arch_initcall(bfin_isp1761_init);
95 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
96 #include <linux/usb/isp1362.h>
98 static struct resource isp1362_hcd_resources[] = {
102 .flags = IORESOURCE_MEM,
106 .flags = IORESOURCE_MEM,
110 .flags = IORESOURCE_IRQ,
114 static struct isp1362_platform_data isp1362_priv = {
119 .int_edge_triggered = 0,
120 .remote_wakeup_connected = 0,
121 .no_power_switching = 1,
122 .power_switching_mode = 0,
125 static struct platform_device isp1362_hcd_device = {
126 .name = "isp1362-hcd",
129 .platform_data = &isp1362_priv,
131 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
132 .resource = isp1362_hcd_resources,
136 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
137 static struct resource net2272_bfin_resources[] = {
140 .end = 0x2C000000 + 0x7F,
141 .flags = IORESOURCE_MEM,
145 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
149 static struct platform_device net2272_bfin_device = {
152 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
153 .resource = net2272_bfin_resources,
158 * USB-LAN EzExtender board
159 * Driver needs to know address, irq and flag pin.
161 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
162 static struct resource smc91x_resources[] = {
164 .name = "smc91x-regs",
166 .end = 0x2C010300 + 16,
167 .flags = IORESOURCE_MEM,
172 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
176 static struct platform_device smc91x_device = {
179 .num_resources = ARRAY_SIZE(smc91x_resources),
180 .resource = smc91x_resources,
184 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
185 static struct resource ax88180_resources[] = {
188 .end = 0x2c000000 + 0x8000,
189 .flags = IORESOURCE_MEM,
194 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
198 static struct platform_device ax88180_device = {
201 .num_resources = ARRAY_SIZE(ax88180_resources),
202 .resource = ax88180_resources,
206 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
207 static struct resource bfin_uart_resources[] = {
211 .flags = IORESOURCE_MEM,
215 static struct platform_device bfin_uart_device = {
218 .num_resources = ARRAY_SIZE(bfin_uart_resources),
219 .resource = bfin_uart_resources,
223 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
224 static struct resource bfin_sir_resources[] = {
225 #ifdef CONFIG_BFIN_SIR0
229 .flags = IORESOURCE_MEM,
234 static struct platform_device bfin_sir_device = {
237 .num_resources = ARRAY_SIZE(bfin_sir_resources),
238 .resource = bfin_sir_resources,
242 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
243 static struct mtd_partition ezkit_partitions[] = {
245 .name = "Bootloader",
251 .offset = MTDPART_OFS_APPEND,
254 .size = MTDPART_SIZ_FULL,
255 .offset = MTDPART_OFS_APPEND,
259 static struct physmap_flash_data ezkit_flash_data = {
261 .parts = ezkit_partitions,
262 .nr_parts = ARRAY_SIZE(ezkit_partitions),
265 static struct resource ezkit_flash_resource = {
268 .flags = IORESOURCE_MEM,
271 static struct platform_device ezkit_flash_device = {
272 .name = "physmap-flash",
275 .platform_data = &ezkit_flash_data,
278 .resource = &ezkit_flash_resource,
282 #ifdef CONFIG_SPI_BFIN
283 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
284 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
285 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
291 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
292 static struct bfin5xx_spi_chip spidev_chip_info = {
300 static struct resource bfin_spi0_resource[] = {
302 .start = SPI0_REGBASE,
303 .end = SPI0_REGBASE + 0xFF,
304 .flags = IORESOURCE_MEM,
309 .flags = IORESOURCE_IRQ,
313 /* SPI controller data */
314 static struct bfin5xx_spi_master bfin_spi0_info = {
316 .enable_dma = 1, /* master has the ability to do dma transfer */
317 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
320 static struct platform_device bfin_spi0_device = {
322 .id = 0, /* Bus number */
323 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
324 .resource = bfin_spi0_resource,
326 .platform_data = &bfin_spi0_info, /* Passed to driver */
330 static struct spi_board_info bfin_spi_board_info[] __initdata = {
331 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
332 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
334 .modalias = "ad1836-spi",
335 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
337 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
338 .controller_data = &ad1836_spi_chip_info,
341 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
343 .modalias = "spidev",
344 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
347 .controller_data = &spidev_chip_info,
352 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
355 static struct pata_platform_info bfin_pata_platform_data = {
357 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
360 static struct resource bfin_pata_resources[] = {
364 .flags = IORESOURCE_MEM,
369 .flags = IORESOURCE_MEM,
374 .flags = IORESOURCE_IRQ,
378 static struct platform_device bfin_pata_device = {
379 .name = "pata_platform",
381 .num_resources = ARRAY_SIZE(bfin_pata_resources),
382 .resource = bfin_pata_resources,
384 .platform_data = &bfin_pata_platform_data,
389 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
390 #include <linux/input.h>
391 #include <linux/gpio_keys.h>
393 static struct gpio_keys_button bfin_gpio_keys_table[] = {
394 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
395 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
396 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
397 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
400 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
401 .buttons = bfin_gpio_keys_table,
402 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
405 static struct platform_device bfin_device_gpiokeys = {
408 .platform_data = &bfin_gpio_keys_data,
413 static struct resource bfin_gpios_resources = {
415 .end = MAX_BLACKFIN_GPIOS - 1,
416 .flags = IORESOURCE_IRQ,
419 static struct platform_device bfin_gpios_device = {
420 .name = "simple-gpio",
423 .resource = &bfin_gpios_resources,
426 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
427 #include <linux/i2c-gpio.h>
429 static struct i2c_gpio_platform_data i2c_gpio_data = {
432 .sda_is_open_drain = 0,
433 .scl_is_open_drain = 0,
437 static struct platform_device i2c_gpio_device = {
441 .platform_data = &i2c_gpio_data,
446 static struct platform_device *ezkit_devices[] __initdata = {
447 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
451 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
455 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
456 &net2272_bfin_device,
459 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
463 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
467 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
471 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
475 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
476 &bfin_device_gpiokeys,
479 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
483 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
489 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
494 static int __init ezkit_init(void)
498 printk(KERN_INFO "%s(): registering device resources\n", __func__);
500 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
504 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
505 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
509 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
510 spi_register_board_info(bfin_spi_board_info,
511 ARRAY_SIZE(bfin_spi_board_info));
514 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
515 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
520 arch_initcall(ezkit_init);