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/bfin5xx_spi.h>
28 #include <asm/bfin_sport.h>
29 #include <asm/portmux.h>
30 #include <asm/bfin_sdh.h>
31 #include <mach/bf54x_keys.h>
32 #include <linux/input.h>
33 #include <linux/spi/ad7877.h>
36 * Name the Board for the /proc/cpuinfo
38 const char bfin_board_name[] = "ADI BF548-EZKIT";
41 * Driver needs to know address, irq and flag pin.
44 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
45 #include <linux/usb/isp1760.h>
46 static struct resource bfin_isp1760_resources[] = {
49 .end = 0x2C0C0000 + 0xfffff,
50 .flags = IORESOURCE_MEM,
55 .flags = IORESOURCE_IRQ,
59 static struct isp1760_platform_data isp1760_priv = {
64 .dack_polarity_high = 0,
65 .dreq_polarity_high = 0,
68 static struct platform_device bfin_isp1760_device = {
72 .platform_data = &isp1760_priv,
74 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
75 .resource = bfin_isp1760_resources,
79 #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
81 #include <mach/bf54x-lq043.h>
83 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
86 .xres = {480, 480, 480},
87 .yres = {272, 272, 272},
92 static struct resource bf54x_lq043_resources[] = {
94 .start = IRQ_EPPI0_ERR,
96 .flags = IORESOURCE_IRQ,
100 static struct platform_device bf54x_lq043_device = {
101 .name = "bf54x-lq043",
103 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
104 .resource = bf54x_lq043_resources,
106 .platform_data = &bf54x_lq043_data,
111 #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
112 static const unsigned int bf548_keymap[] = {
113 KEYVAL(0, 0, KEY_ENTER),
114 KEYVAL(0, 1, KEY_HELP),
116 KEYVAL(0, 3, KEY_BACKSPACE),
117 KEYVAL(1, 0, KEY_TAB),
121 KEYVAL(2, 0, KEY_DOWN),
125 KEYVAL(3, 0, KEY_UP),
131 static struct bfin_kpad_platform_data bf54x_kpad_data = {
134 .keymap = bf548_keymap,
135 .keymapsize = ARRAY_SIZE(bf548_keymap),
137 .debounce_time = 5000, /* ns (5ms) */
138 .coldrive_time = 1000, /* ns (1ms) */
139 .keyup_test_interval = 50, /* ms (50ms) */
142 static struct resource bf54x_kpad_resources[] = {
146 .flags = IORESOURCE_IRQ,
150 static struct platform_device bf54x_kpad_device = {
151 .name = "bf54x-keys",
153 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
154 .resource = bf54x_kpad_resources,
156 .platform_data = &bf54x_kpad_data,
161 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
162 #include <linux/platform_data/bfin_rotary.h>
164 static struct bfin_rotary_platform_data bfin_rotary_data = {
165 /*.rotary_up_key = KEY_UP,*/
166 /*.rotary_down_key = KEY_DOWN,*/
167 .rotary_rel_code = REL_WHEEL,
168 .rotary_button_key = KEY_ENTER,
169 .debounce = 10, /* 0..17 */
170 .mode = ROT_QUAD_ENC | ROT_DEBE,
174 static struct resource bfin_rotary_resources[] = {
177 .end = CNT_CONFIG + 0xff,
178 .flags = IORESOURCE_MEM,
183 .flags = IORESOURCE_IRQ,
187 static struct platform_device bfin_rotary_device = {
188 .name = "bfin-rotary",
190 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
191 .resource = bfin_rotary_resources,
193 .platform_data = &bfin_rotary_data,
198 #if IS_ENABLED(CONFIG_INPUT_ADXL34X)
199 #include <linux/input/adxl34x.h>
200 static const struct adxl34x_platform_data adxl34x_info = {
204 .tap_threshold = 0x31,
205 .tap_duration = 0x10,
208 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
209 .act_axis_control = 0xFF,
210 .activity_threshold = 5,
211 .inactivity_threshold = 3,
212 .inactivity_time = 4,
213 .free_fall_threshold = 0x7,
214 .free_fall_time = 0x20,
216 .data_range = ADXL_FULL_RES,
219 .ev_code_x = ABS_X, /* EV_REL */
220 .ev_code_y = ABS_Y, /* EV_REL */
221 .ev_code_z = ABS_Z, /* EV_REL */
223 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
225 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
226 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
227 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
228 .fifo_mode = ADXL_FIFO_STREAM,
229 .orientation_enable = ADXL_EN_ORIENTATION_3D,
230 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
231 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
232 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
233 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
237 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
238 static struct platform_device rtc_device = {
244 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
245 #ifdef CONFIG_SERIAL_BFIN_UART0
246 static struct resource bfin_uart0_resources[] = {
250 .flags = IORESOURCE_MEM,
252 #ifdef CONFIG_EARLY_PRINTK
256 .flags = IORESOURCE_REG,
260 .start = IRQ_UART0_TX,
262 .flags = IORESOURCE_IRQ,
265 .start = IRQ_UART0_RX,
267 .flags = IORESOURCE_IRQ,
270 .start = IRQ_UART0_ERROR,
271 .end = IRQ_UART0_ERROR,
272 .flags = IORESOURCE_IRQ,
275 .start = CH_UART0_TX,
277 .flags = IORESOURCE_DMA,
280 .start = CH_UART0_RX,
282 .flags = IORESOURCE_DMA,
286 static unsigned short bfin_uart0_peripherals[] = {
287 P_UART0_TX, P_UART0_RX, 0
290 static struct platform_device bfin_uart0_device = {
293 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
294 .resource = bfin_uart0_resources,
296 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
300 #ifdef CONFIG_SERIAL_BFIN_UART1
301 static struct resource bfin_uart1_resources[] = {
305 .flags = IORESOURCE_MEM,
307 #ifdef CONFIG_EARLY_PRINTK
311 .flags = IORESOURCE_REG,
315 .start = IRQ_UART1_TX,
317 .flags = IORESOURCE_IRQ,
320 .start = IRQ_UART1_RX,
322 .flags = IORESOURCE_IRQ,
325 .start = IRQ_UART1_ERROR,
326 .end = IRQ_UART1_ERROR,
327 .flags = IORESOURCE_IRQ,
330 .start = CH_UART1_TX,
332 .flags = IORESOURCE_DMA,
335 .start = CH_UART1_RX,
337 .flags = IORESOURCE_DMA,
339 #ifdef CONFIG_BFIN_UART1_CTSRTS
340 { /* CTS pin -- 0 means not supported */
343 .flags = IORESOURCE_IO,
345 { /* RTS pin -- 0 means not supported */
348 .flags = IORESOURCE_IO,
353 static unsigned short bfin_uart1_peripherals[] = {
354 P_UART1_TX, P_UART1_RX,
355 #ifdef CONFIG_BFIN_UART1_CTSRTS
356 P_UART1_RTS, P_UART1_CTS,
361 static struct platform_device bfin_uart1_device = {
364 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
365 .resource = bfin_uart1_resources,
367 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
371 #ifdef CONFIG_SERIAL_BFIN_UART2
372 static struct resource bfin_uart2_resources[] = {
376 .flags = IORESOURCE_MEM,
378 #ifdef CONFIG_EARLY_PRINTK
382 .flags = IORESOURCE_REG,
386 .start = IRQ_UART2_TX,
388 .flags = IORESOURCE_IRQ,
391 .start = IRQ_UART2_RX,
393 .flags = IORESOURCE_IRQ,
396 .start = IRQ_UART2_ERROR,
397 .end = IRQ_UART2_ERROR,
398 .flags = IORESOURCE_IRQ,
401 .start = CH_UART2_TX,
403 .flags = IORESOURCE_DMA,
406 .start = CH_UART2_RX,
408 .flags = IORESOURCE_DMA,
412 static unsigned short bfin_uart2_peripherals[] = {
413 P_UART2_TX, P_UART2_RX, 0
416 static struct platform_device bfin_uart2_device = {
419 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
420 .resource = bfin_uart2_resources,
422 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
426 #ifdef CONFIG_SERIAL_BFIN_UART3
427 static struct resource bfin_uart3_resources[] = {
431 .flags = IORESOURCE_MEM,
433 #ifdef CONFIG_EARLY_PRINTK
437 .flags = IORESOURCE_REG,
441 .start = IRQ_UART3_TX,
443 .flags = IORESOURCE_IRQ,
446 .start = IRQ_UART3_RX,
448 .flags = IORESOURCE_IRQ,
451 .start = IRQ_UART3_ERROR,
452 .end = IRQ_UART3_ERROR,
453 .flags = IORESOURCE_IRQ,
456 .start = CH_UART3_TX,
458 .flags = IORESOURCE_DMA,
461 .start = CH_UART3_RX,
463 .flags = IORESOURCE_DMA,
465 #ifdef CONFIG_BFIN_UART3_CTSRTS
466 { /* CTS pin -- 0 means not supported */
469 .flags = IORESOURCE_IO,
471 { /* RTS pin -- 0 means not supported */
474 .flags = IORESOURCE_IO,
479 static unsigned short bfin_uart3_peripherals[] = {
480 P_UART3_TX, P_UART3_RX,
481 #ifdef CONFIG_BFIN_UART3_CTSRTS
482 P_UART3_RTS, P_UART3_CTS,
487 static struct platform_device bfin_uart3_device = {
490 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
491 .resource = bfin_uart3_resources,
493 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
499 #if IS_ENABLED(CONFIG_BFIN_SIR)
500 #ifdef CONFIG_BFIN_SIR0
501 static struct resource bfin_sir0_resources[] = {
505 .flags = IORESOURCE_MEM,
508 .start = IRQ_UART0_RX,
509 .end = IRQ_UART0_RX+1,
510 .flags = IORESOURCE_IRQ,
513 .start = CH_UART0_RX,
514 .end = CH_UART0_RX+1,
515 .flags = IORESOURCE_DMA,
518 static struct platform_device bfin_sir0_device = {
521 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
522 .resource = bfin_sir0_resources,
525 #ifdef CONFIG_BFIN_SIR1
526 static struct resource bfin_sir1_resources[] = {
530 .flags = IORESOURCE_MEM,
533 .start = IRQ_UART1_RX,
534 .end = IRQ_UART1_RX+1,
535 .flags = IORESOURCE_IRQ,
538 .start = CH_UART1_RX,
539 .end = CH_UART1_RX+1,
540 .flags = IORESOURCE_DMA,
543 static struct platform_device bfin_sir1_device = {
546 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
547 .resource = bfin_sir1_resources,
550 #ifdef CONFIG_BFIN_SIR2
551 static struct resource bfin_sir2_resources[] = {
555 .flags = IORESOURCE_MEM,
558 .start = IRQ_UART2_RX,
559 .end = IRQ_UART2_RX+1,
560 .flags = IORESOURCE_IRQ,
563 .start = CH_UART2_RX,
564 .end = CH_UART2_RX+1,
565 .flags = IORESOURCE_DMA,
568 static struct platform_device bfin_sir2_device = {
571 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
572 .resource = bfin_sir2_resources,
575 #ifdef CONFIG_BFIN_SIR3
576 static struct resource bfin_sir3_resources[] = {
580 .flags = IORESOURCE_MEM,
583 .start = IRQ_UART3_RX,
584 .end = IRQ_UART3_RX+1,
585 .flags = IORESOURCE_IRQ,
588 .start = CH_UART3_RX,
589 .end = CH_UART3_RX+1,
590 .flags = IORESOURCE_DMA,
593 static struct platform_device bfin_sir3_device = {
596 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
597 .resource = bfin_sir3_resources,
602 #if IS_ENABLED(CONFIG_SMSC911X)
603 #include <linux/smsc911x.h>
605 static struct resource smsc911x_resources[] = {
607 .name = "smsc911x-memory",
609 .end = 0x24000000 + 0xFF,
610 .flags = IORESOURCE_MEM,
615 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
619 static struct smsc911x_platform_config smsc911x_config = {
620 .flags = SMSC911X_USE_32BIT,
621 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
622 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
623 .phy_interface = PHY_INTERFACE_MODE_MII,
626 static struct platform_device smsc911x_device = {
629 .num_resources = ARRAY_SIZE(smsc911x_resources),
630 .resource = smsc911x_resources,
632 .platform_data = &smsc911x_config,
637 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
638 static struct resource musb_resources[] = {
642 .flags = IORESOURCE_MEM,
644 [1] = { /* general IRQ */
645 .start = IRQ_USB_INT0,
647 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
650 [2] = { /* DMA IRQ */
651 .start = IRQ_USB_DMA,
653 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
658 static struct musb_hdrc_config musb_config = {
665 .gpio_vrsel = GPIO_PE7,
666 /* Some custom boards need to be active low, just set it to "0"
669 .gpio_vrsel_active = 1,
670 .clkin = 24, /* musb CLKIN in MHZ */
673 static struct musb_hdrc_platform_data musb_plat = {
674 #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
676 #elif defined(CONFIG_USB_MUSB_HDRC)
678 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
679 .mode = MUSB_PERIPHERAL,
681 .config = &musb_config,
684 static u64 musb_dmamask = ~(u32)0;
686 static struct platform_device musb_device = {
687 .name = "musb-blackfin",
690 .dma_mask = &musb_dmamask,
691 .coherent_dma_mask = 0xffffffff,
692 .platform_data = &musb_plat,
694 .num_resources = ARRAY_SIZE(musb_resources),
695 .resource = musb_resources,
699 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
700 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
701 static struct resource bfin_sport0_uart_resources[] = {
703 .start = SPORT0_TCR1,
704 .end = SPORT0_MRCS3+4,
705 .flags = IORESOURCE_MEM,
708 .start = IRQ_SPORT0_RX,
709 .end = IRQ_SPORT0_RX+1,
710 .flags = IORESOURCE_IRQ,
713 .start = IRQ_SPORT0_ERROR,
714 .end = IRQ_SPORT0_ERROR,
715 .flags = IORESOURCE_IRQ,
719 static unsigned short bfin_sport0_peripherals[] = {
720 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
721 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
724 static struct platform_device bfin_sport0_uart_device = {
725 .name = "bfin-sport-uart",
727 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
728 .resource = bfin_sport0_uart_resources,
730 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
734 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
735 static struct resource bfin_sport1_uart_resources[] = {
737 .start = SPORT1_TCR1,
738 .end = SPORT1_MRCS3+4,
739 .flags = IORESOURCE_MEM,
742 .start = IRQ_SPORT1_RX,
743 .end = IRQ_SPORT1_RX+1,
744 .flags = IORESOURCE_IRQ,
747 .start = IRQ_SPORT1_ERROR,
748 .end = IRQ_SPORT1_ERROR,
749 .flags = IORESOURCE_IRQ,
753 static unsigned short bfin_sport1_peripherals[] = {
754 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
755 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
758 static struct platform_device bfin_sport1_uart_device = {
759 .name = "bfin-sport-uart",
761 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
762 .resource = bfin_sport1_uart_resources,
764 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
768 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
769 static struct resource bfin_sport2_uart_resources[] = {
771 .start = SPORT2_TCR1,
772 .end = SPORT2_MRCS3+4,
773 .flags = IORESOURCE_MEM,
776 .start = IRQ_SPORT2_RX,
777 .end = IRQ_SPORT2_RX+1,
778 .flags = IORESOURCE_IRQ,
781 .start = IRQ_SPORT2_ERROR,
782 .end = IRQ_SPORT2_ERROR,
783 .flags = IORESOURCE_IRQ,
787 static unsigned short bfin_sport2_peripherals[] = {
788 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
789 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
792 static struct platform_device bfin_sport2_uart_device = {
793 .name = "bfin-sport-uart",
795 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
796 .resource = bfin_sport2_uart_resources,
798 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
802 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
803 static struct resource bfin_sport3_uart_resources[] = {
805 .start = SPORT3_TCR1,
806 .end = SPORT3_MRCS3+4,
807 .flags = IORESOURCE_MEM,
810 .start = IRQ_SPORT3_RX,
811 .end = IRQ_SPORT3_RX+1,
812 .flags = IORESOURCE_IRQ,
815 .start = IRQ_SPORT3_ERROR,
816 .end = IRQ_SPORT3_ERROR,
817 .flags = IORESOURCE_IRQ,
821 static unsigned short bfin_sport3_peripherals[] = {
822 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
823 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
826 static struct platform_device bfin_sport3_uart_device = {
827 .name = "bfin-sport-uart",
829 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
830 .resource = bfin_sport3_uart_resources,
832 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
838 #if IS_ENABLED(CONFIG_CAN_BFIN)
840 static unsigned short bfin_can0_peripherals[] = {
841 P_CAN0_RX, P_CAN0_TX, 0
844 static struct resource bfin_can0_resources[] = {
848 .flags = IORESOURCE_MEM,
851 .start = IRQ_CAN0_RX,
853 .flags = IORESOURCE_IRQ,
856 .start = IRQ_CAN0_TX,
858 .flags = IORESOURCE_IRQ,
861 .start = IRQ_CAN0_ERROR,
862 .end = IRQ_CAN0_ERROR,
863 .flags = IORESOURCE_IRQ,
867 static struct platform_device bfin_can0_device = {
870 .num_resources = ARRAY_SIZE(bfin_can0_resources),
871 .resource = bfin_can0_resources,
873 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
877 static unsigned short bfin_can1_peripherals[] = {
878 P_CAN1_RX, P_CAN1_TX, 0
881 static struct resource bfin_can1_resources[] = {
885 .flags = IORESOURCE_MEM,
888 .start = IRQ_CAN1_RX,
890 .flags = IORESOURCE_IRQ,
893 .start = IRQ_CAN1_TX,
895 .flags = IORESOURCE_IRQ,
898 .start = IRQ_CAN1_ERROR,
899 .end = IRQ_CAN1_ERROR,
900 .flags = IORESOURCE_IRQ,
904 static struct platform_device bfin_can1_device = {
907 .num_resources = ARRAY_SIZE(bfin_can1_resources),
908 .resource = bfin_can1_resources,
910 .platform_data = &bfin_can1_peripherals, /* Passed to driver */
916 #if IS_ENABLED(CONFIG_PATA_BF54X)
917 static struct resource bfin_atapi_resources[] = {
921 .flags = IORESOURCE_MEM,
924 .start = IRQ_ATAPI_ERR,
925 .end = IRQ_ATAPI_ERR,
926 .flags = IORESOURCE_IRQ,
930 static struct platform_device bfin_atapi_device = {
931 .name = "pata-bf54x",
933 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
934 .resource = bfin_atapi_resources,
938 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
939 static struct mtd_partition partition_info[] = {
941 .name = "bootloader(nand)",
945 .name = "linux kernel(nand)",
946 .offset = MTDPART_OFS_APPEND,
947 .size = 4 * 1024 * 1024,
950 .name = "file system(nand)",
951 .offset = MTDPART_OFS_APPEND,
952 .size = MTDPART_SIZ_FULL,
956 static struct bf5xx_nand_platform bf5xx_nand_platform = {
957 .data_width = NFC_NWIDTH_8,
958 .partitions = partition_info,
959 .nr_partitions = ARRAY_SIZE(partition_info),
964 static struct resource bf5xx_nand_resources[] = {
968 .flags = IORESOURCE_MEM,
973 .flags = IORESOURCE_IRQ,
977 static struct platform_device bf5xx_nand_device = {
978 .name = "bf5xx-nand",
980 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
981 .resource = bf5xx_nand_resources,
983 .platform_data = &bf5xx_nand_platform,
988 #if IS_ENABLED(CONFIG_SDH_BFIN)
990 static struct bfin_sd_host bfin_sdh_data = {
992 .irq_int0 = IRQ_SDH_MASK0,
993 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
996 static struct platform_device bf54x_sdh_device = {
1000 .platform_data = &bfin_sdh_data,
1005 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
1006 static struct mtd_partition ezkit_partitions[] = {
1008 .name = "bootloader(nor)",
1012 .name = "linux kernel(nor)",
1014 .offset = MTDPART_OFS_APPEND,
1016 .name = "file system(nor)",
1017 .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
1018 .offset = MTDPART_OFS_APPEND,
1020 .name = "config(nor)",
1022 .offset = MTDPART_OFS_APPEND,
1024 .name = "u-boot env(nor)",
1026 .offset = MTDPART_OFS_APPEND,
1030 static struct physmap_flash_data ezkit_flash_data = {
1032 .parts = ezkit_partitions,
1033 .nr_parts = ARRAY_SIZE(ezkit_partitions),
1036 static struct resource ezkit_flash_resource = {
1037 .start = 0x20000000,
1039 .flags = IORESOURCE_MEM,
1042 static struct platform_device ezkit_flash_device = {
1043 .name = "physmap-flash",
1046 .platform_data = &ezkit_flash_data,
1049 .resource = &ezkit_flash_resource,
1053 #if IS_ENABLED(CONFIG_MTD_M25P80)
1054 /* SPI flash chip (m25p16) */
1055 static struct mtd_partition bfin_spi_flash_partitions[] = {
1057 .name = "bootloader(spi)",
1060 .mask_flags = MTD_CAP_ROM
1062 .name = "linux kernel(spi)",
1063 .size = MTDPART_SIZ_FULL,
1064 .offset = MTDPART_OFS_APPEND,
1068 static struct flash_platform_data bfin_spi_flash_data = {
1070 .parts = bfin_spi_flash_partitions,
1071 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
1075 static struct bfin5xx_spi_chip spi_flash_chip_info = {
1076 .enable_dma = 0, /* use dma transfer with this chip*/
1080 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1081 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1083 .vref_delay_usecs = 50, /* internal, no capacitor */
1084 .x_plate_ohms = 419,
1085 .y_plate_ohms = 486,
1086 .pressure_max = 1000,
1088 .stopacq_polarity = 1,
1089 .first_conversion_delay = 3,
1090 .acquisition_time = 1,
1092 .pen_down_acc_interval = 1,
1096 #ifdef CONFIG_PINCTRL_ADI2
1098 # define ADI_PINT_DEVNAME "adi-gpio-pint"
1099 # define ADI_GPIO_DEVNAME "adi-gpio"
1100 # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
1102 static struct platform_device bfin_pinctrl_device = {
1103 .name = ADI_PINCTRL_DEVNAME,
1107 static struct resource bfin_pint0_resources[] = {
1109 .start = PINT0_MASK_SET,
1110 .end = PINT0_LATCH + 3,
1111 .flags = IORESOURCE_MEM,
1116 .flags = IORESOURCE_IRQ,
1120 static struct platform_device bfin_pint0_device = {
1121 .name = ADI_PINT_DEVNAME,
1123 .num_resources = ARRAY_SIZE(bfin_pint0_resources),
1124 .resource = bfin_pint0_resources,
1127 static struct resource bfin_pint1_resources[] = {
1129 .start = PINT1_MASK_SET,
1130 .end = PINT1_LATCH + 3,
1131 .flags = IORESOURCE_MEM,
1136 .flags = IORESOURCE_IRQ,
1140 static struct platform_device bfin_pint1_device = {
1141 .name = ADI_PINT_DEVNAME,
1143 .num_resources = ARRAY_SIZE(bfin_pint1_resources),
1144 .resource = bfin_pint1_resources,
1147 static struct resource bfin_pint2_resources[] = {
1149 .start = PINT2_MASK_SET,
1150 .end = PINT2_LATCH + 3,
1151 .flags = IORESOURCE_MEM,
1156 .flags = IORESOURCE_IRQ,
1160 static struct platform_device bfin_pint2_device = {
1161 .name = ADI_PINT_DEVNAME,
1163 .num_resources = ARRAY_SIZE(bfin_pint2_resources),
1164 .resource = bfin_pint2_resources,
1167 static struct resource bfin_pint3_resources[] = {
1169 .start = PINT3_MASK_SET,
1170 .end = PINT3_LATCH + 3,
1171 .flags = IORESOURCE_MEM,
1176 .flags = IORESOURCE_IRQ,
1180 static struct platform_device bfin_pint3_device = {
1181 .name = ADI_PINT_DEVNAME,
1183 .num_resources = ARRAY_SIZE(bfin_pint3_resources),
1184 .resource = bfin_pint3_resources,
1187 static struct resource bfin_gpa_resources[] = {
1190 .end = PORTA_MUX + 3,
1191 .flags = IORESOURCE_MEM,
1196 .flags = IORESOURCE_IRQ,
1200 static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
1201 .port_gpio_base = GPIO_PA0, /* Optional */
1202 .port_pin_base = GPIO_PA0,
1203 .port_width = GPIO_BANKSIZE,
1204 .pint_id = 0, /* PINT0 */
1205 .pint_assign = true, /* PINT upper 16 bit */
1206 .pint_map = 0, /* mapping mask in PINT */
1209 static struct platform_device bfin_gpa_device = {
1210 .name = ADI_GPIO_DEVNAME,
1212 .num_resources = ARRAY_SIZE(bfin_gpa_resources),
1213 .resource = bfin_gpa_resources,
1215 .platform_data = &bfin_gpa_pdata, /* Passed to driver */
1219 static struct resource bfin_gpb_resources[] = {
1222 .end = PORTB_MUX + 3,
1223 .flags = IORESOURCE_MEM,
1228 .flags = IORESOURCE_IRQ,
1232 static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
1233 .port_gpio_base = GPIO_PB0,
1234 .port_pin_base = GPIO_PB0,
1237 .pint_assign = true,
1241 static struct platform_device bfin_gpb_device = {
1242 .name = ADI_GPIO_DEVNAME,
1244 .num_resources = ARRAY_SIZE(bfin_gpb_resources),
1245 .resource = bfin_gpb_resources,
1247 .platform_data = &bfin_gpb_pdata, /* Passed to driver */
1251 static struct resource bfin_gpc_resources[] = {
1254 .end = PORTC_MUX + 3,
1255 .flags = IORESOURCE_MEM,
1260 .flags = IORESOURCE_IRQ,
1264 static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
1265 .port_gpio_base = GPIO_PC0,
1266 .port_pin_base = GPIO_PC0,
1269 .pint_assign = true,
1273 static struct platform_device bfin_gpc_device = {
1274 .name = ADI_GPIO_DEVNAME,
1276 .num_resources = ARRAY_SIZE(bfin_gpc_resources),
1277 .resource = bfin_gpc_resources,
1279 .platform_data = &bfin_gpc_pdata, /* Passed to driver */
1283 static struct resource bfin_gpd_resources[] = {
1286 .end = PORTD_MUX + 3,
1287 .flags = IORESOURCE_MEM,
1292 .flags = IORESOURCE_IRQ,
1296 static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
1297 .port_gpio_base = GPIO_PD0,
1298 .port_pin_base = GPIO_PD0,
1299 .port_width = GPIO_BANKSIZE,
1301 .pint_assign = false,
1305 static struct platform_device bfin_gpd_device = {
1306 .name = ADI_GPIO_DEVNAME,
1308 .num_resources = ARRAY_SIZE(bfin_gpd_resources),
1309 .resource = bfin_gpd_resources,
1311 .platform_data = &bfin_gpd_pdata, /* Passed to driver */
1315 static struct resource bfin_gpe_resources[] = {
1318 .end = PORTE_MUX + 3,
1319 .flags = IORESOURCE_MEM,
1324 .flags = IORESOURCE_IRQ,
1328 static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
1329 .port_gpio_base = GPIO_PE0,
1330 .port_pin_base = GPIO_PE0,
1331 .port_width = GPIO_BANKSIZE,
1333 .pint_assign = true,
1337 static struct platform_device bfin_gpe_device = {
1338 .name = ADI_GPIO_DEVNAME,
1340 .num_resources = ARRAY_SIZE(bfin_gpe_resources),
1341 .resource = bfin_gpe_resources,
1343 .platform_data = &bfin_gpe_pdata, /* Passed to driver */
1347 static struct resource bfin_gpf_resources[] = {
1350 .end = PORTF_MUX + 3,
1351 .flags = IORESOURCE_MEM,
1356 .flags = IORESOURCE_IRQ,
1360 static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
1361 .port_gpio_base = GPIO_PF0,
1362 .port_pin_base = GPIO_PF0,
1363 .port_width = GPIO_BANKSIZE,
1365 .pint_assign = false,
1369 static struct platform_device bfin_gpf_device = {
1370 .name = ADI_GPIO_DEVNAME,
1372 .num_resources = ARRAY_SIZE(bfin_gpf_resources),
1373 .resource = bfin_gpf_resources,
1375 .platform_data = &bfin_gpf_pdata, /* Passed to driver */
1379 static struct resource bfin_gpg_resources[] = {
1382 .end = PORTG_MUX + 3,
1383 .flags = IORESOURCE_MEM,
1388 .flags = IORESOURCE_IRQ,
1392 static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
1393 .port_gpio_base = GPIO_PG0,
1394 .port_pin_base = GPIO_PG0,
1395 .port_width = GPIO_BANKSIZE,
1399 static struct platform_device bfin_gpg_device = {
1400 .name = ADI_GPIO_DEVNAME,
1402 .num_resources = ARRAY_SIZE(bfin_gpg_resources),
1403 .resource = bfin_gpg_resources,
1405 .platform_data = &bfin_gpg_pdata, /* Passed to driver */
1409 static struct resource bfin_gph_resources[] = {
1412 .end = PORTH_MUX + 3,
1413 .flags = IORESOURCE_MEM,
1418 .flags = IORESOURCE_IRQ,
1422 static struct adi_pinctrl_gpio_platform_data bfin_gph_pdata = {
1423 .port_gpio_base = GPIO_PH0,
1424 .port_pin_base = GPIO_PH0,
1429 static struct platform_device bfin_gph_device = {
1430 .name = ADI_GPIO_DEVNAME,
1432 .num_resources = ARRAY_SIZE(bfin_gph_resources),
1433 .resource = bfin_gph_resources,
1435 .platform_data = &bfin_gph_pdata, /* Passed to driver */
1439 static struct resource bfin_gpi_resources[] = {
1442 .end = PORTI_MUX + 3,
1443 .flags = IORESOURCE_MEM,
1448 .flags = IORESOURCE_IRQ,
1452 static struct adi_pinctrl_gpio_platform_data bfin_gpi_pdata = {
1453 .port_gpio_base = GPIO_PI0,
1454 .port_pin_base = GPIO_PI0,
1455 .port_width = GPIO_BANKSIZE,
1459 static struct platform_device bfin_gpi_device = {
1460 .name = ADI_GPIO_DEVNAME,
1462 .num_resources = ARRAY_SIZE(bfin_gpi_resources),
1463 .resource = bfin_gpi_resources,
1465 .platform_data = &bfin_gpi_pdata, /* Passed to driver */
1469 static struct resource bfin_gpj_resources[] = {
1472 .end = PORTJ_MUX + 3,
1473 .flags = IORESOURCE_MEM,
1478 .flags = IORESOURCE_IRQ,
1482 static struct adi_pinctrl_gpio_platform_data bfin_gpj_pdata = {
1483 .port_gpio_base = GPIO_PJ0,
1484 .port_pin_base = GPIO_PJ0,
1489 static struct platform_device bfin_gpj_device = {
1490 .name = ADI_GPIO_DEVNAME,
1492 .num_resources = ARRAY_SIZE(bfin_gpj_resources),
1493 .resource = bfin_gpj_resources,
1495 .platform_data = &bfin_gpj_pdata, /* Passed to driver */
1501 static struct spi_board_info bfin_spi_board_info[] __initdata = {
1502 #if IS_ENABLED(CONFIG_MTD_M25P80)
1504 /* the modalias must be the same as spi device driver name */
1505 .modalias = "m25p80", /* Name of spi_driver for this device */
1506 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1507 .bus_num = 0, /* Framework bus number */
1508 .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1*/
1509 .platform_data = &bfin_spi_flash_data,
1510 .controller_data = &spi_flash_chip_info,
1514 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
1516 .modalias = "ad183x",
1517 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1519 .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
1522 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
1524 .modalias = "ad7877",
1525 .platform_data = &bfin_ad7877_ts_info,
1526 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
1527 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1529 .chip_select = MAX_CTRL_CS + GPIO_PE5, /* SPI_SSEL2 */
1532 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
1534 .modalias = "spidev",
1535 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1537 .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1 */
1540 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
1542 .modalias = "adxl34x",
1543 .platform_data = &adxl34x_info,
1545 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1547 .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
1552 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
1554 static struct resource bfin_spi0_resource[] = {
1556 .start = SPI0_REGBASE,
1557 .end = SPI0_REGBASE + 0xFF,
1558 .flags = IORESOURCE_MEM,
1563 .flags = IORESOURCE_DMA,
1568 .flags = IORESOURCE_IRQ,
1573 static struct resource bfin_spi1_resource[] = {
1575 .start = SPI1_REGBASE,
1576 .end = SPI1_REGBASE + 0xFF,
1577 .flags = IORESOURCE_MEM,
1582 .flags = IORESOURCE_DMA,
1587 .flags = IORESOURCE_IRQ,
1591 /* SPI controller data */
1592 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
1593 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1594 .enable_dma = 1, /* master has the ability to do dma transfer */
1595 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1598 static struct platform_device bf54x_spi_master0 = {
1600 .id = 0, /* Bus number */
1601 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1602 .resource = bfin_spi0_resource,
1604 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
1608 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
1609 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1610 .enable_dma = 1, /* master has the ability to do dma transfer */
1611 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1614 static struct platform_device bf54x_spi_master1 = {
1616 .id = 1, /* Bus number */
1617 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1618 .resource = bfin_spi1_resource,
1620 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1623 #endif /* spi master and devices */
1625 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
1626 #include <linux/videodev2.h>
1627 #include <media/blackfin/bfin_capture.h>
1628 #include <media/blackfin/ppi.h>
1630 static const unsigned short ppi_req[] = {
1631 P_PPI1_D0, P_PPI1_D1, P_PPI1_D2, P_PPI1_D3,
1632 P_PPI1_D4, P_PPI1_D5, P_PPI1_D6, P_PPI1_D7,
1633 P_PPI1_CLK, P_PPI1_FS1, P_PPI1_FS2,
1637 static const struct ppi_info ppi_info = {
1638 .type = PPI_TYPE_EPPI,
1640 .irq_err = IRQ_EPPI1_ERROR,
1641 .base = (void __iomem *)EPPI1_STATUS,
1645 #if IS_ENABLED(CONFIG_VIDEO_VS6624)
1646 static struct v4l2_input vs6624_inputs[] = {
1650 .type = V4L2_INPUT_TYPE_CAMERA,
1651 .std = V4L2_STD_UNKNOWN,
1655 static struct bcap_route vs6624_routes[] = {
1662 static const unsigned vs6624_ce_pin = GPIO_PG6;
1664 static struct bfin_capture_config bfin_capture_data = {
1665 .card_name = "BF548",
1666 .inputs = vs6624_inputs,
1667 .num_inputs = ARRAY_SIZE(vs6624_inputs),
1668 .routes = vs6624_routes,
1669 .i2c_adapter_id = 0,
1673 .platform_data = (void *)&vs6624_ce_pin,
1675 .ppi_info = &ppi_info,
1676 .ppi_control = (POLC | PACKEN | DLEN_8 | XFR_TYPE | 0x20),
1677 .int_mask = 0xFFFFFFFF, /* disable error interrupt on eppi */
1678 .blank_clocks = 8, /* 8 clocks as SAV and EAV */
1682 static struct platform_device bfin_capture_device = {
1683 .name = "bfin_capture",
1685 .platform_data = &bfin_capture_data,
1690 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1691 static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1693 static struct resource bfin_twi0_resource[] = {
1695 .start = TWI0_REGBASE,
1696 .end = TWI0_REGBASE + 0xFF,
1697 .flags = IORESOURCE_MEM,
1702 .flags = IORESOURCE_IRQ,
1706 static struct platform_device i2c_bfin_twi0_device = {
1707 .name = "i2c-bfin-twi",
1709 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1710 .resource = bfin_twi0_resource,
1712 .platform_data = &bfin_twi0_pins,
1716 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1717 static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1719 static struct resource bfin_twi1_resource[] = {
1721 .start = TWI1_REGBASE,
1722 .end = TWI1_REGBASE + 0xFF,
1723 .flags = IORESOURCE_MEM,
1728 .flags = IORESOURCE_IRQ,
1732 static struct platform_device i2c_bfin_twi1_device = {
1733 .name = "i2c-bfin-twi",
1735 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1736 .resource = bfin_twi1_resource,
1738 .platform_data = &bfin_twi1_pins,
1744 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1745 #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
1747 I2C_BOARD_INFO("ssm2602", 0x1b),
1752 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1753 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1754 #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
1756 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1759 #if IS_ENABLED(CONFIG_INPUT_PCF8574)
1761 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1765 #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
1767 I2C_BOARD_INFO("adxl34x", 0x53),
1769 .platform_data = (void *)&adxl34x_info,
1772 #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
1774 I2C_BOARD_INFO("ad5252", 0x2f),
1780 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1781 #include <linux/gpio_keys.h>
1783 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1784 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
1785 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
1786 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
1787 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
1790 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1791 .buttons = bfin_gpio_keys_table,
1792 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1795 static struct platform_device bfin_device_gpiokeys = {
1796 .name = "gpio-keys",
1798 .platform_data = &bfin_gpio_keys_data,
1803 static const unsigned int cclk_vlev_datasheet[] =
1806 * Internal VLEV BF54XSBBC1533
1807 ****temporarily using these values until data sheet is updated
1809 VRPAIR(VLEV_085, 150000000),
1810 VRPAIR(VLEV_090, 250000000),
1811 VRPAIR(VLEV_110, 276000000),
1812 VRPAIR(VLEV_115, 301000000),
1813 VRPAIR(VLEV_120, 525000000),
1814 VRPAIR(VLEV_125, 550000000),
1815 VRPAIR(VLEV_130, 600000000),
1818 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1819 .tuple_tab = cclk_vlev_datasheet,
1820 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1821 .vr_settling_time = 25 /* us */,
1824 static struct platform_device bfin_dpmc = {
1825 .name = "bfin dpmc",
1827 .platform_data = &bfin_dmpc_vreg_data,
1831 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) || \
1832 IS_ENABLED(CONFIG_SND_BF5XX_AC97)
1834 #define SPORT_REQ(x) \
1835 [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
1836 P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
1838 static const u16 bfin_snd_pin[][7] = {
1845 static struct bfin_snd_platform_data bfin_snd_data[] = {
1847 .pin_req = &bfin_snd_pin[0][0],
1850 .pin_req = &bfin_snd_pin[1][0],
1853 .pin_req = &bfin_snd_pin[2][0],
1856 .pin_req = &bfin_snd_pin[3][0],
1860 #define BFIN_SND_RES(x) \
1863 .start = SPORT##x##_TCR1, \
1864 .end = SPORT##x##_TCR1, \
1865 .flags = IORESOURCE_MEM \
1868 .start = CH_SPORT##x##_RX, \
1869 .end = CH_SPORT##x##_RX, \
1870 .flags = IORESOURCE_DMA, \
1873 .start = CH_SPORT##x##_TX, \
1874 .end = CH_SPORT##x##_TX, \
1875 .flags = IORESOURCE_DMA, \
1878 .start = IRQ_SPORT##x##_ERROR, \
1879 .end = IRQ_SPORT##x##_ERROR, \
1880 .flags = IORESOURCE_IRQ, \
1884 static struct resource bfin_snd_resources[][4] = {
1892 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
1893 static struct platform_device bfin_i2s_pcm = {
1894 .name = "bfin-i2s-pcm-audio",
1899 #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
1900 static struct platform_device bfin_ac97_pcm = {
1901 .name = "bfin-ac97-pcm-audio",
1906 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD73311)
1907 static struct platform_device bfin_ad73311_codec_device = {
1913 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
1914 static struct platform_device bfin_ad1980_codec_device = {
1920 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_I2S)
1921 static struct platform_device bfin_i2s = {
1923 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1924 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1925 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1927 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1932 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AC97)
1933 static struct platform_device bfin_ac97 = {
1934 .name = "bfin-ac97",
1935 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1936 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1937 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1939 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1944 static struct platform_device *ezkit_devices[] __initdata = {
1947 #if defined(CONFIG_PINCTRL_ADI2)
1948 &bfin_pinctrl_device,
1965 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
1969 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
1970 #ifdef CONFIG_SERIAL_BFIN_UART0
1973 #ifdef CONFIG_SERIAL_BFIN_UART1
1976 #ifdef CONFIG_SERIAL_BFIN_UART2
1979 #ifdef CONFIG_SERIAL_BFIN_UART3
1984 #if IS_ENABLED(CONFIG_BFIN_SIR)
1985 #ifdef CONFIG_BFIN_SIR0
1988 #ifdef CONFIG_BFIN_SIR1
1991 #ifdef CONFIG_BFIN_SIR2
1994 #ifdef CONFIG_BFIN_SIR3
1999 #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
2000 &bf54x_lq043_device,
2003 #if IS_ENABLED(CONFIG_SMSC911X)
2007 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
2011 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
2012 &bfin_isp1760_device,
2015 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
2016 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2017 &bfin_sport0_uart_device,
2019 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2020 &bfin_sport1_uart_device,
2022 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
2023 &bfin_sport2_uart_device,
2025 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
2026 &bfin_sport3_uart_device,
2030 #if IS_ENABLED(CONFIG_CAN_BFIN)
2035 #if IS_ENABLED(CONFIG_PATA_BF54X)
2039 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
2043 #if IS_ENABLED(CONFIG_SDH_BFIN)
2047 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
2051 #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
2052 &bfin_capture_device,
2055 #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
2059 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
2060 &bfin_rotary_device,
2063 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
2064 &i2c_bfin_twi0_device,
2065 #if !defined(CONFIG_BF542)
2066 &i2c_bfin_twi1_device,
2070 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
2071 &bfin_device_gpiokeys,
2074 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
2075 &ezkit_flash_device,
2078 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
2082 #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
2086 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
2087 &bfin_ad1980_codec_device,
2090 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
2094 #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
2099 /* Pin control settings */
2100 static struct pinctrl_map __initdata bfin_pinmux_map[] = {
2101 /* per-device maps */
2102 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
2103 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
2104 #ifdef CONFIG_BFIN_UART1_CTSRTS
2105 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1_ctsrts"),
2107 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.2", "pinctrl-adi2.0", NULL, "uart2"),
2108 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3"),
2109 #ifdef CONFIG_BFIN_UART3_CTSRTS
2110 PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3_ctsrts"),
2112 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
2113 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
2114 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.2", "pinctrl-adi2.0", NULL, "uart2"),
2115 PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.3", "pinctrl-adi2.0", NULL, "uart3"),
2116 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
2117 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.0", "pinctrl-adi2.0", NULL, "spi0"),
2118 PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.1", "pinctrl-adi2.0", NULL, "spi1"),
2119 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
2120 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
2121 PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
2123 PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
2124 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
2125 PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"),
2126 PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"),
2127 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
2128 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
2129 PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"),
2130 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
2131 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
2132 PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.1", "pinctrl-adi2.0", NULL, "sport1"),
2133 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
2134 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
2135 PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.2", "pinctrl-adi2.0", NULL, "sport2"),
2136 PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.3", "pinctrl-adi2.0", NULL, "sport3"),
2137 PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.3", "pinctrl-adi2.0", NULL, "sport3"),
2138 PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.3", "pinctrl-adi2.0", NULL, "sport3"),
2139 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.0", "pinctrl-adi2.0", NULL, "sport0"),
2140 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.1", "pinctrl-adi2.0", NULL, "sport1"),
2141 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.2", "pinctrl-adi2.0", NULL, "sport2"),
2142 PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.3", "pinctrl-adi2.0", NULL, "sport3"),
2143 PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi"),
2144 #ifdef CONFIG_BF548_ATAPI_ALTERNATIVE_PORT
2145 PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"),
2147 PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"),
2148 PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
2149 PIN_MAP_MUX_GROUP("bf54x-keys", "4bit", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
2150 PIN_MAP_MUX_GROUP("bf54x-keys", "8bit", "pinctrl-adi2.0", "keys_8x8grp", "keys"),
2153 static int __init ezkit_init(void)
2155 printk(KERN_INFO "%s(): registering device resources\n", __func__);
2157 /* Initialize pinmuxing */
2158 pinctrl_register_mappings(bfin_pinmux_map,
2159 ARRAY_SIZE(bfin_pinmux_map));
2161 i2c_register_board_info(0, bfin_i2c_board_info0,
2162 ARRAY_SIZE(bfin_i2c_board_info0));
2163 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
2164 i2c_register_board_info(1, bfin_i2c_board_info1,
2165 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
2185 #ifdef CONFIG_SERIAL_BFIN_UART2
2188 #ifdef CONFIG_SERIAL_BFIN_UART3
2194 void __init native_machine_early_platform_add_devices(void)
2196 printk(KERN_INFO "register early platform devices\n");
2197 early_platform_add_devices(ezkit_early_devices,
2198 ARRAY_SIZE(ezkit_early_devices));