warning removal
[cor_2_6_31.git] / arch / blackfin / mach-bf561 / boards / ezkit.c
blob4df904f9e90aebc498a5e3447b767a6ec73cbd75
1 /*
2 * File: arch/blackfin/mach-bf561/ezkit.c
3 * Based on:
4 * Author:
6 * Created:
7 * Description:
9 * Modified:
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 <asm/dma.h>
39 #include <asm/bfin5xx_spi.h>
40 #include <asm/portmux.h>
41 #include <asm/dpmc.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[] = {
51 [0] = {
52 .start = 0x2C0F0000,
53 .end = 0x203C0000 + 0xfffff,
54 .flags = IORESOURCE_MEM,
56 [1] = {
57 .start = IRQ_PF10,
58 .end = IRQ_PF10,
59 .flags = IORESOURCE_IRQ,
63 static struct isp1760_platform_data isp1760_priv = {
64 .is_isp1761 = 0,
65 .bus_width_16 = 1,
66 .port1_otg = 0,
67 .analog_oc = 0,
68 .dack_polarity_high = 0,
69 .dreq_polarity_high = 0,
72 static struct platform_device bfin_isp1760_device = {
73 .name = "isp1760-hcd",
74 .id = 0,
75 .dev = {
76 .platform_data = &isp1760_priv,
78 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
79 .resource = bfin_isp1760_resources,
81 #endif
83 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
84 #include <linux/usb/isp1362.h>
86 static struct resource isp1362_hcd_resources[] = {
88 .start = 0x2c060000,
89 .end = 0x2c060000,
90 .flags = IORESOURCE_MEM,
91 }, {
92 .start = 0x2c060004,
93 .end = 0x2c060004,
94 .flags = IORESOURCE_MEM,
95 }, {
96 .start = IRQ_PF8,
97 .end = IRQ_PF8,
98 .flags = IORESOURCE_IRQ,
102 static struct isp1362_platform_data isp1362_priv = {
103 .sel15Kres = 1,
104 .clknotstop = 0,
105 .oc_enable = 0,
106 .int_act_high = 0,
107 .int_edge_triggered = 0,
108 .remote_wakeup_connected = 0,
109 .no_power_switching = 1,
110 .power_switching_mode = 0,
113 static struct platform_device isp1362_hcd_device = {
114 .name = "isp1362-hcd",
115 .id = 0,
116 .dev = {
117 .platform_data = &isp1362_priv,
119 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
120 .resource = isp1362_hcd_resources,
122 #endif
124 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
125 static struct resource net2272_bfin_resources[] = {
127 .start = 0x2C000000,
128 .end = 0x2C000000 + 0x7F,
129 .flags = IORESOURCE_MEM,
130 }, {
131 .start = IRQ_PF10,
132 .end = IRQ_PF10,
133 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
137 static struct platform_device net2272_bfin_device = {
138 .name = "net2272",
139 .id = -1,
140 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
141 .resource = net2272_bfin_resources,
143 #endif
146 * USB-LAN EzExtender board
147 * Driver needs to know address, irq and flag pin.
149 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
150 static struct resource smc91x_resources[] = {
152 .name = "smc91x-regs",
153 .start = 0x2C010300,
154 .end = 0x2C010300 + 16,
155 .flags = IORESOURCE_MEM,
156 }, {
158 .start = IRQ_PF9,
159 .end = IRQ_PF9,
160 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
164 static struct platform_device smc91x_device = {
165 .name = "smc91x",
166 .id = 0,
167 .num_resources = ARRAY_SIZE(smc91x_resources),
168 .resource = smc91x_resources,
170 #endif
172 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
173 static struct resource ax88180_resources[] = {
174 [0] = {
175 .start = 0x2c000000,
176 .end = 0x2c000000 + 0x8000,
177 .flags = IORESOURCE_MEM,
179 [1] = {
180 .start = IRQ_PF10,
181 .end = IRQ_PF10,
182 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
186 static struct platform_device ax88180_device = {
187 .name = "ax88180",
188 .id = -1,
189 .num_resources = ARRAY_SIZE(ax88180_resources),
190 .resource = ax88180_resources,
192 #endif
194 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
195 static struct resource bfin_uart_resources[] = {
197 .start = 0xFFC00400,
198 .end = 0xFFC004FF,
199 .flags = IORESOURCE_MEM,
203 static struct platform_device bfin_uart_device = {
204 .name = "bfin-uart",
205 .id = 1,
206 .num_resources = ARRAY_SIZE(bfin_uart_resources),
207 .resource = bfin_uart_resources,
209 #endif
211 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
212 #ifdef CONFIG_BFIN_SIR0
213 static struct resource bfin_sir0_resources[] = {
215 .start = 0xFFC00400,
216 .end = 0xFFC004FF,
217 .flags = IORESOURCE_MEM,
220 .start = IRQ_UART0_RX,
221 .end = IRQ_UART0_RX+1,
222 .flags = IORESOURCE_IRQ,
225 .start = CH_UART0_RX,
226 .end = CH_UART0_RX+1,
227 .flags = IORESOURCE_DMA,
231 static struct platform_device bfin_sir0_device = {
232 .name = "bfin_sir",
233 .id = 0,
234 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
235 .resource = bfin_sir0_resources,
237 #endif
238 #endif
240 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
241 static struct mtd_partition ezkit_partitions[] = {
243 .name = "bootloader(nor)",
244 .size = 0x40000,
245 .offset = 0,
246 }, {
247 .name = "linux kernel(nor)",
248 .size = 0x1C0000,
249 .offset = MTDPART_OFS_APPEND,
250 }, {
251 .name = "file system(nor)",
252 .size = MTDPART_SIZ_FULL,
253 .offset = MTDPART_OFS_APPEND,
257 static struct physmap_flash_data ezkit_flash_data = {
258 .width = 2,
259 .parts = ezkit_partitions,
260 .nr_parts = ARRAY_SIZE(ezkit_partitions),
263 static struct resource ezkit_flash_resource = {
264 .start = 0x20000000,
265 .end = 0x207fffff,
266 .flags = IORESOURCE_MEM,
269 static struct platform_device ezkit_flash_device = {
270 .name = "physmap-flash",
271 .id = 0,
272 .dev = {
273 .platform_data = &ezkit_flash_data,
275 .num_resources = 1,
276 .resource = &ezkit_flash_resource,
278 #endif
280 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
281 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
282 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
283 .enable_dma = 0,
284 .bits_per_word = 16,
286 #endif
288 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
289 static struct bfin5xx_spi_chip spidev_chip_info = {
290 .enable_dma = 0,
291 .bits_per_word = 8,
293 #endif
295 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
296 /* SPI (0) */
297 static struct resource bfin_spi0_resource[] = {
298 [0] = {
299 .start = SPI0_REGBASE,
300 .end = SPI0_REGBASE + 0xFF,
301 .flags = IORESOURCE_MEM,
303 [1] = {
304 .start = CH_SPI,
305 .end = CH_SPI,
306 .flags = IORESOURCE_DMA,
308 [2] = {
309 .start = IRQ_SPI,
310 .end = IRQ_SPI,
311 .flags = IORESOURCE_IRQ,
315 /* SPI controller data */
316 static struct bfin5xx_spi_master bfin_spi0_info = {
317 .num_chipselect = 8,
318 .enable_dma = 1, /* master has the ability to do dma transfer */
319 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
322 static struct platform_device bfin_spi0_device = {
323 .name = "bfin-spi",
324 .id = 0, /* Bus number */
325 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
326 .resource = bfin_spi0_resource,
327 .dev = {
328 .platform_data = &bfin_spi0_info, /* Passed to driver */
331 #endif
333 static struct spi_board_info bfin_spi_board_info[] __initdata = {
334 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
335 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
337 .modalias = "ad1836-spi",
338 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
339 .bus_num = 0,
340 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
341 .controller_data = &ad1836_spi_chip_info,
343 #endif
344 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
346 .modalias = "spidev",
347 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
348 .bus_num = 0,
349 .chip_select = 1,
350 .controller_data = &spidev_chip_info,
352 #endif
355 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
356 #include <linux/input.h>
357 #include <linux/gpio_keys.h>
359 static struct gpio_keys_button bfin_gpio_keys_table[] = {
360 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
361 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
362 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
363 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
366 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
367 .buttons = bfin_gpio_keys_table,
368 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
371 static struct platform_device bfin_device_gpiokeys = {
372 .name = "gpio-keys",
373 .dev = {
374 .platform_data = &bfin_gpio_keys_data,
377 #endif
379 static struct resource bfin_gpios_resources = {
380 .start = 0,
381 .end = MAX_BLACKFIN_GPIOS - 1,
382 .flags = IORESOURCE_IRQ,
385 static struct platform_device bfin_gpios_device = {
386 .name = "simple-gpio",
387 .id = -1,
388 .num_resources = 1,
389 .resource = &bfin_gpios_resources,
392 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
393 #include <linux/i2c-gpio.h>
395 static struct i2c_gpio_platform_data i2c_gpio_data = {
396 .sda_pin = 1,
397 .scl_pin = 0,
398 .sda_is_open_drain = 0,
399 .scl_is_open_drain = 0,
400 .udelay = 40,
403 static struct platform_device i2c_gpio_device = {
404 .name = "i2c-gpio",
405 .id = 0,
406 .dev = {
407 .platform_data = &i2c_gpio_data,
410 #endif
412 static const unsigned int cclk_vlev_datasheet[] =
414 VRPAIR(VLEV_085, 250000000),
415 VRPAIR(VLEV_090, 300000000),
416 VRPAIR(VLEV_095, 313000000),
417 VRPAIR(VLEV_100, 350000000),
418 VRPAIR(VLEV_105, 400000000),
419 VRPAIR(VLEV_110, 444000000),
420 VRPAIR(VLEV_115, 450000000),
421 VRPAIR(VLEV_120, 475000000),
422 VRPAIR(VLEV_125, 500000000),
423 VRPAIR(VLEV_130, 600000000),
426 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
427 .tuple_tab = cclk_vlev_datasheet,
428 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
429 .vr_settling_time = 25 /* us */,
432 static struct platform_device bfin_dpmc = {
433 .name = "bfin dpmc",
434 .dev = {
435 .platform_data = &bfin_dmpc_vreg_data,
439 static struct platform_device *ezkit_devices[] __initdata = {
441 &bfin_dpmc,
443 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
444 &smc91x_device,
445 #endif
447 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
448 &ax88180_device,
449 #endif
451 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
452 &net2272_bfin_device,
453 #endif
455 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
456 &bfin_isp1760_device,
457 #endif
459 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
460 &bfin_spi0_device,
461 #endif
463 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
464 &bfin_uart_device,
465 #endif
467 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
468 #ifdef CONFIG_BFIN_SIR0
469 &bfin_sir0_device,
470 #endif
471 #endif
473 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
474 &bfin_device_gpiokeys,
475 #endif
477 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
478 &i2c_gpio_device,
479 #endif
481 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
482 &isp1362_hcd_device,
483 #endif
485 &bfin_gpios_device,
487 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
488 &ezkit_flash_device,
489 #endif
492 static int __init ezkit_init(void)
494 int ret;
496 printk(KERN_INFO "%s(): registering device resources\n", __func__);
498 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
499 if (ret < 0)
500 return ret;
502 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
503 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
504 SSYNC();
505 #endif
507 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
508 return 0;
511 arch_initcall(ezkit_init);