]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/blackfin/mach-bf561/boards/ezkit.c
Merge commit '900cfa46191a7d87cf1891924cb90499287fd235'; branches 'timers/nohz',...
[mirror_ubuntu-artful-kernel.git] / arch / blackfin / mach-bf561 / boards / ezkit.c
CommitLineData
1394f032
BW
1/*
2 * File: arch/blackfin/mach-bf561/ezkit.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
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.
18 *
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.
23 *
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
28 */
29
30#include <linux/device.h>
31#include <linux/platform_device.h>
de8c43f2
MF
32#include <linux/mtd/mtd.h>
33#include <linux/mtd/partitions.h>
34#include <linux/mtd/physmap.h>
1394f032 35#include <linux/spi/spi.h>
140a9aec 36#include <linux/irq.h>
1f83b8f1 37#include <linux/interrupt.h>
0a87e3e9 38#include <linux/ata_platform.h>
c6c4d7bb 39#include <asm/dma.h>
1f83b8f1 40#include <asm/bfin5xx_spi.h>
5d448dd5 41#include <asm/portmux.h>
14b03204 42#include <asm/dpmc.h>
1394f032
BW
43
44/*
45 * Name the Board for the /proc/cpuinfo
46 */
066954a3 47const char bfin_board_name[] = "ADDS-BF561-EZKIT";
1394f032 48
140a9aec
MH
49#define ISP1761_BASE 0x2C0F0000
50#define ISP1761_IRQ IRQ_PF10
51
52#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
53static struct resource bfin_isp1761_resources[] = {
1f83b8f1 54 {
140a9aec
MH
55 .name = "isp1761-regs",
56 .start = ISP1761_BASE + 0x00000000,
57 .end = ISP1761_BASE + 0x000fffff,
58 .flags = IORESOURCE_MEM,
59 },
1f83b8f1 60 {
140a9aec
MH
61 .start = ISP1761_IRQ,
62 .end = ISP1761_IRQ,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67static 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,
72};
73
74static struct platform_device *bfin_isp1761_devices[] = {
75 &bfin_isp1761_device,
76};
77
78int __init bfin_isp1761_init(void)
79{
1f83b8f1 80 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
140a9aec 81
b85d858b 82 printk(KERN_INFO "%s(): registering device resources\n", __func__);
140a9aec
MH
83 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
84
85 return platform_add_devices(bfin_isp1761_devices, num_devices);
86}
87
88void __exit bfin_isp1761_exit(void)
89{
90 platform_device_unregister(&bfin_isp1761_device);
91}
92
93arch_initcall(bfin_isp1761_init);
94#endif
95
e9d76c2d
MH
96#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
97#include <linux/usb/isp1362.h>
98
99static struct resource isp1362_hcd_resources[] = {
100 {
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,
112 },
113};
114
115static 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,
124};
125
126static struct platform_device isp1362_hcd_device = {
127 .name = "isp1362-hcd",
128 .id = 0,
129 .dev = {
130 .platform_data = &isp1362_priv,
131 },
132 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
133 .resource = isp1362_hcd_resources,
134};
135#endif
136
83d9cde0
MH
137#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
138static struct resource net2272_bfin_resources[] = {
139 {
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,
147 },
148};
149
150static 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,
155};
156#endif
157
1394f032
BW
158/*
159 * USB-LAN EzExtender board
160 * Driver needs to know address, irq and flag pin.
161 */
162#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
163static struct resource smc91x_resources[] = {
164 {
165 .name = "smc91x-regs",
166 .start = 0x2C010300,
167 .end = 0x2C010300 + 16,
168 .flags = IORESOURCE_MEM,
1f83b8f1 169 }, {
1394f032
BW
170
171 .start = IRQ_PF9,
172 .end = IRQ_PF9,
173 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
174 },
175};
176
177static struct platform_device smc91x_device = {
178 .name = "smc91x",
179 .id = 0,
180 .num_resources = ARRAY_SIZE(smc91x_resources),
181 .resource = smc91x_resources,
182};
183#endif
184
561cc18b
MH
185#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
186static struct resource ax88180_resources[] = {
187 [0] = {
188 .start = 0x2c000000,
189 .end = 0x2c000000 + 0x8000,
190 .flags = IORESOURCE_MEM,
191 },
192 [1] = {
193 .start = IRQ_PF10,
194 .end = IRQ_PF10,
195 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
196 },
197};
198
199static struct platform_device ax88180_device = {
200 .name = "ax88180",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(ax88180_resources),
203 .resource = ax88180_resources,
204};
205#endif
206
1394f032
BW
207#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
208static struct resource bfin_uart_resources[] = {
1f83b8f1
MF
209 {
210 .start = 0xFFC00400,
211 .end = 0xFFC004FF,
212 .flags = IORESOURCE_MEM,
213 },
1394f032
BW
214};
215
216static struct platform_device bfin_uart_device = {
1f83b8f1
MF
217 .name = "bfin-uart",
218 .id = 1,
219 .num_resources = ARRAY_SIZE(bfin_uart_resources),
220 .resource = bfin_uart_resources,
1394f032
BW
221};
222#endif
223
5be36d22
GY
224#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
225static struct resource bfin_sir_resources[] = {
226#ifdef CONFIG_BFIN_SIR0
227 {
228 .start = 0xFFC00400,
229 .end = 0xFFC004FF,
230 .flags = IORESOURCE_MEM,
231 },
232#endif
233};
234
235static 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,
240};
241#endif
242
793dc27b 243#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2
MF
244static struct mtd_partition ezkit_partitions[] = {
245 {
246 .name = "Bootloader",
edf05641 247 .size = 0x40000,
de8c43f2
MF
248 .offset = 0,
249 }, {
250 .name = "Kernel",
ac76d889 251 .size = 0x1C0000,
de8c43f2
MF
252 .offset = MTDPART_OFS_APPEND,
253 }, {
254 .name = "RootFS",
255 .size = MTDPART_SIZ_FULL,
256 .offset = MTDPART_OFS_APPEND,
257 }
258};
259
260static struct physmap_flash_data ezkit_flash_data = {
261 .width = 2,
262 .parts = ezkit_partitions,
263 .nr_parts = ARRAY_SIZE(ezkit_partitions),
264};
265
266static struct resource ezkit_flash_resource = {
267 .start = 0x20000000,
268 .end = 0x207fffff,
269 .flags = IORESOURCE_MEM,
270};
271
272static struct platform_device ezkit_flash_device = {
273 .name = "physmap-flash",
274 .id = 0,
275 .dev = {
276 .platform_data = &ezkit_flash_data,
277 },
278 .num_resources = 1,
279 .resource = &ezkit_flash_resource,
280};
793dc27b 281#endif
de8c43f2 282
1394f032
BW
283#if defined(CONFIG_SND_BLACKFIN_AD1836) \
284 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
285static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
286 .enable_dma = 0,
287 .bits_per_word = 16,
288};
289#endif
6e668936
MH
290
291#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
292static struct bfin5xx_spi_chip spidev_chip_info = {
293 .enable_dma = 0,
294 .bits_per_word = 8,
295};
296#endif
1394f032 297
5bda2723 298#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb
BW
299/* SPI (0) */
300static struct resource bfin_spi0_resource[] = {
301 [0] = {
302 .start = SPI0_REGBASE,
303 .end = SPI0_REGBASE + 0xFF,
304 .flags = IORESOURCE_MEM,
305 },
306 [1] = {
307 .start = CH_SPI,
308 .end = CH_SPI,
309 .flags = IORESOURCE_IRQ,
310 }
311};
312
1394f032 313/* SPI controller data */
c6c4d7bb 314static struct bfin5xx_spi_master bfin_spi0_info = {
1394f032
BW
315 .num_chipselect = 8,
316 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 317 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1394f032
BW
318};
319
c6c4d7bb
BW
320static struct platform_device bfin_spi0_device = {
321 .name = "bfin-spi",
322 .id = 0, /* Bus number */
323 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
324 .resource = bfin_spi0_resource,
1394f032 325 .dev = {
c6c4d7bb 326 .platform_data = &bfin_spi0_info, /* Passed to driver */
1394f032
BW
327 },
328};
5bda2723 329#endif
1394f032
BW
330
331static struct spi_board_info bfin_spi_board_info[] __initdata = {
332#if defined(CONFIG_SND_BLACKFIN_AD1836) \
333 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
334 {
335 .modalias = "ad1836-spi",
336 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 337 .bus_num = 0,
1394f032
BW
338 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
339 .controller_data = &ad1836_spi_chip_info,
340 },
341#endif
6e668936
MH
342#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
343 {
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,
349 },
350#endif
1394f032
BW
351};
352
c6c4d7bb
BW
353#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
354#define PATA_INT 55
355
356static struct pata_platform_info bfin_pata_platform_data = {
357 .ioport_shift = 1,
358 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
359};
360
361static struct resource bfin_pata_resources[] = {
362 {
363 .start = 0x20314020,
364 .end = 0x2031403F,
365 .flags = IORESOURCE_MEM,
366 },
367 {
368 .start = 0x2031401C,
369 .end = 0x2031401F,
370 .flags = IORESOURCE_MEM,
371 },
372 {
373 .start = PATA_INT,
374 .end = PATA_INT,
375 .flags = IORESOURCE_IRQ,
376 },
377};
378
379static 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,
386 }
387};
388#endif
389
2463ef22
MH
390#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
391#include <linux/input.h>
392#include <linux/gpio_keys.h>
393
394static 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"},
399};
400
401static struct gpio_keys_platform_data bfin_gpio_keys_data = {
402 .buttons = bfin_gpio_keys_table,
403 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
404};
405
406static struct platform_device bfin_device_gpiokeys = {
407 .name = "gpio-keys",
408 .dev = {
409 .platform_data = &bfin_gpio_keys_data,
410 },
411};
412#endif
413
cad2ab65
MF
414static struct resource bfin_gpios_resources = {
415 .start = 0,
416 .end = MAX_BLACKFIN_GPIOS - 1,
417 .flags = IORESOURCE_IRQ,
418};
419
420static struct platform_device bfin_gpios_device = {
421 .name = "simple-gpio",
422 .id = -1,
423 .num_resources = 1,
424 .resource = &bfin_gpios_resources,
425};
426
e3163954
BW
427#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
428#include <linux/i2c-gpio.h>
429
430static 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,
436};
437
438static struct platform_device i2c_gpio_device = {
439 .name = "i2c-gpio",
440 .id = 0,
441 .dev = {
442 .platform_data = &i2c_gpio_data,
443 },
444};
445#endif
446
14b03204
MH
447static const unsigned int cclk_vlev_datasheet[] =
448{
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),
459};
460
461static 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 */,
465};
466
467static struct platform_device bfin_dpmc = {
468 .name = "bfin dpmc",
469 .dev = {
470 .platform_data = &bfin_dmpc_vreg_data,
471 },
472};
473
1394f032 474static struct platform_device *ezkit_devices[] __initdata = {
14b03204
MH
475
476 &bfin_dpmc,
477
1394f032
BW
478#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
479 &smc91x_device,
480#endif
561cc18b
MH
481
482#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
483 &ax88180_device,
484#endif
485
83d9cde0
MH
486#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
487 &net2272_bfin_device,
488#endif
489
1394f032 490#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb 491 &bfin_spi0_device,
1394f032 492#endif
2463ef22 493
1394f032 494#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1f83b8f1 495 &bfin_uart_device,
1394f032 496#endif
2463ef22 497
5be36d22
GY
498#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
499 &bfin_sir_device,
500#endif
501
c6c4d7bb
BW
502#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
503 &bfin_pata_device,
504#endif
2463ef22
MH
505
506#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
507 &bfin_device_gpiokeys,
508#endif
e3163954
BW
509
510#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
511 &i2c_gpio_device,
512#endif
e9d76c2d
MH
513
514#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
515 &isp1362_hcd_device,
516#endif
517
cad2ab65 518 &bfin_gpios_device,
793dc27b
MF
519
520#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2 521 &ezkit_flash_device,
793dc27b 522#endif
1394f032
BW
523};
524
525static int __init ezkit_init(void)
526{
527 int ret;
528
c0fc525d
MF
529 printk(KERN_INFO "%s(): registering device resources\n", __func__);
530
531 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1394f032
BW
532 if (ret < 0)
533 return ret;
c0fc525d
MF
534
535#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
536 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
537 SSYNC();
538#endif
539
5bda2723 540 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
c6c4d7bb
BW
541
542#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
543 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
544#endif
545 return 0;
1394f032
BW
546}
547
548arch_initcall(ezkit_init);