blackfin: twi: Move TWI peripheral pin request array to platform data
[linux-2.6/btrfs-unstable.git] / arch / blackfin / mach-bf609 / boards / ezkit.c
blobac64f47217c156d58be5eac34d4cd054ba5acdf8
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
7 */
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>
31 * Name the Board for the /proc/cpuinfo
33 const char bfin_board_name[] = "ADI BF609-EZKIT";
36 * Driver needs to know address, irq and flag pin.
39 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
40 #include <linux/usb/isp1760.h>
41 static struct resource bfin_isp1760_resources[] = {
42 [0] = {
43 .start = 0x2C0C0000,
44 .end = 0x2C0C0000 + 0xfffff,
45 .flags = IORESOURCE_MEM,
47 [1] = {
48 .start = IRQ_PG7,
49 .end = IRQ_PG7,
50 .flags = IORESOURCE_IRQ,
54 static 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,
63 static struct platform_device bfin_isp1760_device = {
64 .name = "isp1760",
65 .id = 0,
66 .dev = {
67 .platform_data = &isp1760_priv,
69 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
70 .resource = bfin_isp1760_resources,
72 #endif
74 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
75 #include <asm/bfin_rotary.h>
77 static 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,
86 static struct resource bfin_rotary_resources[] = {
88 .start = IRQ_CNT,
89 .end = IRQ_CNT,
90 .flags = IORESOURCE_IRQ,
94 static 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,
103 #endif
105 #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
106 #include <linux/stmmac.h>
108 static unsigned short pins[] = P_RMII0;
110 static struct stmmac_mdio_bus_data phy_private_data = {
111 .bus_id = 0,
112 .phy_mask = 1,
115 static 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,
122 static struct platform_device bfin_eth_device = {
123 .name = "stmmaceth",
124 .id = 0,
125 .num_resources = 2,
126 .resource = (struct resource[]) {
128 .start = EMAC0_MACCFG,
129 .end = EMAC0_MACCFG + 0x1274,
130 .flags = IORESOURCE_MEM,
133 .name = "macirq",
134 .start = IRQ_EMAC0_STAT,
135 .end = IRQ_EMAC0_STAT,
136 .flags = IORESOURCE_IRQ,
139 .dev = {
140 .power.can_wakeup = 1,
141 .platform_data = &eth_private_data,
144 #endif
146 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
147 #include <linux/input/adxl34x.h>
148 static 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,
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 */
171 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
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},
183 #endif
185 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
186 static struct platform_device rtc_device = {
187 .name = "rtc-bfin",
188 .id = -1,
190 #endif
192 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
193 #ifdef CONFIG_SERIAL_BFIN_UART0
194 static struct resource bfin_uart0_resources[] = {
196 .start = UART0_REVID,
197 .end = UART0_RXDIV+4,
198 .flags = IORESOURCE_MEM,
201 .start = IRQ_UART0_TX,
202 .end = IRQ_UART0_TX,
203 .flags = IORESOURCE_IRQ,
206 .start = IRQ_UART0_RX,
207 .end = IRQ_UART0_RX,
208 .flags = IORESOURCE_IRQ,
211 .start = IRQ_UART0_STAT,
212 .end = IRQ_UART0_STAT,
213 .flags = IORESOURCE_IRQ,
216 .start = CH_UART0_TX,
217 .end = CH_UART0_TX,
218 .flags = IORESOURCE_DMA,
221 .start = CH_UART0_RX,
222 .end = CH_UART0_RX,
223 .flags = IORESOURCE_DMA,
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,
231 { /* RTS pin -- 0 means not supported */
232 .start = GPIO_PD9,
233 .end = GPIO_PD9,
234 .flags = IORESOURCE_IO,
236 #endif
239 static 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
247 static 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 */
256 #endif
257 #ifdef CONFIG_SERIAL_BFIN_UART1
258 static struct resource bfin_uart1_resources[] = {
260 .start = UART1_REVID,
261 .end = UART1_RXDIV+4,
262 .flags = IORESOURCE_MEM,
265 .start = IRQ_UART1_TX,
266 .end = IRQ_UART1_TX,
267 .flags = IORESOURCE_IRQ,
270 .start = IRQ_UART1_RX,
271 .end = IRQ_UART1_RX,
272 .flags = IORESOURCE_IRQ,
275 .start = IRQ_UART1_STAT,
276 .end = IRQ_UART1_STAT,
277 .flags = IORESOURCE_IRQ,
280 .start = CH_UART1_TX,
281 .end = CH_UART1_TX,
282 .flags = IORESOURCE_DMA,
285 .start = CH_UART1_RX,
286 .end = CH_UART1_RX,
287 .flags = IORESOURCE_DMA,
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,
295 { /* RTS pin -- 0 means not supported */
296 .start = GPIO_PG10,
297 .end = GPIO_PG10,
298 .flags = IORESOURCE_IO,
300 #endif
303 static 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
311 static 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 */
320 #endif
321 #endif
323 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
324 #ifdef CONFIG_BFIN_SIR0
325 static struct resource bfin_sir0_resources[] = {
327 .start = 0xFFC00400,
328 .end = 0xFFC004FF,
329 .flags = IORESOURCE_MEM,
332 .start = IRQ_UART0_TX,
333 .end = IRQ_UART0_TX+1,
334 .flags = IORESOURCE_IRQ,
337 .start = CH_UART0_TX,
338 .end = CH_UART0_TX+1,
339 .flags = IORESOURCE_DMA,
342 static 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,
348 #endif
349 #ifdef CONFIG_BFIN_SIR1
350 static struct resource bfin_sir1_resources[] = {
352 .start = 0xFFC02000,
353 .end = 0xFFC020FF,
354 .flags = IORESOURCE_MEM,
357 .start = IRQ_UART1_TX,
358 .end = IRQ_UART1_TX+1,
359 .flags = IORESOURCE_IRQ,
362 .start = CH_UART1_TX,
363 .end = CH_UART1_TX+1,
364 .flags = IORESOURCE_DMA,
367 static 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,
373 #endif
374 #endif
376 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
377 static struct resource musb_resources[] = {
378 [0] = {
379 .start = 0xFFCC1000,
380 .end = 0xFFCC1398,
381 .flags = IORESOURCE_MEM,
383 [1] = { /* general IRQ */
384 .start = IRQ_USB_STAT,
385 .end = IRQ_USB_STAT,
386 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
387 .name = "mc"
389 [2] = { /* DMA IRQ */
390 .start = IRQ_USB_DMA,
391 .end = IRQ_USB_DMA,
392 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
393 .name = "dma"
397 static 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 */
406 static 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,
417 static u64 musb_dmamask = ~(u32)0;
419 static 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,
427 .num_resources = ARRAY_SIZE(musb_resources),
428 .resource = musb_resources,
430 #endif
432 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
433 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
434 static struct resource bfin_sport0_uart_resources[] = {
436 .start = SPORT0_TCR1,
437 .end = SPORT0_MRCS3+4,
438 .flags = IORESOURCE_MEM,
441 .start = IRQ_SPORT0_RX,
442 .end = IRQ_SPORT0_RX+1,
443 .flags = IORESOURCE_IRQ,
446 .start = IRQ_SPORT0_ERROR,
447 .end = IRQ_SPORT0_ERROR,
448 .flags = IORESOURCE_IRQ,
452 static 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
457 static 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 */
466 #endif
467 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
468 static struct resource bfin_sport1_uart_resources[] = {
470 .start = SPORT1_TCR1,
471 .end = SPORT1_MRCS3+4,
472 .flags = IORESOURCE_MEM,
475 .start = IRQ_SPORT1_RX,
476 .end = IRQ_SPORT1_RX+1,
477 .flags = IORESOURCE_IRQ,
480 .start = IRQ_SPORT1_ERROR,
481 .end = IRQ_SPORT1_ERROR,
482 .flags = IORESOURCE_IRQ,
486 static 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
491 static 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 */
500 #endif
501 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
502 static struct resource bfin_sport2_uart_resources[] = {
504 .start = SPORT2_TCR1,
505 .end = SPORT2_MRCS3+4,
506 .flags = IORESOURCE_MEM,
509 .start = IRQ_SPORT2_RX,
510 .end = IRQ_SPORT2_RX+1,
511 .flags = IORESOURCE_IRQ,
514 .start = IRQ_SPORT2_ERROR,
515 .end = IRQ_SPORT2_ERROR,
516 .flags = IORESOURCE_IRQ,
520 static 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
525 static 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 */
534 #endif
535 #endif
537 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
539 static unsigned short bfin_can0_peripherals[] = {
540 P_CAN0_RX, P_CAN0_TX, 0
543 static struct resource bfin_can0_resources[] = {
545 .start = 0xFFC00A00,
546 .end = 0xFFC00FFF,
547 .flags = IORESOURCE_MEM,
550 .start = IRQ_CAN0_RX,
551 .end = IRQ_CAN0_RX,
552 .flags = IORESOURCE_IRQ,
555 .start = IRQ_CAN0_TX,
556 .end = IRQ_CAN0_TX,
557 .flags = IORESOURCE_IRQ,
560 .start = IRQ_CAN0_STAT,
561 .end = IRQ_CAN0_STAT,
562 .flags = IORESOURCE_IRQ,
566 static 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 */
576 #endif
578 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
579 static struct mtd_partition partition_info[] = {
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,
590 .name = "file system(nand)",
591 .offset = MTDPART_OFS_APPEND,
592 .size = MTDPART_SIZ_FULL,
596 static 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,
604 static struct resource bfin_nand_resources[] = {
606 .start = 0xFFC03B00,
607 .end = 0xFFC03B4F,
608 .flags = IORESOURCE_MEM,
611 .start = CH_NFC,
612 .end = CH_NFC,
613 .flags = IORESOURCE_IRQ,
617 static 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,
626 #endif
628 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
630 static 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},
636 static struct platform_device bfin_sdh_device = {
637 .name = "bfin-sdh",
638 .id = 0,
639 .dev = {
640 .platform_data = &bfin_sdh_data,
643 #endif
645 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
646 static struct mtd_partition ezkit_partitions[] = {
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,
662 int bf609_nor_flash_init(struct platform_device *dev)
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,
671 peripheral_request_list(pins, "smc0");
673 bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
674 bfin_write32(SMC_B0CTL, 0x01002011);
675 bfin_write32(SMC_B0TIM, 0x08170977);
676 bfin_write32(SMC_B0ETIM, 0x00092231);
677 return 0;
680 static 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),
687 static struct resource ezkit_flash_resource = {
688 .start = 0xb0000000,
689 .end = 0xb0ffffff,
690 .flags = IORESOURCE_MEM,
693 static struct platform_device ezkit_flash_device = {
694 .name = "physmap-flash",
695 .id = 0,
696 .dev = {
697 .platform_data = &ezkit_flash_data,
699 .num_resources = 1,
700 .resource = &ezkit_flash_resource,
702 #endif
704 #if defined(CONFIG_MTD_M25P80) \
705 || defined(CONFIG_MTD_M25P80_MODULE)
706 /* SPI flash chip (w25q32) */
707 static struct mtd_partition bfin_spi_flash_partitions[] = {
709 .name = "bootloader(spi)",
710 .size = 0x00080000,
711 .offset = 0,
712 .mask_flags = MTD_CAP_ROM
713 }, {
714 .name = "linux kernel(spi)",
715 .size = 0x00180000,
716 .offset = MTDPART_OFS_APPEND,
717 }, {
718 .name = "file system(spi)",
719 .size = MTDPART_SIZ_FULL,
720 .offset = MTDPART_OFS_APPEND,
724 static struct flash_platform_data bfin_spi_flash_data = {
725 .name = "m25p80",
726 .parts = bfin_spi_flash_partitions,
727 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
728 .type = "w25q32",
731 static struct bfin6xx_spi_chip spi_flash_chip_info = {
732 .enable_dma = true, /* use dma transfer with this chip*/
734 #endif
736 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
737 static struct bfin6xx_spi_chip spidev_chip_info = {
738 .enable_dma = true,
740 #endif
742 #if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
743 static struct platform_device bfin_i2s_pcm = {
744 .name = "bfin-i2s-pcm-audio",
745 .id = -1,
747 #endif
749 #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
750 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
751 #include <asm/bfin_sport3.h>
752 static struct resource bfin_snd_resources[] = {
754 .start = SPORT0_CTL_A,
755 .end = SPORT0_CTL_A,
756 .flags = IORESOURCE_MEM,
759 .start = SPORT0_CTL_B,
760 .end = SPORT0_CTL_B,
761 .flags = IORESOURCE_MEM,
764 .start = CH_SPORT0_TX,
765 .end = CH_SPORT0_TX,
766 .flags = IORESOURCE_DMA,
769 .start = CH_SPORT0_RX,
770 .end = CH_SPORT0_RX,
771 .flags = IORESOURCE_DMA,
774 .start = IRQ_SPORT0_TX_STAT,
775 .end = IRQ_SPORT0_TX_STAT,
776 .flags = IORESOURCE_IRQ,
779 .start = IRQ_SPORT0_RX_STAT,
780 .end = IRQ_SPORT0_RX_STAT,
781 .flags = IORESOURCE_IRQ,
785 static const unsigned short bfin_snd_pin[] = {
786 P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
787 P_SPORT0_BFS, P_SPORT0_BD0, 0,
790 static struct bfin_snd_platform_data bfin_snd_data = {
791 .pin_req = bfin_snd_pin,
794 static struct platform_device bfin_i2s = {
795 .name = "bfin-i2s",
796 .num_resources = ARRAY_SIZE(bfin_snd_resources),
797 .resource = bfin_snd_resources,
798 .dev = {
799 .platform_data = &bfin_snd_data,
802 #endif
804 #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
805 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
806 static struct platform_device adau1761_device = {
807 .name = "bfin-eval-adau1x61",
809 #endif
811 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
812 #include <sound/adau17x1.h>
813 static struct adau1761_platform_data adau1761_info = {
814 .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
815 .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
817 #endif
819 #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
820 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
821 #include <linux/videodev2.h>
822 #include <media/blackfin/bfin_capture.h>
823 #include <media/blackfin/ppi.h>
825 static const unsigned short ppi_req[] = {
826 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
827 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
828 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
832 static const struct ppi_info ppi_info = {
833 .type = PPI_TYPE_EPPI3,
834 .dma_ch = CH_EPPI0_CH0,
835 .irq_err = IRQ_EPPI0_STAT,
836 .base = (void __iomem *)EPPI0_STAT,
837 .pin_req = ppi_req,
840 #if defined(CONFIG_VIDEO_VS6624) \
841 || defined(CONFIG_VIDEO_VS6624_MODULE)
842 static struct v4l2_input vs6624_inputs[] = {
844 .index = 0,
845 .name = "Camera",
846 .type = V4L2_INPUT_TYPE_CAMERA,
847 .std = V4L2_STD_UNKNOWN,
851 static struct bcap_route vs6624_routes[] = {
853 .input = 0,
854 .output = 0,
858 static const unsigned vs6624_ce_pin = GPIO_PD1;
860 static struct bfin_capture_config bfin_capture_data = {
861 .card_name = "BF609",
862 .inputs = vs6624_inputs,
863 .num_inputs = ARRAY_SIZE(vs6624_inputs),
864 .routes = vs6624_routes,
865 .i2c_adapter_id = 0,
866 .board_info = {
867 .type = "vs6624",
868 .addr = 0x10,
869 .platform_data = (void *)&vs6624_ce_pin,
871 .ppi_info = &ppi_info,
872 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
873 | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
874 .blank_clocks = 8,
876 #endif
878 static struct platform_device bfin_capture_device = {
879 .name = "bfin_capture",
880 .dev = {
881 .platform_data = &bfin_capture_data,
884 #endif
886 #if defined(CONFIG_BFIN_CRC)
887 #define BFIN_CRC_NAME "bfin-crc"
889 static struct resource bfin_crc0_resources[] = {
891 .start = REG_CRC0_CTL,
892 .end = REG_CRC0_REVID+4,
893 .flags = IORESOURCE_MEM,
896 .start = IRQ_CRC0_DCNTEXP,
897 .end = IRQ_CRC0_DCNTEXP,
898 .flags = IORESOURCE_IRQ,
901 .start = CH_MEM_STREAM0_SRC_CRC0,
902 .end = CH_MEM_STREAM0_SRC_CRC0,
903 .flags = IORESOURCE_DMA,
906 .start = CH_MEM_STREAM0_DEST_CRC0,
907 .end = CH_MEM_STREAM0_DEST_CRC0,
908 .flags = IORESOURCE_DMA,
912 static struct platform_device bfin_crc0_device = {
913 .name = BFIN_CRC_NAME,
914 .id = 0,
915 .num_resources = ARRAY_SIZE(bfin_crc0_resources),
916 .resource = bfin_crc0_resources,
919 static struct resource bfin_crc1_resources[] = {
921 .start = REG_CRC1_CTL,
922 .end = REG_CRC1_REVID+4,
923 .flags = IORESOURCE_MEM,
926 .start = IRQ_CRC1_DCNTEXP,
927 .end = IRQ_CRC1_DCNTEXP,
928 .flags = IORESOURCE_IRQ,
931 .start = CH_MEM_STREAM1_SRC_CRC1,
932 .end = CH_MEM_STREAM1_SRC_CRC1,
933 .flags = IORESOURCE_DMA,
936 .start = CH_MEM_STREAM1_DEST_CRC1,
937 .end = CH_MEM_STREAM1_DEST_CRC1,
938 .flags = IORESOURCE_DMA,
942 static struct platform_device bfin_crc1_device = {
943 .name = BFIN_CRC_NAME,
944 .id = 1,
945 .num_resources = ARRAY_SIZE(bfin_crc1_resources),
946 .resource = bfin_crc1_resources,
948 #endif
950 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
951 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
952 .model = 7877,
953 .vref_delay_usecs = 50, /* internal, no capacitor */
954 .x_plate_ohms = 419,
955 .y_plate_ohms = 486,
956 .pressure_max = 1000,
957 .pressure_min = 0,
958 .stopacq_polarity = 1,
959 .first_conversion_delay = 3,
960 .acquisition_time = 1,
961 .averaging = 1,
962 .pen_down_acc_interval = 1,
964 #endif
966 static struct spi_board_info bfin_spi_board_info[] __initdata = {
967 #if defined(CONFIG_MTD_M25P80) \
968 || defined(CONFIG_MTD_M25P80_MODULE)
970 /* the modalias must be the same as spi device driver name */
971 .modalias = "m25p80", /* Name of spi_driver for this device */
972 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
973 .bus_num = 0, /* Framework bus number */
974 .chip_select = 1, /* SPI_SSEL1*/
975 .platform_data = &bfin_spi_flash_data,
976 .controller_data = &spi_flash_chip_info,
977 .mode = SPI_MODE_3,
979 #endif
980 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
982 .modalias = "ad7877",
983 .platform_data = &bfin_ad7877_ts_info,
984 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
985 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
986 .bus_num = 0,
987 .chip_select = 2,
989 #endif
990 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
992 .modalias = "spidev",
993 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
994 .bus_num = 0,
995 .chip_select = 1,
996 .controller_data = &spidev_chip_info,
998 #endif
999 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1001 .modalias = "adxl34x",
1002 .platform_data = &adxl34x_info,
1003 .irq = IRQ_PC5,
1004 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1005 .bus_num = 1,
1006 .chip_select = 2,
1007 .mode = SPI_MODE_3,
1009 #endif
1011 #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1012 /* SPI (0) */
1013 static struct resource bfin_spi0_resource[] = {
1015 .start = SPI0_REGBASE,
1016 .end = SPI0_REGBASE + 0xFF,
1017 .flags = IORESOURCE_MEM,
1020 .start = CH_SPI0_TX,
1021 .end = CH_SPI0_TX,
1022 .flags = IORESOURCE_DMA,
1025 .start = CH_SPI0_RX,
1026 .end = CH_SPI0_RX,
1027 .flags = IORESOURCE_DMA,
1031 /* SPI (1) */
1032 static struct resource bfin_spi1_resource[] = {
1034 .start = SPI1_REGBASE,
1035 .end = SPI1_REGBASE + 0xFF,
1036 .flags = IORESOURCE_MEM,
1039 .start = CH_SPI1_TX,
1040 .end = CH_SPI1_TX,
1041 .flags = IORESOURCE_DMA,
1044 .start = CH_SPI1_RX,
1045 .end = CH_SPI1_RX,
1046 .flags = IORESOURCE_DMA,
1051 /* SPI controller data */
1052 static struct bfin6xx_spi_master bf60x_spi_master_info0 = {
1053 .num_chipselect = 4,
1054 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1057 static struct platform_device bf60x_spi_master0 = {
1058 .name = "bfin-spi",
1059 .id = 0, /* Bus number */
1060 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1061 .resource = bfin_spi0_resource,
1062 .dev = {
1063 .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
1067 static struct bfin6xx_spi_master bf60x_spi_master_info1 = {
1068 .num_chipselect = 4,
1069 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1072 static struct platform_device bf60x_spi_master1 = {
1073 .name = "bfin-spi",
1074 .id = 1, /* Bus number */
1075 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1076 .resource = bfin_spi1_resource,
1077 .dev = {
1078 .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
1081 #endif /* spi master and devices */
1083 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1084 static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1086 static struct resource bfin_twi0_resource[] = {
1087 [0] = {
1088 .start = TWI0_CLKDIV,
1089 .end = TWI0_CLKDIV + 0xFF,
1090 .flags = IORESOURCE_MEM,
1092 [1] = {
1093 .start = IRQ_TWI0,
1094 .end = IRQ_TWI0,
1095 .flags = IORESOURCE_IRQ,
1099 static struct platform_device i2c_bfin_twi0_device = {
1100 .name = "i2c-bfin-twi",
1101 .id = 0,
1102 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1103 .resource = bfin_twi0_resource,
1104 .dev = {
1105 .platform_data = &bfin_twi0_pins,
1109 static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1111 static struct resource bfin_twi1_resource[] = {
1112 [0] = {
1113 .start = TWI1_CLKDIV,
1114 .end = TWI1_CLKDIV + 0xFF,
1115 .flags = IORESOURCE_MEM,
1117 [1] = {
1118 .start = IRQ_TWI1,
1119 .end = IRQ_TWI1,
1120 .flags = IORESOURCE_IRQ,
1124 static struct platform_device i2c_bfin_twi1_device = {
1125 .name = "i2c-bfin-twi",
1126 .id = 1,
1127 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1128 .resource = bfin_twi1_resource,
1129 .dev = {
1130 .platform_data = &bfin_twi1_pins,
1133 #endif
1135 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1136 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1138 I2C_BOARD_INFO("adxl34x", 0x53),
1139 .irq = IRQ_PC5,
1140 .platform_data = (void *)&adxl34x_info,
1142 #endif
1143 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1145 I2C_BOARD_INFO("adau1761", 0x38),
1146 .platform_data = (void *)&adau1761_info
1148 #endif
1151 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1154 static const unsigned int cclk_vlev_datasheet[] =
1157 * Internal VLEV BF54XSBBC1533
1158 ****temporarily using these values until data sheet is updated
1160 VRPAIR(VLEV_085, 150000000),
1161 VRPAIR(VLEV_090, 250000000),
1162 VRPAIR(VLEV_110, 276000000),
1163 VRPAIR(VLEV_115, 301000000),
1164 VRPAIR(VLEV_120, 525000000),
1165 VRPAIR(VLEV_125, 550000000),
1166 VRPAIR(VLEV_130, 600000000),
1169 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1170 .tuple_tab = cclk_vlev_datasheet,
1171 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1172 .vr_settling_time = 25 /* us */,
1175 static struct platform_device bfin_dpmc = {
1176 .name = "bfin dpmc",
1177 .dev = {
1178 .platform_data = &bfin_dmpc_vreg_data,
1182 static struct platform_device *ezkit_devices[] __initdata = {
1184 &bfin_dpmc,
1186 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1187 &rtc_device,
1188 #endif
1190 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1191 #ifdef CONFIG_SERIAL_BFIN_UART0
1192 &bfin_uart0_device,
1193 #endif
1194 #ifdef CONFIG_SERIAL_BFIN_UART1
1195 &bfin_uart1_device,
1196 #endif
1197 #endif
1199 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1200 #ifdef CONFIG_BFIN_SIR0
1201 &bfin_sir0_device,
1202 #endif
1203 #ifdef CONFIG_BFIN_SIR1
1204 &bfin_sir1_device,
1205 #endif
1206 #endif
1208 #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1209 &bfin_eth_device,
1210 #endif
1212 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1213 &musb_device,
1214 #endif
1216 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1217 &bfin_isp1760_device,
1218 #endif
1220 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1221 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1222 &bfin_sport0_uart_device,
1223 #endif
1224 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1225 &bfin_sport1_uart_device,
1226 #endif
1227 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1228 &bfin_sport2_uart_device,
1229 #endif
1230 #endif
1232 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1233 &bfin_can0_device,
1234 #endif
1236 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1237 &bfin_nand_device,
1238 #endif
1240 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1241 &bfin_sdh_device,
1242 #endif
1244 #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1245 &bf60x_spi_master0,
1246 &bf60x_spi_master1,
1247 #endif
1249 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1250 &bfin_rotary_device,
1251 #endif
1253 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1254 &i2c_bfin_twi0_device,
1255 #if !defined(CONFIG_BF542)
1256 &i2c_bfin_twi1_device,
1257 #endif
1258 #endif
1260 #if defined(CONFIG_BFIN_CRC)
1261 &bfin_crc0_device,
1262 &bfin_crc1_device,
1263 #endif
1265 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1266 &bfin_device_gpiokeys,
1267 #endif
1269 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1270 &ezkit_flash_device,
1271 #endif
1272 #if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
1273 &bfin_i2s_pcm,
1274 #endif
1275 #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
1276 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
1277 &bfin_i2s,
1278 #endif
1279 #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
1280 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
1281 &adau1761_device,
1282 #endif
1283 #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
1284 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
1285 &bfin_capture_device,
1286 #endif
1289 static int __init ezkit_init(void)
1291 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1293 i2c_register_board_info(0, bfin_i2c_board_info0,
1294 ARRAY_SIZE(bfin_i2c_board_info0));
1295 i2c_register_board_info(1, bfin_i2c_board_info1,
1296 ARRAY_SIZE(bfin_i2c_board_info1));
1298 #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1299 if (!peripheral_request_list(pins, "emac0"))
1300 printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
1301 #endif
1303 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1305 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1307 return 0;
1310 arch_initcall(ezkit_init);
1312 static struct platform_device *ezkit_early_devices[] __initdata = {
1313 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1314 #ifdef CONFIG_SERIAL_BFIN_UART0
1315 &bfin_uart0_device,
1316 #endif
1317 #ifdef CONFIG_SERIAL_BFIN_UART1
1318 &bfin_uart1_device,
1319 #endif
1320 #endif
1322 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1323 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1324 &bfin_sport0_uart_device,
1325 #endif
1326 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1327 &bfin_sport1_uart_device,
1328 #endif
1329 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1330 &bfin_sport2_uart_device,
1331 #endif
1332 #endif
1335 void __init native_machine_early_platform_add_devices(void)
1337 printk(KERN_INFO "register early platform devices\n");
1338 early_platform_add_devices(ezkit_early_devices,
1339 ARRAY_SIZE(ezkit_early_devices));