Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[deliverable/linux.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>
c6c4d7bb 38#include <asm/dma.h>
1f83b8f1 39#include <asm/bfin5xx_spi.h>
5d448dd5 40#include <asm/portmux.h>
14b03204 41#include <asm/dpmc.h>
1394f032
BW
42
43/*
44 * Name the Board for the /proc/cpuinfo
45 */
fe85cad2 46const char bfin_board_name[] = "ADI BF561-EZKIT";
1394f032 47
140a9aec 48#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
3f375690
MH
49#include <linux/usb/isp1760.h>
50static struct resource bfin_isp1760_resources[] = {
51 [0] = {
52 .start = 0x2C0F0000,
53 .end = 0x203C0000 + 0xfffff,
140a9aec
MH
54 .flags = IORESOURCE_MEM,
55 },
3f375690
MH
56 [1] = {
57 .start = IRQ_PF10,
58 .end = IRQ_PF10,
140a9aec
MH
59 .flags = IORESOURCE_IRQ,
60 },
61};
62
3f375690
MH
63static struct isp1760_platform_data isp1760_priv = {
64 .is_isp1761 = 0,
3f375690
MH
65 .bus_width_16 = 1,
66 .port1_otg = 0,
67 .analog_oc = 0,
68 .dack_polarity_high = 0,
69 .dreq_polarity_high = 0,
140a9aec
MH
70};
71
3f375690
MH
72static struct platform_device bfin_isp1760_device = {
73 .name = "isp1760-hcd",
74 .id = 0,
75 .dev = {
76 .platform_data = &isp1760_priv,
77 },
78 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
79 .resource = bfin_isp1760_resources,
140a9aec 80};
140a9aec
MH
81#endif
82
e9d76c2d
MH
83#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
84#include <linux/usb/isp1362.h>
85
86static struct resource isp1362_hcd_resources[] = {
87 {
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,
99 },
100};
101
102static 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,
111};
112
113static struct platform_device isp1362_hcd_device = {
114 .name = "isp1362-hcd",
115 .id = 0,
116 .dev = {
117 .platform_data = &isp1362_priv,
118 },
119 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
120 .resource = isp1362_hcd_resources,
121};
122#endif
123
83d9cde0
MH
124#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
125static struct resource net2272_bfin_resources[] = {
126 {
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,
134 },
135};
136
137static 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,
142};
143#endif
144
1394f032
BW
145/*
146 * USB-LAN EzExtender board
147 * Driver needs to know address, irq and flag pin.
148 */
149#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
61f09b5a
MH
150#include <linux/smc91x.h>
151
152static struct smc91x_platdata smc91x_info = {
153 .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
154 .leda = RPC_LED_100_10,
155 .ledb = RPC_LED_TX_RX,
156};
157
1394f032
BW
158static struct resource smc91x_resources[] = {
159 {
160 .name = "smc91x-regs",
161 .start = 0x2C010300,
162 .end = 0x2C010300 + 16,
163 .flags = IORESOURCE_MEM,
1f83b8f1 164 }, {
1394f032
BW
165
166 .start = IRQ_PF9,
167 .end = IRQ_PF9,
168 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
169 },
170};
171
172static struct platform_device smc91x_device = {
173 .name = "smc91x",
174 .id = 0,
175 .num_resources = ARRAY_SIZE(smc91x_resources),
176 .resource = smc91x_resources,
61f09b5a
MH
177 .dev = {
178 .platform_data = &smc91x_info,
179 },
1394f032
BW
180};
181#endif
182
561cc18b
MH
183#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
184static struct resource ax88180_resources[] = {
185 [0] = {
186 .start = 0x2c000000,
187 .end = 0x2c000000 + 0x8000,
188 .flags = IORESOURCE_MEM,
189 },
190 [1] = {
191 .start = IRQ_PF10,
192 .end = IRQ_PF10,
193 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
194 },
195};
196
197static struct platform_device ax88180_device = {
198 .name = "ax88180",
199 .id = -1,
200 .num_resources = ARRAY_SIZE(ax88180_resources),
201 .resource = ax88180_resources,
202};
203#endif
204
1394f032
BW
205#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
206static struct resource bfin_uart_resources[] = {
1f83b8f1
MF
207 {
208 .start = 0xFFC00400,
209 .end = 0xFFC004FF,
210 .flags = IORESOURCE_MEM,
211 },
1394f032
BW
212};
213
214static struct platform_device bfin_uart_device = {
1f83b8f1
MF
215 .name = "bfin-uart",
216 .id = 1,
217 .num_resources = ARRAY_SIZE(bfin_uart_resources),
218 .resource = bfin_uart_resources,
1394f032
BW
219};
220#endif
221
5be36d22 222#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
5be36d22 223#ifdef CONFIG_BFIN_SIR0
42bd8bcb 224static struct resource bfin_sir0_resources[] = {
5be36d22
GY
225 {
226 .start = 0xFFC00400,
227 .end = 0xFFC004FF,
228 .flags = IORESOURCE_MEM,
229 },
42bd8bcb
GY
230 {
231 .start = IRQ_UART0_RX,
232 .end = IRQ_UART0_RX+1,
233 .flags = IORESOURCE_IRQ,
234 },
235 {
236 .start = CH_UART0_RX,
237 .end = CH_UART0_RX+1,
238 .flags = IORESOURCE_DMA,
239 },
5be36d22
GY
240};
241
42bd8bcb 242static struct platform_device bfin_sir0_device = {
5be36d22
GY
243 .name = "bfin_sir",
244 .id = 0,
42bd8bcb
GY
245 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
246 .resource = bfin_sir0_resources,
5be36d22
GY
247};
248#endif
42bd8bcb 249#endif
5be36d22 250
793dc27b 251#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2
MF
252static struct mtd_partition ezkit_partitions[] = {
253 {
aa582977 254 .name = "bootloader(nor)",
edf05641 255 .size = 0x40000,
de8c43f2
MF
256 .offset = 0,
257 }, {
aa582977 258 .name = "linux kernel(nor)",
ac76d889 259 .size = 0x1C0000,
de8c43f2
MF
260 .offset = MTDPART_OFS_APPEND,
261 }, {
aa582977 262 .name = "file system(nor)",
de8c43f2
MF
263 .size = MTDPART_SIZ_FULL,
264 .offset = MTDPART_OFS_APPEND,
265 }
266};
267
268static struct physmap_flash_data ezkit_flash_data = {
269 .width = 2,
270 .parts = ezkit_partitions,
271 .nr_parts = ARRAY_SIZE(ezkit_partitions),
272};
273
274static struct resource ezkit_flash_resource = {
275 .start = 0x20000000,
276 .end = 0x207fffff,
277 .flags = IORESOURCE_MEM,
278};
279
280static struct platform_device ezkit_flash_device = {
281 .name = "physmap-flash",
282 .id = 0,
283 .dev = {
284 .platform_data = &ezkit_flash_data,
285 },
286 .num_resources = 1,
287 .resource = &ezkit_flash_resource,
288};
793dc27b 289#endif
de8c43f2 290
1394f032
BW
291#if defined(CONFIG_SND_BLACKFIN_AD1836) \
292 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
293static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
294 .enable_dma = 0,
295 .bits_per_word = 16,
296};
297#endif
6e668936
MH
298
299#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
300static struct bfin5xx_spi_chip spidev_chip_info = {
301 .enable_dma = 0,
302 .bits_per_word = 8,
303};
304#endif
1394f032 305
5bda2723 306#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb
BW
307/* SPI (0) */
308static struct resource bfin_spi0_resource[] = {
309 [0] = {
310 .start = SPI0_REGBASE,
311 .end = SPI0_REGBASE + 0xFF,
312 .flags = IORESOURCE_MEM,
313 },
314 [1] = {
315 .start = CH_SPI,
316 .end = CH_SPI,
53122693
YL
317 .flags = IORESOURCE_DMA,
318 },
319 [2] = {
320 .start = IRQ_SPI,
321 .end = IRQ_SPI,
c6c4d7bb
BW
322 .flags = IORESOURCE_IRQ,
323 }
324};
325
1394f032 326/* SPI controller data */
c6c4d7bb 327static struct bfin5xx_spi_master bfin_spi0_info = {
1394f032
BW
328 .num_chipselect = 8,
329 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 330 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1394f032
BW
331};
332
c6c4d7bb
BW
333static struct platform_device bfin_spi0_device = {
334 .name = "bfin-spi",
335 .id = 0, /* Bus number */
336 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
337 .resource = bfin_spi0_resource,
1394f032 338 .dev = {
c6c4d7bb 339 .platform_data = &bfin_spi0_info, /* Passed to driver */
1394f032
BW
340 },
341};
5bda2723 342#endif
1394f032
BW
343
344static struct spi_board_info bfin_spi_board_info[] __initdata = {
345#if defined(CONFIG_SND_BLACKFIN_AD1836) \
346 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
347 {
dac98174 348 .modalias = "ad1836",
1394f032 349 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 350 .bus_num = 0,
1394f032
BW
351 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
352 .controller_data = &ad1836_spi_chip_info,
353 },
354#endif
6e668936
MH
355#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
356 {
357 .modalias = "spidev",
358 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
359 .bus_num = 0,
360 .chip_select = 1,
361 .controller_data = &spidev_chip_info,
362 },
363#endif
1394f032
BW
364};
365
2463ef22
MH
366#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
367#include <linux/input.h>
368#include <linux/gpio_keys.h>
369
370static struct gpio_keys_button bfin_gpio_keys_table[] = {
371 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
372 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
373 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
374 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
375};
376
377static struct gpio_keys_platform_data bfin_gpio_keys_data = {
378 .buttons = bfin_gpio_keys_table,
379 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
380};
381
382static struct platform_device bfin_device_gpiokeys = {
383 .name = "gpio-keys",
384 .dev = {
385 .platform_data = &bfin_gpio_keys_data,
386 },
387};
388#endif
389
cad2ab65
MF
390static struct resource bfin_gpios_resources = {
391 .start = 0,
392 .end = MAX_BLACKFIN_GPIOS - 1,
393 .flags = IORESOURCE_IRQ,
394};
395
396static struct platform_device bfin_gpios_device = {
397 .name = "simple-gpio",
398 .id = -1,
399 .num_resources = 1,
400 .resource = &bfin_gpios_resources,
401};
402
e3163954
BW
403#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
404#include <linux/i2c-gpio.h>
405
406static struct i2c_gpio_platform_data i2c_gpio_data = {
407 .sda_pin = 1,
408 .scl_pin = 0,
409 .sda_is_open_drain = 0,
410 .scl_is_open_drain = 0,
411 .udelay = 40,
412};
413
414static struct platform_device i2c_gpio_device = {
415 .name = "i2c-gpio",
416 .id = 0,
417 .dev = {
418 .platform_data = &i2c_gpio_data,
419 },
420};
421#endif
422
14b03204
MH
423static const unsigned int cclk_vlev_datasheet[] =
424{
425 VRPAIR(VLEV_085, 250000000),
426 VRPAIR(VLEV_090, 300000000),
427 VRPAIR(VLEV_095, 313000000),
428 VRPAIR(VLEV_100, 350000000),
429 VRPAIR(VLEV_105, 400000000),
430 VRPAIR(VLEV_110, 444000000),
431 VRPAIR(VLEV_115, 450000000),
432 VRPAIR(VLEV_120, 475000000),
433 VRPAIR(VLEV_125, 500000000),
434 VRPAIR(VLEV_130, 600000000),
435};
436
437static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
438 .tuple_tab = cclk_vlev_datasheet,
439 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
440 .vr_settling_time = 25 /* us */,
441};
442
443static struct platform_device bfin_dpmc = {
444 .name = "bfin dpmc",
445 .dev = {
446 .platform_data = &bfin_dmpc_vreg_data,
447 },
448};
449
1394f032 450static struct platform_device *ezkit_devices[] __initdata = {
14b03204
MH
451
452 &bfin_dpmc,
453
1394f032
BW
454#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
455 &smc91x_device,
456#endif
561cc18b
MH
457
458#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
459 &ax88180_device,
460#endif
461
83d9cde0
MH
462#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
463 &net2272_bfin_device,
464#endif
465
3f375690
MH
466#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
467 &bfin_isp1760_device,
468#endif
469
1394f032 470#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb 471 &bfin_spi0_device,
1394f032 472#endif
2463ef22 473
1394f032 474#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1f83b8f1 475 &bfin_uart_device,
1394f032 476#endif
2463ef22 477
5be36d22 478#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
42bd8bcb
GY
479#ifdef CONFIG_BFIN_SIR0
480 &bfin_sir0_device,
481#endif
5be36d22
GY
482#endif
483
2463ef22
MH
484#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
485 &bfin_device_gpiokeys,
486#endif
e3163954
BW
487
488#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
489 &i2c_gpio_device,
490#endif
e9d76c2d
MH
491
492#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
493 &isp1362_hcd_device,
494#endif
495
cad2ab65 496 &bfin_gpios_device,
793dc27b
MF
497
498#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2 499 &ezkit_flash_device,
793dc27b 500#endif
1394f032
BW
501};
502
503static int __init ezkit_init(void)
504{
505 int ret;
506
c0fc525d
MF
507 printk(KERN_INFO "%s(): registering device resources\n", __func__);
508
509 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1394f032
BW
510 if (ret < 0)
511 return ret;
c0fc525d
MF
512
513#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
514 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
515 SSYNC();
516#endif
517
5bda2723 518 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
c6c4d7bb 519 return 0;
1394f032
BW
520}
521
522arch_initcall(ezkit_init);
This page took 0.392854 seconds and 5 git commands to generate.