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