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 <asm/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
[] = {
93 .flags
= IORESOURCE_IRQ
,
97 static struct platform_device bfin_rotary_device
= {
98 .name
= "bfin-rotary",
100 .num_resources
= ARRAY_SIZE(bfin_rotary_resources
),
101 .resource
= bfin_rotary_resources
,
103 .platform_data
= &bfin_rotary_data
,
108 #if IS_ENABLED(CONFIG_STMMAC_ETH)
109 #include <linux/stmmac.h>
110 #include <linux/phy.h>
112 static struct stmmac_mdio_bus_data phy_private_data
= {
116 static struct stmmac_dma_cfg eth_dma_cfg
= {
120 int stmmac_ptp_clk_init(struct platform_device
*pdev
, void *priv
)
122 bfin_write32(PADS0_EMAC_PTP_CLKSEL
, 0);
126 static struct plat_stmmacenet_data eth_private_data
= {
131 .mdio_bus_data
= &phy_private_data
,
132 .dma_cfg
= ð_dma_cfg
,
133 .force_thresh_dma_mode
= 1,
134 .interface
= PHY_INTERFACE_MODE_RMII
,
135 .init
= stmmac_ptp_clk_init
,
138 static struct platform_device bfin_eth_device
= {
142 .resource
= (struct resource
[]) {
144 .start
= EMAC0_MACCFG
,
145 .end
= EMAC0_MACCFG
+ 0x1274,
146 .flags
= IORESOURCE_MEM
,
150 .start
= IRQ_EMAC0_STAT
,
151 .end
= IRQ_EMAC0_STAT
,
152 .flags
= IORESOURCE_IRQ
,
156 .power
.can_wakeup
= 1,
157 .platform_data
= ð_private_data
,
162 #if IS_ENABLED(CONFIG_INPUT_ADXL34X)
163 #include <linux/input/adxl34x.h>
164 static const struct adxl34x_platform_data adxl34x_info
= {
168 .tap_threshold
= 0x31,
169 .tap_duration
= 0x10,
172 .tap_axis_control
= ADXL_TAP_X_EN
| ADXL_TAP_Y_EN
| ADXL_TAP_Z_EN
,
173 .act_axis_control
= 0xFF,
174 .activity_threshold
= 5,
175 .inactivity_threshold
= 3,
176 .inactivity_time
= 4,
177 .free_fall_threshold
= 0x7,
178 .free_fall_time
= 0x20,
180 .data_range
= ADXL_FULL_RES
,
183 .ev_code_x
= ABS_X
, /* EV_REL */
184 .ev_code_y
= ABS_Y
, /* EV_REL */
185 .ev_code_z
= ABS_Z
, /* EV_REL */
187 .ev_code_tap
= {BTN_TOUCH
, BTN_TOUCH
, BTN_TOUCH
}, /* EV_KEY x,y,z */
189 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
190 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
191 .power_mode
= ADXL_AUTO_SLEEP
| ADXL_LINK
,
192 .fifo_mode
= ADXL_FIFO_STREAM
,
193 .orientation_enable
= ADXL_EN_ORIENTATION_3D
,
194 .deadzone_angle
= ADXL_DEADZONE_ANGLE_10p8
,
195 .divisor_length
= ADXL_LP_FILTER_DIVISOR_16
,
196 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
197 .ev_codes_orient_3d
= {BTN_Z
, BTN_Y
, BTN_X
, BTN_A
, BTN_B
, BTN_C
},
201 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
202 static struct platform_device rtc_device
= {
208 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
209 #ifdef CONFIG_SERIAL_BFIN_UART0
210 static struct resource bfin_uart0_resources
[] = {
212 .start
= UART0_REVID
,
213 .end
= UART0_RXDIV
+4,
214 .flags
= IORESOURCE_MEM
,
216 #ifdef CONFIG_EARLY_PRINTK
220 .flags
= IORESOURCE_REG
,
225 .flags
= IORESOURCE_REG
,
229 .start
= IRQ_UART0_TX
,
231 .flags
= IORESOURCE_IRQ
,
234 .start
= IRQ_UART0_RX
,
236 .flags
= IORESOURCE_IRQ
,
239 .start
= IRQ_UART0_STAT
,
240 .end
= IRQ_UART0_STAT
,
241 .flags
= IORESOURCE_IRQ
,
244 .start
= CH_UART0_TX
,
246 .flags
= IORESOURCE_DMA
,
249 .start
= CH_UART0_RX
,
251 .flags
= IORESOURCE_DMA
,
253 #ifdef CONFIG_BFIN_UART0_CTSRTS
254 { /* CTS pin -- 0 means not supported */
257 .flags
= IORESOURCE_IO
,
259 { /* RTS pin -- 0 means not supported */
262 .flags
= IORESOURCE_IO
,
267 static unsigned short bfin_uart0_peripherals
[] = {
268 P_UART0_TX
, P_UART0_RX
,
269 #ifdef CONFIG_BFIN_UART0_CTSRTS
270 P_UART0_RTS
, P_UART0_CTS
,
275 static struct platform_device bfin_uart0_device
= {
278 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
279 .resource
= bfin_uart0_resources
,
281 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
285 #ifdef CONFIG_SERIAL_BFIN_UART1
286 static struct resource bfin_uart1_resources
[] = {
288 .start
= UART1_REVID
,
289 .end
= UART1_RXDIV
+4,
290 .flags
= IORESOURCE_MEM
,
292 #ifdef CONFIG_EARLY_PRINTK
294 .start
= PORTG_FER_SET
,
295 .end
= PORTG_FER_SET
+2,
296 .flags
= IORESOURCE_REG
,
300 .start
= IRQ_UART1_TX
,
302 .flags
= IORESOURCE_IRQ
,
305 .start
= IRQ_UART1_RX
,
307 .flags
= IORESOURCE_IRQ
,
310 .start
= IRQ_UART1_STAT
,
311 .end
= IRQ_UART1_STAT
,
312 .flags
= IORESOURCE_IRQ
,
315 .start
= CH_UART1_TX
,
317 .flags
= IORESOURCE_DMA
,
320 .start
= CH_UART1_RX
,
322 .flags
= IORESOURCE_DMA
,
324 #ifdef CONFIG_BFIN_UART1_CTSRTS
325 { /* CTS pin -- 0 means not supported */
328 .flags
= IORESOURCE_IO
,
330 { /* RTS pin -- 0 means not supported */
333 .flags
= IORESOURCE_IO
,
338 static unsigned short bfin_uart1_peripherals
[] = {
339 P_UART1_TX
, P_UART1_RX
,
340 #ifdef CONFIG_BFIN_UART1_CTSRTS
341 P_UART1_RTS
, P_UART1_CTS
,
346 static struct platform_device bfin_uart1_device
= {
349 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
350 .resource
= bfin_uart1_resources
,
352 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
358 #if IS_ENABLED(CONFIG_BFIN_SIR)
359 #ifdef CONFIG_BFIN_SIR0
360 static struct resource bfin_sir0_resources
[] = {
364 .flags
= IORESOURCE_MEM
,
367 .start
= IRQ_UART0_TX
,
368 .end
= IRQ_UART0_TX
+1,
369 .flags
= IORESOURCE_IRQ
,
372 .start
= CH_UART0_TX
,
373 .end
= CH_UART0_TX
+1,
374 .flags
= IORESOURCE_DMA
,
377 static struct platform_device bfin_sir0_device
= {
380 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
381 .resource
= bfin_sir0_resources
,
384 #ifdef CONFIG_BFIN_SIR1
385 static struct resource bfin_sir1_resources
[] = {
389 .flags
= IORESOURCE_MEM
,
392 .start
= IRQ_UART1_TX
,
393 .end
= IRQ_UART1_TX
+1,
394 .flags
= IORESOURCE_IRQ
,
397 .start
= CH_UART1_TX
,
398 .end
= CH_UART1_TX
+1,
399 .flags
= IORESOURCE_DMA
,
402 static struct platform_device bfin_sir1_device
= {
405 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
406 .resource
= bfin_sir1_resources
,
411 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
412 static struct resource musb_resources
[] = {
416 .flags
= IORESOURCE_MEM
,
418 [1] = { /* general IRQ */
419 .start
= IRQ_USB_STAT
,
421 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
424 [2] = { /* DMA IRQ */
425 .start
= IRQ_USB_DMA
,
427 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
432 static struct musb_hdrc_config musb_config
= {
438 .clkin
= 48, /* musb CLKIN in MHZ */
441 static struct musb_hdrc_platform_data musb_plat
= {
442 #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
444 #elif defined(CONFIG_USB_MUSB_HDRC)
446 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
447 .mode
= MUSB_PERIPHERAL
,
449 .config
= &musb_config
,
452 static u64 musb_dmamask
= ~(u32
)0;
454 static struct platform_device musb_device
= {
455 .name
= "musb-blackfin",
458 .dma_mask
= &musb_dmamask
,
459 .coherent_dma_mask
= 0xffffffff,
460 .platform_data
= &musb_plat
,
462 .num_resources
= ARRAY_SIZE(musb_resources
),
463 .resource
= musb_resources
,
467 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
468 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
469 static struct resource bfin_sport0_uart_resources
[] = {
471 .start
= SPORT0_TCR1
,
472 .end
= SPORT0_MRCS3
+4,
473 .flags
= IORESOURCE_MEM
,
476 .start
= IRQ_SPORT0_RX
,
477 .end
= IRQ_SPORT0_RX
+1,
478 .flags
= IORESOURCE_IRQ
,
481 .start
= IRQ_SPORT0_ERROR
,
482 .end
= IRQ_SPORT0_ERROR
,
483 .flags
= IORESOURCE_IRQ
,
487 static unsigned short bfin_sport0_peripherals
[] = {
488 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
489 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
492 static struct platform_device bfin_sport0_uart_device
= {
493 .name
= "bfin-sport-uart",
495 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
496 .resource
= bfin_sport0_uart_resources
,
498 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
502 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
503 static struct resource bfin_sport1_uart_resources
[] = {
505 .start
= SPORT1_TCR1
,
506 .end
= SPORT1_MRCS3
+4,
507 .flags
= IORESOURCE_MEM
,
510 .start
= IRQ_SPORT1_RX
,
511 .end
= IRQ_SPORT1_RX
+1,
512 .flags
= IORESOURCE_IRQ
,
515 .start
= IRQ_SPORT1_ERROR
,
516 .end
= IRQ_SPORT1_ERROR
,
517 .flags
= IORESOURCE_IRQ
,
521 static unsigned short bfin_sport1_peripherals
[] = {
522 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
523 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
526 static struct platform_device bfin_sport1_uart_device
= {
527 .name
= "bfin-sport-uart",
529 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
530 .resource
= bfin_sport1_uart_resources
,
532 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
536 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
537 static struct resource bfin_sport2_uart_resources
[] = {
539 .start
= SPORT2_TCR1
,
540 .end
= SPORT2_MRCS3
+4,
541 .flags
= IORESOURCE_MEM
,
544 .start
= IRQ_SPORT2_RX
,
545 .end
= IRQ_SPORT2_RX
+1,
546 .flags
= IORESOURCE_IRQ
,
549 .start
= IRQ_SPORT2_ERROR
,
550 .end
= IRQ_SPORT2_ERROR
,
551 .flags
= IORESOURCE_IRQ
,
555 static unsigned short bfin_sport2_peripherals
[] = {
556 P_SPORT2_TFS
, P_SPORT2_DTPRI
, P_SPORT2_TSCLK
, P_SPORT2_RFS
,
557 P_SPORT2_DRPRI
, P_SPORT2_RSCLK
, P_SPORT2_DRSEC
, P_SPORT2_DTSEC
, 0
560 static struct platform_device bfin_sport2_uart_device
= {
561 .name
= "bfin-sport-uart",
563 .num_resources
= ARRAY_SIZE(bfin_sport2_uart_resources
),
564 .resource
= bfin_sport2_uart_resources
,
566 .platform_data
= &bfin_sport2_peripherals
, /* Passed to driver */
572 #if IS_ENABLED(CONFIG_CAN_BFIN)
574 static unsigned short bfin_can0_peripherals
[] = {
575 P_CAN0_RX
, P_CAN0_TX
, 0
578 static struct resource bfin_can0_resources
[] = {
582 .flags
= IORESOURCE_MEM
,
585 .start
= IRQ_CAN0_RX
,
587 .flags
= IORESOURCE_IRQ
,
590 .start
= IRQ_CAN0_TX
,
592 .flags
= IORESOURCE_IRQ
,
595 .start
= IRQ_CAN0_STAT
,
596 .end
= IRQ_CAN0_STAT
,
597 .flags
= IORESOURCE_IRQ
,
601 static struct platform_device bfin_can0_device
= {
604 .num_resources
= ARRAY_SIZE(bfin_can0_resources
),
605 .resource
= bfin_can0_resources
,
607 .platform_data
= &bfin_can0_peripherals
, /* Passed to driver */
613 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
614 static struct mtd_partition partition_info
[] = {
616 .name
= "bootloader(nand)",
620 .name
= "linux kernel(nand)",
621 .offset
= MTDPART_OFS_APPEND
,
622 .size
= 4 * 1024 * 1024,
625 .name
= "file system(nand)",
626 .offset
= MTDPART_OFS_APPEND
,
627 .size
= MTDPART_SIZ_FULL
,
631 static struct bf5xx_nand_platform bfin_nand_platform
= {
632 .data_width
= NFC_NWIDTH_8
,
633 .partitions
= partition_info
,
634 .nr_partitions
= ARRAY_SIZE(partition_info
),
639 static struct resource bfin_nand_resources
[] = {
643 .flags
= IORESOURCE_MEM
,
648 .flags
= IORESOURCE_IRQ
,
652 static struct platform_device bfin_nand_device
= {
655 .num_resources
= ARRAY_SIZE(bfin_nand_resources
),
656 .resource
= bfin_nand_resources
,
658 .platform_data
= &bfin_nand_platform
,
663 #if IS_ENABLED(CONFIG_SDH_BFIN)
665 static struct bfin_sd_host bfin_sdh_data
= {
667 .irq_int0
= IRQ_RSI_INT0
,
668 .pin_req
= {P_RSI_DATA0
, P_RSI_DATA1
, P_RSI_DATA2
, P_RSI_DATA3
, P_RSI_CMD
, P_RSI_CLK
, 0},
671 static struct platform_device bfin_sdh_device
= {
675 .platform_data
= &bfin_sdh_data
,
680 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
681 static struct mtd_partition ezkit_partitions
[] = {
683 .name
= "bootloader(nor)",
687 .name
= "linux kernel(nor)",
689 .offset
= MTDPART_OFS_APPEND
,
691 .name
= "file system(nor)",
692 .size
= 0x1000000 - 0x80000 - 0x400000,
693 .offset
= MTDPART_OFS_APPEND
,
697 int bf609_nor_flash_init(struct platform_device
*pdev
)
699 #define CONFIG_SMC_GCTL_VAL 0x00000010
701 if (!devm_pinctrl_get_select_default(&pdev
->dev
))
703 bfin_write32(SMC_GCTL
, CONFIG_SMC_GCTL_VAL
);
704 bfin_write32(SMC_B0CTL
, 0x01002011);
705 bfin_write32(SMC_B0TIM
, 0x08170977);
706 bfin_write32(SMC_B0ETIM
, 0x00092231);
710 void bf609_nor_flash_exit(struct platform_device
*pdev
)
712 devm_pinctrl_put(pdev
->dev
.pins
->p
);
713 bfin_write32(SMC_GCTL
, 0);
716 static struct physmap_flash_data ezkit_flash_data
= {
718 .parts
= ezkit_partitions
,
719 .init
= bf609_nor_flash_init
,
720 .exit
= bf609_nor_flash_exit
,
721 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
722 #ifdef CONFIG_ROMKERNEL
723 .probe_type
= "map_rom",
727 static struct resource ezkit_flash_resource
= {
730 .flags
= IORESOURCE_MEM
,
733 static struct platform_device ezkit_flash_device
= {
734 .name
= "physmap-flash",
737 .platform_data
= &ezkit_flash_data
,
740 .resource
= &ezkit_flash_resource
,
744 #if IS_ENABLED(CONFIG_MTD_M25P80)
745 /* SPI flash chip (w25q32) */
746 static struct mtd_partition bfin_spi_flash_partitions
[] = {
748 .name
= "bootloader(spi)",
751 .mask_flags
= MTD_CAP_ROM
753 .name
= "linux kernel(spi)",
755 .offset
= MTDPART_OFS_APPEND
,
757 .name
= "file system(spi)",
758 .size
= MTDPART_SIZ_FULL
,
759 .offset
= MTDPART_OFS_APPEND
,
763 static struct flash_platform_data bfin_spi_flash_data
= {
765 .parts
= bfin_spi_flash_partitions
,
766 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
770 static struct adi_spi3_chip spi_flash_chip_info
= {
771 .enable_dma
= true, /* use dma transfer with this chip*/
775 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
776 static struct adi_spi3_chip spidev_chip_info
= {
781 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
782 static struct platform_device bfin_i2s_pcm
= {
783 .name
= "bfin-i2s-pcm-audio",
788 #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
789 #include <asm/bfin_sport3.h>
790 static struct resource bfin_snd_resources
[] = {
792 .start
= SPORT0_CTL_A
,
794 .flags
= IORESOURCE_MEM
,
797 .start
= SPORT0_CTL_B
,
799 .flags
= IORESOURCE_MEM
,
802 .start
= CH_SPORT0_TX
,
804 .flags
= IORESOURCE_DMA
,
807 .start
= CH_SPORT0_RX
,
809 .flags
= IORESOURCE_DMA
,
812 .start
= IRQ_SPORT0_TX_STAT
,
813 .end
= IRQ_SPORT0_TX_STAT
,
814 .flags
= IORESOURCE_IRQ
,
817 .start
= IRQ_SPORT0_RX_STAT
,
818 .end
= IRQ_SPORT0_RX_STAT
,
819 .flags
= IORESOURCE_IRQ
,
823 static const unsigned short bfin_snd_pin
[] = {
824 P_SPORT0_ACLK
, P_SPORT0_AFS
, P_SPORT0_AD0
, P_SPORT0_BCLK
,
825 P_SPORT0_BFS
, P_SPORT0_BD0
, 0,
828 static struct bfin_snd_platform_data bfin_snd_data
= {
829 .pin_req
= bfin_snd_pin
,
832 static struct platform_device bfin_i2s
= {
834 .num_resources
= ARRAY_SIZE(bfin_snd_resources
),
835 .resource
= bfin_snd_resources
,
837 .platform_data
= &bfin_snd_data
,
842 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
843 static const char * const ad1836_link
[] = {
847 static struct platform_device bfin_ad1836_machine
= {
848 .name
= "bfin-snd-ad1836",
851 .platform_data
= (void *)ad1836_link
,
856 #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
857 static struct platform_device adau1761_device
= {
858 .name
= "bfin-eval-adau1x61",
862 #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
863 #include <sound/adau17x1.h>
864 static struct adau1761_platform_data adau1761_info
= {
865 .lineout_mode
= ADAU1761_OUTPUT_MODE_LINE
,
866 .headphone_mode
= ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS
,
870 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
871 #include <linux/videodev2.h>
872 #include <media/blackfin/bfin_capture.h>
873 #include <media/blackfin/ppi.h>
875 static const unsigned short ppi_req
[] = {
876 P_PPI0_D0
, P_PPI0_D1
, P_PPI0_D2
, P_PPI0_D3
,
877 P_PPI0_D4
, P_PPI0_D5
, P_PPI0_D6
, P_PPI0_D7
,
878 P_PPI0_D8
, P_PPI0_D9
, P_PPI0_D10
, P_PPI0_D11
,
879 P_PPI0_D12
, P_PPI0_D13
, P_PPI0_D14
, P_PPI0_D15
,
880 #if !IS_ENABLED(CONFIG_VIDEO_VS6624)
881 P_PPI0_D16
, P_PPI0_D17
, P_PPI0_D18
, P_PPI0_D19
,
882 P_PPI0_D20
, P_PPI0_D21
, P_PPI0_D22
, P_PPI0_D23
,
884 P_PPI0_CLK
, P_PPI0_FS1
, P_PPI0_FS2
,
888 static const struct ppi_info ppi_info
= {
889 .type
= PPI_TYPE_EPPI3
,
890 .dma_ch
= CH_EPPI0_CH0
,
891 .irq_err
= IRQ_EPPI0_STAT
,
892 .base
= (void __iomem
*)EPPI0_STAT
,
896 #if IS_ENABLED(CONFIG_VIDEO_VS6624)
897 static struct v4l2_input vs6624_inputs
[] = {
901 .type
= V4L2_INPUT_TYPE_CAMERA
,
902 .std
= V4L2_STD_UNKNOWN
,
906 static struct bcap_route vs6624_routes
[] = {
913 static const unsigned vs6624_ce_pin
= GPIO_PE4
;
915 static struct bfin_capture_config bfin_capture_data
= {
916 .card_name
= "BF609",
917 .inputs
= vs6624_inputs
,
918 .num_inputs
= ARRAY_SIZE(vs6624_inputs
),
919 .routes
= vs6624_routes
,
924 .platform_data
= (void *)&vs6624_ce_pin
,
926 .ppi_info
= &ppi_info
,
927 .ppi_control
= (PACK_EN
| DLEN_8
| EPPI_CTL_FS1HI_FS2HI
928 | EPPI_CTL_POLC3
| EPPI_CTL_SYNC2
| EPPI_CTL_NON656
),
933 #if IS_ENABLED(CONFIG_VIDEO_ADV7842)
934 #include <media/adv7842.h>
936 static struct v4l2_input adv7842_inputs
[] = {
940 .type
= V4L2_INPUT_TYPE_CAMERA
,
942 .capabilities
= V4L2_IN_CAP_STD
,
947 .type
= V4L2_INPUT_TYPE_CAMERA
,
949 .capabilities
= V4L2_IN_CAP_STD
,
954 .type
= V4L2_INPUT_TYPE_CAMERA
,
955 .capabilities
= V4L2_IN_CAP_DV_TIMINGS
,
960 .type
= V4L2_INPUT_TYPE_CAMERA
,
961 .capabilities
= V4L2_IN_CAP_DV_TIMINGS
,
966 .type
= V4L2_INPUT_TYPE_CAMERA
,
967 .capabilities
= V4L2_IN_CAP_DV_TIMINGS
,
971 static struct bcap_route adv7842_routes
[] = {
975 .ppi_control
= (PACK_EN
| DLEN_8
| EPPI_CTL_FLDSEL
976 | EPPI_CTL_ACTIVE656
),
993 .ppi_control
= (EPPI_CTL_SPLTWRD
| PACK_EN
| DLEN_16
994 | EPPI_CTL_FS1LO_FS2LO
| EPPI_CTL_POLC2
995 | EPPI_CTL_SYNC2
| EPPI_CTL_NON656
),
999 static struct adv7842_output_format adv7842_opf
[] = {
1001 .op_ch_sel
= ADV7842_OP_CH_SEL_BRG
,
1002 .op_format_sel
= ADV7842_OP_FORMAT_SEL_SDR_ITU656_8
,
1005 .insert_av_codes
= 1,
1008 .op_ch_sel
= ADV7842_OP_CH_SEL_RGB
,
1009 .op_format_sel
= ADV7842_OP_FORMAT_SEL_SDR_ITU656_16
,
1015 static struct adv7842_platform_data adv7842_data
= {
1017 .num_opf
= ARRAY_SIZE(adv7842_opf
),
1018 .ain_sel
= ADV7842_AIN10_11_12_NC_SYNC_4_1
,
1019 .prim_mode
= ADV7842_PRIM_MODE_SDP
,
1020 .vid_std_select
= ADV7842_SDP_VID_STD_CVBS_SD_4x1
,
1021 .hdmi_free_run_enable
= 1,
1022 .sdp_free_run_auto
= 1,
1023 .llc_dll_phase
= 0x10,
1030 .i2c_repeater
= 0x46,
1032 .i2c_infoframe
= 0x48,
1038 static struct bfin_capture_config bfin_capture_data
= {
1039 .card_name
= "BF609",
1040 .inputs
= adv7842_inputs
,
1041 .num_inputs
= ARRAY_SIZE(adv7842_inputs
),
1042 .routes
= adv7842_routes
,
1043 .i2c_adapter_id
= 0,
1047 .platform_data
= (void *)&adv7842_data
,
1049 .ppi_info
= &ppi_info
,
1050 .ppi_control
= (PACK_EN
| DLEN_8
| EPPI_CTL_FLDSEL
1051 | EPPI_CTL_ACTIVE656
),
1055 static struct platform_device bfin_capture_device
= {
1056 .name
= "bfin_capture",
1058 .platform_data
= &bfin_capture_data
,
1063 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
1064 #include <linux/videodev2.h>
1065 #include <media/blackfin/bfin_display.h>
1066 #include <media/blackfin/ppi.h>
1068 static const unsigned short ppi_req_disp
[] = {
1069 P_PPI0_D0
, P_PPI0_D1
, P_PPI0_D2
, P_PPI0_D3
,
1070 P_PPI0_D4
, P_PPI0_D5
, P_PPI0_D6
, P_PPI0_D7
,
1071 P_PPI0_D8
, P_PPI0_D9
, P_PPI0_D10
, P_PPI0_D11
,
1072 P_PPI0_D12
, P_PPI0_D13
, P_PPI0_D14
, P_PPI0_D15
,
1073 P_PPI0_CLK
, P_PPI0_FS1
, P_PPI0_FS2
,
1077 static const struct ppi_info ppi_info
= {
1078 .type
= PPI_TYPE_EPPI3
,
1079 .dma_ch
= CH_EPPI0_CH0
,
1080 .irq_err
= IRQ_EPPI0_STAT
,
1081 .base
= (void __iomem
*)EPPI0_STAT
,
1082 .pin_req
= ppi_req_disp
,
1085 #if IS_ENABLED(CONFIG_VIDEO_ADV7511)
1086 #include <media/adv7511.h>
1088 static struct v4l2_output adv7511_outputs
[] = {
1092 .type
= V4L2_INPUT_TYPE_CAMERA
,
1093 .capabilities
= V4L2_OUT_CAP_DV_TIMINGS
,
1097 static struct disp_route adv7511_routes
[] = {
1103 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_BFIN_CRC)
1211 #define BFIN_CRC_NAME "bfin-crc"
1213 static struct resource bfin_crc0_resources
[] = {
1215 .start
= REG_CRC0_CTL
,
1216 .end
= REG_CRC0_REVID
+4,
1217 .flags
= IORESOURCE_MEM
,
1220 .start
= IRQ_CRC0_DCNTEXP
,
1221 .end
= IRQ_CRC0_DCNTEXP
,
1222 .flags
= IORESOURCE_IRQ
,
1225 .start
= CH_MEM_STREAM0_SRC_CRC0
,
1226 .end
= CH_MEM_STREAM0_SRC_CRC0
,
1227 .flags
= IORESOURCE_DMA
,
1230 .start
= CH_MEM_STREAM0_DEST_CRC0
,
1231 .end
= CH_MEM_STREAM0_DEST_CRC0
,
1232 .flags
= IORESOURCE_DMA
,
1236 static struct platform_device bfin_crc0_device
= {
1237 .name
= BFIN_CRC_NAME
,
1239 .num_resources
= ARRAY_SIZE(bfin_crc0_resources
),
1240 .resource
= bfin_crc0_resources
,
1243 static struct resource bfin_crc1_resources
[] = {
1245 .start
= REG_CRC1_CTL
,
1246 .end
= REG_CRC1_REVID
+4,
1247 .flags
= IORESOURCE_MEM
,
1250 .start
= IRQ_CRC1_DCNTEXP
,
1251 .end
= IRQ_CRC1_DCNTEXP
,
1252 .flags
= IORESOURCE_IRQ
,
1255 .start
= CH_MEM_STREAM1_SRC_CRC1
,
1256 .end
= CH_MEM_STREAM1_SRC_CRC1
,
1257 .flags
= IORESOURCE_DMA
,
1260 .start
= CH_MEM_STREAM1_DEST_CRC1
,
1261 .end
= CH_MEM_STREAM1_DEST_CRC1
,
1262 .flags
= IORESOURCE_DMA
,
1266 static struct platform_device bfin_crc1_device
= {
1267 .name
= BFIN_CRC_NAME
,
1269 .num_resources
= ARRAY_SIZE(bfin_crc1_resources
),
1270 .resource
= bfin_crc1_resources
,
1274 #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
1275 #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
1276 #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
1278 static struct resource bfin_crypto_crc_resources
[] = {
1280 .start
= REG_CRC0_CTL
,
1281 .end
= REG_CRC0_REVID
+4,
1282 .flags
= IORESOURCE_MEM
,
1285 .start
= IRQ_CRC0_DCNTEXP
,
1286 .end
= IRQ_CRC0_DCNTEXP
,
1287 .flags
= IORESOURCE_IRQ
,
1290 .start
= CH_MEM_STREAM0_SRC_CRC0
,
1291 .end
= CH_MEM_STREAM0_SRC_CRC0
,
1292 .flags
= IORESOURCE_DMA
,
1296 static struct platform_device bfin_crypto_crc_device
= {
1297 .name
= BFIN_CRYPTO_CRC_NAME
,
1299 .num_resources
= ARRAY_SIZE(bfin_crypto_crc_resources
),
1300 .resource
= bfin_crypto_crc_resources
,
1302 .platform_data
= (void *)BFIN_CRYPTO_CRC_POLY_DATA
,
1307 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1308 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
1310 .vref_delay_usecs
= 50, /* internal, no capacitor */
1311 .x_plate_ohms
= 419,
1312 .y_plate_ohms
= 486,
1313 .pressure_max
= 1000,
1315 .stopacq_polarity
= 1,
1316 .first_conversion_delay
= 3,
1317 .acquisition_time
= 1,
1319 .pen_down_acc_interval
= 1,
1323 #ifdef CONFIG_PINCTRL_ADI2
1325 # define ADI_PINT_DEVNAME "adi-gpio-pint"
1326 # define ADI_GPIO_DEVNAME "adi-gpio"
1327 # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
1329 static struct platform_device bfin_pinctrl_device
= {
1330 .name
= ADI_PINCTRL_DEVNAME
,
1334 static struct resource bfin_pint0_resources
[] = {
1336 .start
= PINT0_MASK_SET
,
1337 .end
= PINT0_LATCH
+ 3,
1338 .flags
= IORESOURCE_MEM
,
1343 .flags
= IORESOURCE_IRQ
,
1347 static struct platform_device bfin_pint0_device
= {
1348 .name
= ADI_PINT_DEVNAME
,
1350 .num_resources
= ARRAY_SIZE(bfin_pint0_resources
),
1351 .resource
= bfin_pint0_resources
,
1354 static struct resource bfin_pint1_resources
[] = {
1356 .start
= PINT1_MASK_SET
,
1357 .end
= PINT1_LATCH
+ 3,
1358 .flags
= IORESOURCE_MEM
,
1363 .flags
= IORESOURCE_IRQ
,
1367 static struct platform_device bfin_pint1_device
= {
1368 .name
= ADI_PINT_DEVNAME
,
1370 .num_resources
= ARRAY_SIZE(bfin_pint1_resources
),
1371 .resource
= bfin_pint1_resources
,
1374 static struct resource bfin_pint2_resources
[] = {
1376 .start
= PINT2_MASK_SET
,
1377 .end
= PINT2_LATCH
+ 3,
1378 .flags
= IORESOURCE_MEM
,
1383 .flags
= IORESOURCE_IRQ
,
1387 static struct platform_device bfin_pint2_device
= {
1388 .name
= ADI_PINT_DEVNAME
,
1390 .num_resources
= ARRAY_SIZE(bfin_pint2_resources
),
1391 .resource
= bfin_pint2_resources
,
1394 static struct resource bfin_pint3_resources
[] = {
1396 .start
= PINT3_MASK_SET
,
1397 .end
= PINT3_LATCH
+ 3,
1398 .flags
= IORESOURCE_MEM
,
1403 .flags
= IORESOURCE_IRQ
,
1407 static struct platform_device bfin_pint3_device
= {
1408 .name
= ADI_PINT_DEVNAME
,
1410 .num_resources
= ARRAY_SIZE(bfin_pint3_resources
),
1411 .resource
= bfin_pint3_resources
,
1414 static struct resource bfin_pint4_resources
[] = {
1416 .start
= PINT4_MASK_SET
,
1417 .end
= PINT4_LATCH
+ 3,
1418 .flags
= IORESOURCE_MEM
,
1423 .flags
= IORESOURCE_IRQ
,
1427 static struct platform_device bfin_pint4_device
= {
1428 .name
= ADI_PINT_DEVNAME
,
1430 .num_resources
= ARRAY_SIZE(bfin_pint4_resources
),
1431 .resource
= bfin_pint4_resources
,
1434 static struct resource bfin_pint5_resources
[] = {
1436 .start
= PINT5_MASK_SET
,
1437 .end
= PINT5_LATCH
+ 3,
1438 .flags
= IORESOURCE_MEM
,
1443 .flags
= IORESOURCE_IRQ
,
1447 static struct platform_device bfin_pint5_device
= {
1448 .name
= ADI_PINT_DEVNAME
,
1450 .num_resources
= ARRAY_SIZE(bfin_pint5_resources
),
1451 .resource
= bfin_pint5_resources
,
1454 static struct resource bfin_gpa_resources
[] = {
1457 .end
= PORTA_MUX
+ 3,
1458 .flags
= IORESOURCE_MEM
,
1463 .flags
= IORESOURCE_IRQ
,
1467 static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata
= {
1468 .port_pin_base
= GPIO_PA0
,
1469 .port_width
= GPIO_BANKSIZE
,
1470 .pint_id
= 0, /* PINT0 */
1471 .pint_assign
= true, /* PINT upper 16 bit */
1472 .pint_map
= 0, /* mapping mask in PINT */
1475 static struct platform_device bfin_gpa_device
= {
1476 .name
= ADI_GPIO_DEVNAME
,
1478 .num_resources
= ARRAY_SIZE(bfin_gpa_resources
),
1479 .resource
= bfin_gpa_resources
,
1481 .platform_data
= &bfin_gpa_pdata
, /* Passed to driver */
1485 static struct resource bfin_gpb_resources
[] = {
1488 .end
= PORTB_MUX
+ 3,
1489 .flags
= IORESOURCE_MEM
,
1494 .flags
= IORESOURCE_IRQ
,
1498 static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata
= {
1499 .port_pin_base
= GPIO_PB0
,
1500 .port_width
= GPIO_BANKSIZE
,
1502 .pint_assign
= false,
1506 static struct platform_device bfin_gpb_device
= {
1507 .name
= ADI_GPIO_DEVNAME
,
1509 .num_resources
= ARRAY_SIZE(bfin_gpb_resources
),
1510 .resource
= bfin_gpb_resources
,
1512 .platform_data
= &bfin_gpb_pdata
, /* Passed to driver */
1516 static struct resource bfin_gpc_resources
[] = {
1519 .end
= PORTC_MUX
+ 3,
1520 .flags
= IORESOURCE_MEM
,
1525 .flags
= IORESOURCE_IRQ
,
1529 static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata
= {
1530 .port_pin_base
= GPIO_PC0
,
1531 .port_width
= GPIO_BANKSIZE
,
1533 .pint_assign
= false,
1537 static struct platform_device bfin_gpc_device
= {
1538 .name
= ADI_GPIO_DEVNAME
,
1540 .num_resources
= ARRAY_SIZE(bfin_gpc_resources
),
1541 .resource
= bfin_gpc_resources
,
1543 .platform_data
= &bfin_gpc_pdata
, /* Passed to driver */
1547 static struct resource bfin_gpd_resources
[] = {
1550 .end
= PORTD_MUX
+ 3,
1551 .flags
= IORESOURCE_MEM
,
1556 .flags
= IORESOURCE_IRQ
,
1560 static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata
= {
1561 .port_pin_base
= GPIO_PD0
,
1562 .port_width
= GPIO_BANKSIZE
,
1564 .pint_assign
= false,
1568 static struct platform_device bfin_gpd_device
= {
1569 .name
= ADI_GPIO_DEVNAME
,
1571 .num_resources
= ARRAY_SIZE(bfin_gpd_resources
),
1572 .resource
= bfin_gpd_resources
,
1574 .platform_data
= &bfin_gpd_pdata
, /* Passed to driver */
1578 static struct resource bfin_gpe_resources
[] = {
1581 .end
= PORTE_MUX
+ 3,
1582 .flags
= IORESOURCE_MEM
,
1587 .flags
= IORESOURCE_IRQ
,
1591 static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata
= {
1592 .port_pin_base
= GPIO_PE0
,
1593 .port_width
= GPIO_BANKSIZE
,
1595 .pint_assign
= false,
1599 static struct platform_device bfin_gpe_device
= {
1600 .name
= ADI_GPIO_DEVNAME
,
1602 .num_resources
= ARRAY_SIZE(bfin_gpe_resources
),
1603 .resource
= bfin_gpe_resources
,
1605 .platform_data
= &bfin_gpe_pdata
, /* Passed to driver */
1609 static struct resource bfin_gpf_resources
[] = {
1612 .end
= PORTF_MUX
+ 3,
1613 .flags
= IORESOURCE_MEM
,
1618 .flags
= IORESOURCE_IRQ
,
1622 static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata
= {
1623 .port_pin_base
= GPIO_PF0
,
1624 .port_width
= GPIO_BANKSIZE
,
1626 .pint_assign
= false,
1630 static struct platform_device bfin_gpf_device
= {
1631 .name
= ADI_GPIO_DEVNAME
,
1633 .num_resources
= ARRAY_SIZE(bfin_gpf_resources
),
1634 .resource
= bfin_gpf_resources
,
1636 .platform_data
= &bfin_gpf_pdata
, /* Passed to driver */
1640 static struct resource bfin_gpg_resources
[] = {
1643 .end
= PORTG_MUX
+ 3,
1644 .flags
= IORESOURCE_MEM
,
1649 .flags
= IORESOURCE_IRQ
,
1653 static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata
= {
1654 .port_pin_base
= GPIO_PG0
,
1655 .port_width
= GPIO_BANKSIZE
,
1657 .pint_assign
= false,
1661 static struct platform_device bfin_gpg_device
= {
1662 .name
= ADI_GPIO_DEVNAME
,
1664 .num_resources
= ARRAY_SIZE(bfin_gpg_resources
),
1665 .resource
= bfin_gpg_resources
,
1667 .platform_data
= &bfin_gpg_pdata
, /* Passed to driver */
1673 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1674 #include <linux/input.h>
1675 #include <linux/gpio_keys.h>
1677 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
1678 {BTN_0
, GPIO_PB10
, 1, "gpio-keys: BTN0"},
1679 {BTN_1
, GPIO_PE1
, 1, "gpio-keys: BTN1"},
1682 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
1683 .buttons
= bfin_gpio_keys_table
,
1684 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
1687 static struct platform_device bfin_device_gpiokeys
= {
1688 .name
= "gpio-keys",
1690 .platform_data
= &bfin_gpio_keys_data
,
1695 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
1696 #if IS_ENABLED(CONFIG_MTD_M25P80)
1698 /* the modalias must be the same as spi device driver name */
1699 .modalias
= "m25p80", /* Name of spi_driver for this device */
1700 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
1701 .bus_num
= 0, /* Framework bus number */
1702 .chip_select
= MAX_CTRL_CS
+ GPIO_PD11
, /* SPI_SSEL1*/
1703 .platform_data
= &bfin_spi_flash_data
,
1704 .controller_data
= &spi_flash_chip_info
,
1708 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1710 .modalias
= "ad7877",
1711 .platform_data
= &bfin_ad7877_ts_info
,
1713 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
1715 .chip_select
= MAX_CTRL_CS
+ GPIO_PC15
, /* SPI_SSEL4 */
1718 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
1720 .modalias
= "spidev",
1721 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
1723 .chip_select
= MAX_CTRL_CS
+ GPIO_PD11
, /* SPI_SSEL1*/
1724 .controller_data
= &spidev_chip_info
,
1727 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
1729 .modalias
= "adxl34x",
1730 .platform_data
= &adxl34x_info
,
1732 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
1739 #if IS_ENABLED(CONFIG_SPI_ADI_V3)
1741 static struct resource bfin_spi0_resource
[] = {
1743 .start
= SPI0_REGBASE
,
1744 .end
= SPI0_REGBASE
+ 0xFF,
1745 .flags
= IORESOURCE_MEM
,
1748 .start
= CH_SPI0_TX
,
1750 .flags
= IORESOURCE_DMA
,
1753 .start
= CH_SPI0_RX
,
1755 .flags
= IORESOURCE_DMA
,
1760 static struct resource bfin_spi1_resource
[] = {
1762 .start
= SPI1_REGBASE
,
1763 .end
= SPI1_REGBASE
+ 0xFF,
1764 .flags
= IORESOURCE_MEM
,
1767 .start
= CH_SPI1_TX
,
1769 .flags
= IORESOURCE_DMA
,
1772 .start
= CH_SPI1_RX
,
1774 .flags
= IORESOURCE_DMA
,
1779 /* SPI controller data */
1780 static struct adi_spi3_master bf60x_spi_master_info0
= {
1781 .num_chipselect
= MAX_CTRL_CS
+ MAX_BLACKFIN_GPIOS
,
1782 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
1785 static struct platform_device bf60x_spi_master0
= {
1787 .id
= 0, /* Bus number */
1788 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
1789 .resource
= bfin_spi0_resource
,
1791 .platform_data
= &bf60x_spi_master_info0
, /* Passed to driver */
1795 static struct adi_spi3_master bf60x_spi_master_info1
= {
1796 .num_chipselect
= MAX_CTRL_CS
+ MAX_BLACKFIN_GPIOS
,
1797 .pin_req
= {P_SPI1_SCK
, P_SPI1_MISO
, P_SPI1_MOSI
, 0},
1800 static struct platform_device bf60x_spi_master1
= {
1802 .id
= 1, /* Bus number */
1803 .num_resources
= ARRAY_SIZE(bfin_spi1_resource
),
1804 .resource
= bfin_spi1_resource
,
1806 .platform_data
= &bf60x_spi_master_info1
, /* Passed to driver */
1809 #endif /* spi master and devices */
1811 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1812 static const u16 bfin_twi0_pins
[] = {P_TWI0_SCL
, P_TWI0_SDA
, 0};
1814 static struct resource bfin_twi0_resource
[] = {
1816 .start
= TWI0_CLKDIV
,
1817 .end
= TWI0_CLKDIV
+ 0xFF,
1818 .flags
= IORESOURCE_MEM
,
1823 .flags
= IORESOURCE_IRQ
,
1827 static struct platform_device i2c_bfin_twi0_device
= {
1828 .name
= "i2c-bfin-twi",
1830 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
1831 .resource
= bfin_twi0_resource
,
1833 .platform_data
= &bfin_twi0_pins
,
1837 static const u16 bfin_twi1_pins
[] = {P_TWI1_SCL
, P_TWI1_SDA
, 0};
1839 static struct resource bfin_twi1_resource
[] = {
1841 .start
= TWI1_CLKDIV
,
1842 .end
= TWI1_CLKDIV
+ 0xFF,
1843 .flags
= IORESOURCE_MEM
,
1848 .flags
= IORESOURCE_IRQ
,
1852 static struct platform_device i2c_bfin_twi1_device
= {
1853 .name
= "i2c-bfin-twi",
1855 .num_resources
= ARRAY_SIZE(bfin_twi1_resource
),
1856 .resource
= bfin_twi1_resource
,
1858 .platform_data
= &bfin_twi1_pins
,
1863 static struct i2c_board_info __initdata bfin_i2c_board_info0
[] = {
1864 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
1866 I2C_BOARD_INFO("adxl34x", 0x53),
1868 .platform_data
= (void *)&adxl34x_info
,
1871 #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
1873 I2C_BOARD_INFO("adau1761", 0x38),
1874 .platform_data
= (void *)&adau1761_info
1877 #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
1879 I2C_BOARD_INFO("ssm2602", 0x1b),
1884 static struct i2c_board_info __initdata bfin_i2c_board_info1
[] = {
1887 static const unsigned int cclk_vlev_datasheet
[] =
1890 * Internal VLEV BF54XSBBC1533
1891 ****temporarily using these values until data sheet is updated
1893 VRPAIR(VLEV_085
, 150000000),
1894 VRPAIR(VLEV_090
, 250000000),
1895 VRPAIR(VLEV_110
, 276000000),
1896 VRPAIR(VLEV_115
, 301000000),
1897 VRPAIR(VLEV_120
, 525000000),
1898 VRPAIR(VLEV_125
, 550000000),
1899 VRPAIR(VLEV_130
, 600000000),
1902 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1903 .tuple_tab
= cclk_vlev_datasheet
,
1904 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1905 .vr_settling_time
= 25 /* us */,
1908 static struct platform_device bfin_dpmc
= {
1909 .name
= "bfin dpmc",
1911 .platform_data
= &bfin_dmpc_vreg_data
,
1915 static struct platform_device
*ezkit_devices
[] __initdata
= {
1918 #if defined(CONFIG_PINCTRL_ADI2)
1919 &bfin_pinctrl_device
,
1935 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
1939 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
1940 #ifdef CONFIG_SERIAL_BFIN_UART0
1943 #ifdef CONFIG_SERIAL_BFIN_UART1
1948 #if IS_ENABLED(CONFIG_BFIN_SIR)
1949 #ifdef CONFIG_BFIN_SIR0
1952 #ifdef CONFIG_BFIN_SIR1
1957 #if IS_ENABLED(CONFIG_STMMAC_ETH)
1961 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
1965 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
1966 &bfin_isp1760_device
,
1969 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
1970 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1971 &bfin_sport0_uart_device
,
1973 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1974 &bfin_sport1_uart_device
,
1976 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1977 &bfin_sport2_uart_device
,
1981 #if IS_ENABLED(CONFIG_CAN_BFIN)
1985 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
1989 #if IS_ENABLED(CONFIG_SDH_BFIN)
1993 #if IS_ENABLED(CONFIG_SPI_ADI_V3)
1998 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
1999 &bfin_rotary_device
,
2002 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
2003 &i2c_bfin_twi0_device
,
2004 #if !defined(CONFIG_BF542)
2005 &i2c_bfin_twi1_device
,
2009 #if defined(CONFIG_BFIN_CRC)
2013 #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
2014 &bfin_crypto_crc_device
,
2017 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
2018 &bfin_device_gpiokeys
,
2021 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
2022 &ezkit_flash_device
,
2024 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
2027 #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
2030 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
2031 &bfin_ad1836_machine
,
2033 #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
2036 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
2037 &bfin_capture_device
,
2039 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
2040 &bfin_display_device
,
2045 /* Pin control settings */
2046 static struct pinctrl_map __initdata bfin_pinmux_map
[] = {
2047 /* per-device maps */
2048 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL
, "uart0"),
2049 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL
, "uart1"),
2050 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL
, "uart0"),
2051 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL
, "uart1"),
2052 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL
, "rsi0"),
2053 PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL
, "eth0"),
2054 PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.0", "pinctrl-adi2.0", NULL
, "spi0"),
2055 PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.1", "pinctrl-adi2.0", NULL
, "spi1"),
2056 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL
, "twi0"),
2057 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL
, "twi1"),
2058 PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL
, "rotary"),
2059 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL
, "can0"),
2060 PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL
, "smc0"),
2061 PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", NULL
, "ppi2_16b"),
2062 PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", NULL
, "ppi0_16b"),
2063 #if IS_ENABLED(CONFIG_VIDEO_MT9M114)
2064 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_8b"),
2065 #elif IS_ENABLED(CONFIG_VIDEO_VS6624)
2066 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_16b"),
2068 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_24b"),
2070 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL
, "sport0"),
2071 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL
, "sport0"),
2072 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL
, "sport1"),
2073 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL
, "sport1"),
2074 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL
, "sport2"),
2075 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL
, "sport2"),
2078 static int __init
ezkit_init(void)
2080 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
2082 /* Initialize pinmuxing */
2083 pinctrl_register_mappings(bfin_pinmux_map
,
2084 ARRAY_SIZE(bfin_pinmux_map
));
2086 i2c_register_board_info(0, bfin_i2c_board_info0
,
2087 ARRAY_SIZE(bfin_i2c_board_info0
));
2088 i2c_register_board_info(1, bfin_i2c_board_info1
,
2089 ARRAY_SIZE(bfin_i2c_board_info1
));
2091 platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
2093 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
2098 arch_initcall(ezkit_init
);
2100 static struct platform_device
*ezkit_early_devices
[] __initdata
= {
2101 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2102 #ifdef CONFIG_SERIAL_BFIN_UART0
2105 #ifdef CONFIG_SERIAL_BFIN_UART1
2111 void __init
native_machine_early_platform_add_devices(void)
2113 printk(KERN_INFO
"register early platform devices\n");
2114 early_platform_add_devices(ezkit_early_devices
,
2115 ARRAY_SIZE(ezkit_early_devices
));