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