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>
45 * Name the Board for the /proc/cpuinfo
47 const char bfin_board_name
[] = "ADDS-BF561-EZKIT";
49 #define ISP1761_BASE 0x2C0F0000
50 #define ISP1761_IRQ IRQ_PF10
52 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
53 static struct resource bfin_isp1761_resources
[] = {
55 .name
= "isp1761-regs",
56 .start
= ISP1761_BASE
+ 0x00000000,
57 .end
= ISP1761_BASE
+ 0x000fffff,
58 .flags
= IORESOURCE_MEM
,
63 .flags
= IORESOURCE_IRQ
,
67 static struct platform_device bfin_isp1761_device
= {
70 .num_resources
= ARRAY_SIZE(bfin_isp1761_resources
),
71 .resource
= bfin_isp1761_resources
,
74 static struct platform_device
*bfin_isp1761_devices
[] = {
78 int __init
bfin_isp1761_init(void)
80 unsigned int num_devices
= ARRAY_SIZE(bfin_isp1761_devices
);
82 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
83 set_irq_type(ISP1761_IRQ
, IRQF_TRIGGER_FALLING
);
85 return platform_add_devices(bfin_isp1761_devices
, num_devices
);
88 void __exit
bfin_isp1761_exit(void)
90 platform_device_unregister(&bfin_isp1761_device
);
93 arch_initcall(bfin_isp1761_init
);
96 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
97 #include <linux/usb/isp1362.h>
99 static struct resource isp1362_hcd_resources
[] = {
103 .flags
= IORESOURCE_MEM
,
107 .flags
= IORESOURCE_MEM
,
111 .flags
= IORESOURCE_IRQ
,
115 static struct isp1362_platform_data isp1362_priv
= {
120 .int_edge_triggered
= 0,
121 .remote_wakeup_connected
= 0,
122 .no_power_switching
= 1,
123 .power_switching_mode
= 0,
126 static struct platform_device isp1362_hcd_device
= {
127 .name
= "isp1362-hcd",
130 .platform_data
= &isp1362_priv
,
132 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
133 .resource
= isp1362_hcd_resources
,
137 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
138 static struct resource net2272_bfin_resources
[] = {
141 .end
= 0x2C000000 + 0x7F,
142 .flags
= IORESOURCE_MEM
,
146 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
150 static struct platform_device net2272_bfin_device
= {
153 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
154 .resource
= net2272_bfin_resources
,
159 * USB-LAN EzExtender board
160 * Driver needs to know address, irq and flag pin.
162 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
163 static struct resource smc91x_resources
[] = {
165 .name
= "smc91x-regs",
167 .end
= 0x2C010300 + 16,
168 .flags
= IORESOURCE_MEM
,
173 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
177 static struct platform_device smc91x_device
= {
180 .num_resources
= ARRAY_SIZE(smc91x_resources
),
181 .resource
= smc91x_resources
,
185 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
186 static struct resource ax88180_resources
[] = {
189 .end
= 0x2c000000 + 0x8000,
190 .flags
= IORESOURCE_MEM
,
195 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
),
199 static struct platform_device ax88180_device
= {
202 .num_resources
= ARRAY_SIZE(ax88180_resources
),
203 .resource
= ax88180_resources
,
207 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
208 static struct resource bfin_uart_resources
[] = {
212 .flags
= IORESOURCE_MEM
,
216 static struct platform_device bfin_uart_device
= {
219 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
220 .resource
= bfin_uart_resources
,
224 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
225 static struct resource bfin_sir_resources
[] = {
226 #ifdef CONFIG_BFIN_SIR0
230 .flags
= IORESOURCE_MEM
,
235 static struct platform_device bfin_sir_device
= {
238 .num_resources
= ARRAY_SIZE(bfin_sir_resources
),
239 .resource
= bfin_sir_resources
,
243 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
244 static struct mtd_partition ezkit_partitions
[] = {
246 .name
= "Bootloader",
252 .offset
= MTDPART_OFS_APPEND
,
255 .size
= MTDPART_SIZ_FULL
,
256 .offset
= MTDPART_OFS_APPEND
,
260 static struct physmap_flash_data ezkit_flash_data
= {
262 .parts
= ezkit_partitions
,
263 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
266 static struct resource ezkit_flash_resource
= {
269 .flags
= IORESOURCE_MEM
,
272 static struct platform_device ezkit_flash_device
= {
273 .name
= "physmap-flash",
276 .platform_data
= &ezkit_flash_data
,
279 .resource
= &ezkit_flash_resource
,
283 #ifdef CONFIG_SPI_BFIN
284 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
285 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
286 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
292 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
293 static struct bfin5xx_spi_chip spidev_chip_info
= {
301 static struct resource bfin_spi0_resource
[] = {
303 .start
= SPI0_REGBASE
,
304 .end
= SPI0_REGBASE
+ 0xFF,
305 .flags
= IORESOURCE_MEM
,
310 .flags
= IORESOURCE_IRQ
,
314 /* SPI controller data */
315 static struct bfin5xx_spi_master bfin_spi0_info
= {
317 .enable_dma
= 1, /* master has the ability to do dma transfer */
318 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
321 static struct platform_device bfin_spi0_device
= {
323 .id
= 0, /* Bus number */
324 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
325 .resource
= bfin_spi0_resource
,
327 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
331 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
332 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
333 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
335 .modalias
= "ad1836-spi",
336 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
338 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
339 .controller_data
= &ad1836_spi_chip_info
,
342 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
344 .modalias
= "spidev",
345 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
348 .controller_data
= &spidev_chip_info
,
353 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
356 static struct pata_platform_info bfin_pata_platform_data
= {
358 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
361 static struct resource bfin_pata_resources
[] = {
365 .flags
= IORESOURCE_MEM
,
370 .flags
= IORESOURCE_MEM
,
375 .flags
= IORESOURCE_IRQ
,
379 static struct platform_device bfin_pata_device
= {
380 .name
= "pata_platform",
382 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
383 .resource
= bfin_pata_resources
,
385 .platform_data
= &bfin_pata_platform_data
,
390 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
391 #include <linux/input.h>
392 #include <linux/gpio_keys.h>
394 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
395 {BTN_0
, GPIO_PF5
, 1, "gpio-keys: BTN0"},
396 {BTN_1
, GPIO_PF6
, 1, "gpio-keys: BTN1"},
397 {BTN_2
, GPIO_PF7
, 1, "gpio-keys: BTN2"},
398 {BTN_3
, GPIO_PF8
, 1, "gpio-keys: BTN3"},
401 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
402 .buttons
= bfin_gpio_keys_table
,
403 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
406 static struct platform_device bfin_device_gpiokeys
= {
409 .platform_data
= &bfin_gpio_keys_data
,
414 static struct resource bfin_gpios_resources
= {
416 .end
= MAX_BLACKFIN_GPIOS
- 1,
417 .flags
= IORESOURCE_IRQ
,
420 static struct platform_device bfin_gpios_device
= {
421 .name
= "simple-gpio",
424 .resource
= &bfin_gpios_resources
,
427 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
428 #include <linux/i2c-gpio.h>
430 static struct i2c_gpio_platform_data i2c_gpio_data
= {
433 .sda_is_open_drain
= 0,
434 .scl_is_open_drain
= 0,
438 static struct platform_device i2c_gpio_device
= {
442 .platform_data
= &i2c_gpio_data
,
447 static const unsigned int cclk_vlev_datasheet
[] =
449 VRPAIR(VLEV_085
, 250000000),
450 VRPAIR(VLEV_090
, 300000000),
451 VRPAIR(VLEV_095
, 313000000),
452 VRPAIR(VLEV_100
, 350000000),
453 VRPAIR(VLEV_105
, 400000000),
454 VRPAIR(VLEV_110
, 444000000),
455 VRPAIR(VLEV_115
, 450000000),
456 VRPAIR(VLEV_120
, 475000000),
457 VRPAIR(VLEV_125
, 500000000),
458 VRPAIR(VLEV_130
, 600000000),
461 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
462 .tuple_tab
= cclk_vlev_datasheet
,
463 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
464 .vr_settling_time
= 25 /* us */,
467 static struct platform_device bfin_dpmc
= {
470 .platform_data
= &bfin_dmpc_vreg_data
,
474 static struct platform_device
*ezkit_devices
[] __initdata
= {
478 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
482 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
486 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
487 &net2272_bfin_device
,
490 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
494 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
498 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
502 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
506 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
507 &bfin_device_gpiokeys
,
510 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
514 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
520 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
525 static int __init
ezkit_init(void)
529 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
531 ret
= platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
535 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
536 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
540 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
541 spi_register_board_info(bfin_spi_board_info
,
542 ARRAY_SIZE(bfin_spi_board_info
));
545 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
546 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
551 arch_initcall(ezkit_init
);