2 * File: arch/blackfin/mach-bf533/ezkit.c
3 * Based on: Original Work
4 * Author: Aidan Williams <aidan@nicta.com.au>
9 * Modified: Robin Getz <rgetz@blackfin.uclinux.org> - Named the boards
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #include <linux/usb/isp1362.h>
38 #include <linux/pata_platform.h>
39 #include <linux/irq.h>
41 #include <asm/bfin5xx_spi.h>
42 #include <asm/portmux.h>
45 * Name the Board for the /proc/cpuinfo
47 const char bfin_board_name
[] = "ADDS-BF533-EZKIT";
49 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
50 static struct platform_device rtc_device
= {
56 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
57 static struct platform_device bfin_fb_adv7393_device
= {
58 .name
= "bfin-adv7393",
63 * USB-LAN EzExtender board
64 * Driver needs to know address, irq and flag pin.
66 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
67 static struct resource smc91x_resources
[] = {
69 .name
= "smc91x-regs",
71 .end
= 0x20310300 + 16,
72 .flags
= IORESOURCE_MEM
,
76 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
79 static struct platform_device smc91x_device
= {
82 .num_resources
= ARRAY_SIZE(smc91x_resources
),
83 .resource
= smc91x_resources
,
87 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
88 /* all SPI peripherals info goes here */
90 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
91 static struct mtd_partition bfin_spi_flash_partitions
[] = {
96 .mask_flags
= MTD_CAP_ROM
102 .name
= "file system",
104 .offset
= 0x00100000,
108 static struct flash_platform_data bfin_spi_flash_data
= {
110 .parts
= bfin_spi_flash_partitions
,
111 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
115 /* SPI flash chip (m25p64) */
116 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
117 .enable_dma
= 0, /* use dma transfer with this chip*/
122 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
124 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
125 .enable_dma
= 1, /* use dma transfer with this chip*/
130 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
131 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
137 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
138 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
140 /* the modalias must be the same as spi device driver name */
141 .modalias
= "m25p80", /* Name of spi_driver for this device */
142 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
143 .bus_num
= 0, /* Framework bus number */
144 .chip_select
= 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
145 .platform_data
= &bfin_spi_flash_data
,
146 .controller_data
= &spi_flash_chip_info
,
151 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
153 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
154 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
155 .bus_num
= 0, /* Framework bus number */
156 .chip_select
= 1, /* Framework chip select. */
157 .platform_data
= NULL
, /* No spi_driver specific config */
158 .controller_data
= &spi_adc_chip_info
,
162 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
164 .modalias
= "ad1836-spi",
165 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
167 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
168 .controller_data
= &ad1836_spi_chip_info
,
174 static struct resource bfin_spi0_resource
[] = {
176 .start
= SPI0_REGBASE
,
177 .end
= SPI0_REGBASE
+ 0xFF,
178 .flags
= IORESOURCE_MEM
,
183 .flags
= IORESOURCE_IRQ
,
187 /* SPI controller data */
188 static struct bfin5xx_spi_master bfin_spi0_info
= {
190 .enable_dma
= 1, /* master has the ability to do dma transfer */
191 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
194 static struct platform_device bfin_spi0_device
= {
196 .id
= 0, /* Bus number */
197 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
198 .resource
= bfin_spi0_resource
,
200 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
203 #endif /* spi master and devices */
205 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
206 static struct resource bfin_uart_resources
[] = {
210 .flags
= IORESOURCE_MEM
,
214 static struct platform_device bfin_uart_device
= {
217 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
218 .resource
= bfin_uart_resources
,
222 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
225 static struct pata_platform_info bfin_pata_platform_data
= {
227 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
230 static struct resource bfin_pata_resources
[] = {
234 .flags
= IORESOURCE_MEM
,
239 .flags
= IORESOURCE_MEM
,
244 .flags
= IORESOURCE_IRQ
,
248 static struct platform_device bfin_pata_device
= {
249 .name
= "pata_platform",
251 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
252 .resource
= bfin_pata_resources
,
254 .platform_data
= &bfin_pata_platform_data
,
259 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
260 #include <linux/input.h>
261 #include <linux/gpio_keys.h>
263 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
264 {BTN_0
, GPIO_PF7
, 1, "gpio-keys: BTN0"},
265 {BTN_1
, GPIO_PF8
, 1, "gpio-keys: BTN1"},
266 {BTN_2
, GPIO_PF9
, 1, "gpio-keys: BTN2"},
267 {BTN_3
, GPIO_PF10
, 1, "gpio-keys: BTN3"},
270 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
271 .buttons
= bfin_gpio_keys_table
,
272 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
275 static struct platform_device bfin_device_gpiokeys
= {
278 .platform_data
= &bfin_gpio_keys_data
,
283 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
284 #include <linux/i2c-gpio.h>
286 static struct i2c_gpio_platform_data i2c_gpio_data
= {
289 .sda_is_open_drain
= 0,
290 .scl_is_open_drain
= 0,
294 static struct platform_device i2c_gpio_device
= {
298 .platform_data
= &i2c_gpio_data
,
303 static struct platform_device
*ezkit_devices
[] __initdata
= {
304 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
308 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
312 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
313 &bfin_fb_adv7393_device
,
316 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
320 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
324 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
328 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
329 &bfin_device_gpiokeys
,
332 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
337 static int __init
ezkit_init(void)
339 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
340 platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
341 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
342 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
345 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
346 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
351 arch_initcall(ezkit_init
);