blob: a4ef400945caf0f0433c9ad602673d265800a13c [file] [log] [blame]
Sonic Zhang22a82622012-05-16 17:24:33 +08001/*
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/bfin6xx_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 <linux/input.h>
28#include <linux/spi/ad7877.h>
29
30/*
31 * Name the Board for the /proc/cpuinfo
32 */
33const char bfin_board_name[] = "ADI BF609-EZKIT";
34
35/*
36 * Driver needs to know address, irq and flag pin.
37 */
38
39#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
40#include <linux/usb/isp1760.h>
41static struct resource bfin_isp1760_resources[] = {
42 [0] = {
43 .start = 0x2C0C0000,
44 .end = 0x2C0C0000 + 0xfffff,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = IRQ_PG7,
49 .end = IRQ_PG7,
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct isp1760_platform_data isp1760_priv = {
55 .is_isp1761 = 0,
56 .bus_width_16 = 1,
57 .port1_otg = 0,
58 .analog_oc = 0,
59 .dack_polarity_high = 0,
60 .dreq_polarity_high = 0,
61};
62
63static struct platform_device bfin_isp1760_device = {
64 .name = "isp1760",
65 .id = 0,
66 .dev = {
67 .platform_data = &isp1760_priv,
68 },
69 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
70 .resource = bfin_isp1760_resources,
71};
72#endif
73
74#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
75#include <asm/bfin_rotary.h>
76
77static struct bfin_rotary_platform_data bfin_rotary_data = {
78 /*.rotary_up_key = KEY_UP,*/
79 /*.rotary_down_key = KEY_DOWN,*/
80 .rotary_rel_code = REL_WHEEL,
81 .rotary_button_key = KEY_ENTER,
82 .debounce = 10, /* 0..17 */
83 .mode = ROT_QUAD_ENC | ROT_DEBE,
84};
85
86static struct resource bfin_rotary_resources[] = {
87 {
88 .start = IRQ_CNT,
89 .end = IRQ_CNT,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94static struct platform_device bfin_rotary_device = {
95 .name = "bfin-rotary",
96 .id = -1,
97 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
98 .resource = bfin_rotary_resources,
99 .dev = {
100 .platform_data = &bfin_rotary_data,
101 },
102};
103#endif
104
105#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
106#include <linux/stmmac.h>
107
Bob Liu3a3cf0d2012-05-17 14:21:22 +0800108static unsigned short pins[] = P_RMII0;
109
Sonic Zhang22a82622012-05-16 17:24:33 +0800110static struct stmmac_mdio_bus_data phy_private_data = {
111 .bus_id = 0,
112 .phy_mask = 1,
113};
114
115static struct plat_stmmacenet_data eth_private_data = {
116 .bus_id = 0,
117 .enh_desc = 1,
118 .phy_addr = 1,
119 .mdio_bus_data = &phy_private_data,
120};
121
122static struct platform_device bfin_eth_device = {
123 .name = "stmmaceth",
124 .id = 0,
125 .num_resources = 2,
126 .resource = (struct resource[]) {
127 {
128 .start = EMAC0_MACCFG,
129 .end = EMAC0_MACCFG + 0x1274,
130 .flags = IORESOURCE_MEM,
131 },
132 {
133 .name = "macirq",
134 .start = IRQ_EMAC0_STAT,
135 .end = IRQ_EMAC0_STAT,
136 .flags = IORESOURCE_IRQ,
137 },
138 },
139 .dev = {
Bob Liu6e1953e2012-05-09 17:20:32 +0800140 .power.can_wakeup = 1,
Sonic Zhang22a82622012-05-16 17:24:33 +0800141 .platform_data = &eth_private_data,
142 }
143};
144#endif
145
146#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
147#include <linux/input/adxl34x.h>
148static const struct adxl34x_platform_data adxl34x_info = {
149 .x_axis_offset = 0,
150 .y_axis_offset = 0,
151 .z_axis_offset = 0,
152 .tap_threshold = 0x31,
153 .tap_duration = 0x10,
154 .tap_latency = 0x60,
155 .tap_window = 0xF0,
156 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
157 .act_axis_control = 0xFF,
158 .activity_threshold = 5,
159 .inactivity_threshold = 3,
160 .inactivity_time = 4,
161 .free_fall_threshold = 0x7,
162 .free_fall_time = 0x20,
163 .data_rate = 0x8,
164 .data_range = ADXL_FULL_RES,
165
166 .ev_type = EV_ABS,
167 .ev_code_x = ABS_X, /* EV_REL */
168 .ev_code_y = ABS_Y, /* EV_REL */
169 .ev_code_z = ABS_Z, /* EV_REL */
170
171 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
172
173/* .ev_code_ff = KEY_F,*/ /* EV_KEY */
174/* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
175 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
176 .fifo_mode = ADXL_FIFO_STREAM,
177 .orientation_enable = ADXL_EN_ORIENTATION_3D,
178 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
179 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
180 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
181 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
182};
183#endif
184
185#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
186static struct platform_device rtc_device = {
187 .name = "rtc-bfin",
188 .id = -1,
189};
190#endif
191
192#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
193#ifdef CONFIG_SERIAL_BFIN_UART0
194static struct resource bfin_uart0_resources[] = {
195 {
196 .start = UART0_REVID,
197 .end = UART0_RXDIV+4,
198 .flags = IORESOURCE_MEM,
199 },
200 {
201 .start = IRQ_UART0_TX,
202 .end = IRQ_UART0_TX,
203 .flags = IORESOURCE_IRQ,
204 },
205 {
206 .start = IRQ_UART0_RX,
207 .end = IRQ_UART0_RX,
208 .flags = IORESOURCE_IRQ,
209 },
210 {
211 .start = IRQ_UART0_STAT,
212 .end = IRQ_UART0_STAT,
213 .flags = IORESOURCE_IRQ,
214 },
215 {
216 .start = CH_UART0_TX,
217 .end = CH_UART0_TX,
218 .flags = IORESOURCE_DMA,
219 },
220 {
221 .start = CH_UART0_RX,
222 .end = CH_UART0_RX,
223 .flags = IORESOURCE_DMA,
224 },
225#ifdef CONFIG_BFIN_UART0_CTSRTS
226 { /* CTS pin -- 0 means not supported */
227 .start = GPIO_PD10,
228 .end = GPIO_PD10,
229 .flags = IORESOURCE_IO,
230 },
231 { /* RTS pin -- 0 means not supported */
232 .start = GPIO_PD9,
233 .end = GPIO_PD9,
234 .flags = IORESOURCE_IO,
235 },
236#endif
237};
238
239static unsigned short bfin_uart0_peripherals[] = {
240 P_UART0_TX, P_UART0_RX,
241#ifdef CONFIG_BFIN_UART0_CTSRTS
242 P_UART0_RTS, P_UART0_CTS,
243#endif
244 0
245};
246
247static struct platform_device bfin_uart0_device = {
248 .name = "bfin-uart",
249 .id = 0,
250 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
251 .resource = bfin_uart0_resources,
252 .dev = {
253 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
254 },
255};
256#endif
257#ifdef CONFIG_SERIAL_BFIN_UART1
258static struct resource bfin_uart1_resources[] = {
259 {
260 .start = UART1_REVID,
261 .end = UART1_RXDIV+4,
262 .flags = IORESOURCE_MEM,
263 },
264 {
265 .start = IRQ_UART1_TX,
266 .end = IRQ_UART1_TX,
267 .flags = IORESOURCE_IRQ,
268 },
269 {
270 .start = IRQ_UART1_RX,
271 .end = IRQ_UART1_RX,
272 .flags = IORESOURCE_IRQ,
273 },
274 {
275 .start = IRQ_UART1_STAT,
276 .end = IRQ_UART1_STAT,
277 .flags = IORESOURCE_IRQ,
278 },
279 {
280 .start = CH_UART1_TX,
281 .end = CH_UART1_TX,
282 .flags = IORESOURCE_DMA,
283 },
284 {
285 .start = CH_UART1_RX,
286 .end = CH_UART1_RX,
287 .flags = IORESOURCE_DMA,
288 },
289#ifdef CONFIG_BFIN_UART1_CTSRTS
290 { /* CTS pin -- 0 means not supported */
291 .start = GPIO_PG13,
292 .end = GPIO_PG13,
293 .flags = IORESOURCE_IO,
294 },
295 { /* RTS pin -- 0 means not supported */
296 .start = GPIO_PG10,
297 .end = GPIO_PG10,
298 .flags = IORESOURCE_IO,
299 },
300#endif
301};
302
303static unsigned short bfin_uart1_peripherals[] = {
304 P_UART1_TX, P_UART1_RX,
305#ifdef CONFIG_BFIN_UART1_CTSRTS
306 P_UART1_RTS, P_UART1_CTS,
307#endif
308 0
309};
310
311static struct platform_device bfin_uart1_device = {
312 .name = "bfin-uart",
313 .id = 1,
314 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
315 .resource = bfin_uart1_resources,
316 .dev = {
317 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
318 },
319};
320#endif
321#endif
322
323#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
324#ifdef CONFIG_BFIN_SIR0
325static struct resource bfin_sir0_resources[] = {
326 {
327 .start = 0xFFC00400,
328 .end = 0xFFC004FF,
329 .flags = IORESOURCE_MEM,
330 },
331 {
332 .start = IRQ_UART0_TX,
333 .end = IRQ_UART0_TX+1,
334 .flags = IORESOURCE_IRQ,
335 },
336 {
337 .start = CH_UART0_TX,
338 .end = CH_UART0_TX+1,
339 .flags = IORESOURCE_DMA,
340 },
341};
342static struct platform_device bfin_sir0_device = {
343 .name = "bfin_sir",
344 .id = 0,
345 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
346 .resource = bfin_sir0_resources,
347};
348#endif
349#ifdef CONFIG_BFIN_SIR1
350static struct resource bfin_sir1_resources[] = {
351 {
352 .start = 0xFFC02000,
353 .end = 0xFFC020FF,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .start = IRQ_UART1_TX,
358 .end = IRQ_UART1_TX+1,
359 .flags = IORESOURCE_IRQ,
360 },
361 {
362 .start = CH_UART1_TX,
363 .end = CH_UART1_TX+1,
364 .flags = IORESOURCE_DMA,
365 },
366};
367static struct platform_device bfin_sir1_device = {
368 .name = "bfin_sir",
369 .id = 1,
370 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
371 .resource = bfin_sir1_resources,
372};
373#endif
374#endif
375
376#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
377static struct resource musb_resources[] = {
378 [0] = {
379 .start = 0xFFCC1000,
380 .end = 0xFFCC1398,
381 .flags = IORESOURCE_MEM,
382 },
383 [1] = { /* general IRQ */
384 .start = IRQ_USB_STAT,
385 .end = IRQ_USB_STAT,
386 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
387 .name = "mc"
388 },
389 [2] = { /* DMA IRQ */
390 .start = IRQ_USB_DMA,
391 .end = IRQ_USB_DMA,
392 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
393 .name = "dma"
394 },
395};
396
397static struct musb_hdrc_config musb_config = {
398 .multipoint = 1,
399 .dyn_fifo = 0,
400 .dma = 1,
401 .num_eps = 16,
402 .dma_channels = 8,
403 .clkin = 48, /* musb CLKIN in MHZ */
404};
405
406static struct musb_hdrc_platform_data musb_plat = {
407#if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
408 .mode = MUSB_OTG,
409#elif defined(CONFIG_USB_MUSB_HDRC)
410 .mode = MUSB_HOST,
411#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
412 .mode = MUSB_PERIPHERAL,
413#endif
414 .config = &musb_config,
415};
416
417static u64 musb_dmamask = ~(u32)0;
418
419static struct platform_device musb_device = {
420 .name = "musb-blackfin",
421 .id = 0,
422 .dev = {
423 .dma_mask = &musb_dmamask,
424 .coherent_dma_mask = 0xffffffff,
425 .platform_data = &musb_plat,
426 },
427 .num_resources = ARRAY_SIZE(musb_resources),
428 .resource = musb_resources,
429};
430#endif
431
432#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
433#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
434static struct resource bfin_sport0_uart_resources[] = {
435 {
436 .start = SPORT0_TCR1,
437 .end = SPORT0_MRCS3+4,
438 .flags = IORESOURCE_MEM,
439 },
440 {
441 .start = IRQ_SPORT0_RX,
442 .end = IRQ_SPORT0_RX+1,
443 .flags = IORESOURCE_IRQ,
444 },
445 {
446 .start = IRQ_SPORT0_ERROR,
447 .end = IRQ_SPORT0_ERROR,
448 .flags = IORESOURCE_IRQ,
449 },
450};
451
452static unsigned short bfin_sport0_peripherals[] = {
453 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
454 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
455};
456
457static struct platform_device bfin_sport0_uart_device = {
458 .name = "bfin-sport-uart",
459 .id = 0,
460 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
461 .resource = bfin_sport0_uart_resources,
462 .dev = {
463 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
464 },
465};
466#endif
467#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
468static struct resource bfin_sport1_uart_resources[] = {
469 {
470 .start = SPORT1_TCR1,
471 .end = SPORT1_MRCS3+4,
472 .flags = IORESOURCE_MEM,
473 },
474 {
475 .start = IRQ_SPORT1_RX,
476 .end = IRQ_SPORT1_RX+1,
477 .flags = IORESOURCE_IRQ,
478 },
479 {
480 .start = IRQ_SPORT1_ERROR,
481 .end = IRQ_SPORT1_ERROR,
482 .flags = IORESOURCE_IRQ,
483 },
484};
485
486static unsigned short bfin_sport1_peripherals[] = {
487 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
488 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
489};
490
491static struct platform_device bfin_sport1_uart_device = {
492 .name = "bfin-sport-uart",
493 .id = 1,
494 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
495 .resource = bfin_sport1_uart_resources,
496 .dev = {
497 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
498 },
499};
500#endif
501#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
502static struct resource bfin_sport2_uart_resources[] = {
503 {
504 .start = SPORT2_TCR1,
505 .end = SPORT2_MRCS3+4,
506 .flags = IORESOURCE_MEM,
507 },
508 {
509 .start = IRQ_SPORT2_RX,
510 .end = IRQ_SPORT2_RX+1,
511 .flags = IORESOURCE_IRQ,
512 },
513 {
514 .start = IRQ_SPORT2_ERROR,
515 .end = IRQ_SPORT2_ERROR,
516 .flags = IORESOURCE_IRQ,
517 },
518};
519
520static unsigned short bfin_sport2_peripherals[] = {
521 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
522 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
523};
524
525static struct platform_device bfin_sport2_uart_device = {
526 .name = "bfin-sport-uart",
527 .id = 2,
528 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
529 .resource = bfin_sport2_uart_resources,
530 .dev = {
531 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
532 },
533};
534#endif
535#endif
536
537#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
538
539static unsigned short bfin_can0_peripherals[] = {
540 P_CAN0_RX, P_CAN0_TX, 0
541};
542
543static struct resource bfin_can0_resources[] = {
544 {
545 .start = 0xFFC00A00,
546 .end = 0xFFC00FFF,
547 .flags = IORESOURCE_MEM,
548 },
549 {
550 .start = IRQ_CAN0_RX,
551 .end = IRQ_CAN0_RX,
552 .flags = IORESOURCE_IRQ,
553 },
554 {
555 .start = IRQ_CAN0_TX,
556 .end = IRQ_CAN0_TX,
557 .flags = IORESOURCE_IRQ,
558 },
559 {
560 .start = IRQ_CAN0_STAT,
561 .end = IRQ_CAN0_STAT,
562 .flags = IORESOURCE_IRQ,
563 },
564};
565
566static struct platform_device bfin_can0_device = {
567 .name = "bfin_can",
568 .id = 0,
569 .num_resources = ARRAY_SIZE(bfin_can0_resources),
570 .resource = bfin_can0_resources,
571 .dev = {
572 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
573 },
574};
575
576#endif
577
578#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
579static struct mtd_partition partition_info[] = {
580 {
581 .name = "bootloader(nand)",
582 .offset = 0,
583 .size = 0x80000,
584 }, {
585 .name = "linux kernel(nand)",
586 .offset = MTDPART_OFS_APPEND,
587 .size = 4 * 1024 * 1024,
588 },
589 {
590 .name = "file system(nand)",
591 .offset = MTDPART_OFS_APPEND,
592 .size = MTDPART_SIZ_FULL,
593 },
594};
595
596static struct bf5xx_nand_platform bfin_nand_platform = {
597 .data_width = NFC_NWIDTH_8,
598 .partitions = partition_info,
599 .nr_partitions = ARRAY_SIZE(partition_info),
600 .rd_dly = 3,
601 .wr_dly = 3,
602};
603
604static struct resource bfin_nand_resources[] = {
605 {
606 .start = 0xFFC03B00,
607 .end = 0xFFC03B4F,
608 .flags = IORESOURCE_MEM,
609 },
610 {
611 .start = CH_NFC,
612 .end = CH_NFC,
613 .flags = IORESOURCE_IRQ,
614 },
615};
616
617static struct platform_device bfin_nand_device = {
618 .name = "bfin-nand",
619 .id = 0,
620 .num_resources = ARRAY_SIZE(bfin_nand_resources),
621 .resource = bfin_nand_resources,
622 .dev = {
623 .platform_data = &bfin_nand_platform,
624 },
625};
626#endif
627
628#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
629
630static struct bfin_sd_host bfin_sdh_data = {
631 .dma_chan = CH_RSI,
632 .irq_int0 = IRQ_RSI_INT0,
633 .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
634};
635
636static struct platform_device bfin_sdh_device = {
637 .name = "bfin-sdh",
638 .id = 0,
639 .dev = {
640 .platform_data = &bfin_sdh_data,
641 },
642};
643#endif
644
Bob Liu1c400932012-05-15 13:58:56 +0800645#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Sonic Zhang22a82622012-05-16 17:24:33 +0800646static struct mtd_partition ezkit_partitions[] = {
647 {
648 .name = "bootloader(nor)",
649 .size = 0x80000,
650 .offset = 0,
651 }, {
652 .name = "linux kernel(nor)",
653 .size = 0x400000,
654 .offset = MTDPART_OFS_APPEND,
655 }, {
656 .name = "file system(nor)",
657 .size = 0x1000000 - 0x80000 - 0x400000,
658 .offset = MTDPART_OFS_APPEND,
659 },
660};
661
662int bf609_nor_flash_init(struct platform_device *dev)
663{
664#define CONFIG_SMC_GCTL_VAL 0x00000010
665 const unsigned short pins[] = {
666 P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
667 P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
668 P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
669 };
670
671 peripheral_request_list(pins, "smc0");
672
673 bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
Bob Liu1c400932012-05-15 13:58:56 +0800674 bfin_write32(SMC_B0CTL, 0x01002011);
Sonic Zhang22a82622012-05-16 17:24:33 +0800675 bfin_write32(SMC_B0TIM, 0x08170977);
676 bfin_write32(SMC_B0ETIM, 0x00092231);
677 return 0;
678}
679
680static struct physmap_flash_data ezkit_flash_data = {
681 .width = 2,
682 .parts = ezkit_partitions,
683 .init = bf609_nor_flash_init,
684 .nr_parts = ARRAY_SIZE(ezkit_partitions),
Bob Liu3fa8c4b2012-06-05 17:20:32 +0800685#ifdef CONFIG_ROMKERNEL
686 .probe_type = "map_rom",
687#endif
Sonic Zhang22a82622012-05-16 17:24:33 +0800688};
689
690static struct resource ezkit_flash_resource = {
691 .start = 0xb0000000,
692 .end = 0xb0ffffff,
693 .flags = IORESOURCE_MEM,
694};
695
696static struct platform_device ezkit_flash_device = {
Bob Liu1c400932012-05-15 13:58:56 +0800697 .name = "physmap-flash",
Sonic Zhang22a82622012-05-16 17:24:33 +0800698 .id = 0,
699 .dev = {
700 .platform_data = &ezkit_flash_data,
701 },
702 .num_resources = 1,
703 .resource = &ezkit_flash_resource,
704};
705#endif
706
707#if defined(CONFIG_MTD_M25P80) \
708 || defined(CONFIG_MTD_M25P80_MODULE)
709/* SPI flash chip (w25q32) */
710static struct mtd_partition bfin_spi_flash_partitions[] = {
711 {
712 .name = "bootloader(spi)",
713 .size = 0x00080000,
714 .offset = 0,
715 .mask_flags = MTD_CAP_ROM
716 }, {
717 .name = "linux kernel(spi)",
718 .size = 0x00180000,
719 .offset = MTDPART_OFS_APPEND,
720 }, {
721 .name = "file system(spi)",
722 .size = MTDPART_SIZ_FULL,
723 .offset = MTDPART_OFS_APPEND,
724 }
725};
726
727static struct flash_platform_data bfin_spi_flash_data = {
728 .name = "m25p80",
729 .parts = bfin_spi_flash_partitions,
730 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
731 .type = "w25q32",
732};
733
734static struct bfin6xx_spi_chip spi_flash_chip_info = {
735 .enable_dma = true, /* use dma transfer with this chip*/
736};
737#endif
738
739#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
740static struct bfin6xx_spi_chip spidev_chip_info = {
741 .enable_dma = true,
742};
743#endif
744
745#if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
746static struct platform_device bfin_i2s_pcm = {
747 .name = "bfin-i2s-pcm-audio",
748 .id = -1,
749};
750#endif
751
752#if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
753 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
754#include <asm/bfin_sport3.h>
755static struct resource bfin_snd_resources[] = {
756 {
757 .start = SPORT0_CTL_A,
758 .end = SPORT0_CTL_A,
759 .flags = IORESOURCE_MEM,
760 },
761 {
762 .start = SPORT0_CTL_B,
763 .end = SPORT0_CTL_B,
764 .flags = IORESOURCE_MEM,
765 },
766 {
767 .start = CH_SPORT0_TX,
768 .end = CH_SPORT0_TX,
769 .flags = IORESOURCE_DMA,
770 },
771 {
772 .start = CH_SPORT0_RX,
773 .end = CH_SPORT0_RX,
774 .flags = IORESOURCE_DMA,
775 },
776 {
777 .start = IRQ_SPORT0_TX_STAT,
778 .end = IRQ_SPORT0_TX_STAT,
779 .flags = IORESOURCE_IRQ,
780 },
781 {
782 .start = IRQ_SPORT0_RX_STAT,
783 .end = IRQ_SPORT0_RX_STAT,
784 .flags = IORESOURCE_IRQ,
785 },
786};
787
788static const unsigned short bfin_snd_pin[] = {
789 P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
790 P_SPORT0_BFS, P_SPORT0_BD0, 0,
791};
792
793static struct bfin_snd_platform_data bfin_snd_data = {
794 .pin_req = bfin_snd_pin,
795};
796
797static struct platform_device bfin_i2s = {
798 .name = "bfin-i2s",
799 .num_resources = ARRAY_SIZE(bfin_snd_resources),
800 .resource = bfin_snd_resources,
801 .dev = {
802 .platform_data = &bfin_snd_data,
803 },
804};
805#endif
806
807#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
808 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
809static struct platform_device adau1761_device = {
810 .name = "bfin-eval-adau1x61",
811};
812#endif
813
814#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
815#include <sound/adau17x1.h>
816static struct adau1761_platform_data adau1761_info = {
817 .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
818 .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
819};
820#endif
821
822#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
823 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
824#include <linux/videodev2.h>
825#include <media/blackfin/bfin_capture.h>
826#include <media/blackfin/ppi.h>
827
828static const unsigned short ppi_req[] = {
829 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
830 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
Scott Jiang338881a2012-06-01 12:06:25 -0400831 P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
832 P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
833 P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
834 P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
Sonic Zhang22a82622012-05-16 17:24:33 +0800835 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
836 0,
837};
838
839static const struct ppi_info ppi_info = {
840 .type = PPI_TYPE_EPPI3,
841 .dma_ch = CH_EPPI0_CH0,
842 .irq_err = IRQ_EPPI0_STAT,
843 .base = (void __iomem *)EPPI0_STAT,
844 .pin_req = ppi_req,
845};
846
847#if defined(CONFIG_VIDEO_VS6624) \
848 || defined(CONFIG_VIDEO_VS6624_MODULE)
849static struct v4l2_input vs6624_inputs[] = {
850 {
851 .index = 0,
852 .name = "Camera",
853 .type = V4L2_INPUT_TYPE_CAMERA,
854 .std = V4L2_STD_UNKNOWN,
855 },
856};
857
858static struct bcap_route vs6624_routes[] = {
859 {
860 .input = 0,
861 .output = 0,
862 },
863};
864
865static const unsigned vs6624_ce_pin = GPIO_PD1;
866
867static struct bfin_capture_config bfin_capture_data = {
868 .card_name = "BF609",
869 .inputs = vs6624_inputs,
870 .num_inputs = ARRAY_SIZE(vs6624_inputs),
871 .routes = vs6624_routes,
872 .i2c_adapter_id = 0,
873 .board_info = {
874 .type = "vs6624",
875 .addr = 0x10,
876 .platform_data = (void *)&vs6624_ce_pin,
877 },
878 .ppi_info = &ppi_info,
879 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
880 | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
Scott Jiangac5bb8932012-06-20 18:32:11 -0400881 .blank_pixels = 4,
Sonic Zhang22a82622012-05-16 17:24:33 +0800882};
883#endif
884
Scott Jiang338881a2012-06-01 12:06:25 -0400885#if defined(CONFIG_VIDEO_ADV7842) \
886 || defined(CONFIG_VIDEO_ADV7842_MODULE)
887#include <media/adv7842.h>
888
889static struct v4l2_input adv7842_inputs[] = {
890 {
891 .index = 0,
892 .name = "Composite",
893 .type = V4L2_INPUT_TYPE_CAMERA,
894 .std = V4L2_STD_ALL,
Scott Jiang688da5e2012-06-14 18:23:08 -0400895 .capabilities = V4L2_IN_CAP_STD,
Scott Jiang338881a2012-06-01 12:06:25 -0400896 },
897 {
898 .index = 1,
899 .name = "S-Video",
900 .type = V4L2_INPUT_TYPE_CAMERA,
901 .std = V4L2_STD_ALL,
Scott Jiang688da5e2012-06-14 18:23:08 -0400902 .capabilities = V4L2_IN_CAP_STD,
Scott Jiang338881a2012-06-01 12:06:25 -0400903 },
904 {
905 .index = 2,
906 .name = "Component",
907 .type = V4L2_INPUT_TYPE_CAMERA,
Scott Jiang688da5e2012-06-14 18:23:08 -0400908 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
Scott Jiang338881a2012-06-01 12:06:25 -0400909 },
910 {
911 .index = 3,
912 .name = "VGA",
913 .type = V4L2_INPUT_TYPE_CAMERA,
Scott Jiang688da5e2012-06-14 18:23:08 -0400914 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
Scott Jiang338881a2012-06-01 12:06:25 -0400915 },
916 {
917 .index = 4,
918 .name = "HDMI",
919 .type = V4L2_INPUT_TYPE_CAMERA,
Scott Jiang688da5e2012-06-14 18:23:08 -0400920 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
Scott Jiang338881a2012-06-01 12:06:25 -0400921 },
922};
923
924static struct bcap_route adv7842_routes[] = {
925 {
926 .input = 3,
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400927 .output = 0,
Scott Jiang688da5e2012-06-14 18:23:08 -0400928 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
929 | EPPI_CTL_ACTIVE656),
Scott Jiang338881a2012-06-01 12:06:25 -0400930 },
931 {
932 .input = 4,
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400933 .output = 0,
Scott Jiang338881a2012-06-01 12:06:25 -0400934 },
935 {
936 .input = 2,
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400937 .output = 0,
Scott Jiang338881a2012-06-01 12:06:25 -0400938 },
939 {
940 .input = 1,
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400941 .output = 0,
Scott Jiang338881a2012-06-01 12:06:25 -0400942 },
943 {
944 .input = 0,
Scott Jiang688da5e2012-06-14 18:23:08 -0400945 .output = 1,
946 .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
947 | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
948 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400949 },
950};
951
952static struct adv7842_output_format adv7842_opf[] = {
953 {
954 .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
955 .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
956 .op_656_range = 1,
957 .blank_data = 1,
958 .insert_av_codes = 1,
Scott Jiang338881a2012-06-01 12:06:25 -0400959 },
Scott Jiang688da5e2012-06-14 18:23:08 -0400960 {
961 .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
962 .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
963 .op_656_range = 1,
964 .blank_data = 1,
965 },
Scott Jiang338881a2012-06-01 12:06:25 -0400966};
967
968static struct adv7842_platform_data adv7842_data = {
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400969 .opf = adv7842_opf,
970 .num_opf = ARRAY_SIZE(adv7842_opf),
Scott Jiang338881a2012-06-01 12:06:25 -0400971 .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
Scott Jiang338881a2012-06-01 12:06:25 -0400972 .prim_mode = ADV7842_PRIM_MODE_SDP,
973 .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
974 .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO,
Scott Jiang338881a2012-06-01 12:06:25 -0400975 .i2c_sdp_io = 0x30,
976 .i2c_sdp = 0x31,
977 .i2c_cp = 0x32,
978 .i2c_vdp = 0x33,
979 .i2c_afe = 0x34,
980 .i2c_hdmi = 0x35,
981 .i2c_repeater = 0x36,
982 .i2c_edid = 0x37,
Scott Jiang688da5e2012-06-14 18:23:08 -0400983 .i2c_infoframe = 0x39,
984 .i2c_cec = 0x3a,
985 .i2c_avlink = 0x3b,
Scott Jiangb5c00ae2012-06-08 14:22:36 -0400986 .i2c_ex = 0x26,
Scott Jiang338881a2012-06-01 12:06:25 -0400987};
988
989static struct bfin_capture_config bfin_capture_data = {
990 .card_name = "BF609",
991 .inputs = adv7842_inputs,
992 .num_inputs = ARRAY_SIZE(adv7842_inputs),
993 .routes = adv7842_routes,
994 .i2c_adapter_id = 0,
995 .board_info = {
996 .type = "adv7842",
997 .addr = 0x20,
998 .platform_data = (void *)&adv7842_data,
999 },
1000 .ppi_info = &ppi_info,
1001 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
1002 | EPPI_CTL_ACTIVE656),
1003};
1004#endif
1005
Sonic Zhang22a82622012-05-16 17:24:33 +08001006static struct platform_device bfin_capture_device = {
1007 .name = "bfin_capture",
1008 .dev = {
1009 .platform_data = &bfin_capture_data,
1010 },
1011};
1012#endif
1013
1014#if defined(CONFIG_BFIN_CRC)
1015#define BFIN_CRC_NAME "bfin-crc"
1016
1017static struct resource bfin_crc0_resources[] = {
1018 {
1019 .start = REG_CRC0_CTL,
1020 .end = REG_CRC0_REVID+4,
1021 .flags = IORESOURCE_MEM,
1022 },
1023 {
1024 .start = IRQ_CRC0_DCNTEXP,
1025 .end = IRQ_CRC0_DCNTEXP,
1026 .flags = IORESOURCE_IRQ,
1027 },
1028 {
1029 .start = CH_MEM_STREAM0_SRC_CRC0,
1030 .end = CH_MEM_STREAM0_SRC_CRC0,
1031 .flags = IORESOURCE_DMA,
1032 },
1033 {
1034 .start = CH_MEM_STREAM0_DEST_CRC0,
1035 .end = CH_MEM_STREAM0_DEST_CRC0,
1036 .flags = IORESOURCE_DMA,
1037 },
1038};
1039
1040static struct platform_device bfin_crc0_device = {
1041 .name = BFIN_CRC_NAME,
1042 .id = 0,
1043 .num_resources = ARRAY_SIZE(bfin_crc0_resources),
1044 .resource = bfin_crc0_resources,
1045};
1046
1047static struct resource bfin_crc1_resources[] = {
1048 {
1049 .start = REG_CRC1_CTL,
1050 .end = REG_CRC1_REVID+4,
1051 .flags = IORESOURCE_MEM,
1052 },
1053 {
1054 .start = IRQ_CRC1_DCNTEXP,
1055 .end = IRQ_CRC1_DCNTEXP,
1056 .flags = IORESOURCE_IRQ,
1057 },
1058 {
1059 .start = CH_MEM_STREAM1_SRC_CRC1,
1060 .end = CH_MEM_STREAM1_SRC_CRC1,
1061 .flags = IORESOURCE_DMA,
1062 },
1063 {
1064 .start = CH_MEM_STREAM1_DEST_CRC1,
1065 .end = CH_MEM_STREAM1_DEST_CRC1,
1066 .flags = IORESOURCE_DMA,
1067 },
1068};
1069
1070static struct platform_device bfin_crc1_device = {
1071 .name = BFIN_CRC_NAME,
1072 .id = 1,
1073 .num_resources = ARRAY_SIZE(bfin_crc1_resources),
1074 .resource = bfin_crc1_resources,
1075};
1076#endif
1077
Sonic Zhangc21e7832012-05-22 18:25:57 +08001078#if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
1079#define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
1080#define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
1081
1082static struct resource bfin_crypto_crc_resources[] = {
1083 {
1084 .start = REG_CRC0_CTL,
1085 .end = REG_CRC0_REVID+4,
1086 .flags = IORESOURCE_MEM,
1087 },
1088 {
1089 .start = IRQ_CRC0_DCNTEXP,
1090 .end = IRQ_CRC0_DCNTEXP,
1091 .flags = IORESOURCE_IRQ,
1092 },
1093 {
1094 .start = CH_MEM_STREAM0_SRC_CRC0,
1095 .end = CH_MEM_STREAM0_SRC_CRC0,
1096 .flags = IORESOURCE_DMA,
1097 },
Sonic Zhangc21e7832012-05-22 18:25:57 +08001098};
1099
1100static struct platform_device bfin_crypto_crc_device = {
1101 .name = BFIN_CRYPTO_CRC_NAME,
1102 .id = 0,
1103 .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
1104 .resource = bfin_crypto_crc_resources,
1105 .dev = {
1106 .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
1107 },
1108};
1109#endif
1110
Sonic Zhang22a82622012-05-16 17:24:33 +08001111#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1112static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1113 .model = 7877,
1114 .vref_delay_usecs = 50, /* internal, no capacitor */
1115 .x_plate_ohms = 419,
1116 .y_plate_ohms = 486,
1117 .pressure_max = 1000,
1118 .pressure_min = 0,
1119 .stopacq_polarity = 1,
1120 .first_conversion_delay = 3,
1121 .acquisition_time = 1,
1122 .averaging = 1,
1123 .pen_down_acc_interval = 1,
1124};
1125#endif
1126
Steven Miaobbca5c62012-06-07 15:06:45 +08001127#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1128#include <linux/input.h>
1129#include <linux/gpio_keys.h>
1130
1131static struct gpio_keys_button bfin_gpio_keys_table[] = {
1132 {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
1133 {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
1134};
1135
1136static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1137 .buttons = bfin_gpio_keys_table,
1138 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1139};
1140
1141static struct platform_device bfin_device_gpiokeys = {
1142 .name = "gpio-keys",
1143 .dev = {
1144 .platform_data = &bfin_gpio_keys_data,
1145 },
1146};
1147#endif
1148
Sonic Zhang22a82622012-05-16 17:24:33 +08001149static struct spi_board_info bfin_spi_board_info[] __initdata = {
1150#if defined(CONFIG_MTD_M25P80) \
1151 || defined(CONFIG_MTD_M25P80_MODULE)
1152 {
1153 /* the modalias must be the same as spi device driver name */
1154 .modalias = "m25p80", /* Name of spi_driver for this device */
1155 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1156 .bus_num = 0, /* Framework bus number */
1157 .chip_select = 1, /* SPI_SSEL1*/
1158 .platform_data = &bfin_spi_flash_data,
1159 .controller_data = &spi_flash_chip_info,
1160 .mode = SPI_MODE_3,
1161 },
1162#endif
1163#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1164 {
1165 .modalias = "ad7877",
1166 .platform_data = &bfin_ad7877_ts_info,
Scott Jiang2cdd7002012-05-18 16:13:03 -04001167 .irq = IRQ_PD9,
Sonic Zhang22a82622012-05-16 17:24:33 +08001168 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1169 .bus_num = 0,
Scott Jiang2cdd7002012-05-18 16:13:03 -04001170 .chip_select = 4,
Sonic Zhang22a82622012-05-16 17:24:33 +08001171 },
1172#endif
1173#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1174 {
1175 .modalias = "spidev",
1176 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1177 .bus_num = 0,
1178 .chip_select = 1,
1179 .controller_data = &spidev_chip_info,
1180 },
1181#endif
1182#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1183 {
1184 .modalias = "adxl34x",
1185 .platform_data = &adxl34x_info,
1186 .irq = IRQ_PC5,
1187 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1188 .bus_num = 1,
1189 .chip_select = 2,
1190 .mode = SPI_MODE_3,
1191 },
1192#endif
1193};
1194#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1195/* SPI (0) */
1196static struct resource bfin_spi0_resource[] = {
1197 {
1198 .start = SPI0_REGBASE,
1199 .end = SPI0_REGBASE + 0xFF,
1200 .flags = IORESOURCE_MEM,
1201 },
1202 {
1203 .start = CH_SPI0_TX,
1204 .end = CH_SPI0_TX,
1205 .flags = IORESOURCE_DMA,
1206 },
1207 {
1208 .start = CH_SPI0_RX,
1209 .end = CH_SPI0_RX,
1210 .flags = IORESOURCE_DMA,
1211 },
1212};
1213
1214/* SPI (1) */
1215static struct resource bfin_spi1_resource[] = {
1216 {
1217 .start = SPI1_REGBASE,
1218 .end = SPI1_REGBASE + 0xFF,
1219 .flags = IORESOURCE_MEM,
1220 },
1221 {
1222 .start = CH_SPI1_TX,
1223 .end = CH_SPI1_TX,
1224 .flags = IORESOURCE_DMA,
1225 },
1226 {
1227 .start = CH_SPI1_RX,
1228 .end = CH_SPI1_RX,
1229 .flags = IORESOURCE_DMA,
1230 },
1231
1232};
1233
1234/* SPI controller data */
1235static struct bfin6xx_spi_master bf60x_spi_master_info0 = {
Scott Jiang2cdd7002012-05-18 16:13:03 -04001236 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
Sonic Zhang22a82622012-05-16 17:24:33 +08001237 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1238};
1239
1240static struct platform_device bf60x_spi_master0 = {
1241 .name = "bfin-spi",
1242 .id = 0, /* Bus number */
1243 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1244 .resource = bfin_spi0_resource,
1245 .dev = {
1246 .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
1247 },
1248};
1249
1250static struct bfin6xx_spi_master bf60x_spi_master_info1 = {
Scott Jiang2cdd7002012-05-18 16:13:03 -04001251 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
Sonic Zhang22a82622012-05-16 17:24:33 +08001252 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1253};
1254
1255static struct platform_device bf60x_spi_master1 = {
1256 .name = "bfin-spi",
1257 .id = 1, /* Bus number */
1258 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1259 .resource = bfin_spi1_resource,
1260 .dev = {
1261 .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
1262 },
1263};
1264#endif /* spi master and devices */
1265
1266#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Sonic Zhangcf93feb2012-05-15 15:25:50 +08001267static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1268
Sonic Zhang22a82622012-05-16 17:24:33 +08001269static struct resource bfin_twi0_resource[] = {
1270 [0] = {
1271 .start = TWI0_CLKDIV,
1272 .end = TWI0_CLKDIV + 0xFF,
1273 .flags = IORESOURCE_MEM,
1274 },
1275 [1] = {
1276 .start = IRQ_TWI0,
1277 .end = IRQ_TWI0,
1278 .flags = IORESOURCE_IRQ,
1279 },
1280};
1281
1282static struct platform_device i2c_bfin_twi0_device = {
1283 .name = "i2c-bfin-twi",
1284 .id = 0,
1285 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1286 .resource = bfin_twi0_resource,
Sonic Zhangcf93feb2012-05-15 15:25:50 +08001287 .dev = {
1288 .platform_data = &bfin_twi0_pins,
1289 },
Sonic Zhang22a82622012-05-16 17:24:33 +08001290};
1291
Sonic Zhangcf93feb2012-05-15 15:25:50 +08001292static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1293
Sonic Zhang22a82622012-05-16 17:24:33 +08001294static struct resource bfin_twi1_resource[] = {
1295 [0] = {
1296 .start = TWI1_CLKDIV,
1297 .end = TWI1_CLKDIV + 0xFF,
1298 .flags = IORESOURCE_MEM,
1299 },
1300 [1] = {
1301 .start = IRQ_TWI1,
1302 .end = IRQ_TWI1,
1303 .flags = IORESOURCE_IRQ,
1304 },
1305};
1306
1307static struct platform_device i2c_bfin_twi1_device = {
1308 .name = "i2c-bfin-twi",
1309 .id = 1,
1310 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1311 .resource = bfin_twi1_resource,
Sonic Zhangcf93feb2012-05-15 15:25:50 +08001312 .dev = {
1313 .platform_data = &bfin_twi1_pins,
1314 },
Sonic Zhang22a82622012-05-16 17:24:33 +08001315};
1316#endif
1317
1318static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1319#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1320 {
1321 I2C_BOARD_INFO("adxl34x", 0x53),
1322 .irq = IRQ_PC5,
1323 .platform_data = (void *)&adxl34x_info,
1324 },
1325#endif
1326#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1327 {
1328 I2C_BOARD_INFO("adau1761", 0x38),
1329 .platform_data = (void *)&adau1761_info
1330 },
1331#endif
Scott Jiang335dd552012-06-01 18:12:52 -04001332#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1333 {
1334 I2C_BOARD_INFO("ssm2602", 0x1b),
1335 },
1336#endif
Sonic Zhang22a82622012-05-16 17:24:33 +08001337};
1338
1339static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1340};
1341
1342static const unsigned int cclk_vlev_datasheet[] =
1343{
1344/*
1345 * Internal VLEV BF54XSBBC1533
1346 ****temporarily using these values until data sheet is updated
1347 */
1348 VRPAIR(VLEV_085, 150000000),
1349 VRPAIR(VLEV_090, 250000000),
1350 VRPAIR(VLEV_110, 276000000),
1351 VRPAIR(VLEV_115, 301000000),
1352 VRPAIR(VLEV_120, 525000000),
1353 VRPAIR(VLEV_125, 550000000),
1354 VRPAIR(VLEV_130, 600000000),
1355};
1356
1357static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1358 .tuple_tab = cclk_vlev_datasheet,
1359 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1360 .vr_settling_time = 25 /* us */,
1361};
1362
1363static struct platform_device bfin_dpmc = {
1364 .name = "bfin dpmc",
1365 .dev = {
1366 .platform_data = &bfin_dmpc_vreg_data,
1367 },
1368};
1369
1370static struct platform_device *ezkit_devices[] __initdata = {
1371
1372 &bfin_dpmc,
1373
1374#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1375 &rtc_device,
1376#endif
1377
1378#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1379#ifdef CONFIG_SERIAL_BFIN_UART0
1380 &bfin_uart0_device,
1381#endif
1382#ifdef CONFIG_SERIAL_BFIN_UART1
1383 &bfin_uart1_device,
1384#endif
1385#endif
1386
1387#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1388#ifdef CONFIG_BFIN_SIR0
1389 &bfin_sir0_device,
1390#endif
1391#ifdef CONFIG_BFIN_SIR1
1392 &bfin_sir1_device,
1393#endif
1394#endif
1395
1396#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1397 &bfin_eth_device,
1398#endif
1399
1400#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1401 &musb_device,
1402#endif
1403
1404#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1405 &bfin_isp1760_device,
1406#endif
1407
1408#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1409#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1410 &bfin_sport0_uart_device,
1411#endif
1412#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1413 &bfin_sport1_uart_device,
1414#endif
1415#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1416 &bfin_sport2_uart_device,
1417#endif
1418#endif
1419
1420#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1421 &bfin_can0_device,
1422#endif
1423
1424#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1425 &bfin_nand_device,
1426#endif
1427
1428#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1429 &bfin_sdh_device,
1430#endif
1431
1432#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1433 &bf60x_spi_master0,
1434 &bf60x_spi_master1,
1435#endif
1436
1437#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1438 &bfin_rotary_device,
1439#endif
1440
1441#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1442 &i2c_bfin_twi0_device,
1443#if !defined(CONFIG_BF542)
1444 &i2c_bfin_twi1_device,
1445#endif
1446#endif
1447
1448#if defined(CONFIG_BFIN_CRC)
1449 &bfin_crc0_device,
1450 &bfin_crc1_device,
1451#endif
Sonic Zhangc21e7832012-05-22 18:25:57 +08001452#if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
1453 &bfin_crypto_crc_device,
1454#endif
Sonic Zhang22a82622012-05-16 17:24:33 +08001455
1456#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1457 &bfin_device_gpiokeys,
1458#endif
1459
Bob Liu1c400932012-05-15 13:58:56 +08001460#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Sonic Zhang22a82622012-05-16 17:24:33 +08001461 &ezkit_flash_device,
1462#endif
1463#if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
1464 &bfin_i2s_pcm,
1465#endif
1466#if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
1467 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
1468 &bfin_i2s,
1469#endif
1470#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
1471 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
1472 &adau1761_device,
1473#endif
1474#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
1475 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
1476 &bfin_capture_device,
1477#endif
1478};
1479
1480static int __init ezkit_init(void)
1481{
1482 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1483
1484 i2c_register_board_info(0, bfin_i2c_board_info0,
1485 ARRAY_SIZE(bfin_i2c_board_info0));
1486 i2c_register_board_info(1, bfin_i2c_board_info1,
1487 ARRAY_SIZE(bfin_i2c_board_info1));
1488
1489#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
Sonic Zhang22a82622012-05-16 17:24:33 +08001490 if (!peripheral_request_list(pins, "emac0"))
1491 printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
1492#endif
1493
1494 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1495
1496 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1497
1498 return 0;
1499}
1500
1501arch_initcall(ezkit_init);
1502
1503static struct platform_device *ezkit_early_devices[] __initdata = {
1504#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1505#ifdef CONFIG_SERIAL_BFIN_UART0
1506 &bfin_uart0_device,
1507#endif
1508#ifdef CONFIG_SERIAL_BFIN_UART1
1509 &bfin_uart1_device,
1510#endif
1511#endif
1512
1513#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1514#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1515 &bfin_sport0_uart_device,
1516#endif
1517#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1518 &bfin_sport1_uart_device,
1519#endif
1520#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1521 &bfin_sport2_uart_device,
1522#endif
1523#endif
1524};
1525
1526void __init native_machine_early_platform_add_devices(void)
1527{
1528 printk(KERN_INFO "register early platform devices\n");
1529 early_platform_add_devices(ezkit_early_devices,
1530 ARRAY_SIZE(ezkit_early_devices));
1531}