[ARM] pxa: update defconfig for Verdex Pro
[linux-2.6/verdex.git] / arch / blackfin / mach-bf561 / boards / ezkit.c
blob9e2d8cfba546c58e252742f36e8dc11a27365739
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
7 */
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/spi/spi.h>
15 #include <linux/irq.h>
16 #include <linux/interrupt.h>
17 #include <asm/dma.h>
18 #include <asm/bfin5xx_spi.h>
19 #include <asm/portmux.h>
20 #include <asm/dpmc.h>
23 * Name the Board for the /proc/cpuinfo
25 const char bfin_board_name[] = "ADI BF561-EZKIT";
27 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
28 #include <linux/usb/isp1760.h>
29 static struct resource bfin_isp1760_resources[] = {
30 [0] = {
31 .start = 0x2C0F0000,
32 .end = 0x203C0000 + 0xfffff,
33 .flags = IORESOURCE_MEM,
35 [1] = {
36 .start = IRQ_PF10,
37 .end = IRQ_PF10,
38 .flags = IORESOURCE_IRQ,
42 static struct isp1760_platform_data isp1760_priv = {
43 .is_isp1761 = 0,
44 .bus_width_16 = 1,
45 .port1_otg = 0,
46 .analog_oc = 0,
47 .dack_polarity_high = 0,
48 .dreq_polarity_high = 0,
51 static struct platform_device bfin_isp1760_device = {
52 .name = "isp1760-hcd",
53 .id = 0,
54 .dev = {
55 .platform_data = &isp1760_priv,
57 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
58 .resource = bfin_isp1760_resources,
60 #endif
62 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
63 #include <linux/usb/isp1362.h>
65 static struct resource isp1362_hcd_resources[] = {
67 .start = 0x2c060000,
68 .end = 0x2c060000,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = 0x2c060004,
72 .end = 0x2c060004,
73 .flags = IORESOURCE_MEM,
74 }, {
75 .start = IRQ_PF8,
76 .end = IRQ_PF8,
77 .flags = IORESOURCE_IRQ,
81 static struct isp1362_platform_data isp1362_priv = {
82 .sel15Kres = 1,
83 .clknotstop = 0,
84 .oc_enable = 0,
85 .int_act_high = 0,
86 .int_edge_triggered = 0,
87 .remote_wakeup_connected = 0,
88 .no_power_switching = 1,
89 .power_switching_mode = 0,
92 static struct platform_device isp1362_hcd_device = {
93 .name = "isp1362-hcd",
94 .id = 0,
95 .dev = {
96 .platform_data = &isp1362_priv,
98 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
99 .resource = isp1362_hcd_resources,
101 #endif
103 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
104 static struct resource net2272_bfin_resources[] = {
106 .start = 0x2C000000,
107 .end = 0x2C000000 + 0x7F,
108 .flags = IORESOURCE_MEM,
109 }, {
110 .start = IRQ_PF10,
111 .end = IRQ_PF10,
112 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
116 static struct platform_device net2272_bfin_device = {
117 .name = "net2272",
118 .id = -1,
119 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
120 .resource = net2272_bfin_resources,
122 #endif
125 * USB-LAN EzExtender board
126 * Driver needs to know address, irq and flag pin.
128 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
129 #include <linux/smc91x.h>
131 static struct smc91x_platdata smc91x_info = {
132 .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
133 .leda = RPC_LED_100_10,
134 .ledb = RPC_LED_TX_RX,
137 static struct resource smc91x_resources[] = {
139 .name = "smc91x-regs",
140 .start = 0x2C010300,
141 .end = 0x2C010300 + 16,
142 .flags = IORESOURCE_MEM,
143 }, {
145 .start = IRQ_PF9,
146 .end = IRQ_PF9,
147 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
151 static struct platform_device smc91x_device = {
152 .name = "smc91x",
153 .id = 0,
154 .num_resources = ARRAY_SIZE(smc91x_resources),
155 .resource = smc91x_resources,
156 .dev = {
157 .platform_data = &smc91x_info,
160 #endif
162 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
163 static struct resource ax88180_resources[] = {
164 [0] = {
165 .start = 0x2c000000,
166 .end = 0x2c000000 + 0x8000,
167 .flags = IORESOURCE_MEM,
169 [1] = {
170 .start = IRQ_PF10,
171 .end = IRQ_PF10,
172 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
176 static struct platform_device ax88180_device = {
177 .name = "ax88180",
178 .id = -1,
179 .num_resources = ARRAY_SIZE(ax88180_resources),
180 .resource = ax88180_resources,
182 #endif
184 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
185 static struct resource bfin_uart_resources[] = {
187 .start = 0xFFC00400,
188 .end = 0xFFC004FF,
189 .flags = IORESOURCE_MEM,
193 static struct platform_device bfin_uart_device = {
194 .name = "bfin-uart",
195 .id = 1,
196 .num_resources = ARRAY_SIZE(bfin_uart_resources),
197 .resource = bfin_uart_resources,
199 #endif
201 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
202 #ifdef CONFIG_BFIN_SIR0
203 static struct resource bfin_sir0_resources[] = {
205 .start = 0xFFC00400,
206 .end = 0xFFC004FF,
207 .flags = IORESOURCE_MEM,
210 .start = IRQ_UART0_RX,
211 .end = IRQ_UART0_RX+1,
212 .flags = IORESOURCE_IRQ,
215 .start = CH_UART0_RX,
216 .end = CH_UART0_RX+1,
217 .flags = IORESOURCE_DMA,
221 static struct platform_device bfin_sir0_device = {
222 .name = "bfin_sir",
223 .id = 0,
224 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
225 .resource = bfin_sir0_resources,
227 #endif
228 #endif
230 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
231 static struct mtd_partition ezkit_partitions[] = {
233 .name = "bootloader(nor)",
234 .size = 0x40000,
235 .offset = 0,
236 }, {
237 .name = "linux kernel(nor)",
238 .size = 0x1C0000,
239 .offset = MTDPART_OFS_APPEND,
240 }, {
241 .name = "file system(nor)",
242 .size = MTDPART_SIZ_FULL,
243 .offset = MTDPART_OFS_APPEND,
247 static struct physmap_flash_data ezkit_flash_data = {
248 .width = 2,
249 .parts = ezkit_partitions,
250 .nr_parts = ARRAY_SIZE(ezkit_partitions),
253 static struct resource ezkit_flash_resource = {
254 .start = 0x20000000,
255 .end = 0x207fffff,
256 .flags = IORESOURCE_MEM,
259 static struct platform_device ezkit_flash_device = {
260 .name = "physmap-flash",
261 .id = 0,
262 .dev = {
263 .platform_data = &ezkit_flash_data,
265 .num_resources = 1,
266 .resource = &ezkit_flash_resource,
268 #endif
270 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
271 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
272 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
273 .enable_dma = 0,
274 .bits_per_word = 16,
276 #endif
278 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
279 static struct bfin5xx_spi_chip spidev_chip_info = {
280 .enable_dma = 0,
281 .bits_per_word = 8,
283 #endif
285 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
286 /* SPI (0) */
287 static struct resource bfin_spi0_resource[] = {
288 [0] = {
289 .start = SPI0_REGBASE,
290 .end = SPI0_REGBASE + 0xFF,
291 .flags = IORESOURCE_MEM,
293 [1] = {
294 .start = CH_SPI,
295 .end = CH_SPI,
296 .flags = IORESOURCE_DMA,
298 [2] = {
299 .start = IRQ_SPI,
300 .end = IRQ_SPI,
301 .flags = IORESOURCE_IRQ,
305 /* SPI controller data */
306 static struct bfin5xx_spi_master bfin_spi0_info = {
307 .num_chipselect = 8,
308 .enable_dma = 1, /* master has the ability to do dma transfer */
309 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
312 static struct platform_device bfin_spi0_device = {
313 .name = "bfin-spi",
314 .id = 0, /* Bus number */
315 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
316 .resource = bfin_spi0_resource,
317 .dev = {
318 .platform_data = &bfin_spi0_info, /* Passed to driver */
321 #endif
323 static struct spi_board_info bfin_spi_board_info[] __initdata = {
324 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
325 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
327 .modalias = "ad1836",
328 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
329 .bus_num = 0,
330 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
331 .controller_data = &ad1836_spi_chip_info,
333 #endif
334 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
336 .modalias = "spidev",
337 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
338 .bus_num = 0,
339 .chip_select = 1,
340 .controller_data = &spidev_chip_info,
342 #endif
345 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
346 #include <linux/input.h>
347 #include <linux/gpio_keys.h>
349 static struct gpio_keys_button bfin_gpio_keys_table[] = {
350 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
351 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
352 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
353 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
356 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
357 .buttons = bfin_gpio_keys_table,
358 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
361 static struct platform_device bfin_device_gpiokeys = {
362 .name = "gpio-keys",
363 .dev = {
364 .platform_data = &bfin_gpio_keys_data,
367 #endif
369 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
370 #include <linux/i2c-gpio.h>
372 static struct i2c_gpio_platform_data i2c_gpio_data = {
373 .sda_pin = 1,
374 .scl_pin = 0,
375 .sda_is_open_drain = 0,
376 .scl_is_open_drain = 0,
377 .udelay = 40,
380 static struct platform_device i2c_gpio_device = {
381 .name = "i2c-gpio",
382 .id = 0,
383 .dev = {
384 .platform_data = &i2c_gpio_data,
387 #endif
389 static const unsigned int cclk_vlev_datasheet[] =
391 VRPAIR(VLEV_085, 250000000),
392 VRPAIR(VLEV_090, 300000000),
393 VRPAIR(VLEV_095, 313000000),
394 VRPAIR(VLEV_100, 350000000),
395 VRPAIR(VLEV_105, 400000000),
396 VRPAIR(VLEV_110, 444000000),
397 VRPAIR(VLEV_115, 450000000),
398 VRPAIR(VLEV_120, 475000000),
399 VRPAIR(VLEV_125, 500000000),
400 VRPAIR(VLEV_130, 600000000),
403 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
404 .tuple_tab = cclk_vlev_datasheet,
405 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
406 .vr_settling_time = 25 /* us */,
409 static struct platform_device bfin_dpmc = {
410 .name = "bfin dpmc",
411 .dev = {
412 .platform_data = &bfin_dmpc_vreg_data,
416 static struct platform_device *ezkit_devices[] __initdata = {
418 &bfin_dpmc,
420 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
421 &smc91x_device,
422 #endif
424 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
425 &ax88180_device,
426 #endif
428 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
429 &net2272_bfin_device,
430 #endif
432 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
433 &bfin_isp1760_device,
434 #endif
436 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
437 &bfin_spi0_device,
438 #endif
440 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
441 &bfin_uart_device,
442 #endif
444 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
445 #ifdef CONFIG_BFIN_SIR0
446 &bfin_sir0_device,
447 #endif
448 #endif
450 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
451 &bfin_device_gpiokeys,
452 #endif
454 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
455 &i2c_gpio_device,
456 #endif
458 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
459 &isp1362_hcd_device,
460 #endif
462 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
463 &ezkit_flash_device,
464 #endif
467 static int __init ezkit_init(void)
469 int ret;
471 printk(KERN_INFO "%s(): registering device resources\n", __func__);
473 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
474 if (ret < 0)
475 return ret;
477 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
478 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
479 SSYNC();
480 #endif
482 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
483 return 0;
486 arch_initcall(ezkit_init);