Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / blackfin / mach-bf533 / boards / ezkit.c
blob6faff6fe5dc5fe8925195da6be81c49483cca9c9
1 /*
2 * File: arch/blackfin/mach-bf533/ezkit.c
3 * Based on: Original Work
4 * Author: Aidan Williams <aidan@nicta.com.au>
6 * Created: 2005
7 * Description:
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 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38 #include <linux/usb/isp1362.h>
39 #endif
40 #include <linux/ata_platform.h>
41 #include <linux/irq.h>
42 #include <asm/dma.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <asm/portmux.h>
47 * Name the Board for the /proc/cpuinfo
49 const char bfin_board_name[] = "ADDS-BF533-EZKIT";
51 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
52 static struct platform_device rtc_device = {
53 .name = "rtc-bfin",
54 .id = -1,
56 #endif
58 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
59 static struct platform_device bfin_fb_adv7393_device = {
60 .name = "bfin-adv7393",
62 #endif
65 * USB-LAN EzExtender board
66 * Driver needs to know address, irq and flag pin.
68 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
69 static struct resource smc91x_resources[] = {
71 .name = "smc91x-regs",
72 .start = 0x20310300,
73 .end = 0x20310300 + 16,
74 .flags = IORESOURCE_MEM,
75 }, {
76 .start = IRQ_PF9,
77 .end = IRQ_PF9,
78 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
81 static struct platform_device smc91x_device = {
82 .name = "smc91x",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(smc91x_resources),
85 .resource = smc91x_resources,
87 #endif
89 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
90 /* all SPI peripherals info goes here */
92 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
93 static struct mtd_partition bfin_spi_flash_partitions[] = {
95 .name = "bootloader",
96 .size = 0x00020000,
97 .offset = 0,
98 .mask_flags = MTD_CAP_ROM
99 }, {
100 .name = "kernel",
101 .size = 0xe0000,
102 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/ezkit.c
103 .offset = 0x20000
104 =======
105 .offset = MTDPART_OFS_APPEND,
106 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/ezkit.c
107 }, {
108 .name = "file system",
109 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/ezkit.c
110 .size = 0x700000,
111 .offset = 0x00100000,
112 =======
113 .size = MTDPART_SIZ_FULL,
114 .offset = MTDPART_OFS_APPEND,
115 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/ezkit.c
119 static struct flash_platform_data bfin_spi_flash_data = {
120 .name = "m25p80",
121 .parts = bfin_spi_flash_partitions,
122 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
123 .type = "m25p64",
126 /* SPI flash chip (m25p64) */
127 static struct bfin5xx_spi_chip spi_flash_chip_info = {
128 .enable_dma = 0, /* use dma transfer with this chip*/
129 .bits_per_word = 8,
131 #endif
133 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
134 /* SPI ADC chip */
135 static struct bfin5xx_spi_chip spi_adc_chip_info = {
136 .enable_dma = 1, /* use dma transfer with this chip*/
137 .bits_per_word = 16,
139 #endif
141 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
142 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
143 .enable_dma = 0,
144 .bits_per_word = 16,
146 #endif
148 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
149 static struct bfin5xx_spi_chip spidev_chip_info = {
150 .enable_dma = 0,
151 .bits_per_word = 8,
153 #endif
155 static struct spi_board_info bfin_spi_board_info[] __initdata = {
156 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
158 /* the modalias must be the same as spi device driver name */
159 .modalias = "m25p80", /* Name of spi_driver for this device */
160 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
161 .bus_num = 0, /* Framework bus number */
162 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
163 .platform_data = &bfin_spi_flash_data,
164 .controller_data = &spi_flash_chip_info,
165 .mode = SPI_MODE_3,
167 #endif
169 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
171 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
172 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
173 .bus_num = 0, /* Framework bus number */
174 .chip_select = 1, /* Framework chip select. */
175 .platform_data = NULL, /* No spi_driver specific config */
176 .controller_data = &spi_adc_chip_info,
178 #endif
180 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
182 .modalias = "ad1836-spi",
183 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
184 .bus_num = 0,
185 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
186 .controller_data = &ad1836_spi_chip_info,
188 #endif
189 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
191 .modalias = "spidev",
192 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
193 .bus_num = 0,
194 .chip_select = 1,
195 .controller_data = &spidev_chip_info,
197 #endif
200 /* SPI (0) */
201 static struct resource bfin_spi0_resource[] = {
202 [0] = {
203 .start = SPI0_REGBASE,
204 .end = SPI0_REGBASE + 0xFF,
205 .flags = IORESOURCE_MEM,
207 [1] = {
208 .start = CH_SPI,
209 .end = CH_SPI,
210 .flags = IORESOURCE_IRQ,
214 /* SPI controller data */
215 static struct bfin5xx_spi_master bfin_spi0_info = {
216 .num_chipselect = 8,
217 .enable_dma = 1, /* master has the ability to do dma transfer */
218 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
221 static struct platform_device bfin_spi0_device = {
222 .name = "bfin-spi",
223 .id = 0, /* Bus number */
224 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
225 .resource = bfin_spi0_resource,
226 .dev = {
227 .platform_data = &bfin_spi0_info, /* Passed to driver */
230 #endif /* spi master and devices */
232 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
233 static struct resource bfin_uart_resources[] = {
235 .start = 0xFFC00400,
236 .end = 0xFFC004FF,
237 .flags = IORESOURCE_MEM,
241 static struct platform_device bfin_uart_device = {
242 .name = "bfin-uart",
243 .id = 1,
244 .num_resources = ARRAY_SIZE(bfin_uart_resources),
245 .resource = bfin_uart_resources,
247 #endif
249 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
250 #define PATA_INT 55
252 static struct pata_platform_info bfin_pata_platform_data = {
253 .ioport_shift = 1,
254 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
257 static struct resource bfin_pata_resources[] = {
259 .start = 0x20314020,
260 .end = 0x2031403F,
261 .flags = IORESOURCE_MEM,
264 .start = 0x2031401C,
265 .end = 0x2031401F,
266 .flags = IORESOURCE_MEM,
269 .start = PATA_INT,
270 .end = PATA_INT,
271 .flags = IORESOURCE_IRQ,
275 static struct platform_device bfin_pata_device = {
276 .name = "pata_platform",
277 .id = -1,
278 .num_resources = ARRAY_SIZE(bfin_pata_resources),
279 .resource = bfin_pata_resources,
280 .dev = {
281 .platform_data = &bfin_pata_platform_data,
284 #endif
286 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
287 #include <linux/input.h>
288 #include <linux/gpio_keys.h>
290 static struct gpio_keys_button bfin_gpio_keys_table[] = {
291 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
292 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
293 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
294 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
297 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
298 .buttons = bfin_gpio_keys_table,
299 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
302 static struct platform_device bfin_device_gpiokeys = {
303 .name = "gpio-keys",
304 .dev = {
305 .platform_data = &bfin_gpio_keys_data,
308 #endif
310 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/ezkit.c
311 =======
312 static struct resource bfin_gpios_resources = {
313 .start = 0,
314 .end = MAX_BLACKFIN_GPIOS - 1,
315 .flags = IORESOURCE_IRQ,
318 static struct platform_device bfin_gpios_device = {
319 .name = "simple-gpio",
320 .id = -1,
321 .num_resources = 1,
322 .resource = &bfin_gpios_resources,
325 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/ezkit.c
326 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
327 #include <linux/i2c-gpio.h>
329 static struct i2c_gpio_platform_data i2c_gpio_data = {
330 .sda_pin = 1,
331 .scl_pin = 0,
332 .sda_is_open_drain = 0,
333 .scl_is_open_drain = 0,
334 .udelay = 40,
337 static struct platform_device i2c_gpio_device = {
338 .name = "i2c-gpio",
339 .id = 0,
340 .dev = {
341 .platform_data = &i2c_gpio_data,
344 #endif
346 static struct platform_device *ezkit_devices[] __initdata = {
347 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
348 &smc91x_device,
349 #endif
351 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
352 &bfin_spi0_device,
353 #endif
355 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
356 &bfin_fb_adv7393_device,
357 #endif
359 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
360 &rtc_device,
361 #endif
363 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
364 &bfin_uart_device,
365 #endif
367 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
368 &bfin_pata_device,
369 #endif
371 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
372 &bfin_device_gpiokeys,
373 #endif
375 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
376 &i2c_gpio_device,
377 #endif
378 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/ezkit.c
379 =======
381 &bfin_gpios_device,
382 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/ezkit.c
385 static int __init ezkit_init(void)
387 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
388 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
389 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
390 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
391 #endif
393 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
394 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
395 #endif
396 return 0;
399 arch_initcall(ezkit_init);