[MIPS] DBAu1xx0 code style cleanup
[linux-ginger.git] / arch / blackfin / mach-bf561 / boards / ezkit.c
blob61d8f7648b247da40f771d252ecfd759c20e29bf
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 <linux/ata_platform.h>
39 #include <asm/dma.h>
40 #include <asm/bfin5xx_spi.h>
41 #include <asm/portmux.h>
42 #include <asm/dpmc.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,
61 .start = ISP1761_IRQ,
62 .end = ISP1761_IRQ,
63 .flags = IORESOURCE_IRQ,
67 static struct platform_device bfin_isp1761_device = {
68 .name = "isp1761",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
71 .resource = bfin_isp1761_resources,
74 static struct platform_device *bfin_isp1761_devices[] = {
75 &bfin_isp1761_device,
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);
94 #endif
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[] = {
101 .start = 0x2c060000,
102 .end = 0x2c060000,
103 .flags = IORESOURCE_MEM,
104 }, {
105 .start = 0x2c060004,
106 .end = 0x2c060004,
107 .flags = IORESOURCE_MEM,
108 }, {
109 .start = IRQ_PF8,
110 .end = IRQ_PF8,
111 .flags = IORESOURCE_IRQ,
115 static struct isp1362_platform_data isp1362_priv = {
116 .sel15Kres = 1,
117 .clknotstop = 0,
118 .oc_enable = 0,
119 .int_act_high = 0,
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",
128 .id = 0,
129 .dev = {
130 .platform_data = &isp1362_priv,
132 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
133 .resource = isp1362_hcd_resources,
135 #endif
137 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
138 static struct resource net2272_bfin_resources[] = {
140 .start = 0x2C000000,
141 .end = 0x2C000000 + 0x7F,
142 .flags = IORESOURCE_MEM,
143 }, {
144 .start = IRQ_PF10,
145 .end = IRQ_PF10,
146 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
150 static struct platform_device net2272_bfin_device = {
151 .name = "net2272",
152 .id = -1,
153 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
154 .resource = net2272_bfin_resources,
156 #endif
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",
166 .start = 0x2C010300,
167 .end = 0x2C010300 + 16,
168 .flags = IORESOURCE_MEM,
169 }, {
171 .start = IRQ_PF9,
172 .end = IRQ_PF9,
173 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
177 static struct platform_device smc91x_device = {
178 .name = "smc91x",
179 .id = 0,
180 .num_resources = ARRAY_SIZE(smc91x_resources),
181 .resource = smc91x_resources,
183 #endif
185 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
186 static struct resource ax88180_resources[] = {
187 [0] = {
188 .start = 0x2c000000,
189 .end = 0x2c000000 + 0x8000,
190 .flags = IORESOURCE_MEM,
192 [1] = {
193 .start = IRQ_PF10,
194 .end = IRQ_PF10,
195 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
199 static struct platform_device ax88180_device = {
200 .name = "ax88180",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(ax88180_resources),
203 .resource = ax88180_resources,
205 #endif
207 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
208 static struct resource bfin_uart_resources[] = {
210 .start = 0xFFC00400,
211 .end = 0xFFC004FF,
212 .flags = IORESOURCE_MEM,
216 static struct platform_device bfin_uart_device = {
217 .name = "bfin-uart",
218 .id = 1,
219 .num_resources = ARRAY_SIZE(bfin_uart_resources),
220 .resource = bfin_uart_resources,
222 #endif
224 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
225 static struct resource bfin_sir_resources[] = {
226 #ifdef CONFIG_BFIN_SIR0
228 .start = 0xFFC00400,
229 .end = 0xFFC004FF,
230 .flags = IORESOURCE_MEM,
232 #endif
235 static struct platform_device bfin_sir_device = {
236 .name = "bfin_sir",
237 .id = 0,
238 .num_resources = ARRAY_SIZE(bfin_sir_resources),
239 .resource = bfin_sir_resources,
241 #endif
243 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
244 static struct mtd_partition ezkit_partitions[] = {
246 .name = "Bootloader",
247 .size = 0x40000,
248 .offset = 0,
249 }, {
250 .name = "Kernel",
251 .size = 0x1C0000,
252 .offset = MTDPART_OFS_APPEND,
253 }, {
254 .name = "RootFS",
255 .size = MTDPART_SIZ_FULL,
256 .offset = MTDPART_OFS_APPEND,
260 static struct physmap_flash_data ezkit_flash_data = {
261 .width = 2,
262 .parts = ezkit_partitions,
263 .nr_parts = ARRAY_SIZE(ezkit_partitions),
266 static struct resource ezkit_flash_resource = {
267 .start = 0x20000000,
268 .end = 0x207fffff,
269 .flags = IORESOURCE_MEM,
272 static struct platform_device ezkit_flash_device = {
273 .name = "physmap-flash",
274 .id = 0,
275 .dev = {
276 .platform_data = &ezkit_flash_data,
278 .num_resources = 1,
279 .resource = &ezkit_flash_resource,
281 #endif
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 = {
287 .enable_dma = 0,
288 .bits_per_word = 16,
290 #endif
292 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
293 static struct bfin5xx_spi_chip spidev_chip_info = {
294 .enable_dma = 0,
295 .bits_per_word = 8,
297 #endif
298 #endif
300 /* SPI (0) */
301 static struct resource bfin_spi0_resource[] = {
302 [0] = {
303 .start = SPI0_REGBASE,
304 .end = SPI0_REGBASE + 0xFF,
305 .flags = IORESOURCE_MEM,
307 [1] = {
308 .start = CH_SPI,
309 .end = CH_SPI,
310 .flags = IORESOURCE_IRQ,
314 /* SPI controller data */
315 static struct bfin5xx_spi_master bfin_spi0_info = {
316 .num_chipselect = 8,
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 = {
322 .name = "bfin-spi",
323 .id = 0, /* Bus number */
324 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
325 .resource = bfin_spi0_resource,
326 .dev = {
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 */
337 .bus_num = 0,
338 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
339 .controller_data = &ad1836_spi_chip_info,
341 #endif
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 */
346 .bus_num = 0,
347 .chip_select = 1,
348 .controller_data = &spidev_chip_info,
350 #endif
353 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
354 #define PATA_INT 55
356 static struct pata_platform_info bfin_pata_platform_data = {
357 .ioport_shift = 1,
358 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
361 static struct resource bfin_pata_resources[] = {
363 .start = 0x20314020,
364 .end = 0x2031403F,
365 .flags = IORESOURCE_MEM,
368 .start = 0x2031401C,
369 .end = 0x2031401F,
370 .flags = IORESOURCE_MEM,
373 .start = PATA_INT,
374 .end = PATA_INT,
375 .flags = IORESOURCE_IRQ,
379 static struct platform_device bfin_pata_device = {
380 .name = "pata_platform",
381 .id = -1,
382 .num_resources = ARRAY_SIZE(bfin_pata_resources),
383 .resource = bfin_pata_resources,
384 .dev = {
385 .platform_data = &bfin_pata_platform_data,
388 #endif
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 = {
407 .name = "gpio-keys",
408 .dev = {
409 .platform_data = &bfin_gpio_keys_data,
412 #endif
414 static struct resource bfin_gpios_resources = {
415 .start = 0,
416 .end = MAX_BLACKFIN_GPIOS - 1,
417 .flags = IORESOURCE_IRQ,
420 static struct platform_device bfin_gpios_device = {
421 .name = "simple-gpio",
422 .id = -1,
423 .num_resources = 1,
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 = {
431 .sda_pin = 1,
432 .scl_pin = 0,
433 .sda_is_open_drain = 0,
434 .scl_is_open_drain = 0,
435 .udelay = 40,
438 static struct platform_device i2c_gpio_device = {
439 .name = "i2c-gpio",
440 .id = 0,
441 .dev = {
442 .platform_data = &i2c_gpio_data,
445 #endif
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 = {
468 .name = "bfin dpmc",
469 .dev = {
470 .platform_data = &bfin_dmpc_vreg_data,
474 static struct platform_device *ezkit_devices[] __initdata = {
476 &bfin_dpmc,
478 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
479 &smc91x_device,
480 #endif
482 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
483 &ax88180_device,
484 #endif
486 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
487 &net2272_bfin_device,
488 #endif
490 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
491 &bfin_spi0_device,
492 #endif
494 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
495 &bfin_uart_device,
496 #endif
498 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
499 &bfin_sir_device,
500 #endif
502 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
503 &bfin_pata_device,
504 #endif
506 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
507 &bfin_device_gpiokeys,
508 #endif
510 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
511 &i2c_gpio_device,
512 #endif
514 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
515 &isp1362_hcd_device,
516 #endif
518 &bfin_gpios_device,
520 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
521 &ezkit_flash_device,
522 #endif
525 static int __init ezkit_init(void)
527 int ret;
529 printk(KERN_INFO "%s(): registering device resources\n", __func__);
531 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
532 if (ret < 0)
533 return ret;
535 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
536 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
537 SSYNC();
538 #endif
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));
543 #endif
545 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
546 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
547 #endif
548 return 0;
551 arch_initcall(ezkit_init);