311bf9970fe716e97278611b8c7879ffabc5c0b1
[deliverable/linux.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/bfin_sport.h>
26 #include <asm/portmux.h>
27 #include <asm/bfin_sdh.h>
28 #include <mach/bf54x_keys.h>
29 #include <linux/input.h>
30 #include <linux/spi/ad7877.h>
31
32 /*
33 * Name the Board for the /proc/cpuinfo
34 */
35 const char bfin_board_name[] = "ADI BF548-EZKIT";
36
37 /*
38 * Driver needs to know address, irq and flag pin.
39 */
40
41 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
42 #include <linux/usb/isp1760.h>
43 static struct resource bfin_isp1760_resources[] = {
44 [0] = {
45 .start = 0x2C0C0000,
46 .end = 0x2C0C0000 + 0xfffff,
47 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
50 .start = IRQ_PG7,
51 .end = IRQ_PG7,
52 .flags = IORESOURCE_IRQ,
53 },
54 };
55
56 static struct isp1760_platform_data isp1760_priv = {
57 .is_isp1761 = 0,
58 .bus_width_16 = 1,
59 .port1_otg = 0,
60 .analog_oc = 0,
61 .dack_polarity_high = 0,
62 .dreq_polarity_high = 0,
63 };
64
65 static struct platform_device bfin_isp1760_device = {
66 .name = "isp1760",
67 .id = 0,
68 .dev = {
69 .platform_data = &isp1760_priv,
70 },
71 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
72 .resource = bfin_isp1760_resources,
73 };
74 #endif
75
76 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
77
78 #include <mach/bf54x-lq043.h>
79
80 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
81 .width = 95,
82 .height = 54,
83 .xres = {480, 480, 480},
84 .yres = {272, 272, 272},
85 .bpp = {24, 24, 24},
86 .disp = GPIO_PE3,
87 };
88
89 static struct resource bf54x_lq043_resources[] = {
90 {
91 .start = IRQ_EPPI0_ERR,
92 .end = IRQ_EPPI0_ERR,
93 .flags = IORESOURCE_IRQ,
94 },
95 };
96
97 static struct platform_device bf54x_lq043_device = {
98 .name = "bf54x-lq043",
99 .id = -1,
100 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
101 .resource = bf54x_lq043_resources,
102 .dev = {
103 .platform_data = &bf54x_lq043_data,
104 },
105 };
106 #endif
107
108 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
109 static const unsigned int bf548_keymap[] = {
110 KEYVAL(0, 0, KEY_ENTER),
111 KEYVAL(0, 1, KEY_HELP),
112 KEYVAL(0, 2, KEY_0),
113 KEYVAL(0, 3, KEY_BACKSPACE),
114 KEYVAL(1, 0, KEY_TAB),
115 KEYVAL(1, 1, KEY_9),
116 KEYVAL(1, 2, KEY_8),
117 KEYVAL(1, 3, KEY_7),
118 KEYVAL(2, 0, KEY_DOWN),
119 KEYVAL(2, 1, KEY_6),
120 KEYVAL(2, 2, KEY_5),
121 KEYVAL(2, 3, KEY_4),
122 KEYVAL(3, 0, KEY_UP),
123 KEYVAL(3, 1, KEY_3),
124 KEYVAL(3, 2, KEY_2),
125 KEYVAL(3, 3, KEY_1),
126 };
127
128 static struct bfin_kpad_platform_data bf54x_kpad_data = {
129 .rows = 4,
130 .cols = 4,
131 .keymap = bf548_keymap,
132 .keymapsize = ARRAY_SIZE(bf548_keymap),
133 .repeat = 0,
134 .debounce_time = 5000, /* ns (5ms) */
135 .coldrive_time = 1000, /* ns (1ms) */
136 .keyup_test_interval = 50, /* ms (50ms) */
137 };
138
139 static struct resource bf54x_kpad_resources[] = {
140 {
141 .start = IRQ_KEY,
142 .end = IRQ_KEY,
143 .flags = IORESOURCE_IRQ,
144 },
145 };
146
147 static struct platform_device bf54x_kpad_device = {
148 .name = "bf54x-keys",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
151 .resource = bf54x_kpad_resources,
152 .dev = {
153 .platform_data = &bf54x_kpad_data,
154 },
155 };
156 #endif
157
158 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
159 #include <asm/bfin_rotary.h>
160
161 static struct bfin_rotary_platform_data bfin_rotary_data = {
162 /*.rotary_up_key = KEY_UP,*/
163 /*.rotary_down_key = KEY_DOWN,*/
164 .rotary_rel_code = REL_WHEEL,
165 .rotary_button_key = KEY_ENTER,
166 .debounce = 10, /* 0..17 */
167 .mode = ROT_QUAD_ENC | ROT_DEBE,
168 };
169
170 static struct resource bfin_rotary_resources[] = {
171 {
172 .start = IRQ_CNT,
173 .end = IRQ_CNT,
174 .flags = IORESOURCE_IRQ,
175 },
176 };
177
178 static struct platform_device bfin_rotary_device = {
179 .name = "bfin-rotary",
180 .id = -1,
181 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
182 .resource = bfin_rotary_resources,
183 .dev = {
184 .platform_data = &bfin_rotary_data,
185 },
186 };
187 #endif
188
189 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
190 #include <linux/input/adxl34x.h>
191 static const struct adxl34x_platform_data adxl34x_info = {
192 .x_axis_offset = 0,
193 .y_axis_offset = 0,
194 .z_axis_offset = 0,
195 .tap_threshold = 0x31,
196 .tap_duration = 0x10,
197 .tap_latency = 0x60,
198 .tap_window = 0xF0,
199 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
200 .act_axis_control = 0xFF,
201 .activity_threshold = 5,
202 .inactivity_threshold = 3,
203 .inactivity_time = 4,
204 .free_fall_threshold = 0x7,
205 .free_fall_time = 0x20,
206 .data_rate = 0x8,
207 .data_range = ADXL_FULL_RES,
208
209 .ev_type = EV_ABS,
210 .ev_code_x = ABS_X, /* EV_REL */
211 .ev_code_y = ABS_Y, /* EV_REL */
212 .ev_code_z = ABS_Z, /* EV_REL */
213
214 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
215
216 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
217 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
218 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
219 .fifo_mode = ADXL_FIFO_STREAM,
220 .orientation_enable = ADXL_EN_ORIENTATION_3D,
221 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
222 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
223 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
224 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
225 };
226 #endif
227
228 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
229 static struct platform_device rtc_device = {
230 .name = "rtc-bfin",
231 .id = -1,
232 };
233 #endif
234
235 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
236 #ifdef CONFIG_SERIAL_BFIN_UART0
237 static struct resource bfin_uart0_resources[] = {
238 {
239 .start = UART0_DLL,
240 .end = UART0_RBR+2,
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .start = IRQ_UART0_RX,
245 .end = IRQ_UART0_RX+1,
246 .flags = IORESOURCE_IRQ,
247 },
248 {
249 .start = IRQ_UART0_ERROR,
250 .end = IRQ_UART0_ERROR,
251 .flags = IORESOURCE_IRQ,
252 },
253 {
254 .start = CH_UART0_TX,
255 .end = CH_UART0_TX,
256 .flags = IORESOURCE_DMA,
257 },
258 {
259 .start = CH_UART0_RX,
260 .end = CH_UART0_RX,
261 .flags = IORESOURCE_DMA,
262 },
263 };
264
265 static unsigned short bfin_uart0_peripherals[] = {
266 P_UART0_TX, P_UART0_RX, 0
267 };
268
269 static struct platform_device bfin_uart0_device = {
270 .name = "bfin-uart",
271 .id = 0,
272 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
273 .resource = bfin_uart0_resources,
274 .dev = {
275 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
276 },
277 };
278 #endif
279 #ifdef CONFIG_SERIAL_BFIN_UART1
280 static struct resource bfin_uart1_resources[] = {
281 {
282 .start = UART1_DLL,
283 .end = UART1_RBR+2,
284 .flags = IORESOURCE_MEM,
285 },
286 {
287 .start = IRQ_UART1_RX,
288 .end = IRQ_UART1_RX+1,
289 .flags = IORESOURCE_IRQ,
290 },
291 {
292 .start = IRQ_UART1_ERROR,
293 .end = IRQ_UART1_ERROR,
294 .flags = IORESOURCE_IRQ,
295 },
296 {
297 .start = CH_UART1_TX,
298 .end = CH_UART1_TX,
299 .flags = IORESOURCE_DMA,
300 },
301 {
302 .start = CH_UART1_RX,
303 .end = CH_UART1_RX,
304 .flags = IORESOURCE_DMA,
305 },
306 #ifdef CONFIG_BFIN_UART1_CTSRTS
307 { /* CTS pin -- 0 means not supported */
308 .start = GPIO_PE10,
309 .end = GPIO_PE10,
310 .flags = IORESOURCE_IO,
311 },
312 { /* RTS pin -- 0 means not supported */
313 .start = GPIO_PE9,
314 .end = GPIO_PE9,
315 .flags = IORESOURCE_IO,
316 },
317 #endif
318 };
319
320 static unsigned short bfin_uart1_peripherals[] = {
321 P_UART1_TX, P_UART1_RX,
322 #ifdef CONFIG_BFIN_UART1_CTSRTS
323 P_UART1_RTS, P_UART1_CTS,
324 #endif
325 0
326 };
327
328 static struct platform_device bfin_uart1_device = {
329 .name = "bfin-uart",
330 .id = 1,
331 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
332 .resource = bfin_uart1_resources,
333 .dev = {
334 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
335 },
336 };
337 #endif
338 #ifdef CONFIG_SERIAL_BFIN_UART2
339 static struct resource bfin_uart2_resources[] = {
340 {
341 .start = UART2_DLL,
342 .end = UART2_RBR+2,
343 .flags = IORESOURCE_MEM,
344 },
345 {
346 .start = IRQ_UART2_RX,
347 .end = IRQ_UART2_RX+1,
348 .flags = IORESOURCE_IRQ,
349 },
350 {
351 .start = IRQ_UART2_ERROR,
352 .end = IRQ_UART2_ERROR,
353 .flags = IORESOURCE_IRQ,
354 },
355 {
356 .start = CH_UART2_TX,
357 .end = CH_UART2_TX,
358 .flags = IORESOURCE_DMA,
359 },
360 {
361 .start = CH_UART2_RX,
362 .end = CH_UART2_RX,
363 .flags = IORESOURCE_DMA,
364 },
365 };
366
367 static unsigned short bfin_uart2_peripherals[] = {
368 P_UART2_TX, P_UART2_RX, 0
369 };
370
371 static struct platform_device bfin_uart2_device = {
372 .name = "bfin-uart",
373 .id = 2,
374 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
375 .resource = bfin_uart2_resources,
376 .dev = {
377 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
378 },
379 };
380 #endif
381 #ifdef CONFIG_SERIAL_BFIN_UART3
382 static struct resource bfin_uart3_resources[] = {
383 {
384 .start = UART3_DLL,
385 .end = UART3_RBR+2,
386 .flags = IORESOURCE_MEM,
387 },
388 {
389 .start = IRQ_UART3_RX,
390 .end = IRQ_UART3_RX+1,
391 .flags = IORESOURCE_IRQ,
392 },
393 {
394 .start = IRQ_UART3_ERROR,
395 .end = IRQ_UART3_ERROR,
396 .flags = IORESOURCE_IRQ,
397 },
398 {
399 .start = CH_UART3_TX,
400 .end = CH_UART3_TX,
401 .flags = IORESOURCE_DMA,
402 },
403 {
404 .start = CH_UART3_RX,
405 .end = CH_UART3_RX,
406 .flags = IORESOURCE_DMA,
407 },
408 #ifdef CONFIG_BFIN_UART3_CTSRTS
409 { /* CTS pin -- 0 means not supported */
410 .start = GPIO_PB3,
411 .end = GPIO_PB3,
412 .flags = IORESOURCE_IO,
413 },
414 { /* RTS pin -- 0 means not supported */
415 .start = GPIO_PB2,
416 .end = GPIO_PB2,
417 .flags = IORESOURCE_IO,
418 },
419 #endif
420 };
421
422 static unsigned short bfin_uart3_peripherals[] = {
423 P_UART3_TX, P_UART3_RX,
424 #ifdef CONFIG_BFIN_UART3_CTSRTS
425 P_UART3_RTS, P_UART3_CTS,
426 #endif
427 0
428 };
429
430 static struct platform_device bfin_uart3_device = {
431 .name = "bfin-uart",
432 .id = 3,
433 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
434 .resource = bfin_uart3_resources,
435 .dev = {
436 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
437 },
438 };
439 #endif
440 #endif
441
442 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
443 #ifdef CONFIG_BFIN_SIR0
444 static struct resource bfin_sir0_resources[] = {
445 {
446 .start = 0xFFC00400,
447 .end = 0xFFC004FF,
448 .flags = IORESOURCE_MEM,
449 },
450 {
451 .start = IRQ_UART0_RX,
452 .end = IRQ_UART0_RX+1,
453 .flags = IORESOURCE_IRQ,
454 },
455 {
456 .start = CH_UART0_RX,
457 .end = CH_UART0_RX+1,
458 .flags = IORESOURCE_DMA,
459 },
460 };
461 static struct platform_device bfin_sir0_device = {
462 .name = "bfin_sir",
463 .id = 0,
464 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
465 .resource = bfin_sir0_resources,
466 };
467 #endif
468 #ifdef CONFIG_BFIN_SIR1
469 static struct resource bfin_sir1_resources[] = {
470 {
471 .start = 0xFFC02000,
472 .end = 0xFFC020FF,
473 .flags = IORESOURCE_MEM,
474 },
475 {
476 .start = IRQ_UART1_RX,
477 .end = IRQ_UART1_RX+1,
478 .flags = IORESOURCE_IRQ,
479 },
480 {
481 .start = CH_UART1_RX,
482 .end = CH_UART1_RX+1,
483 .flags = IORESOURCE_DMA,
484 },
485 };
486 static struct platform_device bfin_sir1_device = {
487 .name = "bfin_sir",
488 .id = 1,
489 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
490 .resource = bfin_sir1_resources,
491 };
492 #endif
493 #ifdef CONFIG_BFIN_SIR2
494 static struct resource bfin_sir2_resources[] = {
495 {
496 .start = 0xFFC02100,
497 .end = 0xFFC021FF,
498 .flags = IORESOURCE_MEM,
499 },
500 {
501 .start = IRQ_UART2_RX,
502 .end = IRQ_UART2_RX+1,
503 .flags = IORESOURCE_IRQ,
504 },
505 {
506 .start = CH_UART2_RX,
507 .end = CH_UART2_RX+1,
508 .flags = IORESOURCE_DMA,
509 },
510 };
511 static struct platform_device bfin_sir2_device = {
512 .name = "bfin_sir",
513 .id = 2,
514 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
515 .resource = bfin_sir2_resources,
516 };
517 #endif
518 #ifdef CONFIG_BFIN_SIR3
519 static struct resource bfin_sir3_resources[] = {
520 {
521 .start = 0xFFC03100,
522 .end = 0xFFC031FF,
523 .flags = IORESOURCE_MEM,
524 },
525 {
526 .start = IRQ_UART3_RX,
527 .end = IRQ_UART3_RX+1,
528 .flags = IORESOURCE_IRQ,
529 },
530 {
531 .start = CH_UART3_RX,
532 .end = CH_UART3_RX+1,
533 .flags = IORESOURCE_DMA,
534 },
535 };
536 static struct platform_device bfin_sir3_device = {
537 .name = "bfin_sir",
538 .id = 3,
539 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
540 .resource = bfin_sir3_resources,
541 };
542 #endif
543 #endif
544
545 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
546 #include <linux/smsc911x.h>
547
548 static struct resource smsc911x_resources[] = {
549 {
550 .name = "smsc911x-memory",
551 .start = 0x24000000,
552 .end = 0x24000000 + 0xFF,
553 .flags = IORESOURCE_MEM,
554 },
555 {
556 .start = IRQ_PE8,
557 .end = IRQ_PE8,
558 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
559 },
560 };
561
562 static struct smsc911x_platform_config smsc911x_config = {
563 .flags = SMSC911X_USE_32BIT,
564 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
565 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
566 .phy_interface = PHY_INTERFACE_MODE_MII,
567 };
568
569 static struct platform_device smsc911x_device = {
570 .name = "smsc911x",
571 .id = 0,
572 .num_resources = ARRAY_SIZE(smsc911x_resources),
573 .resource = smsc911x_resources,
574 .dev = {
575 .platform_data = &smsc911x_config,
576 },
577 };
578 #endif
579
580 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
581 static struct resource musb_resources[] = {
582 [0] = {
583 .start = 0xFFC03C00,
584 .end = 0xFFC040FF,
585 .flags = IORESOURCE_MEM,
586 },
587 [1] = { /* general IRQ */
588 .start = IRQ_USB_INT0,
589 .end = IRQ_USB_INT0,
590 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
591 .name = "mc"
592 },
593 [2] = { /* DMA IRQ */
594 .start = IRQ_USB_DMA,
595 .end = IRQ_USB_DMA,
596 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
597 .name = "dma"
598 },
599 };
600
601 static struct musb_hdrc_config musb_config = {
602 .multipoint = 0,
603 .dyn_fifo = 0,
604 .soft_con = 1,
605 .dma = 1,
606 .num_eps = 8,
607 .dma_channels = 8,
608 .gpio_vrsel = GPIO_PE7,
609 /* Some custom boards need to be active low, just set it to "0"
610 * if it is the case.
611 */
612 .gpio_vrsel_active = 1,
613 .clkin = 24, /* musb CLKIN in MHZ */
614 };
615
616 static struct musb_hdrc_platform_data musb_plat = {
617 #if defined(CONFIG_USB_MUSB_OTG)
618 .mode = MUSB_OTG,
619 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
620 .mode = MUSB_HOST,
621 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
622 .mode = MUSB_PERIPHERAL,
623 #endif
624 .config = &musb_config,
625 };
626
627 static u64 musb_dmamask = ~(u32)0;
628
629 static struct platform_device musb_device = {
630 .name = "musb-blackfin",
631 .id = 0,
632 .dev = {
633 .dma_mask = &musb_dmamask,
634 .coherent_dma_mask = 0xffffffff,
635 .platform_data = &musb_plat,
636 },
637 .num_resources = ARRAY_SIZE(musb_resources),
638 .resource = musb_resources,
639 };
640 #endif
641
642 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
643 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
644 static struct resource bfin_sport0_uart_resources[] = {
645 {
646 .start = SPORT0_TCR1,
647 .end = SPORT0_MRCS3+4,
648 .flags = IORESOURCE_MEM,
649 },
650 {
651 .start = IRQ_SPORT0_RX,
652 .end = IRQ_SPORT0_RX+1,
653 .flags = IORESOURCE_IRQ,
654 },
655 {
656 .start = IRQ_SPORT0_ERROR,
657 .end = IRQ_SPORT0_ERROR,
658 .flags = IORESOURCE_IRQ,
659 },
660 };
661
662 static unsigned short bfin_sport0_peripherals[] = {
663 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
664 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
665 };
666
667 static struct platform_device bfin_sport0_uart_device = {
668 .name = "bfin-sport-uart",
669 .id = 0,
670 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
671 .resource = bfin_sport0_uart_resources,
672 .dev = {
673 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
674 },
675 };
676 #endif
677 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
678 static struct resource bfin_sport1_uart_resources[] = {
679 {
680 .start = SPORT1_TCR1,
681 .end = SPORT1_MRCS3+4,
682 .flags = IORESOURCE_MEM,
683 },
684 {
685 .start = IRQ_SPORT1_RX,
686 .end = IRQ_SPORT1_RX+1,
687 .flags = IORESOURCE_IRQ,
688 },
689 {
690 .start = IRQ_SPORT1_ERROR,
691 .end = IRQ_SPORT1_ERROR,
692 .flags = IORESOURCE_IRQ,
693 },
694 };
695
696 static unsigned short bfin_sport1_peripherals[] = {
697 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
698 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
699 };
700
701 static struct platform_device bfin_sport1_uart_device = {
702 .name = "bfin-sport-uart",
703 .id = 1,
704 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
705 .resource = bfin_sport1_uart_resources,
706 .dev = {
707 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
708 },
709 };
710 #endif
711 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
712 static struct resource bfin_sport2_uart_resources[] = {
713 {
714 .start = SPORT2_TCR1,
715 .end = SPORT2_MRCS3+4,
716 .flags = IORESOURCE_MEM,
717 },
718 {
719 .start = IRQ_SPORT2_RX,
720 .end = IRQ_SPORT2_RX+1,
721 .flags = IORESOURCE_IRQ,
722 },
723 {
724 .start = IRQ_SPORT2_ERROR,
725 .end = IRQ_SPORT2_ERROR,
726 .flags = IORESOURCE_IRQ,
727 },
728 };
729
730 static unsigned short bfin_sport2_peripherals[] = {
731 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
732 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
733 };
734
735 static struct platform_device bfin_sport2_uart_device = {
736 .name = "bfin-sport-uart",
737 .id = 2,
738 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
739 .resource = bfin_sport2_uart_resources,
740 .dev = {
741 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
742 },
743 };
744 #endif
745 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
746 static struct resource bfin_sport3_uart_resources[] = {
747 {
748 .start = SPORT3_TCR1,
749 .end = SPORT3_MRCS3+4,
750 .flags = IORESOURCE_MEM,
751 },
752 {
753 .start = IRQ_SPORT3_RX,
754 .end = IRQ_SPORT3_RX+1,
755 .flags = IORESOURCE_IRQ,
756 },
757 {
758 .start = IRQ_SPORT3_ERROR,
759 .end = IRQ_SPORT3_ERROR,
760 .flags = IORESOURCE_IRQ,
761 },
762 };
763
764 static unsigned short bfin_sport3_peripherals[] = {
765 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
766 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
767 };
768
769 static struct platform_device bfin_sport3_uart_device = {
770 .name = "bfin-sport-uart",
771 .id = 3,
772 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
773 .resource = bfin_sport3_uart_resources,
774 .dev = {
775 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
776 },
777 };
778 #endif
779 #endif
780
781 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
782
783 static unsigned short bfin_can0_peripherals[] = {
784 P_CAN0_RX, P_CAN0_TX, 0
785 };
786
787 static struct resource bfin_can0_resources[] = {
788 {
789 .start = 0xFFC02A00,
790 .end = 0xFFC02FFF,
791 .flags = IORESOURCE_MEM,
792 },
793 {
794 .start = IRQ_CAN0_RX,
795 .end = IRQ_CAN0_RX,
796 .flags = IORESOURCE_IRQ,
797 },
798 {
799 .start = IRQ_CAN0_TX,
800 .end = IRQ_CAN0_TX,
801 .flags = IORESOURCE_IRQ,
802 },
803 {
804 .start = IRQ_CAN0_ERROR,
805 .end = IRQ_CAN0_ERROR,
806 .flags = IORESOURCE_IRQ,
807 },
808 };
809
810 static struct platform_device bfin_can0_device = {
811 .name = "bfin_can",
812 .id = 0,
813 .num_resources = ARRAY_SIZE(bfin_can0_resources),
814 .resource = bfin_can0_resources,
815 .dev = {
816 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
817 },
818 };
819
820 static unsigned short bfin_can1_peripherals[] = {
821 P_CAN1_RX, P_CAN1_TX, 0
822 };
823
824 static struct resource bfin_can1_resources[] = {
825 {
826 .start = 0xFFC03200,
827 .end = 0xFFC037FF,
828 .flags = IORESOURCE_MEM,
829 },
830 {
831 .start = IRQ_CAN1_RX,
832 .end = IRQ_CAN1_RX,
833 .flags = IORESOURCE_IRQ,
834 },
835 {
836 .start = IRQ_CAN1_TX,
837 .end = IRQ_CAN1_TX,
838 .flags = IORESOURCE_IRQ,
839 },
840 {
841 .start = IRQ_CAN1_ERROR,
842 .end = IRQ_CAN1_ERROR,
843 .flags = IORESOURCE_IRQ,
844 },
845 };
846
847 static struct platform_device bfin_can1_device = {
848 .name = "bfin_can",
849 .id = 1,
850 .num_resources = ARRAY_SIZE(bfin_can1_resources),
851 .resource = bfin_can1_resources,
852 .dev = {
853 .platform_data = &bfin_can1_peripherals, /* Passed to driver */
854 },
855 };
856
857 #endif
858
859 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
860 static struct resource bfin_atapi_resources[] = {
861 {
862 .start = 0xFFC03800,
863 .end = 0xFFC0386F,
864 .flags = IORESOURCE_MEM,
865 },
866 {
867 .start = IRQ_ATAPI_ERR,
868 .end = IRQ_ATAPI_ERR,
869 .flags = IORESOURCE_IRQ,
870 },
871 };
872
873 static struct platform_device bfin_atapi_device = {
874 .name = "pata-bf54x",
875 .id = -1,
876 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
877 .resource = bfin_atapi_resources,
878 };
879 #endif
880
881 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
882 static struct mtd_partition partition_info[] = {
883 {
884 .name = "bootloader(nand)",
885 .offset = 0,
886 .size = 0x80000,
887 }, {
888 .name = "linux kernel(nand)",
889 .offset = MTDPART_OFS_APPEND,
890 .size = 4 * 1024 * 1024,
891 },
892 {
893 .name = "file system(nand)",
894 .offset = MTDPART_OFS_APPEND,
895 .size = MTDPART_SIZ_FULL,
896 },
897 };
898
899 static struct bf5xx_nand_platform bf5xx_nand_platform = {
900 .data_width = NFC_NWIDTH_8,
901 .partitions = partition_info,
902 .nr_partitions = ARRAY_SIZE(partition_info),
903 .rd_dly = 3,
904 .wr_dly = 3,
905 };
906
907 static struct resource bf5xx_nand_resources[] = {
908 {
909 .start = 0xFFC03B00,
910 .end = 0xFFC03B4F,
911 .flags = IORESOURCE_MEM,
912 },
913 {
914 .start = CH_NFC,
915 .end = CH_NFC,
916 .flags = IORESOURCE_IRQ,
917 },
918 };
919
920 static struct platform_device bf5xx_nand_device = {
921 .name = "bf5xx-nand",
922 .id = 0,
923 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
924 .resource = bf5xx_nand_resources,
925 .dev = {
926 .platform_data = &bf5xx_nand_platform,
927 },
928 };
929 #endif
930
931 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
932
933 static struct bfin_sd_host bfin_sdh_data = {
934 .dma_chan = CH_SDH,
935 .irq_int0 = IRQ_SDH_MASK0,
936 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
937 };
938
939 static struct platform_device bf54x_sdh_device = {
940 .name = "bfin-sdh",
941 .id = 0,
942 .dev = {
943 .platform_data = &bfin_sdh_data,
944 },
945 };
946 #endif
947
948 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
949 static struct mtd_partition ezkit_partitions[] = {
950 {
951 .name = "bootloader(nor)",
952 .size = 0x80000,
953 .offset = 0,
954 }, {
955 .name = "linux kernel(nor)",
956 .size = 0x400000,
957 .offset = MTDPART_OFS_APPEND,
958 }, {
959 .name = "file system(nor)",
960 .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
961 .offset = MTDPART_OFS_APPEND,
962 }, {
963 .name = "config(nor)",
964 .size = 0x8000 * 3,
965 .offset = MTDPART_OFS_APPEND,
966 }, {
967 .name = "u-boot env(nor)",
968 .size = 0x8000,
969 .offset = MTDPART_OFS_APPEND,
970 }
971 };
972
973 static struct physmap_flash_data ezkit_flash_data = {
974 .width = 2,
975 .parts = ezkit_partitions,
976 .nr_parts = ARRAY_SIZE(ezkit_partitions),
977 };
978
979 static struct resource ezkit_flash_resource = {
980 .start = 0x20000000,
981 .end = 0x21ffffff,
982 .flags = IORESOURCE_MEM,
983 };
984
985 static struct platform_device ezkit_flash_device = {
986 .name = "physmap-flash",
987 .id = 0,
988 .dev = {
989 .platform_data = &ezkit_flash_data,
990 },
991 .num_resources = 1,
992 .resource = &ezkit_flash_resource,
993 };
994 #endif
995
996 #if defined(CONFIG_MTD_M25P80) \
997 || defined(CONFIG_MTD_M25P80_MODULE)
998 /* SPI flash chip (m25p16) */
999 static struct mtd_partition bfin_spi_flash_partitions[] = {
1000 {
1001 .name = "bootloader(spi)",
1002 .size = 0x00080000,
1003 .offset = 0,
1004 .mask_flags = MTD_CAP_ROM
1005 }, {
1006 .name = "linux kernel(spi)",
1007 .size = MTDPART_SIZ_FULL,
1008 .offset = MTDPART_OFS_APPEND,
1009 }
1010 };
1011
1012 static struct flash_platform_data bfin_spi_flash_data = {
1013 .name = "m25p80",
1014 .parts = bfin_spi_flash_partitions,
1015 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
1016 .type = "m25p16",
1017 };
1018
1019 static struct bfin5xx_spi_chip spi_flash_chip_info = {
1020 .enable_dma = 0, /* use dma transfer with this chip*/
1021 .bits_per_word = 8,
1022 };
1023 #endif
1024
1025 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
1026 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
1027 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
1028 .enable_dma = 0,
1029 .bits_per_word = 16,
1030 };
1031 #endif
1032
1033 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1034 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
1035 .enable_dma = 0,
1036 .bits_per_word = 16,
1037 };
1038
1039 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1040 .model = 7877,
1041 .vref_delay_usecs = 50, /* internal, no capacitor */
1042 .x_plate_ohms = 419,
1043 .y_plate_ohms = 486,
1044 .pressure_max = 1000,
1045 .pressure_min = 0,
1046 .stopacq_polarity = 1,
1047 .first_conversion_delay = 3,
1048 .acquisition_time = 1,
1049 .averaging = 1,
1050 .pen_down_acc_interval = 1,
1051 };
1052 #endif
1053
1054 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1055 static struct bfin5xx_spi_chip spidev_chip_info = {
1056 .enable_dma = 0,
1057 .bits_per_word = 8,
1058 };
1059 #endif
1060
1061 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1062 static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
1063 .enable_dma = 0, /* use dma transfer with this chip*/
1064 .bits_per_word = 8,
1065 };
1066 #endif
1067
1068 static struct spi_board_info bfin_spi_board_info[] __initdata = {
1069 #if defined(CONFIG_MTD_M25P80) \
1070 || defined(CONFIG_MTD_M25P80_MODULE)
1071 {
1072 /* the modalias must be the same as spi device driver name */
1073 .modalias = "m25p80", /* Name of spi_driver for this device */
1074 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1075 .bus_num = 0, /* Framework bus number */
1076 .chip_select = 1, /* SPI_SSEL1*/
1077 .platform_data = &bfin_spi_flash_data,
1078 .controller_data = &spi_flash_chip_info,
1079 .mode = SPI_MODE_3,
1080 },
1081 #endif
1082 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
1083 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
1084 {
1085 .modalias = "ad183x",
1086 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1087 .bus_num = 1,
1088 .chip_select = 4,
1089 .controller_data = &ad1836_spi_chip_info,
1090 },
1091 #endif
1092 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1093 {
1094 .modalias = "ad7877",
1095 .platform_data = &bfin_ad7877_ts_info,
1096 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
1097 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1098 .bus_num = 0,
1099 .chip_select = 2,
1100 .controller_data = &spi_ad7877_chip_info,
1101 },
1102 #endif
1103 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1104 {
1105 .modalias = "spidev",
1106 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1107 .bus_num = 0,
1108 .chip_select = 1,
1109 .controller_data = &spidev_chip_info,
1110 },
1111 #endif
1112 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1113 {
1114 .modalias = "adxl34x",
1115 .platform_data = &adxl34x_info,
1116 .irq = IRQ_PC5,
1117 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1118 .bus_num = 1,
1119 .chip_select = 2,
1120 .controller_data = &spi_adxl34x_chip_info,
1121 .mode = SPI_MODE_3,
1122 },
1123 #endif
1124 };
1125 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1126 /* SPI (0) */
1127 static struct resource bfin_spi0_resource[] = {
1128 [0] = {
1129 .start = SPI0_REGBASE,
1130 .end = SPI0_REGBASE + 0xFF,
1131 .flags = IORESOURCE_MEM,
1132 },
1133 [1] = {
1134 .start = CH_SPI0,
1135 .end = CH_SPI0,
1136 .flags = IORESOURCE_DMA,
1137 },
1138 [2] = {
1139 .start = IRQ_SPI0,
1140 .end = IRQ_SPI0,
1141 .flags = IORESOURCE_IRQ,
1142 }
1143 };
1144
1145 /* SPI (1) */
1146 static struct resource bfin_spi1_resource[] = {
1147 [0] = {
1148 .start = SPI1_REGBASE,
1149 .end = SPI1_REGBASE + 0xFF,
1150 .flags = IORESOURCE_MEM,
1151 },
1152 [1] = {
1153 .start = CH_SPI1,
1154 .end = CH_SPI1,
1155 .flags = IORESOURCE_DMA,
1156 },
1157 [2] = {
1158 .start = IRQ_SPI1,
1159 .end = IRQ_SPI1,
1160 .flags = IORESOURCE_IRQ,
1161 }
1162 };
1163
1164 /* SPI controller data */
1165 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
1166 .num_chipselect = 4,
1167 .enable_dma = 1, /* master has the ability to do dma transfer */
1168 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1169 };
1170
1171 static struct platform_device bf54x_spi_master0 = {
1172 .name = "bfin-spi",
1173 .id = 0, /* Bus number */
1174 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1175 .resource = bfin_spi0_resource,
1176 .dev = {
1177 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
1178 },
1179 };
1180
1181 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
1182 .num_chipselect = 4,
1183 .enable_dma = 1, /* master has the ability to do dma transfer */
1184 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1185 };
1186
1187 static struct platform_device bf54x_spi_master1 = {
1188 .name = "bfin-spi",
1189 .id = 1, /* Bus number */
1190 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1191 .resource = bfin_spi1_resource,
1192 .dev = {
1193 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1194 },
1195 };
1196 #endif /* spi master and devices */
1197
1198 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1199 static struct resource bfin_twi0_resource[] = {
1200 [0] = {
1201 .start = TWI0_REGBASE,
1202 .end = TWI0_REGBASE + 0xFF,
1203 .flags = IORESOURCE_MEM,
1204 },
1205 [1] = {
1206 .start = IRQ_TWI0,
1207 .end = IRQ_TWI0,
1208 .flags = IORESOURCE_IRQ,
1209 },
1210 };
1211
1212 static struct platform_device i2c_bfin_twi0_device = {
1213 .name = "i2c-bfin-twi",
1214 .id = 0,
1215 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1216 .resource = bfin_twi0_resource,
1217 };
1218
1219 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1220 static struct resource bfin_twi1_resource[] = {
1221 [0] = {
1222 .start = TWI1_REGBASE,
1223 .end = TWI1_REGBASE + 0xFF,
1224 .flags = IORESOURCE_MEM,
1225 },
1226 [1] = {
1227 .start = IRQ_TWI1,
1228 .end = IRQ_TWI1,
1229 .flags = IORESOURCE_IRQ,
1230 },
1231 };
1232
1233 static struct platform_device i2c_bfin_twi1_device = {
1234 .name = "i2c-bfin-twi",
1235 .id = 1,
1236 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1237 .resource = bfin_twi1_resource,
1238 };
1239 #endif
1240 #endif
1241
1242 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1243 };
1244
1245 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1246 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1247 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1248 {
1249 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1250 },
1251 #endif
1252 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1253 {
1254 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1255 .irq = 212,
1256 },
1257 #endif
1258 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1259 {
1260 I2C_BOARD_INFO("adxl34x", 0x53),
1261 .irq = IRQ_PC5,
1262 .platform_data = (void *)&adxl34x_info,
1263 },
1264 #endif
1265 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1266 {
1267 I2C_BOARD_INFO("ad5252", 0x2f),
1268 },
1269 #endif
1270 };
1271 #endif
1272
1273 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1274 #include <linux/gpio_keys.h>
1275
1276 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1277 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
1278 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
1279 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
1280 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
1281 };
1282
1283 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1284 .buttons = bfin_gpio_keys_table,
1285 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1286 };
1287
1288 static struct platform_device bfin_device_gpiokeys = {
1289 .name = "gpio-keys",
1290 .dev = {
1291 .platform_data = &bfin_gpio_keys_data,
1292 },
1293 };
1294 #endif
1295
1296 static const unsigned int cclk_vlev_datasheet[] =
1297 {
1298 /*
1299 * Internal VLEV BF54XSBBC1533
1300 ****temporarily using these values until data sheet is updated
1301 */
1302 VRPAIR(VLEV_085, 150000000),
1303 VRPAIR(VLEV_090, 250000000),
1304 VRPAIR(VLEV_110, 276000000),
1305 VRPAIR(VLEV_115, 301000000),
1306 VRPAIR(VLEV_120, 525000000),
1307 VRPAIR(VLEV_125, 550000000),
1308 VRPAIR(VLEV_130, 600000000),
1309 };
1310
1311 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1312 .tuple_tab = cclk_vlev_datasheet,
1313 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1314 .vr_settling_time = 25 /* us */,
1315 };
1316
1317 static struct platform_device bfin_dpmc = {
1318 .name = "bfin dpmc",
1319 .dev = {
1320 .platform_data = &bfin_dmpc_vreg_data,
1321 },
1322 };
1323
1324 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1325 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1326 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1327
1328 #define SPORT_REQ(x) \
1329 [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
1330 P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
1331
1332 static const u16 bfin_snd_pin[][7] = {
1333 SPORT_REQ(0),
1334 SPORT_REQ(1),
1335 };
1336
1337 static struct bfin_snd_platform_data bfin_snd_data[] = {
1338 {
1339 .pin_req = &bfin_snd_pin[0][0],
1340 },
1341 {
1342 .pin_req = &bfin_snd_pin[1][0],
1343 },
1344 };
1345
1346 #define BFIN_SND_RES(x) \
1347 [x] = { \
1348 { \
1349 .start = SPORT##x##_TCR1, \
1350 .end = SPORT##x##_TCR1, \
1351 .flags = IORESOURCE_MEM \
1352 }, \
1353 { \
1354 .start = CH_SPORT##x##_RX, \
1355 .end = CH_SPORT##x##_RX, \
1356 .flags = IORESOURCE_DMA, \
1357 }, \
1358 { \
1359 .start = CH_SPORT##x##_TX, \
1360 .end = CH_SPORT##x##_TX, \
1361 .flags = IORESOURCE_DMA, \
1362 }, \
1363 { \
1364 .start = IRQ_SPORT##x##_ERROR, \
1365 .end = IRQ_SPORT##x##_ERROR, \
1366 .flags = IORESOURCE_IRQ, \
1367 } \
1368 }
1369
1370 static struct resource bfin_snd_resources[][4] = {
1371 BFIN_SND_RES(0),
1372 BFIN_SND_RES(1),
1373 };
1374
1375 static struct platform_device bfin_pcm = {
1376 .name = "bfin-pcm-audio",
1377 .id = -1,
1378 };
1379 #endif
1380
1381 #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
1382 static struct platform_device bfin_ad73311_codec_device = {
1383 .name = "ad73311",
1384 .id = -1,
1385 };
1386 #endif
1387
1388 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1389 static struct platform_device bfin_ad1980_codec_device = {
1390 .name = "ad1980",
1391 .id = -1,
1392 };
1393 #endif
1394
1395 #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
1396 static struct platform_device bfin_i2s = {
1397 .name = "bfin-i2s",
1398 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1399 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1400 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1401 .dev = {
1402 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1403 },
1404 };
1405 #endif
1406
1407 #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
1408 static struct platform_device bfin_tdm = {
1409 .name = "bfin-tdm",
1410 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1411 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1412 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1413 .dev = {
1414 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1415 },
1416 };
1417 #endif
1418
1419 #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
1420 static struct platform_device bfin_ac97 = {
1421 .name = "bfin-ac97",
1422 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1423 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1424 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1425 .dev = {
1426 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1427 },
1428 };
1429 #endif
1430
1431 static struct platform_device *ezkit_devices[] __initdata = {
1432
1433 &bfin_dpmc,
1434
1435 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1436 &rtc_device,
1437 #endif
1438
1439 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1440 #ifdef CONFIG_SERIAL_BFIN_UART0
1441 &bfin_uart0_device,
1442 #endif
1443 #ifdef CONFIG_SERIAL_BFIN_UART1
1444 &bfin_uart1_device,
1445 #endif
1446 #ifdef CONFIG_SERIAL_BFIN_UART2
1447 &bfin_uart2_device,
1448 #endif
1449 #ifdef CONFIG_SERIAL_BFIN_UART3
1450 &bfin_uart3_device,
1451 #endif
1452 #endif
1453
1454 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1455 #ifdef CONFIG_BFIN_SIR0
1456 &bfin_sir0_device,
1457 #endif
1458 #ifdef CONFIG_BFIN_SIR1
1459 &bfin_sir1_device,
1460 #endif
1461 #ifdef CONFIG_BFIN_SIR2
1462 &bfin_sir2_device,
1463 #endif
1464 #ifdef CONFIG_BFIN_SIR3
1465 &bfin_sir3_device,
1466 #endif
1467 #endif
1468
1469 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
1470 &bf54x_lq043_device,
1471 #endif
1472
1473 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
1474 &smsc911x_device,
1475 #endif
1476
1477 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1478 &musb_device,
1479 #endif
1480
1481 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1482 &bfin_isp1760_device,
1483 #endif
1484
1485 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1486 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1487 &bfin_sport0_uart_device,
1488 #endif
1489 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1490 &bfin_sport1_uart_device,
1491 #endif
1492 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1493 &bfin_sport2_uart_device,
1494 #endif
1495 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1496 &bfin_sport3_uart_device,
1497 #endif
1498 #endif
1499
1500 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1501 &bfin_can0_device,
1502 &bfin_can1_device,
1503 #endif
1504
1505 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
1506 &bfin_atapi_device,
1507 #endif
1508
1509 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1510 &bf5xx_nand_device,
1511 #endif
1512
1513 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1514 &bf54x_sdh_device,
1515 #endif
1516
1517 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1518 &bf54x_spi_master0,
1519 &bf54x_spi_master1,
1520 #endif
1521
1522 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
1523 &bf54x_kpad_device,
1524 #endif
1525
1526 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1527 &bfin_rotary_device,
1528 #endif
1529
1530 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1531 &i2c_bfin_twi0_device,
1532 #if !defined(CONFIG_BF542)
1533 &i2c_bfin_twi1_device,
1534 #endif
1535 #endif
1536
1537 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1538 &bfin_device_gpiokeys,
1539 #endif
1540
1541 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1542 &ezkit_flash_device,
1543 #endif
1544
1545 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1546 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1547 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1548 &bfin_pcm,
1549 #endif
1550
1551 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1552 &bfin_ad1980_codec_device,
1553 #endif
1554
1555 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1556 &bfin_i2s,
1557 #endif
1558
1559 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1560 &bfin_tdm,
1561 #endif
1562
1563 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1564 &bfin_ac97,
1565 #endif
1566 };
1567
1568 static int __init ezkit_init(void)
1569 {
1570 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1571
1572 i2c_register_board_info(0, bfin_i2c_board_info0,
1573 ARRAY_SIZE(bfin_i2c_board_info0));
1574 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1575 i2c_register_board_info(1, bfin_i2c_board_info1,
1576 ARRAY_SIZE(bfin_i2c_board_info1));
1577 #endif
1578
1579 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1580
1581 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1582
1583 return 0;
1584 }
1585
1586 arch_initcall(ezkit_init);
1587
1588 static struct platform_device *ezkit_early_devices[] __initdata = {
1589 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1590 #ifdef CONFIG_SERIAL_BFIN_UART0
1591 &bfin_uart0_device,
1592 #endif
1593 #ifdef CONFIG_SERIAL_BFIN_UART1
1594 &bfin_uart1_device,
1595 #endif
1596 #ifdef CONFIG_SERIAL_BFIN_UART2
1597 &bfin_uart2_device,
1598 #endif
1599 #ifdef CONFIG_SERIAL_BFIN_UART3
1600 &bfin_uart3_device,
1601 #endif
1602 #endif
1603
1604 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1605 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1606 &bfin_sport0_uart_device,
1607 #endif
1608 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1609 &bfin_sport1_uart_device,
1610 #endif
1611 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1612 &bfin_sport2_uart_device,
1613 #endif
1614 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1615 &bfin_sport3_uart_device,
1616 #endif
1617 #endif
1618 };
1619
1620 void __init native_machine_early_platform_add_devices(void)
1621 {
1622 printk(KERN_INFO "register early platform devices\n");
1623 early_platform_add_devices(ezkit_early_devices,
1624 ARRAY_SIZE(ezkit_early_devices));
1625 }
This page took 0.062906 seconds and 4 git commands to generate.