]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/blackfin/mach-bf548/boards/ezkit.c
Linux 2.6.27
[net-next-2.6.git] / arch / blackfin / mach-bf548 / boards / ezkit.c
CommitLineData
24a07a12
RH
1/*
2 * File: arch/blackfin/mach-bf548/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2007 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
de8c43f2 35#include <linux/mtd/physmap.h>
24a07a12
RH
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
1f83b8f1 38#include <linux/irq.h>
81d9c7f2 39#include <linux/i2c.h>
24a07a12 40#include <linux/interrupt.h>
67f2d33e 41#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
c6c4d7bb 42#include <linux/usb/musb.h>
67f2d33e 43#endif
24a07a12 44#include <asm/bfin5xx_spi.h>
c6c4d7bb
BW
45#include <asm/cplb.h>
46#include <asm/dma.h>
47#include <asm/gpio.h>
48#include <asm/nand.h>
14b03204 49#include <asm/dpmc.h>
5d448dd5 50#include <asm/portmux.h>
639f6571 51#include <mach/bf54x_keys.h>
c6c4d7bb
BW
52#include <linux/input.h>
53#include <linux/spi/ad7877.h>
24a07a12
RH
54
55/*
56 * Name the Board for the /proc/cpuinfo
57 */
066954a3 58const char bfin_board_name[] = "ADSP-BF548-EZKIT";
24a07a12
RH
59
60/*
61 * Driver needs to know address, irq and flag pin.
62 */
63
0a6304a9
MH
64#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65static struct resource bfin_isp1761_resources[] = {
66 [0] = {
67 .name = "isp1761-regs",
68 .start = 0x2C0C0000,
69 .end = 0x2C0C0000 + 0xfffff,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = IRQ_PG7,
74 .end = IRQ_PG7,
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct platform_device bfin_isp1761_device = {
80 .name = "isp1761",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
83 .resource = bfin_isp1761_resources,
84};
85
86static struct platform_device *bfin_isp1761_devices[] = {
87 &bfin_isp1761_device,
88};
89
90int __init bfin_isp1761_init(void)
91{
92 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
93
94 printk(KERN_INFO "%s(): registering device resources\n", __func__);
95 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
96
97 return platform_add_devices(bfin_isp1761_devices, num_devices);
98}
99
100void __exit bfin_isp1761_exit(void)
101{
102 platform_device_unregister(&bfin_isp1761_device);
103}
104arch_initcall(bfin_isp1761_init);
105#endif
106
c6c4d7bb
BW
107#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
108
639f6571 109#include <mach/bf54x-lq043.h>
c6c4d7bb
BW
110
111static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
112 .width = 480,
113 .height = 272,
114 .xres = {480, 480, 480},
115 .yres = {272, 272, 272},
116 .bpp = {24, 24, 24},
117 .disp = GPIO_PE3,
118};
119
120static struct resource bf54x_lq043_resources[] = {
121 {
122 .start = IRQ_EPPI0_ERR,
123 .end = IRQ_EPPI0_ERR,
124 .flags = IORESOURCE_IRQ,
125 },
126};
127
128static struct platform_device bf54x_lq043_device = {
129 .name = "bf54x-lq043",
130 .id = -1,
131 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
132 .resource = bf54x_lq043_resources,
133 .dev = {
134 .platform_data = &bf54x_lq043_data,
135 },
136};
137#endif
138
139#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
8f740ef3 140static const unsigned int bf548_keymap[] = {
c6c4d7bb
BW
141 KEYVAL(0, 0, KEY_ENTER),
142 KEYVAL(0, 1, KEY_HELP),
143 KEYVAL(0, 2, KEY_0),
144 KEYVAL(0, 3, KEY_BACKSPACE),
145 KEYVAL(1, 0, KEY_TAB),
146 KEYVAL(1, 1, KEY_9),
147 KEYVAL(1, 2, KEY_8),
148 KEYVAL(1, 3, KEY_7),
149 KEYVAL(2, 0, KEY_DOWN),
150 KEYVAL(2, 1, KEY_6),
151 KEYVAL(2, 2, KEY_5),
152 KEYVAL(2, 3, KEY_4),
153 KEYVAL(3, 0, KEY_UP),
154 KEYVAL(3, 1, KEY_3),
155 KEYVAL(3, 2, KEY_2),
156 KEYVAL(3, 3, KEY_1),
157};
158
159static struct bfin_kpad_platform_data bf54x_kpad_data = {
160 .rows = 4,
161 .cols = 4,
8f740ef3
MH
162 .keymap = bf548_keymap,
163 .keymapsize = ARRAY_SIZE(bf548_keymap),
c6c4d7bb
BW
164 .repeat = 0,
165 .debounce_time = 5000, /* ns (5ms) */
166 .coldrive_time = 1000, /* ns (1ms) */
167 .keyup_test_interval = 50, /* ms (50ms) */
168};
169
170static struct resource bf54x_kpad_resources[] = {
171 {
172 .start = IRQ_KEY,
173 .end = IRQ_KEY,
174 .flags = IORESOURCE_IRQ,
175 },
176};
177
178static struct platform_device bf54x_kpad_device = {
179 .name = "bf54x-keys",
180 .id = -1,
181 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
182 .resource = bf54x_kpad_resources,
183 .dev = {
184 .platform_data = &bf54x_kpad_data,
185 },
186};
187#endif
188
24a07a12
RH
189#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
190static struct platform_device rtc_device = {
191 .name = "rtc-bfin",
192 .id = -1,
193};
194#endif
195
196#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
197static struct resource bfin_uart_resources[] = {
198#ifdef CONFIG_SERIAL_BFIN_UART0
199 {
200 .start = 0xFFC00400,
201 .end = 0xFFC004FF,
202 .flags = IORESOURCE_MEM,
203 },
204#endif
205#ifdef CONFIG_SERIAL_BFIN_UART1
206 {
207 .start = 0xFFC02000,
208 .end = 0xFFC020FF,
209 .flags = IORESOURCE_MEM,
210 },
211#endif
212#ifdef CONFIG_SERIAL_BFIN_UART2
213 {
214 .start = 0xFFC02100,
215 .end = 0xFFC021FF,
216 .flags = IORESOURCE_MEM,
217 },
218#endif
219#ifdef CONFIG_SERIAL_BFIN_UART3
220 {
221 .start = 0xFFC03100,
222 .end = 0xFFC031FF,
cc2e16bd 223 .flags = IORESOURCE_MEM,
24a07a12
RH
224 },
225#endif
226};
227
228static struct platform_device bfin_uart_device = {
229 .name = "bfin-uart",
230 .id = 1,
231 .num_resources = ARRAY_SIZE(bfin_uart_resources),
232 .resource = bfin_uart_resources,
233};
234#endif
235
5be36d22
GY
236#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
237static struct resource bfin_sir_resources[] = {
238#ifdef CONFIG_BFIN_SIR0
239 {
240 .start = 0xFFC00400,
241 .end = 0xFFC004FF,
242 .flags = IORESOURCE_MEM,
243 },
244#endif
245#ifdef CONFIG_BFIN_SIR1
246 {
247 .start = 0xFFC02000,
248 .end = 0xFFC020FF,
249 .flags = IORESOURCE_MEM,
250 },
251#endif
252#ifdef CONFIG_BFIN_SIR2
253 {
254 .start = 0xFFC02100,
255 .end = 0xFFC021FF,
256 .flags = IORESOURCE_MEM,
257 },
258#endif
259#ifdef CONFIG_BFIN_SIR3
260 {
261 .start = 0xFFC03100,
262 .end = 0xFFC031FF,
263 .flags = IORESOURCE_MEM,
264 },
265#endif
266};
267
268static struct platform_device bfin_sir_device = {
269 .name = "bfin_sir",
270 .id = 0,
271 .num_resources = ARRAY_SIZE(bfin_sir_resources),
272 .resource = bfin_sir_resources,
273};
274#endif
275
c6c4d7bb
BW
276#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
277static struct resource smsc911x_resources[] = {
278 {
279 .name = "smsc911x-memory",
280 .start = 0x24000000,
281 .end = 0x24000000 + 0xFF,
282 .flags = IORESOURCE_MEM,
283 },
284 {
285 .start = IRQ_PE8,
286 .end = IRQ_PE8,
287 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
288 },
289};
290static struct platform_device smsc911x_device = {
291 .name = "smsc911x",
292 .id = 0,
293 .num_resources = ARRAY_SIZE(smsc911x_resources),
294 .resource = smsc911x_resources,
295};
296#endif
297
c6c4d7bb
BW
298#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
299static struct resource musb_resources[] = {
300 [0] = {
301 .start = 0xFFC03C00,
302 .end = 0xFFC040FF,
303 .flags = IORESOURCE_MEM,
304 },
305 [1] = { /* general IRQ */
306 .start = IRQ_USB_INT0,
307 .end = IRQ_USB_INT0,
308 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
309 },
310 [2] = { /* DMA IRQ */
311 .start = IRQ_USB_DMA,
312 .end = IRQ_USB_DMA,
313 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
314 },
315};
316
317static struct musb_hdrc_platform_data musb_plat = {
2935077e 318#if defined(CONFIG_USB_MUSB_OTG)
c6c4d7bb 319 .mode = MUSB_OTG,
2935077e 320#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
c6c4d7bb 321 .mode = MUSB_HOST,
2935077e 322#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
c6c4d7bb
BW
323 .mode = MUSB_PERIPHERAL,
324#endif
2935077e 325 .multipoint = 0,
c6c4d7bb
BW
326};
327
328static u64 musb_dmamask = ~(u32)0;
329
330static struct platform_device musb_device = {
331 .name = "musb_hdrc",
332 .id = 0,
333 .dev = {
334 .dma_mask = &musb_dmamask,
335 .coherent_dma_mask = 0xffffffff,
336 .platform_data = &musb_plat,
337 },
338 .num_resources = ARRAY_SIZE(musb_resources),
339 .resource = musb_resources,
340};
341#endif
342
343#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
344static struct resource bfin_atapi_resources[] = {
345 {
346 .start = 0xFFC03800,
347 .end = 0xFFC0386F,
348 .flags = IORESOURCE_MEM,
349 },
350 {
351 .start = IRQ_ATAPI_ERR,
352 .end = IRQ_ATAPI_ERR,
353 .flags = IORESOURCE_IRQ,
354 },
355};
356
357static struct platform_device bfin_atapi_device = {
358 .name = "pata-bf54x",
359 .id = -1,
360 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
361 .resource = bfin_atapi_resources,
362};
363#endif
364
365#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
366static struct mtd_partition partition_info[] = {
367 {
aa582977 368 .name = "linux kernel(nand)",
c6c4d7bb
BW
369 .offset = 0,
370 .size = 4 * SIZE_1M,
371 },
372 {
aa582977 373 .name = "file system(nand)",
edf05641
MF
374 .offset = MTDPART_OFS_APPEND,
375 .size = MTDPART_SIZ_FULL,
c6c4d7bb
BW
376 },
377};
378
379static struct bf5xx_nand_platform bf5xx_nand_platform = {
380 .page_size = NFC_PG_SIZE_256,
381 .data_width = NFC_NWIDTH_8,
382 .partitions = partition_info,
383 .nr_partitions = ARRAY_SIZE(partition_info),
384 .rd_dly = 3,
385 .wr_dly = 3,
386};
387
388static struct resource bf5xx_nand_resources[] = {
389 {
390 .start = 0xFFC03B00,
391 .end = 0xFFC03B4F,
392 .flags = IORESOURCE_MEM,
393 },
394 {
395 .start = CH_NFC,
396 .end = CH_NFC,
397 .flags = IORESOURCE_IRQ,
398 },
399};
400
401static struct platform_device bf5xx_nand_device = {
402 .name = "bf5xx-nand",
403 .id = 0,
404 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
405 .resource = bf5xx_nand_resources,
406 .dev = {
407 .platform_data = &bf5xx_nand_platform,
408 },
409};
410#endif
411
3d7e6cf8 412#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
c6c4d7bb
BW
413static struct platform_device bf54x_sdh_device = {
414 .name = "bfin-sdh",
415 .id = 0,
416};
417#endif
418
793dc27b 419#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2
MF
420static struct mtd_partition ezkit_partitions[] = {
421 {
aa582977 422 .name = "bootloader(nor)",
edf05641 423 .size = 0x40000,
de8c43f2
MF
424 .offset = 0,
425 }, {
aa582977 426 .name = "linux kernel(nor)",
ac76d889 427 .size = 0x1C0000,
de8c43f2
MF
428 .offset = MTDPART_OFS_APPEND,
429 }, {
aa582977 430 .name = "file system(nor)",
de8c43f2
MF
431 .size = MTDPART_SIZ_FULL,
432 .offset = MTDPART_OFS_APPEND,
433 }
434};
435
436static struct physmap_flash_data ezkit_flash_data = {
437 .width = 2,
438 .parts = ezkit_partitions,
439 .nr_parts = ARRAY_SIZE(ezkit_partitions),
440};
441
442static struct resource ezkit_flash_resource = {
443 .start = 0x20000000,
444 .end = 0x20ffffff,
445 .flags = IORESOURCE_MEM,
446};
447
448static struct platform_device ezkit_flash_device = {
449 .name = "physmap-flash",
450 .id = 0,
451 .dev = {
452 .platform_data = &ezkit_flash_data,
453 },
454 .num_resources = 1,
455 .resource = &ezkit_flash_resource,
456};
793dc27b 457#endif
de8c43f2 458
c6c4d7bb
BW
459#if defined(CONFIG_MTD_M25P80) \
460 || defined(CONFIG_MTD_M25P80_MODULE)
461/* SPI flash chip (m25p16) */
462static struct mtd_partition bfin_spi_flash_partitions[] = {
463 {
aa582977 464 .name = "bootloader(spi)",
c6c4d7bb
BW
465 .size = 0x00040000,
466 .offset = 0,
467 .mask_flags = MTD_CAP_ROM
468 }, {
aa582977 469 .name = "linux kernel(spi)",
edf05641
MF
470 .size = MTDPART_SIZ_FULL,
471 .offset = MTDPART_OFS_APPEND,
c6c4d7bb
BW
472 }
473};
474
475static struct flash_platform_data bfin_spi_flash_data = {
476 .name = "m25p80",
477 .parts = bfin_spi_flash_partitions,
478 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
479 .type = "m25p16",
480};
481
482static struct bfin5xx_spi_chip spi_flash_chip_info = {
483 .enable_dma = 0, /* use dma transfer with this chip*/
484 .bits_per_word = 8,
485 .cs_change_per_word = 0,
486};
487#endif
488
37fa2421
BS
489#if defined(CONFIG_SND_BLACKFIN_AD1836) \
490 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
491static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
492 .enable_dma = 0,
493 .bits_per_word = 16,
494};
495#endif
496
c6c4d7bb
BW
497#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
498static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
c7d48966 499 .cs_change_per_word = 0,
c6c4d7bb
BW
500 .enable_dma = 0,
501 .bits_per_word = 16,
502};
503
504static const struct ad7877_platform_data bfin_ad7877_ts_info = {
505 .model = 7877,
506 .vref_delay_usecs = 50, /* internal, no capacitor */
507 .x_plate_ohms = 419,
508 .y_plate_ohms = 486,
509 .pressure_max = 1000,
510 .pressure_min = 0,
511 .stopacq_polarity = 1,
512 .first_conversion_delay = 3,
513 .acquisition_time = 1,
514 .averaging = 1,
515 .pen_down_acc_interval = 1,
516};
517#endif
518
6e668936
MH
519#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
520static struct bfin5xx_spi_chip spidev_chip_info = {
521 .enable_dma = 0,
522 .bits_per_word = 8,
523};
524#endif
525
5bda2723 526static struct spi_board_info bfin_spi_board_info[] __initdata = {
c6c4d7bb
BW
527#if defined(CONFIG_MTD_M25P80) \
528 || defined(CONFIG_MTD_M25P80_MODULE)
529 {
530 /* the modalias must be the same as spi device driver name */
531 .modalias = "m25p80", /* Name of spi_driver for this device */
532 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
533 .bus_num = 0, /* Framework bus number */
534 .chip_select = 1, /* SPI_SSEL1*/
535 .platform_data = &bfin_spi_flash_data,
536 .controller_data = &spi_flash_chip_info,
537 .mode = SPI_MODE_3,
538 },
539#endif
37fa2421
BS
540#if defined(CONFIG_SND_BLACKFIN_AD1836) \
541 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
542 {
543 .modalias = "ad1836-spi",
544 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
545 .bus_num = 1,
546 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
547 .controller_data = &ad1836_spi_chip_info,
548 },
549#endif
c6c4d7bb
BW
550#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
551{
552 .modalias = "ad7877",
553 .platform_data = &bfin_ad7877_ts_info,
554 .irq = IRQ_PJ11,
555 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
556 .bus_num = 0,
557 .chip_select = 2,
558 .controller_data = &spi_ad7877_chip_info,
559},
560#endif
6e668936
MH
561#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
562 {
563 .modalias = "spidev",
564 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
565 .bus_num = 0,
566 .chip_select = 1,
567 .controller_data = &spidev_chip_info,
568 },
569#endif
c6c4d7bb
BW
570};
571
5bda2723 572#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb
BW
573/* SPI (0) */
574static struct resource bfin_spi0_resource[] = {
575 [0] = {
576 .start = SPI0_REGBASE,
577 .end = SPI0_REGBASE + 0xFF,
578 .flags = IORESOURCE_MEM,
579 },
580 [1] = {
581 .start = CH_SPI0,
582 .end = CH_SPI0,
583 .flags = IORESOURCE_IRQ,
584 }
585};
586
587/* SPI (1) */
588static struct resource bfin_spi1_resource[] = {
589 [0] = {
590 .start = SPI1_REGBASE,
591 .end = SPI1_REGBASE + 0xFF,
592 .flags = IORESOURCE_MEM,
593 },
594 [1] = {
595 .start = CH_SPI1,
596 .end = CH_SPI1,
597 .flags = IORESOURCE_IRQ,
598 }
599};
600
601/* SPI controller data */
5d448dd5 602static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
c6c4d7bb
BW
603 .num_chipselect = 8,
604 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 605 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
c6c4d7bb
BW
606};
607
608static struct platform_device bf54x_spi_master0 = {
609 .name = "bfin-spi",
610 .id = 0, /* Bus number */
611 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
612 .resource = bfin_spi0_resource,
613 .dev = {
5d448dd5 614 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
c6c4d7bb
BW
615 },
616};
617
5d448dd5
BW
618static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
619 .num_chipselect = 8,
620 .enable_dma = 1, /* master has the ability to do dma transfer */
621 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
622};
623
c6c4d7bb
BW
624static struct platform_device bf54x_spi_master1 = {
625 .name = "bfin-spi",
626 .id = 1, /* Bus number */
627 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
628 .resource = bfin_spi1_resource,
629 .dev = {
5d448dd5 630 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
c6c4d7bb
BW
631 },
632};
633#endif /* spi master and devices */
634
635#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
636static struct resource bfin_twi0_resource[] = {
637 [0] = {
638 .start = TWI0_REGBASE,
639 .end = TWI0_REGBASE + 0xFF,
640 .flags = IORESOURCE_MEM,
641 },
642 [1] = {
643 .start = IRQ_TWI0,
644 .end = IRQ_TWI0,
645 .flags = IORESOURCE_IRQ,
646 },
647};
648
649static struct platform_device i2c_bfin_twi0_device = {
650 .name = "i2c-bfin-twi",
651 .id = 0,
652 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
653 .resource = bfin_twi0_resource,
654};
655
7160e950 656#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
c6c4d7bb
BW
657static struct resource bfin_twi1_resource[] = {
658 [0] = {
659 .start = TWI1_REGBASE,
660 .end = TWI1_REGBASE + 0xFF,
661 .flags = IORESOURCE_MEM,
662 },
663 [1] = {
664 .start = IRQ_TWI1,
665 .end = IRQ_TWI1,
666 .flags = IORESOURCE_IRQ,
667 },
668};
669
670static struct platform_device i2c_bfin_twi1_device = {
671 .name = "i2c-bfin-twi",
672 .id = 1,
673 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
674 .resource = bfin_twi1_resource,
675};
676#endif
7160e950 677#endif
c6c4d7bb 678
81d9c7f2
BW
679#ifdef CONFIG_I2C_BOARDINFO
680static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
681};
682
683#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
684static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
685#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
686 {
687 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
81d9c7f2
BW
688 },
689#endif
690#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
691 {
692 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
81d9c7f2
BW
693 .irq = 212,
694 },
695#endif
696};
697#endif
698#endif
699
2463ef22
MH
700#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
701#include <linux/gpio_keys.h>
702
703static struct gpio_keys_button bfin_gpio_keys_table[] = {
704 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
705 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
706 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
707 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
708};
709
710static struct gpio_keys_platform_data bfin_gpio_keys_data = {
711 .buttons = bfin_gpio_keys_table,
712 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
713};
714
715static struct platform_device bfin_device_gpiokeys = {
716 .name = "gpio-keys",
717 .dev = {
718 .platform_data = &bfin_gpio_keys_data,
719 },
720};
721#endif
722
cad2ab65
MF
723static struct resource bfin_gpios_resources = {
724 .start = 0,
725 .end = MAX_BLACKFIN_GPIOS - 1,
726 .flags = IORESOURCE_IRQ,
727};
728
729static struct platform_device bfin_gpios_device = {
730 .name = "simple-gpio",
731 .id = -1,
732 .num_resources = 1,
733 .resource = &bfin_gpios_resources,
734};
735
14b03204
MH
736static const unsigned int cclk_vlev_datasheet[] =
737{
738/*
739 * Internal VLEV BF54XSBBC1533
740 ****temporarily using these values until data sheet is updated
741 */
742 VRPAIR(VLEV_085, 150000000),
743 VRPAIR(VLEV_090, 250000000),
744 VRPAIR(VLEV_110, 276000000),
745 VRPAIR(VLEV_115, 301000000),
746 VRPAIR(VLEV_120, 525000000),
747 VRPAIR(VLEV_125, 550000000),
748 VRPAIR(VLEV_130, 600000000),
749};
750
751static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
752 .tuple_tab = cclk_vlev_datasheet,
753 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
754 .vr_settling_time = 25 /* us */,
755};
756
757static struct platform_device bfin_dpmc = {
758 .name = "bfin dpmc",
759 .dev = {
760 .platform_data = &bfin_dmpc_vreg_data,
761 },
762};
763
24a07a12 764static struct platform_device *ezkit_devices[] __initdata = {
14b03204
MH
765
766 &bfin_dpmc,
767
24a07a12
RH
768#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
769 &rtc_device,
770#endif
771
772#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
773 &bfin_uart_device,
774#endif
c6c4d7bb 775
5be36d22
GY
776#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
777 &bfin_sir_device,
778#endif
779
c6c4d7bb
BW
780#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
781 &bf54x_lq043_device,
782#endif
783
784#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
785 &smsc911x_device,
786#endif
787
c6c4d7bb
BW
788#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
789 &musb_device,
790#endif
791
792#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
793 &bfin_atapi_device,
794#endif
795
796#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
797 &bf5xx_nand_device,
798#endif
799
3d7e6cf8 800#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
c6c4d7bb
BW
801 &bf54x_sdh_device,
802#endif
803
804#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
805 &bf54x_spi_master0,
d4b1d273 806 &bf54x_spi_master1,
c6c4d7bb
BW
807#endif
808
809#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
810 &bf54x_kpad_device,
811#endif
812
813#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
814 &i2c_bfin_twi0_device,
7160e950 815#if !defined(CONFIG_BF542)
c6c4d7bb
BW
816 &i2c_bfin_twi1_device,
817#endif
7160e950 818#endif
2463ef22
MH
819
820#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
821 &bfin_device_gpiokeys,
822#endif
cad2ab65
MF
823
824 &bfin_gpios_device,
793dc27b
MF
825
826#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2 827 &ezkit_flash_device,
793dc27b 828#endif
24a07a12
RH
829};
830
a01d7a76 831static int __init ezkit_init(void)
24a07a12 832{
b85d858b 833 printk(KERN_INFO "%s(): registering device resources\n", __func__);
81d9c7f2
BW
834
835#ifdef CONFIG_I2C_BOARDINFO
836 i2c_register_board_info(0, bfin_i2c_board_info0,
837 ARRAY_SIZE(bfin_i2c_board_info0));
838#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
839 i2c_register_board_info(1, bfin_i2c_board_info1,
840 ARRAY_SIZE(bfin_i2c_board_info1));
841#endif
842#endif
843
24a07a12 844 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
c6c4d7bb 845
5bda2723 846 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
c6c4d7bb 847
24a07a12
RH
848 return 0;
849}
850
a01d7a76 851arch_initcall(ezkit_init);