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