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.
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 <linux/pinctrl/machine.h>
21 #include <linux/pinctrl/pinconf-generic.h>
22 #include <linux/platform_data/pinctrl-adi2.h>
23 #include <linux/spi/adi_spi3.h>
28 #include <asm/portmux.h>
29 #include <asm/bfin_sdh.h>
30 #include <linux/input.h>
31 #include <linux/spi/ad7877.h>
34 * Name the Board for the /proc/cpuinfo
36 const char bfin_board_name[] = "ADI BF609-EZKIT";
39 * Driver needs to know address, irq and flag pin.
42 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
43 #include <linux/usb/isp1760.h>
44 static struct resource bfin_isp1760_resources[] = {
47 .end = 0x2C0C0000 + 0xfffff,
48 .flags = IORESOURCE_MEM,
53 .flags = IORESOURCE_IRQ,
57 static struct isp1760_platform_data isp1760_priv = {
62 .dack_polarity_high = 0,
63 .dreq_polarity_high = 0,
66 static struct platform_device bfin_isp1760_device = {
70 .platform_data = &isp1760_priv,
72 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
73 .resource = bfin_isp1760_resources,
77 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
78 #include <linux/platform_data/bfin_rotary.h>
80 static struct bfin_rotary_platform_data bfin_rotary_data = {
81 /*.rotary_up_key = KEY_UP,*/
82 /*.rotary_down_key = KEY_DOWN,*/
83 .rotary_rel_code = REL_WHEEL,
84 .rotary_button_key = KEY_ENTER,
85 .debounce = 10, /* 0..17 */
86 .mode = ROT_QUAD_ENC | ROT_DEBE,
89 static struct resource bfin_rotary_resources[] = {
92 .end = CNT_CONFIG + 0xff,
93 .flags = IORESOURCE_MEM,
98 .flags = IORESOURCE_IRQ,
102 static struct platform_device bfin_rotary_device = {
103 .name = "bfin-rotary",
105 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
106 .resource = bfin_rotary_resources,
108 .platform_data = &bfin_rotary_data,
113 #if IS_ENABLED(CONFIG_STMMAC_ETH)
114 #include <linux/stmmac.h>
115 #include <linux/phy.h>
117 static struct stmmac_mdio_bus_data phy_private_data = {
121 static struct stmmac_dma_cfg eth_dma_cfg = {
125 int stmmac_ptp_clk_init(struct platform_device *pdev, void *priv)
127 bfin_write32(PADS0_EMAC_PTP_CLKSEL, 0);
131 static struct plat_stmmacenet_data eth_private_data = {
136 .mdio_bus_data = &phy_private_data,
137 .dma_cfg = ð_dma_cfg,
138 .force_thresh_dma_mode = 1,
139 .interface = PHY_INTERFACE_MODE_RMII,
140 .init = stmmac_ptp_clk_init,
143 static struct platform_device bfin_eth_device = {
147 .resource = (struct resource[]) {
149 .start = EMAC0_MACCFG,
150 .end = EMAC0_MACCFG + 0x1274,
151 .flags = IORESOURCE_MEM,
155 .start = IRQ_EMAC0_STAT,
156 .end = IRQ_EMAC0_STAT,
157 .flags = IORESOURCE_IRQ,
161 .power.can_wakeup = 1,
162 .platform_data = ð_private_data,
167 #if IS_ENABLED(CONFIG_INPUT_ADXL34X)
168 #include <linux/input/adxl34x.h>
169 static const struct adxl34x_platform_data adxl34x_info = {
173 .tap_threshold = 0x31,
174 .tap_duration = 0x10,
177 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
178 .act_axis_control = 0xFF,
179 .activity_threshold = 5,
180 .inactivity_threshold = 3,
181 .inactivity_time = 4,
182 .free_fall_threshold = 0x7,
183 .free_fall_time = 0x20,
185 .data_range = ADXL_FULL_RES,
188 .ev_code_x = ABS_X, /* EV_REL */
189 .ev_code_y = ABS_Y, /* EV_REL */
190 .ev_code_z = ABS_Z, /* EV_REL */
192 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
194 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
195 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
196 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
197 .fifo_mode = ADXL_FIFO_STREAM,
198 .orientation_enable = ADXL_EN_ORIENTATION_3D,
199 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
200 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
201 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
202 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
206 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
207 static struct platform_device rtc_device = {
213 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
214 #ifdef CONFIG_SERIAL_BFIN_UART0
215 static struct resource bfin_uart0_resources[] = {
217 .start = UART0_REVID,
218 .end = UART0_RXDIV+4,
219 .flags = IORESOURCE_MEM,
221 #ifdef CONFIG_EARLY_PRINTK
225 .flags = IORESOURCE_REG,
230 .flags = IORESOURCE_REG,
234 .start = IRQ_UART0_TX,
236 .flags = IORESOURCE_IRQ,
239 .start = IRQ_UART0_RX,
241 .flags = IORESOURCE_IRQ,
244 .start = IRQ_UART0_STAT,
245 .end = IRQ_UART0_STAT,
246 .flags = IORESOURCE_IRQ,
249 .start = CH_UART0_TX,
251 .flags = IORESOURCE_DMA,
254 .start = CH_UART0_RX,
256 .flags = IORESOURCE_DMA,
258 #ifdef CONFIG_BFIN_UART0_CTSRTS
259 { /* CTS pin -- 0 means not supported */
262 .flags = IORESOURCE_IO,
264 { /* RTS pin -- 0 means not supported */
267 .flags = IORESOURCE_IO,
272 static unsigned short bfin_uart0_peripherals[] = {
273 P_UART0_TX, P_UART0_RX,
274 #ifdef CONFIG_BFIN_UART0_CTSRTS
275 P_UART0_RTS, P_UART0_CTS,
280 static struct platform_device bfin_uart0_device = {
283 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
284 .resource = bfin_uart0_resources,
286 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
290 #ifdef CONFIG_SERIAL_BFIN_UART1
291 static struct resource bfin_uart1_resources[] = {
293 .start = UART1_REVID,
294 .end = UART1_RXDIV+4,
295 .flags = IORESOURCE_MEM,
297 #ifdef CONFIG_EARLY_PRINTK
299 .start = PORTG_FER_SET,
300 .end = PORTG_FER_SET+2,
301 .flags = IORESOURCE_REG,
305 .start = IRQ_UART1_TX,
307 .flags = IORESOURCE_IRQ,
310 .start = IRQ_UART1_RX,
312 .flags = IORESOURCE_IRQ,
315 .start = IRQ_UART1_STAT,
316 .end = IRQ_UART1_STAT,
317 .flags = IORESOURCE_IRQ,
320 .start = CH_UART1_TX,
322 .flags = IORESOURCE_DMA,
325 .start = CH_UART1_RX,
327 .flags = IORESOURCE_DMA,
329 #ifdef CONFIG_BFIN_UART1_CTSRTS
330 { /* CTS pin -- 0 means not supported */
333 .flags = IORESOURCE_IO,
335 { /* RTS pin -- 0 means not supported */
338 .flags = IORESOURCE_IO,
343 static unsigned short bfin_uart1_peripherals[] = {
344 P_UART1_TX, P_UART1_RX,
345 #ifdef CONFIG_BFIN_UART1_CTSRTS
346 P_UART1_RTS, P_UART1_CTS,
351 static struct platform_device bfin_uart1_device = {
354 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
355 .resource = bfin_uart1_resources,
357 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
363 #if IS_ENABLED(CONFIG_BFIN_SIR)
364 #ifdef CONFIG_BFIN_SIR0
365 static struct resource bfin_sir0_resources[] = {
369 .flags = IORESOURCE_MEM,
372 .start = IRQ_UART0_TX,
373 .end = IRQ_UART0_TX+1,
374 .flags = IORESOURCE_IRQ,
377 .start = CH_UART0_TX,
378 .end = CH_UART0_TX+1,
379 .flags = IORESOURCE_DMA,
382 static struct platform_device bfin_sir0_device = {
385 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
386 .resource = bfin_sir0_resources,
389 #ifdef CONFIG_BFIN_SIR1
390 static struct resource bfin_sir1_resources[] = {
394 .flags = IORESOURCE_MEM,
397 .start = IRQ_UART1_TX,
398 .end = IRQ_UART1_TX+1,
399 .flags = IORESOURCE_IRQ,
402 .start = CH_UART1_TX,
403 .end = CH_UART1_TX+1,
404 .flags = IORESOURCE_DMA,
407 static struct platform_device bfin_sir1_device = {
410 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
411 .resource = bfin_sir1_resources,
416 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
417 static struct resource musb_resources[] = {
421 .flags = IORESOURCE_MEM,
423 [1] = { /* general IRQ */
424 .start = IRQ_USB_STAT,
426 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
429 [2] = { /* DMA IRQ */
430 .start = IRQ_USB_DMA,
432 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
437 static struct musb_hdrc_config musb_config = {
443 .clkin = 48, /* musb CLKIN in MHZ */
446 static struct musb_hdrc_platform_data musb_plat = {
447 #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
449 #elif defined(CONFIG_USB_MUSB_HDRC)
451 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
452 .mode = MUSB_PERIPHERAL,
454 .config = &musb_config,
457 static u64 musb_dmamask = ~(u32)0;
459 static struct platform_device musb_device = {
460 .name = "musb-blackfin",
463 .dma_mask = &musb_dmamask,
464 .coherent_dma_mask = 0xffffffff,
465 .platform_data = &musb_plat,
467 .num_resources = ARRAY_SIZE(musb_resources),
468 .resource = musb_resources,
472 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
473 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
474 static struct resource bfin_sport0_uart_resources[] = {
476 .start = SPORT0_TCR1,
477 .end = SPORT0_MRCS3+4,
478 .flags = IORESOURCE_MEM,
481 .start = IRQ_SPORT0_RX,
482 .end = IRQ_SPORT0_RX+1,
483 .flags = IORESOURCE_IRQ,
486 .start = IRQ_SPORT0_ERROR,
487 .end = IRQ_SPORT0_ERROR,
488 .flags = IORESOURCE_IRQ,
492 static unsigned short bfin_sport0_peripherals[] = {
493 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
494 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
497 static struct platform_device bfin_sport0_uart_device = {
498 .name = "bfin-sport-uart",
500 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
501 .resource = bfin_sport0_uart_resources,
503 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
507 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
508 static struct resource bfin_sport1_uart_resources[] = {
510 .start = SPORT1_TCR1,
511 .end = SPORT1_MRCS3+4,
512 .flags = IORESOURCE_MEM,
515 .start = IRQ_SPORT1_RX,
516 .end = IRQ_SPORT1_RX+1,
517 .flags = IORESOURCE_IRQ,
520 .start = IRQ_SPORT1_ERROR,
521 .end = IRQ_SPORT1_ERROR,
522 .flags = IORESOURCE_IRQ,
526 static unsigned short bfin_sport1_peripherals[] = {
527 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
528 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
531 static struct platform_device bfin_sport1_uart_device = {
532 .name = "bfin-sport-uart",
534 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
535 .resource = bfin_sport1_uart_resources,
537 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
541 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
542 static struct resource bfin_sport2_uart_resources[] = {
544 .start = SPORT2_TCR1,
545 .end = SPORT2_MRCS3+4,
546 .flags = IORESOURCE_MEM,
549 .start = IRQ_SPORT2_RX,
550 .end = IRQ_SPORT2_RX+1,
551 .flags = IORESOURCE_IRQ,
554 .start = IRQ_SPORT2_ERROR,
555 .end = IRQ_SPORT2_ERROR,
556 .flags = IORESOURCE_IRQ,
560 static unsigned short bfin_sport2_peripherals[] = {
561 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
562 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
565 static struct platform_device bfin_sport2_uart_device = {
566 .name = "bfin-sport-uart",
568 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
569 .resource = bfin_sport2_uart_resources,
571 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
577 #if IS_ENABLED(CONFIG_CAN_BFIN)
579 static unsigned short bfin_can0_peripherals[] = {
580 P_CAN0_RX, P_CAN0_TX, 0
583 static struct resource bfin_can0_resources[] = {
587 .flags = IORESOURCE_MEM,
590 .start = IRQ_CAN0_RX,
592 .flags = IORESOURCE_IRQ,
595 .start = IRQ_CAN0_TX,
597 .flags = IORESOURCE_IRQ,
600 .start = IRQ_CAN0_STAT,
601 .end = IRQ_CAN0_STAT,
602 .flags = IORESOURCE_IRQ,
606 static struct platform_device bfin_can0_device = {
609 .num_resources = ARRAY_SIZE(bfin_can0_resources),
610 .resource = bfin_can0_resources,
612 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
618 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
619 static struct mtd_partition partition_info[] = {
621 .name = "bootloader(nand)",
625 .name = "linux kernel(nand)",
626 .offset = MTDPART_OFS_APPEND,
627 .size = 4 * 1024 * 1024,
630 .name = "file system(nand)",
631 .offset = MTDPART_OFS_APPEND,
632 .size = MTDPART_SIZ_FULL,
636 static struct bf5xx_nand_platform bfin_nand_platform = {
637 .data_width = NFC_NWIDTH_8,
638 .partitions = partition_info,
639 .nr_partitions = ARRAY_SIZE(partition_info),
644 static struct resource bfin_nand_resources[] = {
648 .flags = IORESOURCE_MEM,
653 .flags = IORESOURCE_IRQ,
657 static struct platform_device bfin_nand_device = {
660 .num_resources = ARRAY_SIZE(bfin_nand_resources),
661 .resource = bfin_nand_resources,
663 .platform_data = &bfin_nand_platform,
668 #if IS_ENABLED(CONFIG_SDH_BFIN)
670 static struct bfin_sd_host bfin_sdh_data = {
672 .irq_int0 = IRQ_RSI_INT0,
673 .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
676 static struct platform_device bfin_sdh_device = {
680 .platform_data = &bfin_sdh_data,
685 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
686 static struct mtd_partition ezkit_partitions[] = {
688 .name = "bootloader(nor)",
692 .name = "linux kernel(nor)",
694 .offset = MTDPART_OFS_APPEND,
696 .name = "file system(nor)",
697 .size = 0x1000000 - 0x80000 - 0x400000,
698 .offset = MTDPART_OFS_APPEND,
702 int bf609_nor_flash_init(struct platform_device *pdev)
704 #define CONFIG_SMC_GCTL_VAL 0x00000010
706 bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
707 bfin_write32(SMC_B0CTL, 0x01002011);
708 bfin_write32(SMC_B0TIM, 0x08170977);
709 bfin_write32(SMC_B0ETIM, 0x00092231);
713 void bf609_nor_flash_exit(struct platform_device *pdev)
715 bfin_write32(SMC_GCTL, 0);
718 static struct physmap_flash_data ezkit_flash_data = {
720 .parts = ezkit_partitions,
721 .init = bf609_nor_flash_init,
722 .exit = bf609_nor_flash_exit,
723 .nr_parts = ARRAY_SIZE(ezkit_partitions),
724 #ifdef CONFIG_ROMKERNEL
725 .probe_type = "map_rom",
729 static struct resource ezkit_flash_resource = {
732 .flags = IORESOURCE_MEM,
735 static struct platform_device ezkit_flash_device = {
736 .name = "physmap-flash",
739 .platform_data = &ezkit_flash_data,
742 .resource = &ezkit_flash_resource,
746 #if IS_ENABLED(CONFIG_MTD_M25P80)
747 /* SPI flash chip (w25q32) */
748 static struct mtd_partition bfin_spi_flash_partitions[] = {
750 .name = "bootloader(spi)",
753 .mask_flags = MTD_CAP_ROM
755 .name = "linux kernel(spi)",
757 .offset = MTDPART_OFS_APPEND,
759 .name = "file system(spi)",
760 .size = MTDPART_SIZ_FULL,
761 .offset = MTDPART_OFS_APPEND,
765 static struct flash_platform_data bfin_spi_flash_data = {
767 .parts = bfin_spi_flash_partitions,
768 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
772 static struct adi_spi3_chip spi_flash_chip_info = {
773 .enable_dma = true, /* use dma transfer with this chip*/
777 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
778 static struct adi_spi3_chip spidev_chip_info = {
783 #if IS_ENABLED(CONFIG_SND_BF6XX_PCM)
784 static struct platform_device bfin_pcm = {
785 .name = "bfin-i2s-pcm-audio",
790 #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
791 #include <asm/bfin_sport3.h>
792 static struct resource bfin_snd_resources[] = {
794 .start = SPORT0_CTL_A,
796 .flags = IORESOURCE_MEM,
799 .start = SPORT0_CTL_B,
801 .flags = IORESOURCE_MEM,
804 .start = CH_SPORT0_TX,
806 .flags = IORESOURCE_DMA,
809 .start = CH_SPORT0_RX,
811 .flags = IORESOURCE_DMA,
814 .start = IRQ_SPORT0_TX_STAT,
815 .end = IRQ_SPORT0_TX_STAT,
816 .flags = IORESOURCE_IRQ,
819 .start = IRQ_SPORT0_RX_STAT,
820 .end = IRQ_SPORT0_RX_STAT,
821 .flags = IORESOURCE_IRQ,
825 static const unsigned short bfin_snd_pin[] = {
826 P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
827 P_SPORT0_BFS, P_SPORT0_BD0, 0,
830 static struct bfin_snd_platform_data bfin_snd_data = {
831 .pin_req = bfin_snd_pin,
834 static struct platform_device bfin_i2s = {
836 .num_resources = ARRAY_SIZE(bfin_snd_resources),
837 .resource = bfin_snd_resources,
839 .platform_data = &bfin_snd_data,
844 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
845 static const char * const ad1836_link[] = {
849 static struct platform_device bfin_ad1836_machine = {
850 .name = "bfin-snd-ad1836",
853 .platform_data = (void *)ad1836_link,
858 #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
859 static struct platform_device adau1761_device = {
860 .name = "bfin-eval-adau1x61",
864 #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
865 #include <sound/adau17x1.h>
866 static struct adau1761_platform_data adau1761_info = {
867 .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
868 .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
872 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
873 #include <linux/videodev2.h>
874 #include <media/blackfin/bfin_capture.h>
875 #include <media/blackfin/ppi.h>
877 static const unsigned short ppi_req[] = {
878 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
879 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
880 P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
881 P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
882 #if !IS_ENABLED(CONFIG_VIDEO_VS6624)
883 P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
884 P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
886 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
890 static const struct ppi_info ppi_info = {
891 .type = PPI_TYPE_EPPI3,
892 .dma_ch = CH_EPPI0_CH0,
893 .irq_err = IRQ_EPPI0_STAT,
894 .base = (void __iomem *)EPPI0_STAT,
898 #if IS_ENABLED(CONFIG_VIDEO_VS6624)
899 static struct v4l2_input vs6624_inputs[] = {
903 .type = V4L2_INPUT_TYPE_CAMERA,
904 .std = V4L2_STD_UNKNOWN,
908 static struct bcap_route vs6624_routes[] = {
915 static const unsigned vs6624_ce_pin = GPIO_PE4;
917 static struct bfin_capture_config bfin_capture_data = {
918 .card_name = "BF609",
919 .inputs = vs6624_inputs,
920 .num_inputs = ARRAY_SIZE(vs6624_inputs),
921 .routes = vs6624_routes,
926 .platform_data = (void *)&vs6624_ce_pin,
928 .ppi_info = &ppi_info,
929 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
930 | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
935 #if IS_ENABLED(CONFIG_VIDEO_ADV7842)
936 #include <media/adv7842.h>
938 static struct v4l2_input adv7842_inputs[] = {
942 .type = V4L2_INPUT_TYPE_CAMERA,
944 .capabilities = V4L2_IN_CAP_STD,
949 .type = V4L2_INPUT_TYPE_CAMERA,
951 .capabilities = V4L2_IN_CAP_STD,
956 .type = V4L2_INPUT_TYPE_CAMERA,
957 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
962 .type = V4L2_INPUT_TYPE_CAMERA,
963 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
968 .type = V4L2_INPUT_TYPE_CAMERA,
969 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
973 static struct bcap_route adv7842_routes[] = {
977 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
978 | EPPI_CTL_ACTIVE656),
995 .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
996 | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
997 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
1001 static struct adv7842_output_format adv7842_opf[] = {
1003 .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
1004 .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
1007 .insert_av_codes = 1,
1010 .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
1011 .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
1017 static struct adv7842_platform_data adv7842_data = {
1019 .num_opf = ARRAY_SIZE(adv7842_opf),
1020 .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
1021 .prim_mode = ADV7842_PRIM_MODE_SDP,
1022 .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
1023 .hdmi_free_run_enable = 1,
1024 .sdp_free_run_auto = 1,
1025 .llc_dll_phase = 0x10,
1032 .i2c_repeater = 0x46,
1034 .i2c_infoframe = 0x48,
1039 static struct bfin_capture_config bfin_capture_data = {
1040 .card_name = "BF609",
1041 .inputs = adv7842_inputs,
1042 .num_inputs = ARRAY_SIZE(adv7842_inputs),
1043 .routes = adv7842_routes,
1044 .i2c_adapter_id = 0,
1048 .platform_data = (void *)&adv7842_data,
1050 .ppi_info = &ppi_info,
1051 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
1052 | EPPI_CTL_ACTIVE656),
1056 static struct platform_device bfin_capture_device = {
1057 .name = "bfin_capture",
1059 .platform_data = &bfin_capture_data,
1064 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
1065 #include <linux/videodev2.h>
1066 #include <media/blackfin/bfin_display.h>
1067 #include <media/blackfin/ppi.h>
1069 static const unsigned short ppi_req_disp[] = {
1070 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
1071 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
1072 P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
1073 P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
1074 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
1078 static const struct ppi_info ppi_info = {
1079 .type = PPI_TYPE_EPPI3,
1080 .dma_ch = CH_EPPI0_CH0,
1081 .irq_err = IRQ_EPPI0_STAT,
1082 .base = (void __iomem *)EPPI0_STAT,
1083 .pin_req = ppi_req_disp,
1086 #if IS_ENABLED(CONFIG_VIDEO_ADV7511)
1087 #include <media/adv7511.h>
1089 static struct v4l2_output adv7511_outputs[] = {
1093 .type = V4L2_INPUT_TYPE_CAMERA,
1094 .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
1098 static struct disp_route adv7511_routes[] = {
1104 static struct adv7511_platform_data adv7511_data = {
1108 static struct bfin_display_config bfin_display_data = {
1109 .card_name = "BF609",
1110 .outputs = adv7511_outputs,
1111 .num_outputs = ARRAY_SIZE(adv7511_outputs),
1112 .routes = adv7511_routes,
1113 .i2c_adapter_id = 0,
1117 .platform_data = (void *)&adv7511_data,
1119 .ppi_info = &ppi_info,
1120 .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
1121 | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC3
1122 | EPPI_CTL_IFSGEN | EPPI_CTL_SYNC2
1123 | EPPI_CTL_NON656 | EPPI_CTL_DIR),
1127 #if IS_ENABLED(CONFIG_VIDEO_ADV7343)
1128 #include <media/adv7343.h>
1130 static struct v4l2_output adv7343_outputs[] = {
1133 .name = "Composite",
1134 .type = V4L2_OUTPUT_TYPE_ANALOG,
1135 .std = V4L2_STD_ALL,
1136 .capabilities = V4L2_OUT_CAP_STD,
1141 .type = V4L2_OUTPUT_TYPE_ANALOG,
1142 .std = V4L2_STD_ALL,
1143 .capabilities = V4L2_OUT_CAP_STD,
1147 .name = "Component",
1148 .type = V4L2_OUTPUT_TYPE_ANALOG,
1149 .std = V4L2_STD_ALL,
1150 .capabilities = V4L2_OUT_CAP_STD,
1155 static struct disp_route adv7343_routes[] = {
1157 .output = ADV7343_COMPOSITE_ID,
1160 .output = ADV7343_SVIDEO_ID,
1163 .output = ADV7343_COMPONENT_ID,
1167 static struct adv7343_platform_data adv7343_data = {
1169 .sleep_mode = false,
1170 .pll_control = false,
1179 .sd_dac_out1 = false,
1180 .sd_dac_out2 = false,
1184 static struct bfin_display_config bfin_display_data = {
1185 .card_name = "BF609",
1186 .outputs = adv7343_outputs,
1187 .num_outputs = ARRAY_SIZE(adv7343_outputs),
1188 .routes = adv7343_routes,
1189 .i2c_adapter_id = 0,
1193 .platform_data = (void *)&adv7343_data,
1195 .ppi_info = &ppi_info_disp,
1196 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1LO_FS2LO
1197 | EPPI_CTL_POLC3 | EPPI_CTL_BLANKGEN | EPPI_CTL_SYNC2
1198 | EPPI_CTL_NON656 | EPPI_CTL_DIR),
1202 static struct platform_device bfin_display_device = {
1203 .name = "bfin_display",
1205 .platform_data = &bfin_display_data,
1210 #if defined(CONFIG_FB_BF609_NL8048) \
1211 || defined(CONFIG_FB_BF609_NL8048_MODULE)
1212 static struct resource nl8048_resources[] = {
1214 .start = EPPI2_STAT,
1216 .flags = IORESOURCE_MEM,
1219 .start = CH_EPPI2_CH0,
1220 .end = CH_EPPI2_CH0,
1221 .flags = IORESOURCE_DMA,
1224 .start = IRQ_EPPI2_STAT,
1225 .end = IRQ_EPPI2_STAT,
1226 .flags = IORESOURCE_IRQ,
1229 static struct platform_device bfin_fb_device = {
1230 .name = "bf609_nl8048",
1231 .num_resources = ARRAY_SIZE(nl8048_resources),
1232 .resource = nl8048_resources,
1234 .platform_data = (void *)GPIO_PC15,
1239 #if defined(CONFIG_BFIN_CRC)
1240 #define BFIN_CRC_NAME "bfin-crc"
1242 static struct resource bfin_crc0_resources[] = {
1244 .start = REG_CRC0_CTL,
1245 .end = REG_CRC0_REVID+4,
1246 .flags = IORESOURCE_MEM,
1249 .start = IRQ_CRC0_DCNTEXP,
1250 .end = IRQ_CRC0_DCNTEXP,
1251 .flags = IORESOURCE_IRQ,
1254 .start = CH_MEM_STREAM0_SRC_CRC0,
1255 .end = CH_MEM_STREAM0_SRC_CRC0,
1256 .flags = IORESOURCE_DMA,
1259 .start = CH_MEM_STREAM0_DEST_CRC0,
1260 .end = CH_MEM_STREAM0_DEST_CRC0,
1261 .flags = IORESOURCE_DMA,
1265 static struct platform_device bfin_crc0_device = {
1266 .name = BFIN_CRC_NAME,
1268 .num_resources = ARRAY_SIZE(bfin_crc0_resources),
1269 .resource = bfin_crc0_resources,
1272 static struct resource bfin_crc1_resources[] = {
1274 .start = REG_CRC1_CTL,
1275 .end = REG_CRC1_REVID+4,
1276 .flags = IORESOURCE_MEM,
1279 .start = IRQ_CRC1_DCNTEXP,
1280 .end = IRQ_CRC1_DCNTEXP,
1281 .flags = IORESOURCE_IRQ,
1284 .start = CH_MEM_STREAM1_SRC_CRC1,
1285 .end = CH_MEM_STREAM1_SRC_CRC1,
1286 .flags = IORESOURCE_DMA,
1289 .start = CH_MEM_STREAM1_DEST_CRC1,
1290 .end = CH_MEM_STREAM1_DEST_CRC1,
1291 .flags = IORESOURCE_DMA,
1295 static struct platform_device bfin_crc1_device = {
1296 .name = BFIN_CRC_NAME,
1298 .num_resources = ARRAY_SIZE(bfin_crc1_resources),
1299 .resource = bfin_crc1_resources,
1303 #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
1304 #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
1305 #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
1307 static struct resource bfin_crypto_crc_resources[] = {
1309 .start = REG_CRC0_CTL,
1310 .end = REG_CRC0_REVID+4,
1311 .flags = IORESOURCE_MEM,
1314 .start = IRQ_CRC0_DCNTEXP,
1315 .end = IRQ_CRC0_DCNTEXP,
1316 .flags = IORESOURCE_IRQ,
1319 .start = CH_MEM_STREAM0_SRC_CRC0,
1320 .end = CH_MEM_STREAM0_SRC_CRC0,
1321 .flags = IORESOURCE_DMA,
1325 static struct platform_device bfin_crypto_crc_device = {
1326 .name = BFIN_CRYPTO_CRC_NAME,
1328 .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
1329 .resource = bfin_crypto_crc_resources,
1331 .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
1336 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1337 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1339 .vref_delay_usecs = 50, /* internal, no capacitor */
1340 .x_plate_ohms = 419,
1341 .y_plate_ohms = 486,
1342 .pressure_max = 1000,
1344 .stopacq_polarity = 1,
1345 .first_conversion_delay = 3,
1346 .acquisition_time = 1,
1348 .pen_down_acc_interval = 1,
1352 #ifdef CONFIG_PINCTRL_ADI2
1354 # define ADI_PINT_DEVNAME "adi-gpio-pint"
1355 # define ADI_GPIO_DEVNAME "adi-gpio"
1356 # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
1358 static struct platform_device bfin_pinctrl_device = {
1359 .name = ADI_PINCTRL_DEVNAME,
1363 static struct resource bfin_pint0_resources[] = {
1365 .start = PINT0_MASK_SET,
1366 .end = PINT0_LATCH + 3,
1367 .flags = IORESOURCE_MEM,
1372 .flags = IORESOURCE_IRQ,
1376 static struct platform_device bfin_pint0_device = {
1377 .name = ADI_PINT_DEVNAME,
1379 .num_resources = ARRAY_SIZE(bfin_pint0_resources),
1380 .resource = bfin_pint0_resources,
1383 static struct resource bfin_pint1_resources[] = {
1385 .start = PINT1_MASK_SET,
1386 .end = PINT1_LATCH + 3,
1387 .flags = IORESOURCE_MEM,
1392 .flags = IORESOURCE_IRQ,
1396 static struct platform_device bfin_pint1_device = {
1397 .name = ADI_PINT_DEVNAME,
1399 .num_resources = ARRAY_SIZE(bfin_pint1_resources),
1400 .resource = bfin_pint1_resources,
1403 static struct resource bfin_pint2_resources[] = {
1405 .start = PINT2_MASK_SET,
1406 .end = PINT2_LATCH + 3,
1407 .flags = IORESOURCE_MEM,
1412 .flags = IORESOURCE_IRQ,
1416 static struct platform_device bfin_pint2_device = {
1417 .name = ADI_PINT_DEVNAME,
1419 .num_resources = ARRAY_SIZE(bfin_pint2_resources),
1420 .resource = bfin_pint2_resources,
1423 static struct resource bfin_pint3_resources[] = {
1425 .start = PINT3_MASK_SET,
1426 .end = PINT3_LATCH + 3,
1427 .flags = IORESOURCE_MEM,
1432 .flags = IORESOURCE_IRQ,
1436 static struct platform_device bfin_pint3_device = {
1437 .name = ADI_PINT_DEVNAME,
1439 .num_resources = ARRAY_SIZE(bfin_pint3_resources),
1440 .resource = bfin_pint3_resources,
1443 static struct resource bfin_pint4_resources[] = {
1445 .start = PINT4_MASK_SET,
1446 .end = PINT4_LATCH + 3,
1447 .flags = IORESOURCE_MEM,
1452 .flags = IORESOURCE_IRQ,
1456 static struct platform_device bfin_pint4_device = {
1457 .name = ADI_PINT_DEVNAME,
1459 .num_resources = ARRAY_SIZE(bfin_pint4_resources),
1460 .resource = bfin_pint4_resources,
1463 static struct resource bfin_pint5_resources[] = {
1465 .start = PINT5_MASK_SET,
1466 .end = PINT5_LATCH + 3,
1467 .flags = IORESOURCE_MEM,
1472 .flags = IORESOURCE_IRQ,
1476 static struct platform_device bfin_pint5_device = {
1477 .name = ADI_PINT_DEVNAME,
1479 .num_resources = ARRAY_SIZE(bfin_pint5_resources),
1480 .resource = bfin_pint5_resources,
1483 static struct resource bfin_gpa_resources[] = {
1486 .end = PORTA_MUX + 3,
1487 .flags = IORESOURCE_MEM,
1492 .flags = IORESOURCE_IRQ,
1496 static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
1497 .port_pin_base = GPIO_PA0,
1498 .port_width = GPIO_BANKSIZE,
1499 .pint_id = 0, /* PINT0 */
1500 .pint_assign = true, /* PINT upper 16 bit */
1501 .pint_map = 0, /* mapping mask in PINT */
1504 static struct platform_device bfin_gpa_device = {
1505 .name = ADI_GPIO_DEVNAME,
1507 .num_resources = ARRAY_SIZE(bfin_gpa_resources),
1508 .resource = bfin_gpa_resources,
1510 .platform_data = &bfin_gpa_pdata, /* Passed to driver */
1514 static struct resource bfin_gpb_resources[] = {
1517 .end = PORTB_MUX + 3,
1518 .flags = IORESOURCE_MEM,
1523 .flags = IORESOURCE_IRQ,
1527 static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
1528 .port_pin_base = GPIO_PB0,
1529 .port_width = GPIO_BANKSIZE,
1531 .pint_assign = false,
1535 static struct platform_device bfin_gpb_device = {
1536 .name = ADI_GPIO_DEVNAME,
1538 .num_resources = ARRAY_SIZE(bfin_gpb_resources),
1539 .resource = bfin_gpb_resources,
1541 .platform_data = &bfin_gpb_pdata, /* Passed to driver */
1545 static struct resource bfin_gpc_resources[] = {
1548 .end = PORTC_MUX + 3,
1549 .flags = IORESOURCE_MEM,
1554 .flags = IORESOURCE_IRQ,
1558 static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
1559 .port_pin_base = GPIO_PC0,
1560 .port_width = GPIO_BANKSIZE,
1562 .pint_assign = false,
1566 static struct platform_device bfin_gpc_device = {
1567 .name = ADI_GPIO_DEVNAME,
1569 .num_resources = ARRAY_SIZE(bfin_gpc_resources),
1570 .resource = bfin_gpc_resources,
1572 .platform_data = &bfin_gpc_pdata, /* Passed to driver */
1576 static struct resource bfin_gpd_resources[] = {
1579 .end = PORTD_MUX + 3,
1580 .flags = IORESOURCE_MEM,
1585 .flags = IORESOURCE_IRQ,
1589 static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
1590 .port_pin_base = GPIO_PD0,
1591 .port_width = GPIO_BANKSIZE,
1593 .pint_assign = false,
1597 static struct platform_device bfin_gpd_device = {
1598 .name = ADI_GPIO_DEVNAME,
1600 .num_resources = ARRAY_SIZE(bfin_gpd_resources),
1601 .resource = bfin_gpd_resources,
1603 .platform_data = &bfin_gpd_pdata, /* Passed to driver */
1607 static struct resource bfin_gpe_resources[] = {
1610 .end = PORTE_MUX + 3,
1611 .flags = IORESOURCE_MEM,
1616 .flags = IORESOURCE_IRQ,
1620 static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
1621 .port_pin_base = GPIO_PE0,
1622 .port_width = GPIO_BANKSIZE,
1624 .pint_assign = false,
1628 static struct platform_device bfin_gpe_device = {
1629 .name = ADI_GPIO_DEVNAME,
1631 .num_resources = ARRAY_SIZE(bfin_gpe_resources),
1632 .resource = bfin_gpe_resources,
1634 .platform_data = &bfin_gpe_pdata, /* Passed to driver */
1638 static struct resource bfin_gpf_resources[] = {
1641 .end = PORTF_MUX + 3,
1642 .flags = IORESOURCE_MEM,
1647 .flags = IORESOURCE_IRQ,
1651 static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
1652 .port_pin_base = GPIO_PF0,
1653 .port_width = GPIO_BANKSIZE,
1655 .pint_assign = false,
1659 static struct platform_device bfin_gpf_device = {
1660 .name = ADI_GPIO_DEVNAME,
1662 .num_resources = ARRAY_SIZE(bfin_gpf_resources),
1663 .resource = bfin_gpf_resources,
1665 .platform_data = &bfin_gpf_pdata, /* Passed to driver */
1669 static struct resource bfin_gpg_resources[] = {
1672 .end = PORTG_MUX + 3,
1673 .flags = IORESOURCE_MEM,
1678 .flags = IORESOURCE_IRQ,
1682 static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
1683 .port_pin_base = GPIO_PG0,
1684 .port_width = GPIO_BANKSIZE,
1686 .pint_assign = false,
1690 static struct platform_device bfin_gpg_device = {
1691 .name = ADI_GPIO_DEVNAME,
1693 .num_resources = ARRAY_SIZE(bfin_gpg_resources),
1694 .resource = bfin_gpg_resources,
1696 .platform_data = &bfin_gpg_pdata, /* Passed to driver */
1702 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1703 #include <linux/input.h>
1704 #include <linux/gpio_keys.h>
1706 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1707 {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
1708 {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
1711 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1712 .buttons = bfin_gpio_keys_table,
1713 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1716 static struct platform_device bfin_device_gpiokeys = {
1717 .name = "gpio-keys",
1719 .platform_data = &bfin_gpio_keys_data,
1724 static struct spi_board_info bfin_spi_board_info[] __initdata = {
1725 #if IS_ENABLED(CONFIG_MTD_M25P80)
1727 /* the modalias must be the same as spi device driver name */
1728 .modalias = "m25p80", /* Name of spi_driver for this device */
1729 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1730 .bus_num = 0, /* Framework bus number */
1731 .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
1732 .platform_data = &bfin_spi_flash_data,
1733 .controller_data = &spi_flash_chip_info,
1737 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1739 .modalias = "ad7877",
1740 .platform_data = &bfin_ad7877_ts_info,
1742 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1744 .chip_select = MAX_CTRL_CS + GPIO_PC15, /* SPI_SSEL4 */
1747 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
1749 .modalias = "spidev",
1750 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1752 .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
1753 .controller_data = &spidev_chip_info,
1756 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
1758 .modalias = "adxl34x",
1759 .platform_data = &adxl34x_info,
1761 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1768 #if IS_ENABLED(CONFIG_SPI_ADI_V3)
1770 static struct resource bfin_spi0_resource[] = {
1772 .start = SPI0_REGBASE,
1773 .end = SPI0_REGBASE + 0xFF,
1774 .flags = IORESOURCE_MEM,
1777 .start = CH_SPI0_TX,
1779 .flags = IORESOURCE_DMA,
1782 .start = CH_SPI0_RX,
1784 .flags = IORESOURCE_DMA,
1789 static struct resource bfin_spi1_resource[] = {
1791 .start = SPI1_REGBASE,
1792 .end = SPI1_REGBASE + 0xFF,
1793 .flags = IORESOURCE_MEM,
1796 .start = CH_SPI1_TX,
1798 .flags = IORESOURCE_DMA,
1801 .start = CH_SPI1_RX,
1803 .flags = IORESOURCE_DMA,
1808 /* SPI controller data */
1809 static struct adi_spi3_master bf60x_spi_master_info0 = {
1810 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1811 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1814 static struct platform_device bf60x_spi_master0 = {
1816 .id = 0, /* Bus number */
1817 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1818 .resource = bfin_spi0_resource,
1820 .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
1824 static struct adi_spi3_master bf60x_spi_master_info1 = {
1825 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1826 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1829 static struct platform_device bf60x_spi_master1 = {
1831 .id = 1, /* Bus number */
1832 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1833 .resource = bfin_spi1_resource,
1835 .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
1838 #endif /* spi master and devices */
1840 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1841 static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1843 static struct resource bfin_twi0_resource[] = {
1845 .start = TWI0_CLKDIV,
1846 .end = TWI0_CLKDIV + 0xFF,
1847 .flags = IORESOURCE_MEM,
1852 .flags = IORESOURCE_IRQ,
1856 static struct platform_device i2c_bfin_twi0_device = {
1857 .name = "i2c-bfin-twi",
1859 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1860 .resource = bfin_twi0_resource,
1862 .platform_data = &bfin_twi0_pins,
1866 static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1868 static struct resource bfin_twi1_resource[] = {
1870 .start = TWI1_CLKDIV,
1871 .end = TWI1_CLKDIV + 0xFF,
1872 .flags = IORESOURCE_MEM,
1877 .flags = IORESOURCE_IRQ,
1881 static struct platform_device i2c_bfin_twi1_device = {
1882 .name = "i2c-bfin-twi",
1884 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1885 .resource = bfin_twi1_resource,
1887 .platform_data = &bfin_twi1_pins,
1892 #if IS_ENABLED(CONFIG_GPIO_MCP23S08)
1893 #include <linux/spi/mcp23s08.h>
1894 static const struct mcp23s08_platform_data bfin_mcp23s08_soft_switch0 = {
1897 static const struct mcp23s08_platform_data bfin_mcp23s08_soft_switch1 = {
1900 static const struct mcp23s08_platform_data bfin_mcp23s08_soft_switch2 = {
1903 # if IS_ENABLED(CONFIG_VIDEO_ADV7842)
1904 static const struct mcp23s08_platform_data bfin_adv7842_soft_switch = {
1908 # if IS_ENABLED(CONFIG_VIDEO_ADV7511) || IS_ENABLED(CONFIG_VIDEO_ADV7343)
1909 static const struct mcp23s08_platform_data bfin_adv7511_soft_switch = {
1915 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1916 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
1918 I2C_BOARD_INFO("adxl34x", 0x53),
1920 .platform_data = (void *)&adxl34x_info,
1923 #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
1925 I2C_BOARD_INFO("adau1761", 0x38),
1926 .platform_data = (void *)&adau1761_info
1929 #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
1931 I2C_BOARD_INFO("ssm2602", 0x1b),
1934 #if IS_ENABLED(CONFIG_GPIO_MCP23S08)
1936 I2C_BOARD_INFO("mcp23017", 0x21),
1937 .platform_data = (void *)&bfin_mcp23s08_soft_switch0
1940 I2C_BOARD_INFO("mcp23017", 0x22),
1941 .platform_data = (void *)&bfin_mcp23s08_soft_switch1
1944 I2C_BOARD_INFO("mcp23017", 0x23),
1945 .platform_data = (void *)&bfin_mcp23s08_soft_switch2
1947 # if IS_ENABLED(CONFIG_VIDEO_ADV7842)
1949 I2C_BOARD_INFO("mcp23017", 0x26),
1950 .platform_data = (void *)&bfin_adv7842_soft_switch
1953 # if IS_ENABLED(CONFIG_VIDEO_ADV7511) || IS_ENABLED(CONFIG_VIDEO_ADV7343)
1955 I2C_BOARD_INFO("mcp23017", 0x25),
1956 .platform_data = (void *)&bfin_adv7511_soft_switch
1962 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1965 static const unsigned int cclk_vlev_datasheet[] =
1968 * Internal VLEV BF54XSBBC1533
1969 ****temporarily using these values until data sheet is updated
1971 VRPAIR(VLEV_085, 150000000),
1972 VRPAIR(VLEV_090, 250000000),
1973 VRPAIR(VLEV_110, 276000000),
1974 VRPAIR(VLEV_115, 301000000),
1975 VRPAIR(VLEV_120, 525000000),
1976 VRPAIR(VLEV_125, 550000000),
1977 VRPAIR(VLEV_130, 600000000),
1980 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1981 .tuple_tab = cclk_vlev_datasheet,
1982 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1983 .vr_settling_time = 25 /* us */,
1986 static struct platform_device bfin_dpmc = {
1987 .name = "bfin dpmc",
1989 .platform_data = &bfin_dmpc_vreg_data,
1993 static struct platform_device *ezkit_devices[] __initdata = {
1996 #if defined(CONFIG_PINCTRL_ADI2)
1997 &bfin_pinctrl_device,
2013 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
2017 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
2018 #ifdef CONFIG_SERIAL_BFIN_UART0
2021 #ifdef CONFIG_SERIAL_BFIN_UART1
2026 #if IS_ENABLED(CONFIG_BFIN_SIR)
2027 #ifdef CONFIG_BFIN_SIR0
2030 #ifdef CONFIG_BFIN_SIR1
2035 #if IS_ENABLED(CONFIG_STMMAC_ETH)
2039 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
2043 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
2044 &bfin_isp1760_device,
2047 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
2048 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2049 &bfin_sport0_uart_device,
2051 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2052 &bfin_sport1_uart_device,
2054 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
2055 &bfin_sport2_uart_device,
2059 #if IS_ENABLED(CONFIG_CAN_BFIN)
2063 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
2067 #if IS_ENABLED(CONFIG_SDH_BFIN)
2071 #if IS_ENABLED(CONFIG_SPI_ADI_V3)
2076 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
2077 &bfin_rotary_device,
2080 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
2081 &i2c_bfin_twi0_device,
2082 #if !defined(CONFIG_BF542)
2083 &i2c_bfin_twi1_device,
2087 #if defined(CONFIG_BFIN_CRC)
2091 #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
2092 &bfin_crypto_crc_device,
2095 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
2096 &bfin_device_gpiokeys,
2099 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
2100 &ezkit_flash_device,
2102 #if IS_ENABLED(CONFIG_SND_BF6XX_PCM)
2105 #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
2108 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
2109 &bfin_ad1836_machine,
2111 #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
2114 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
2115 &bfin_capture_device,
2117 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
2118 &bfin_display_device,
2123 /* Pin control settings */
2124 static struct pinctrl_map __initdata bfin_pinmux_map[] = {
2125 /* per-device maps */
2126 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
2127 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
2128 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
2129 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
2130 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
2131 PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL, "eth0"),
2132 PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.0", "pinctrl-adi2.0", NULL, "spi0"),
2133 PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.1", "pinctrl-adi2.0", NULL, "spi1"),
2134 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
2135 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
2136 PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
2137 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
2138 PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL, "smc0"),
2139 PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.0", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
2140 PIN_MAP_MUX_GROUP("bfin_display.0", "8bit", "pinctrl-adi2.0", "ppi2_8bgrp", "ppi2"),
2141 PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
2142 PIN_MAP_MUX_GROUP("bfin_display.0", "16bit", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
2143 PIN_MAP_MUX_GROUP("bfin_capture.0", "8bit", "pinctrl-adi2.0", "ppi0_8bgrp", "ppi0"),
2144 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"),
2145 PIN_MAP_MUX_GROUP("bfin_capture.0", "16bit", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"),
2146 PIN_MAP_MUX_GROUP("bfin_capture.0", "24bit", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"),
2147 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
2148 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
2149 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
2150 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
2151 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
2152 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
2155 static int __init ezkit_init(void)
2157 printk(KERN_INFO "%s(): registering device resources\n", __func__);
2159 /* Initialize pinmuxing */
2160 pinctrl_register_mappings(bfin_pinmux_map,
2161 ARRAY_SIZE(bfin_pinmux_map));
2163 i2c_register_board_info(0, bfin_i2c_board_info0,
2164 ARRAY_SIZE(bfin_i2c_board_info0));
2165 i2c_register_board_info(1, bfin_i2c_board_info1,
2166 ARRAY_SIZE(bfin_i2c_board_info1));
2168 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
2170 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
2175 arch_initcall(ezkit_init);
2177 static struct platform_device *ezkit_early_devices[] __initdata = {
2178 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2179 #ifdef CONFIG_SERIAL_BFIN_UART0
2182 #ifdef CONFIG_SERIAL_BFIN_UART1
2188 void __init native_machine_early_platform_add_devices(void)
2190 printk(KERN_INFO "register early platform devices\n");
2191 early_platform_add_devices(ezkit_early_devices,
2192 ARRAY_SIZE(ezkit_early_devices));