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 <asm/bfin_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 defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
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 defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
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 defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
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
)
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 defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
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 defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
202 static struct platform_device rtc_device
= {
208 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
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
,
217 .start
= IRQ_UART0_TX
,
219 .flags
= IORESOURCE_IRQ
,
222 .start
= IRQ_UART0_RX
,
224 .flags
= IORESOURCE_IRQ
,
227 .start
= IRQ_UART0_STAT
,
228 .end
= IRQ_UART0_STAT
,
229 .flags
= IORESOURCE_IRQ
,
232 .start
= CH_UART0_TX
,
234 .flags
= IORESOURCE_DMA
,
237 .start
= CH_UART0_RX
,
239 .flags
= IORESOURCE_DMA
,
241 #ifdef CONFIG_BFIN_UART0_CTSRTS
242 { /* CTS pin -- 0 means not supported */
245 .flags
= IORESOURCE_IO
,
247 { /* RTS pin -- 0 means not supported */
250 .flags
= IORESOURCE_IO
,
255 static unsigned short bfin_uart0_peripherals
[] = {
256 P_UART0_TX
, P_UART0_RX
,
257 #ifdef CONFIG_BFIN_UART0_CTSRTS
258 P_UART0_RTS
, P_UART0_CTS
,
263 static struct platform_device bfin_uart0_device
= {
266 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
267 .resource
= bfin_uart0_resources
,
269 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
273 #ifdef CONFIG_SERIAL_BFIN_UART1
274 static struct resource bfin_uart1_resources
[] = {
276 .start
= UART1_REVID
,
277 .end
= UART1_RXDIV
+4,
278 .flags
= IORESOURCE_MEM
,
281 .start
= IRQ_UART1_TX
,
283 .flags
= IORESOURCE_IRQ
,
286 .start
= IRQ_UART1_RX
,
288 .flags
= IORESOURCE_IRQ
,
291 .start
= IRQ_UART1_STAT
,
292 .end
= IRQ_UART1_STAT
,
293 .flags
= IORESOURCE_IRQ
,
296 .start
= CH_UART1_TX
,
298 .flags
= IORESOURCE_DMA
,
301 .start
= CH_UART1_RX
,
303 .flags
= IORESOURCE_DMA
,
305 #ifdef CONFIG_BFIN_UART1_CTSRTS
306 { /* CTS pin -- 0 means not supported */
309 .flags
= IORESOURCE_IO
,
311 { /* RTS pin -- 0 means not supported */
314 .flags
= IORESOURCE_IO
,
319 static unsigned short bfin_uart1_peripherals
[] = {
320 P_UART1_TX
, P_UART1_RX
,
321 #ifdef CONFIG_BFIN_UART1_CTSRTS
322 P_UART1_RTS
, P_UART1_CTS
,
327 static struct platform_device bfin_uart1_device
= {
330 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
331 .resource
= bfin_uart1_resources
,
333 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
339 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
340 #ifdef CONFIG_BFIN_SIR0
341 static struct resource bfin_sir0_resources
[] = {
345 .flags
= IORESOURCE_MEM
,
348 .start
= IRQ_UART0_TX
,
349 .end
= IRQ_UART0_TX
+1,
350 .flags
= IORESOURCE_IRQ
,
353 .start
= CH_UART0_TX
,
354 .end
= CH_UART0_TX
+1,
355 .flags
= IORESOURCE_DMA
,
358 static struct platform_device bfin_sir0_device
= {
361 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
362 .resource
= bfin_sir0_resources
,
365 #ifdef CONFIG_BFIN_SIR1
366 static struct resource bfin_sir1_resources
[] = {
370 .flags
= IORESOURCE_MEM
,
373 .start
= IRQ_UART1_TX
,
374 .end
= IRQ_UART1_TX
+1,
375 .flags
= IORESOURCE_IRQ
,
378 .start
= CH_UART1_TX
,
379 .end
= CH_UART1_TX
+1,
380 .flags
= IORESOURCE_DMA
,
383 static struct platform_device bfin_sir1_device
= {
386 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
387 .resource
= bfin_sir1_resources
,
392 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
393 static struct resource musb_resources
[] = {
397 .flags
= IORESOURCE_MEM
,
399 [1] = { /* general IRQ */
400 .start
= IRQ_USB_STAT
,
402 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
405 [2] = { /* DMA IRQ */
406 .start
= IRQ_USB_DMA
,
408 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
413 static struct musb_hdrc_config musb_config
= {
419 .clkin
= 48, /* musb CLKIN in MHZ */
422 static struct musb_hdrc_platform_data musb_plat
= {
423 #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
425 #elif defined(CONFIG_USB_MUSB_HDRC)
427 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
428 .mode
= MUSB_PERIPHERAL
,
430 .config
= &musb_config
,
433 static u64 musb_dmamask
= ~(u32
)0;
435 static struct platform_device musb_device
= {
436 .name
= "musb-blackfin",
439 .dma_mask
= &musb_dmamask
,
440 .coherent_dma_mask
= 0xffffffff,
441 .platform_data
= &musb_plat
,
443 .num_resources
= ARRAY_SIZE(musb_resources
),
444 .resource
= musb_resources
,
448 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
449 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
450 static struct resource bfin_sport0_uart_resources
[] = {
452 .start
= SPORT0_TCR1
,
453 .end
= SPORT0_MRCS3
+4,
454 .flags
= IORESOURCE_MEM
,
457 .start
= IRQ_SPORT0_RX
,
458 .end
= IRQ_SPORT0_RX
+1,
459 .flags
= IORESOURCE_IRQ
,
462 .start
= IRQ_SPORT0_ERROR
,
463 .end
= IRQ_SPORT0_ERROR
,
464 .flags
= IORESOURCE_IRQ
,
468 static unsigned short bfin_sport0_peripherals
[] = {
469 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
470 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
473 static struct platform_device bfin_sport0_uart_device
= {
474 .name
= "bfin-sport-uart",
476 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
477 .resource
= bfin_sport0_uart_resources
,
479 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
483 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
484 static struct resource bfin_sport1_uart_resources
[] = {
486 .start
= SPORT1_TCR1
,
487 .end
= SPORT1_MRCS3
+4,
488 .flags
= IORESOURCE_MEM
,
491 .start
= IRQ_SPORT1_RX
,
492 .end
= IRQ_SPORT1_RX
+1,
493 .flags
= IORESOURCE_IRQ
,
496 .start
= IRQ_SPORT1_ERROR
,
497 .end
= IRQ_SPORT1_ERROR
,
498 .flags
= IORESOURCE_IRQ
,
502 static unsigned short bfin_sport1_peripherals
[] = {
503 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
504 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
507 static struct platform_device bfin_sport1_uart_device
= {
508 .name
= "bfin-sport-uart",
510 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
511 .resource
= bfin_sport1_uart_resources
,
513 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
517 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
518 static struct resource bfin_sport2_uart_resources
[] = {
520 .start
= SPORT2_TCR1
,
521 .end
= SPORT2_MRCS3
+4,
522 .flags
= IORESOURCE_MEM
,
525 .start
= IRQ_SPORT2_RX
,
526 .end
= IRQ_SPORT2_RX
+1,
527 .flags
= IORESOURCE_IRQ
,
530 .start
= IRQ_SPORT2_ERROR
,
531 .end
= IRQ_SPORT2_ERROR
,
532 .flags
= IORESOURCE_IRQ
,
536 static unsigned short bfin_sport2_peripherals
[] = {
537 P_SPORT2_TFS
, P_SPORT2_DTPRI
, P_SPORT2_TSCLK
, P_SPORT2_RFS
,
538 P_SPORT2_DRPRI
, P_SPORT2_RSCLK
, P_SPORT2_DRSEC
, P_SPORT2_DTSEC
, 0
541 static struct platform_device bfin_sport2_uart_device
= {
542 .name
= "bfin-sport-uart",
544 .num_resources
= ARRAY_SIZE(bfin_sport2_uart_resources
),
545 .resource
= bfin_sport2_uart_resources
,
547 .platform_data
= &bfin_sport2_peripherals
, /* Passed to driver */
553 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
555 static unsigned short bfin_can0_peripherals
[] = {
556 P_CAN0_RX
, P_CAN0_TX
, 0
559 static struct resource bfin_can0_resources
[] = {
563 .flags
= IORESOURCE_MEM
,
566 .start
= IRQ_CAN0_RX
,
568 .flags
= IORESOURCE_IRQ
,
571 .start
= IRQ_CAN0_TX
,
573 .flags
= IORESOURCE_IRQ
,
576 .start
= IRQ_CAN0_STAT
,
577 .end
= IRQ_CAN0_STAT
,
578 .flags
= IORESOURCE_IRQ
,
582 static struct platform_device bfin_can0_device
= {
585 .num_resources
= ARRAY_SIZE(bfin_can0_resources
),
586 .resource
= bfin_can0_resources
,
588 .platform_data
= &bfin_can0_peripherals
, /* Passed to driver */
594 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
595 static struct mtd_partition partition_info
[] = {
597 .name
= "bootloader(nand)",
601 .name
= "linux kernel(nand)",
602 .offset
= MTDPART_OFS_APPEND
,
603 .size
= 4 * 1024 * 1024,
606 .name
= "file system(nand)",
607 .offset
= MTDPART_OFS_APPEND
,
608 .size
= MTDPART_SIZ_FULL
,
612 static struct bf5xx_nand_platform bfin_nand_platform
= {
613 .data_width
= NFC_NWIDTH_8
,
614 .partitions
= partition_info
,
615 .nr_partitions
= ARRAY_SIZE(partition_info
),
620 static struct resource bfin_nand_resources
[] = {
624 .flags
= IORESOURCE_MEM
,
629 .flags
= IORESOURCE_IRQ
,
633 static struct platform_device bfin_nand_device
= {
636 .num_resources
= ARRAY_SIZE(bfin_nand_resources
),
637 .resource
= bfin_nand_resources
,
639 .platform_data
= &bfin_nand_platform
,
644 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
646 static struct bfin_sd_host bfin_sdh_data
= {
648 .irq_int0
= IRQ_RSI_INT0
,
649 .pin_req
= {P_RSI_DATA0
, P_RSI_DATA1
, P_RSI_DATA2
, P_RSI_DATA3
, P_RSI_CMD
, P_RSI_CLK
, 0},
652 static struct platform_device bfin_sdh_device
= {
656 .platform_data
= &bfin_sdh_data
,
661 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
662 static struct mtd_partition ezkit_partitions
[] = {
664 .name
= "bootloader(nor)",
668 .name
= "linux kernel(nor)",
670 .offset
= MTDPART_OFS_APPEND
,
672 .name
= "file system(nor)",
673 .size
= 0x1000000 - 0x80000 - 0x400000,
674 .offset
= MTDPART_OFS_APPEND
,
678 int bf609_nor_flash_init(struct platform_device
*pdev
)
680 #define CONFIG_SMC_GCTL_VAL 0x00000010
681 const unsigned short pins
[] = {
682 P_A3
, P_A4
, P_A5
, P_A6
, P_A7
, P_A8
, P_A9
, P_A10
, P_A11
, P_A12
,
683 P_A13
, P_A14
, P_A15
, P_A16
, P_A17
, P_A18
, P_A19
, P_A20
, P_A21
,
684 P_A22
, P_A23
, P_A24
, P_A25
, P_NORCK
, 0,
687 peripheral_request_list(pins
, "smc0");
689 bfin_write32(SMC_GCTL
, CONFIG_SMC_GCTL_VAL
);
690 bfin_write32(SMC_B0CTL
, 0x01002011);
691 bfin_write32(SMC_B0TIM
, 0x08170977);
692 bfin_write32(SMC_B0ETIM
, 0x00092231);
696 void bf609_nor_flash_exit(struct platform_device
*dev
)
698 const unsigned short pins
[] = {
699 P_A3
, P_A4
, P_A5
, P_A6
, P_A7
, P_A8
, P_A9
, P_A10
, P_A11
, P_A12
,
700 P_A13
, P_A14
, P_A15
, P_A16
, P_A17
, P_A18
, P_A19
, P_A20
, P_A21
,
701 P_A22
, P_A23
, P_A24
, P_A25
, P_NORCK
, 0,
704 peripheral_free_list(pins
);
706 bfin_write32(SMC_GCTL
, 0);
709 static struct physmap_flash_data ezkit_flash_data
= {
711 .parts
= ezkit_partitions
,
712 .init
= bf609_nor_flash_init
,
713 .exit
= bf609_nor_flash_exit
,
714 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
715 #ifdef CONFIG_ROMKERNEL
716 .probe_type
= "map_rom",
720 static struct resource ezkit_flash_resource
= {
723 .flags
= IORESOURCE_MEM
,
726 static struct platform_device ezkit_flash_device
= {
727 .name
= "physmap-flash",
730 .platform_data
= &ezkit_flash_data
,
733 .resource
= &ezkit_flash_resource
,
737 #if defined(CONFIG_MTD_M25P80) \
738 || defined(CONFIG_MTD_M25P80_MODULE)
739 /* SPI flash chip (w25q32) */
740 static struct mtd_partition bfin_spi_flash_partitions
[] = {
742 .name
= "bootloader(spi)",
745 .mask_flags
= MTD_CAP_ROM
747 .name
= "linux kernel(spi)",
749 .offset
= MTDPART_OFS_APPEND
,
751 .name
= "file system(spi)",
752 .size
= MTDPART_SIZ_FULL
,
753 .offset
= MTDPART_OFS_APPEND
,
757 static struct flash_platform_data bfin_spi_flash_data
= {
759 .parts
= bfin_spi_flash_partitions
,
760 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
764 static struct bfin_spi3_chip spi_flash_chip_info
= {
765 .enable_dma
= true, /* use dma transfer with this chip*/
769 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
770 static struct bfin_spi3_chip spidev_chip_info
= {
775 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
776 static struct platform_device bfin_i2s_pcm
= {
777 .name
= "bfin-i2s-pcm-audio",
782 #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
783 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
784 #include <asm/bfin_sport3.h>
785 static struct resource bfin_snd_resources
[] = {
787 .start
= SPORT0_CTL_A
,
789 .flags
= IORESOURCE_MEM
,
792 .start
= SPORT0_CTL_B
,
794 .flags
= IORESOURCE_MEM
,
797 .start
= CH_SPORT0_TX
,
799 .flags
= IORESOURCE_DMA
,
802 .start
= CH_SPORT0_RX
,
804 .flags
= IORESOURCE_DMA
,
807 .start
= IRQ_SPORT0_TX_STAT
,
808 .end
= IRQ_SPORT0_TX_STAT
,
809 .flags
= IORESOURCE_IRQ
,
812 .start
= IRQ_SPORT0_RX_STAT
,
813 .end
= IRQ_SPORT0_RX_STAT
,
814 .flags
= IORESOURCE_IRQ
,
818 static const unsigned short bfin_snd_pin
[] = {
819 P_SPORT0_ACLK
, P_SPORT0_AFS
, P_SPORT0_AD0
, P_SPORT0_BCLK
,
820 P_SPORT0_BFS
, P_SPORT0_BD0
, 0,
823 static struct bfin_snd_platform_data bfin_snd_data
= {
824 .pin_req
= bfin_snd_pin
,
827 static struct platform_device bfin_i2s
= {
829 .num_resources
= ARRAY_SIZE(bfin_snd_resources
),
830 .resource
= bfin_snd_resources
,
832 .platform_data
= &bfin_snd_data
,
837 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
838 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
839 static const char * const ad1836_link
[] = {
843 static struct platform_device bfin_ad1836_machine
= {
844 .name
= "bfin-snd-ad1836",
847 .platform_data
= (void *)ad1836_link
,
852 #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
853 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
854 static struct platform_device adau1761_device
= {
855 .name
= "bfin-eval-adau1x61",
859 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
860 #include <sound/adau17x1.h>
861 static struct adau1761_platform_data adau1761_info
= {
862 .lineout_mode
= ADAU1761_OUTPUT_MODE_LINE
,
863 .headphone_mode
= ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS
,
867 #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
868 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
869 #include <linux/videodev2.h>
870 #include <media/blackfin/bfin_capture.h>
871 #include <media/blackfin/ppi.h>
873 static const unsigned short ppi_req
[] = {
874 P_PPI0_D0
, P_PPI0_D1
, P_PPI0_D2
, P_PPI0_D3
,
875 P_PPI0_D4
, P_PPI0_D5
, P_PPI0_D6
, P_PPI0_D7
,
876 P_PPI0_D8
, P_PPI0_D9
, P_PPI0_D10
, P_PPI0_D11
,
877 P_PPI0_D12
, P_PPI0_D13
, P_PPI0_D14
, P_PPI0_D15
,
878 #if !defined(CONFIG_VIDEO_VS6624) && !defined(CONFIG_VIDEO_VS6624_MODULE)
879 P_PPI0_D16
, P_PPI0_D17
, P_PPI0_D18
, P_PPI0_D19
,
880 P_PPI0_D20
, P_PPI0_D21
, P_PPI0_D22
, P_PPI0_D23
,
882 P_PPI0_CLK
, P_PPI0_FS1
, P_PPI0_FS2
,
886 static const struct ppi_info ppi_info
= {
887 .type
= PPI_TYPE_EPPI3
,
888 .dma_ch
= CH_EPPI0_CH0
,
889 .irq_err
= IRQ_EPPI0_STAT
,
890 .base
= (void __iomem
*)EPPI0_STAT
,
894 #if defined(CONFIG_VIDEO_VS6624) \
895 || defined(CONFIG_VIDEO_VS6624_MODULE)
896 static struct v4l2_input vs6624_inputs
[] = {
900 .type
= V4L2_INPUT_TYPE_CAMERA
,
901 .std
= V4L2_STD_UNKNOWN
,
905 static struct bcap_route vs6624_routes
[] = {
912 static const unsigned vs6624_ce_pin
= GPIO_PE4
;
914 static struct bfin_capture_config bfin_capture_data
= {
915 .card_name
= "BF609",
916 .inputs
= vs6624_inputs
,
917 .num_inputs
= ARRAY_SIZE(vs6624_inputs
),
918 .routes
= vs6624_routes
,
923 .platform_data
= (void *)&vs6624_ce_pin
,
925 .ppi_info
= &ppi_info
,
926 .ppi_control
= (PACK_EN
| DLEN_8
| EPPI_CTL_FS1HI_FS2HI
927 | EPPI_CTL_POLC3
| EPPI_CTL_SYNC2
| EPPI_CTL_NON656
),
932 #if defined(CONFIG_VIDEO_ADV7842) \
933 || defined(CONFIG_VIDEO_ADV7842_MODULE)
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 .inp_color_space
= ADV7842_INP_COLOR_SPACE_AUTO
,
1028 .i2c_repeater
= 0x46,
1030 .i2c_infoframe
= 0x48,
1036 static struct bfin_capture_config bfin_capture_data
= {
1037 .card_name
= "BF609",
1038 .inputs
= adv7842_inputs
,
1039 .num_inputs
= ARRAY_SIZE(adv7842_inputs
),
1040 .routes
= adv7842_routes
,
1041 .i2c_adapter_id
= 0,
1045 .platform_data
= (void *)&adv7842_data
,
1047 .ppi_info
= &ppi_info
,
1048 .ppi_control
= (PACK_EN
| DLEN_8
| EPPI_CTL_FLDSEL
1049 | EPPI_CTL_ACTIVE656
),
1053 static struct platform_device bfin_capture_device
= {
1054 .name
= "bfin_capture",
1056 .platform_data
= &bfin_capture_data
,
1061 #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
1062 || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
1063 #include <linux/videodev2.h>
1064 #include <media/blackfin/bfin_display.h>
1065 #include <media/blackfin/ppi.h>
1067 static const unsigned short ppi_req_disp
[] = {
1068 P_PPI0_D0
, P_PPI0_D1
, P_PPI0_D2
, P_PPI0_D3
,
1069 P_PPI0_D4
, P_PPI0_D5
, P_PPI0_D6
, P_PPI0_D7
,
1070 P_PPI0_D8
, P_PPI0_D9
, P_PPI0_D10
, P_PPI0_D11
,
1071 P_PPI0_D12
, P_PPI0_D13
, P_PPI0_D14
, P_PPI0_D15
,
1072 P_PPI0_CLK
, P_PPI0_FS1
, P_PPI0_FS2
,
1076 static const struct ppi_info ppi_info
= {
1077 .type
= PPI_TYPE_EPPI3
,
1078 .dma_ch
= CH_EPPI0_CH0
,
1079 .irq_err
= IRQ_EPPI0_STAT
,
1080 .base
= (void __iomem
*)EPPI0_STAT
,
1081 .pin_req
= ppi_req_disp
,
1084 #if defined(CONFIG_VIDEO_ADV7511) \
1085 || defined(CONFIG_VIDEO_ADV7511_MODULE)
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 defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
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 #ifdef CONFIG_PINCTRL_ADI2
1336 # define ADI_PINT_DEVNAME "adi-gpio-pint"
1337 # define ADI_GPIO_DEVNAME "adi-gpio"
1338 # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
1340 static struct platform_device bfin_pinctrl_device
= {
1341 .name
= ADI_PINCTRL_DEVNAME
,
1345 static struct resource bfin_pint0_resources
[] = {
1347 .start
= PINT0_MASK_SET
,
1348 .end
= PINT0_LATCH
+ 3,
1349 .flags
= IORESOURCE_MEM
,
1354 .flags
= IORESOURCE_IRQ
,
1358 static struct platform_device bfin_pint0_device
= {
1359 .name
= ADI_PINT_DEVNAME
,
1361 .num_resources
= ARRAY_SIZE(bfin_pint0_resources
),
1362 .resource
= bfin_pint0_resources
,
1365 static struct resource bfin_pint1_resources
[] = {
1367 .start
= PINT1_MASK_SET
,
1368 .end
= PINT1_LATCH
+ 3,
1369 .flags
= IORESOURCE_MEM
,
1374 .flags
= IORESOURCE_IRQ
,
1378 static struct platform_device bfin_pint1_device
= {
1379 .name
= ADI_PINT_DEVNAME
,
1381 .num_resources
= ARRAY_SIZE(bfin_pint1_resources
),
1382 .resource
= bfin_pint1_resources
,
1385 static struct resource bfin_pint2_resources
[] = {
1387 .start
= PINT2_MASK_SET
,
1388 .end
= PINT2_LATCH
+ 3,
1389 .flags
= IORESOURCE_MEM
,
1394 .flags
= IORESOURCE_IRQ
,
1398 static struct platform_device bfin_pint2_device
= {
1399 .name
= ADI_PINT_DEVNAME
,
1401 .num_resources
= ARRAY_SIZE(bfin_pint2_resources
),
1402 .resource
= bfin_pint2_resources
,
1405 static struct resource bfin_pint3_resources
[] = {
1407 .start
= PINT3_MASK_SET
,
1408 .end
= PINT3_LATCH
+ 3,
1409 .flags
= IORESOURCE_MEM
,
1414 .flags
= IORESOURCE_IRQ
,
1418 static struct platform_device bfin_pint3_device
= {
1419 .name
= ADI_PINT_DEVNAME
,
1421 .num_resources
= ARRAY_SIZE(bfin_pint3_resources
),
1422 .resource
= bfin_pint3_resources
,
1425 static struct resource bfin_pint4_resources
[] = {
1427 .start
= PINT4_MASK_SET
,
1428 .end
= PINT4_LATCH
+ 3,
1429 .flags
= IORESOURCE_MEM
,
1434 .flags
= IORESOURCE_IRQ
,
1438 static struct platform_device bfin_pint4_device
= {
1439 .name
= ADI_PINT_DEVNAME
,
1441 .num_resources
= ARRAY_SIZE(bfin_pint4_resources
),
1442 .resource
= bfin_pint4_resources
,
1445 static struct resource bfin_pint5_resources
[] = {
1447 .start
= PINT5_MASK_SET
,
1448 .end
= PINT5_LATCH
+ 3,
1449 .flags
= IORESOURCE_MEM
,
1454 .flags
= IORESOURCE_IRQ
,
1458 static struct platform_device bfin_pint5_device
= {
1459 .name
= ADI_PINT_DEVNAME
,
1461 .num_resources
= ARRAY_SIZE(bfin_pint5_resources
),
1462 .resource
= bfin_pint5_resources
,
1465 static struct resource bfin_gpa_resources
[] = {
1468 .end
= PORTA_MUX
+ 3,
1469 .flags
= IORESOURCE_MEM
,
1474 .flags
= IORESOURCE_IRQ
,
1478 static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata
= {
1479 .port_pin_base
= GPIO_PA0
,
1480 .port_width
= GPIO_BANKSIZE
,
1481 .pint_id
= 0, /* PINT0 */
1482 .pint_assign
= true, /* PINT upper 16 bit */
1483 .pint_map
= 0, /* mapping mask in PINT */
1486 static struct platform_device bfin_gpa_device
= {
1487 .name
= ADI_GPIO_DEVNAME
,
1489 .num_resources
= ARRAY_SIZE(bfin_gpa_resources
),
1490 .resource
= bfin_gpa_resources
,
1492 .platform_data
= &bfin_gpa_pdata
, /* Passed to driver */
1496 static struct resource bfin_gpb_resources
[] = {
1499 .end
= PORTB_MUX
+ 3,
1500 .flags
= IORESOURCE_MEM
,
1505 .flags
= IORESOURCE_IRQ
,
1509 static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata
= {
1510 .port_pin_base
= GPIO_PB0
,
1511 .port_width
= GPIO_BANKSIZE
,
1513 .pint_assign
= false,
1517 static struct platform_device bfin_gpb_device
= {
1518 .name
= ADI_GPIO_DEVNAME
,
1520 .num_resources
= ARRAY_SIZE(bfin_gpb_resources
),
1521 .resource
= bfin_gpb_resources
,
1523 .platform_data
= &bfin_gpb_pdata
, /* Passed to driver */
1527 static struct resource bfin_gpc_resources
[] = {
1530 .end
= PORTC_MUX
+ 3,
1531 .flags
= IORESOURCE_MEM
,
1536 .flags
= IORESOURCE_IRQ
,
1540 static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata
= {
1541 .port_pin_base
= GPIO_PC0
,
1542 .port_width
= GPIO_BANKSIZE
,
1544 .pint_assign
= false,
1548 static struct platform_device bfin_gpc_device
= {
1549 .name
= ADI_GPIO_DEVNAME
,
1551 .num_resources
= ARRAY_SIZE(bfin_gpc_resources
),
1552 .resource
= bfin_gpc_resources
,
1554 .platform_data
= &bfin_gpc_pdata
, /* Passed to driver */
1558 static struct resource bfin_gpd_resources
[] = {
1561 .end
= PORTD_MUX
+ 3,
1562 .flags
= IORESOURCE_MEM
,
1567 .flags
= IORESOURCE_IRQ
,
1571 static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata
= {
1572 .port_pin_base
= GPIO_PD0
,
1573 .port_width
= GPIO_BANKSIZE
,
1575 .pint_assign
= false,
1579 static struct platform_device bfin_gpd_device
= {
1580 .name
= ADI_GPIO_DEVNAME
,
1582 .num_resources
= ARRAY_SIZE(bfin_gpd_resources
),
1583 .resource
= bfin_gpd_resources
,
1585 .platform_data
= &bfin_gpd_pdata
, /* Passed to driver */
1589 static struct resource bfin_gpe_resources
[] = {
1592 .end
= PORTE_MUX
+ 3,
1593 .flags
= IORESOURCE_MEM
,
1598 .flags
= IORESOURCE_IRQ
,
1602 static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata
= {
1603 .port_pin_base
= GPIO_PE0
,
1604 .port_width
= GPIO_BANKSIZE
,
1606 .pint_assign
= false,
1610 static struct platform_device bfin_gpe_device
= {
1611 .name
= ADI_GPIO_DEVNAME
,
1613 .num_resources
= ARRAY_SIZE(bfin_gpe_resources
),
1614 .resource
= bfin_gpe_resources
,
1616 .platform_data
= &bfin_gpe_pdata
, /* Passed to driver */
1620 static struct resource bfin_gpf_resources
[] = {
1623 .end
= PORTF_MUX
+ 3,
1624 .flags
= IORESOURCE_MEM
,
1629 .flags
= IORESOURCE_IRQ
,
1633 static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata
= {
1634 .port_pin_base
= GPIO_PF0
,
1635 .port_width
= GPIO_BANKSIZE
,
1637 .pint_assign
= false,
1641 static struct platform_device bfin_gpf_device
= {
1642 .name
= ADI_GPIO_DEVNAME
,
1644 .num_resources
= ARRAY_SIZE(bfin_gpf_resources
),
1645 .resource
= bfin_gpf_resources
,
1647 .platform_data
= &bfin_gpf_pdata
, /* Passed to driver */
1651 static struct resource bfin_gpg_resources
[] = {
1654 .end
= PORTG_MUX
+ 3,
1655 .flags
= IORESOURCE_MEM
,
1660 .flags
= IORESOURCE_IRQ
,
1664 static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata
= {
1665 .port_pin_base
= GPIO_PG0
,
1666 .port_width
= GPIO_BANKSIZE
,
1668 .pint_assign
= false,
1672 static struct platform_device bfin_gpg_device
= {
1673 .name
= ADI_GPIO_DEVNAME
,
1675 .num_resources
= ARRAY_SIZE(bfin_gpg_resources
),
1676 .resource
= bfin_gpg_resources
,
1678 .platform_data
= &bfin_gpg_pdata
, /* Passed to driver */
1684 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1685 #include <linux/input.h>
1686 #include <linux/gpio_keys.h>
1688 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
1689 {BTN_0
, GPIO_PB10
, 1, "gpio-keys: BTN0"},
1690 {BTN_1
, GPIO_PE1
, 1, "gpio-keys: BTN1"},
1693 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
1694 .buttons
= bfin_gpio_keys_table
,
1695 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
1698 static struct platform_device bfin_device_gpiokeys
= {
1699 .name
= "gpio-keys",
1701 .platform_data
= &bfin_gpio_keys_data
,
1706 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
1707 #if defined(CONFIG_MTD_M25P80) \
1708 || defined(CONFIG_MTD_M25P80_MODULE)
1710 /* the modalias must be the same as spi device driver name */
1711 .modalias
= "m25p80", /* Name of spi_driver for this device */
1712 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
1713 .bus_num
= 0, /* Framework bus number */
1714 .chip_select
= MAX_CTRL_CS
+ GPIO_PD11
, /* SPI_SSEL1*/
1715 .platform_data
= &bfin_spi_flash_data
,
1716 .controller_data
= &spi_flash_chip_info
,
1720 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1722 .modalias
= "ad7877",
1723 .platform_data
= &bfin_ad7877_ts_info
,
1725 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
1727 .chip_select
= MAX_CTRL_CS
+ GPIO_PC15
, /* SPI_SSEL4 */
1730 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1732 .modalias
= "spidev",
1733 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
1735 .chip_select
= MAX_CTRL_CS
+ GPIO_PD11
, /* SPI_SSEL1*/
1736 .controller_data
= &spidev_chip_info
,
1739 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1741 .modalias
= "adxl34x",
1742 .platform_data
= &adxl34x_info
,
1744 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
1751 #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
1753 static struct resource bfin_spi0_resource
[] = {
1755 .start
= SPI0_REGBASE
,
1756 .end
= SPI0_REGBASE
+ 0xFF,
1757 .flags
= IORESOURCE_MEM
,
1760 .start
= CH_SPI0_TX
,
1762 .flags
= IORESOURCE_DMA
,
1765 .start
= CH_SPI0_RX
,
1767 .flags
= IORESOURCE_DMA
,
1772 static struct resource bfin_spi1_resource
[] = {
1774 .start
= SPI1_REGBASE
,
1775 .end
= SPI1_REGBASE
+ 0xFF,
1776 .flags
= IORESOURCE_MEM
,
1779 .start
= CH_SPI1_TX
,
1781 .flags
= IORESOURCE_DMA
,
1784 .start
= CH_SPI1_RX
,
1786 .flags
= IORESOURCE_DMA
,
1791 /* SPI controller data */
1792 static struct bfin_spi3_master bf60x_spi_master_info0
= {
1793 .num_chipselect
= MAX_CTRL_CS
+ MAX_BLACKFIN_GPIOS
,
1794 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
1797 static struct platform_device bf60x_spi_master0
= {
1798 .name
= "bfin-spi3",
1799 .id
= 0, /* Bus number */
1800 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
1801 .resource
= bfin_spi0_resource
,
1803 .platform_data
= &bf60x_spi_master_info0
, /* Passed to driver */
1807 static struct bfin_spi3_master bf60x_spi_master_info1
= {
1808 .num_chipselect
= MAX_CTRL_CS
+ MAX_BLACKFIN_GPIOS
,
1809 .pin_req
= {P_SPI1_SCK
, P_SPI1_MISO
, P_SPI1_MOSI
, 0},
1812 static struct platform_device bf60x_spi_master1
= {
1813 .name
= "bfin-spi3",
1814 .id
= 1, /* Bus number */
1815 .num_resources
= ARRAY_SIZE(bfin_spi1_resource
),
1816 .resource
= bfin_spi1_resource
,
1818 .platform_data
= &bf60x_spi_master_info1
, /* Passed to driver */
1821 #endif /* spi master and devices */
1823 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1824 static const u16 bfin_twi0_pins
[] = {P_TWI0_SCL
, P_TWI0_SDA
, 0};
1826 static struct resource bfin_twi0_resource
[] = {
1828 .start
= TWI0_CLKDIV
,
1829 .end
= TWI0_CLKDIV
+ 0xFF,
1830 .flags
= IORESOURCE_MEM
,
1835 .flags
= IORESOURCE_IRQ
,
1839 static struct platform_device i2c_bfin_twi0_device
= {
1840 .name
= "i2c-bfin-twi",
1842 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
1843 .resource
= bfin_twi0_resource
,
1845 .platform_data
= &bfin_twi0_pins
,
1849 static const u16 bfin_twi1_pins
[] = {P_TWI1_SCL
, P_TWI1_SDA
, 0};
1851 static struct resource bfin_twi1_resource
[] = {
1853 .start
= TWI1_CLKDIV
,
1854 .end
= TWI1_CLKDIV
+ 0xFF,
1855 .flags
= IORESOURCE_MEM
,
1860 .flags
= IORESOURCE_IRQ
,
1864 static struct platform_device i2c_bfin_twi1_device
= {
1865 .name
= "i2c-bfin-twi",
1867 .num_resources
= ARRAY_SIZE(bfin_twi1_resource
),
1868 .resource
= bfin_twi1_resource
,
1870 .platform_data
= &bfin_twi1_pins
,
1875 static struct i2c_board_info __initdata bfin_i2c_board_info0
[] = {
1876 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1878 I2C_BOARD_INFO("adxl34x", 0x53),
1880 .platform_data
= (void *)&adxl34x_info
,
1883 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1885 I2C_BOARD_INFO("adau1761", 0x38),
1886 .platform_data
= (void *)&adau1761_info
1889 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1891 I2C_BOARD_INFO("ssm2602", 0x1b),
1896 static struct i2c_board_info __initdata bfin_i2c_board_info1
[] = {
1899 static const unsigned int cclk_vlev_datasheet
[] =
1902 * Internal VLEV BF54XSBBC1533
1903 ****temporarily using these values until data sheet is updated
1905 VRPAIR(VLEV_085
, 150000000),
1906 VRPAIR(VLEV_090
, 250000000),
1907 VRPAIR(VLEV_110
, 276000000),
1908 VRPAIR(VLEV_115
, 301000000),
1909 VRPAIR(VLEV_120
, 525000000),
1910 VRPAIR(VLEV_125
, 550000000),
1911 VRPAIR(VLEV_130
, 600000000),
1914 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1915 .tuple_tab
= cclk_vlev_datasheet
,
1916 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1917 .vr_settling_time
= 25 /* us */,
1920 static struct platform_device bfin_dpmc
= {
1921 .name
= "bfin dpmc",
1923 .platform_data
= &bfin_dmpc_vreg_data
,
1927 static struct platform_device
*ezkit_devices
[] __initdata
= {
1930 #if defined(CONFIG_PINCTRL_ADI2)
1931 &bfin_pinctrl_device
,
1947 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1951 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1952 #ifdef CONFIG_SERIAL_BFIN_UART0
1955 #ifdef CONFIG_SERIAL_BFIN_UART1
1960 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1961 #ifdef CONFIG_BFIN_SIR0
1964 #ifdef CONFIG_BFIN_SIR1
1969 #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1973 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1977 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1978 &bfin_isp1760_device
,
1981 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1982 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1983 &bfin_sport0_uart_device
,
1985 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1986 &bfin_sport1_uart_device
,
1988 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1989 &bfin_sport2_uart_device
,
1993 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1997 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
2001 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
2005 #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
2010 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
2011 &bfin_rotary_device
,
2014 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
2015 &i2c_bfin_twi0_device
,
2016 #if !defined(CONFIG_BF542)
2017 &i2c_bfin_twi1_device
,
2021 #if defined(CONFIG_BFIN_CRC)
2025 #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
2026 &bfin_crypto_crc_device
,
2029 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2030 &bfin_device_gpiokeys
,
2033 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
2034 &ezkit_flash_device
,
2036 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2039 #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
2040 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
2043 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
2044 defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
2045 &bfin_ad1836_machine
,
2047 #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
2048 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
2051 #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
2052 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
2053 &bfin_capture_device
,
2055 #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
2056 || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
2057 &bfin_display_device
,
2062 /* Pin control settings */
2063 static struct pinctrl_map __initdata bfin_pinmux_map
[] = {
2064 /* per-device maps */
2065 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL
, "uart0"),
2066 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL
, "uart1"),
2067 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL
, "uart0"),
2068 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL
, "uart1"),
2069 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL
, "rsi0"),
2070 PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL
, "eth0"),
2071 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.0", "pinctrl-adi2.0", NULL
, "spi0"),
2072 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.1", "pinctrl-adi2.0", NULL
, "spi1"),
2073 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL
, "twi0"),
2074 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL
, "twi1"),
2075 PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL
, "rotary"),
2076 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL
, "can0"),
2077 PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL
, "smc0"),
2078 PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", NULL
, "ppi2_16b"),
2079 PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", NULL
, "ppi0_16b"),
2080 #if defined(CONFIG_VIDEO_MT9M114) || defined(CONFIG_VIDEO_MT9M114_MODULE)
2081 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_8b"),
2082 #elif defined(CONFIG_VIDEO_VS6624) || defined(CONFIG_VIDEO_VS6624_MODULE)
2083 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_16b"),
2085 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_24b"),
2087 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL
, "sport0"),
2088 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL
, "sport0"),
2089 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL
, "sport1"),
2090 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL
, "sport1"),
2091 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL
, "sport2"),
2092 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL
, "sport2"),
2095 /* Pin control settings */
2096 static struct pinctrl_map __initdata bfin_pinmux_map
[] = {
2097 /* per-device maps */
2098 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL
, "uart0"),
2099 #ifdef CONFIG_BFIN_UART0_CTSRTS
2100 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL
, "uart0_ctsrts"),
2102 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL
, "uart1"),
2103 #ifdef CONFIG_BFIN_UART1_CTSRTS
2104 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL
, "uart1_ctsrts"),
2106 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL
, "uart0"),
2107 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL
, "uart1"),
2108 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL
, "rsi0"),
2109 PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL
, "eth0"),
2110 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.0", "pinctrl-adi2.0", NULL
, "spi0"),
2111 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.1", "pinctrl-adi2.0", NULL
, "spi1"),
2112 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL
, "twi0"),
2113 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL
, "twi1"),
2114 PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL
, "rotary"),
2115 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL
, "can0"),
2116 PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL
, "smc0"),
2117 PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", NULL
, "ppi2_16b"),
2118 PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", NULL
, "ppi2_16b"),
2119 #if defined(CONFIG_VIDEO_MT9M114) || defined(CONFIG_VIDEO_MT9M114_MODULE)
2120 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_8b"),
2121 #elif defined(CONFIG_VIDEO_VS6624) || defined(CONFIG_VIDEO_VS6624_MODULE)
2122 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_16b"),
2124 PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL
, "ppi0_24b"),
2126 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL
, "sport0"),
2127 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL
, "sport0"),
2128 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL
, "sport1"),
2129 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL
, "sport1"),
2130 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL
, "sport2"),
2131 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL
, "sport2"),
2134 static int __init
ezkit_init(void)
2136 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
2138 /* Initialize pinmuxing */
2139 pinctrl_register_mappings(bfin_pinmux_map
,
2140 ARRAY_SIZE(bfin_pinmux_map
));
2142 i2c_register_board_info(0, bfin_i2c_board_info0
,
2143 ARRAY_SIZE(bfin_i2c_board_info0
));
2144 i2c_register_board_info(1, bfin_i2c_board_info1
,
2145 ARRAY_SIZE(bfin_i2c_board_info1
));
2147 platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
2149 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
2154 arch_initcall(ezkit_init
);
2156 static struct platform_device
*ezkit_early_devices
[] __initdata
= {
2157 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2158 #ifdef CONFIG_SERIAL_BFIN_UART0
2161 #ifdef CONFIG_SERIAL_BFIN_UART1
2166 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
2167 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2168 &bfin_sport0_uart_device
,
2170 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2171 &bfin_sport1_uart_device
,
2173 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
2174 &bfin_sport2_uart_device
,
2179 void __init
native_machine_early_platform_add_devices(void)
2181 printk(KERN_INFO
"register early platform devices\n");
2182 early_platform_add_devices(ezkit_early_devices
,
2183 ARRAY_SIZE(ezkit_early_devices
));