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