Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[pandora-kernel.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 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
42 #include <linux/usb/musb.h>
43 #endif
44 #include <asm/bfin5xx_spi.h>
45 #include <asm/cplb.h>
46 #include <asm/dma.h>
47 #include <asm/gpio.h>
48 #include <asm/nand.h>
49 #include <asm/dpmc.h>
50 #include <asm/portmux.h>
51 #include <asm/mach/bf54x_keys.h>
52 #include <linux/input.h>
53 #include <linux/spi/ad7877.h>
54
55 /*
56  * Name the Board for the /proc/cpuinfo
57  */
58 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
59
60 /*
61  *  Driver needs to know address, irq and flag pin.
62  */
63
64 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 static 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
79 static 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
86 static struct platform_device *bfin_isp1761_devices[] = {
87         &bfin_isp1761_device,
88 };
89
90 int __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
100 void __exit bfin_isp1761_exit(void)
101 {
102         platform_device_unregister(&bfin_isp1761_device);
103 }
104 arch_initcall(bfin_isp1761_init);
105 #endif
106
107 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
108
109 #include <asm/mach/bf54x-lq043.h>
110
111 static 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
120 static struct resource bf54x_lq043_resources[] = {
121         {
122                 .start = IRQ_EPPI0_ERR,
123                 .end = IRQ_EPPI0_ERR,
124                 .flags = IORESOURCE_IRQ,
125         },
126 };
127
128 static 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)
140 static const unsigned int bf548_keymap[] = {
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
159 static struct bfin_kpad_platform_data bf54x_kpad_data = {
160         .rows                   = 4,
161         .cols                   = 4,
162         .keymap                 = bf548_keymap,
163         .keymapsize             = ARRAY_SIZE(bf548_keymap),
164         .repeat                 = 0,
165         .debounce_time          = 5000, /* ns (5ms) */
166         .coldrive_time          = 1000, /* ns (1ms) */
167         .keyup_test_interval    = 50, /* ms (50ms) */
168 };
169
170 static struct resource bf54x_kpad_resources[] = {
171         {
172                 .start = IRQ_KEY,
173                 .end = IRQ_KEY,
174                 .flags = IORESOURCE_IRQ,
175         },
176 };
177
178 static 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
189 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
190 static 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)
197 static 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,
223                 .flags = IORESOURCE_MEM,
224         },
225 #endif
226 };
227
228 static 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
236 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
237 static 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
268 static 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
276 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
277 static 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 };
290 static 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
298 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
299 static 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
317 static struct musb_hdrc_platform_data musb_plat = {
318 #if defined(CONFIG_USB_MUSB_OTG)
319         .mode           = MUSB_OTG,
320 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
321         .mode           = MUSB_HOST,
322 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
323         .mode           = MUSB_PERIPHERAL,
324 #endif
325         .multipoint     = 0,
326 };
327
328 static u64 musb_dmamask = ~(u32)0;
329
330 static 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)
344 static 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
357 static 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)
366 static struct mtd_partition partition_info[] = {
367         {
368                 .name = "Linux Kernel",
369                 .offset = 0,
370                 .size = 4 * SIZE_1M,
371         },
372         {
373                 .name = "File System",
374                 .offset = MTDPART_OFS_APPEND,
375                 .size = MTDPART_SIZ_FULL,
376         },
377 };
378
379 static 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
388 static 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
401 static 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
412 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
413 static struct platform_device bf54x_sdh_device = {
414         .name = "bfin-sdh",
415         .id = 0,
416 };
417 #endif
418
419 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
420 static struct mtd_partition ezkit_partitions[] = {
421         {
422                 .name       = "Bootloader",
423                 .size       = 0x40000,
424                 .offset     = 0,
425         }, {
426                 .name       = "Kernel",
427                 .size       = 0x1C0000,
428                 .offset     = MTDPART_OFS_APPEND,
429         }, {
430                 .name       = "RootFS",
431                 .size       = MTDPART_SIZ_FULL,
432                 .offset     = MTDPART_OFS_APPEND,
433         }
434 };
435
436 static struct physmap_flash_data ezkit_flash_data = {
437         .width      = 2,
438         .parts      = ezkit_partitions,
439         .nr_parts   = ARRAY_SIZE(ezkit_partitions),
440 };
441
442 static struct resource ezkit_flash_resource = {
443         .start = 0x20000000,
444         .end   = 0x20ffffff,
445         .flags = IORESOURCE_MEM,
446 };
447
448 static 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 };
457 #endif
458
459 #if defined(CONFIG_MTD_M25P80) \
460         || defined(CONFIG_MTD_M25P80_MODULE)
461 /* SPI flash chip (m25p16) */
462 static struct mtd_partition bfin_spi_flash_partitions[] = {
463         {
464                 .name = "bootloader",
465                 .size = 0x00040000,
466                 .offset = 0,
467                 .mask_flags = MTD_CAP_ROM
468         }, {
469                 .name = "linux kernel",
470                 .size = MTDPART_SIZ_FULL,
471                 .offset = MTDPART_OFS_APPEND,
472         }
473 };
474
475 static 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
482 static 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
489 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
490         || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
491 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
492         .enable_dma = 0,
493         .bits_per_word = 16,
494 };
495 #endif
496
497 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
498 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
499         .cs_change_per_word = 0,
500         .enable_dma = 0,
501         .bits_per_word = 16,
502 };
503
504 static 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
519 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
520 static struct bfin5xx_spi_chip spidev_chip_info = {
521         .enable_dma = 0,
522         .bits_per_word = 8,
523 };
524 #endif
525
526 static struct spi_board_info bfin_spi_board_info[] __initdata = {
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
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
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
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
570 };
571
572 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
573 /* SPI (0) */
574 static 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) */
588 static 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 */
602 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
603         .num_chipselect = 8,
604         .enable_dma = 1,  /* master has the ability to do dma transfer */
605         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
606 };
607
608 static 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 = {
614                 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
615                 },
616 };
617
618 static 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
624 static 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 = {
630                 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
631                 },
632 };
633 #endif  /* spi master and devices */
634
635 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
636 static 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
649 static 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
656 #if !defined(CONFIG_BF542)      /* The BF542 only has 1 TWI */
657 static 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
670 static 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
677 #endif
678
679 #ifdef CONFIG_I2C_BOARDINFO
680 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
681 };
682
683 #if !defined(CONFIG_BF542)      /* The BF542 only has 1 TWI */
684 static 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),
688         },
689 #endif
690 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
691         {
692                 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
693                 .irq = 212,
694         },
695 #endif
696 };
697 #endif
698 #endif
699
700 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
701 #include <linux/gpio_keys.h>
702
703 static 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
710 static 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
715 static struct platform_device bfin_device_gpiokeys = {
716         .name      = "gpio-keys",
717         .dev = {
718                 .platform_data = &bfin_gpio_keys_data,
719         },
720 };
721 #endif
722
723 static struct resource bfin_gpios_resources = {
724         .start = 0,
725         .end   = MAX_BLACKFIN_GPIOS - 1,
726         .flags = IORESOURCE_IRQ,
727 };
728
729 static struct platform_device bfin_gpios_device = {
730         .name = "simple-gpio",
731         .id = -1,
732         .num_resources = 1,
733         .resource = &bfin_gpios_resources,
734 };
735
736 static 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
751 static 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
757 static struct platform_device bfin_dpmc = {
758         .name = "bfin dpmc",
759         .dev = {
760                 .platform_data = &bfin_dmpc_vreg_data,
761         },
762 };
763
764 static struct platform_device *ezkit_devices[] __initdata = {
765
766         &bfin_dpmc,
767
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
775
776 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
777         &bfin_sir_device,
778 #endif
779
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
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
800 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
801         &bf54x_sdh_device,
802 #endif
803
804 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
805         &bf54x_spi_master0,
806         &bf54x_spi_master1,
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,
815 #if !defined(CONFIG_BF542)
816         &i2c_bfin_twi1_device,
817 #endif
818 #endif
819
820 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
821         &bfin_device_gpiokeys,
822 #endif
823
824         &bfin_gpios_device,
825
826 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
827         &ezkit_flash_device,
828 #endif
829 };
830
831 static int __init ezkit_init(void)
832 {
833         printk(KERN_INFO "%s(): registering device resources\n", __func__);
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
844         platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
845
846         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
847
848         return 0;
849 }
850
851 arch_initcall(ezkit_init);