2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2008-2009 Bluetechnix
4 * 2005 National ICT Australia (NICTA)
5 * Aidan Williams <aidan@nicta.com.au>
7 * Licensed under the GPL-2 or later.
10 #include <linux/device.h>
11 #include <linux/platform_device.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/mtd/physmap.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/musb.h>
20 #include <asm/bfin5xx_spi.h>
24 #include <asm/portmux.h>
25 #include <asm/bfin_sdh.h>
26 #include <mach/bf54x_keys.h>
28 #include <linux/input.h>
29 #include <linux/spi/ad7877.h>
32 * Name the Board for the /proc/cpuinfo
34 const char bfin_board_name[] = "Bluetechnix CM-BF548";
37 * Driver needs to know address, irq and flag pin.
40 #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
42 #include <mach/bf54x-lq043.h>
44 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
47 .xres = {480, 480, 480},
48 .yres = {272, 272, 272},
53 static struct resource bf54x_lq043_resources[] = {
55 .start = IRQ_EPPI0_ERR,
57 .flags = IORESOURCE_IRQ,
61 static struct platform_device bf54x_lq043_device = {
62 .name = "bf54x-lq043",
64 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
65 .resource = bf54x_lq043_resources,
67 .platform_data = &bf54x_lq043_data,
72 #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
73 static unsigned int bf548_keymap[] = {
74 KEYVAL(0, 0, KEY_ENTER),
75 KEYVAL(0, 1, KEY_HELP),
77 KEYVAL(0, 3, KEY_BACKSPACE),
78 KEYVAL(1, 0, KEY_TAB),
82 KEYVAL(2, 0, KEY_DOWN),
92 static struct bfin_kpad_platform_data bf54x_kpad_data = {
95 .keymap = bf548_keymap,
96 .keymapsize = ARRAY_SIZE(bf548_keymap),
98 .debounce_time = 5000, /* ns (5ms) */
99 .coldrive_time = 1000, /* ns (1ms) */
100 .keyup_test_interval = 50, /* ms (50ms) */
103 static struct resource bf54x_kpad_resources[] = {
107 .flags = IORESOURCE_IRQ,
111 static struct platform_device bf54x_kpad_device = {
112 .name = "bf54x-keys",
114 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
115 .resource = bf54x_kpad_resources,
117 .platform_data = &bf54x_kpad_data,
122 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
123 static struct platform_device rtc_device = {
129 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
130 #ifdef CONFIG_SERIAL_BFIN_UART0
131 static struct resource bfin_uart0_resources[] = {
135 .flags = IORESOURCE_MEM,
138 .start = IRQ_UART0_TX,
140 .flags = IORESOURCE_IRQ,
143 .start = IRQ_UART0_RX,
145 .flags = IORESOURCE_IRQ,
148 .start = IRQ_UART0_ERROR,
149 .end = IRQ_UART0_ERROR,
150 .flags = IORESOURCE_IRQ,
153 .start = CH_UART0_TX,
155 .flags = IORESOURCE_DMA,
158 .start = CH_UART0_RX,
160 .flags = IORESOURCE_DMA,
164 static unsigned short bfin_uart0_peripherals[] = {
165 P_UART0_TX, P_UART0_RX, 0
168 static struct platform_device bfin_uart0_device = {
171 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
172 .resource = bfin_uart0_resources,
174 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
178 #ifdef CONFIG_SERIAL_BFIN_UART1
179 static struct resource bfin_uart1_resources[] = {
183 .flags = IORESOURCE_MEM,
186 .start = IRQ_UART1_TX,
188 .flags = IORESOURCE_IRQ,
191 .start = IRQ_UART1_RX,
193 .flags = IORESOURCE_IRQ,
196 .start = IRQ_UART1_ERROR,
197 .end = IRQ_UART1_ERROR,
198 .flags = IORESOURCE_IRQ,
201 .start = CH_UART1_TX,
203 .flags = IORESOURCE_DMA,
206 .start = CH_UART1_RX,
208 .flags = IORESOURCE_DMA,
210 #ifdef CONFIG_BFIN_UART1_CTSRTS
211 { /* CTS pin -- 0 means not supported */
214 .flags = IORESOURCE_IO,
216 { /* RTS pin -- 0 means not supported */
219 .flags = IORESOURCE_IO,
224 static unsigned short bfin_uart1_peripherals[] = {
225 P_UART1_TX, P_UART1_RX,
226 #ifdef CONFIG_BFIN_UART1_CTSRTS
227 P_UART1_RTS, P_UART1_CTS,
232 static struct platform_device bfin_uart1_device = {
235 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
236 .resource = bfin_uart1_resources,
238 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
242 #ifdef CONFIG_SERIAL_BFIN_UART2
243 static struct resource bfin_uart2_resources[] = {
247 .flags = IORESOURCE_MEM,
250 .start = IRQ_UART2_TX,
252 .flags = IORESOURCE_IRQ,
255 .start = IRQ_UART2_RX,
257 .flags = IORESOURCE_IRQ,
260 .start = IRQ_UART2_ERROR,
261 .end = IRQ_UART2_ERROR,
262 .flags = IORESOURCE_IRQ,
265 .start = CH_UART2_TX,
267 .flags = IORESOURCE_DMA,
270 .start = CH_UART2_RX,
272 .flags = IORESOURCE_DMA,
276 static unsigned short bfin_uart2_peripherals[] = {
277 P_UART2_TX, P_UART2_RX, 0
280 static struct platform_device bfin_uart2_device = {
283 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
284 .resource = bfin_uart2_resources,
286 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
290 #ifdef CONFIG_SERIAL_BFIN_UART3
291 static struct resource bfin_uart3_resources[] = {
295 .flags = IORESOURCE_MEM,
298 .start = IRQ_UART3_TX,
300 .flags = IORESOURCE_IRQ,
303 .start = IRQ_UART3_RX,
305 .flags = IORESOURCE_IRQ,
308 .start = IRQ_UART3_ERROR,
309 .end = IRQ_UART3_ERROR,
310 .flags = IORESOURCE_IRQ,
313 .start = CH_UART3_TX,
315 .flags = IORESOURCE_DMA,
318 .start = CH_UART3_RX,
320 .flags = IORESOURCE_DMA,
322 #ifdef CONFIG_BFIN_UART3_CTSRTS
323 { /* CTS pin -- 0 means not supported */
326 .flags = IORESOURCE_IO,
328 { /* RTS pin -- 0 means not supported */
331 .flags = IORESOURCE_IO,
336 static unsigned short bfin_uart3_peripherals[] = {
337 P_UART3_TX, P_UART3_RX,
338 #ifdef CONFIG_BFIN_UART3_CTSRTS
339 P_UART3_RTS, P_UART3_CTS,
344 static struct platform_device bfin_uart3_device = {
347 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
348 .resource = bfin_uart3_resources,
350 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
356 #if IS_ENABLED(CONFIG_BFIN_SIR)
357 #ifdef CONFIG_BFIN_SIR0
358 static struct resource bfin_sir0_resources[] = {
362 .flags = IORESOURCE_MEM,
365 .start = IRQ_UART0_RX,
366 .end = IRQ_UART0_RX+1,
367 .flags = IORESOURCE_IRQ,
370 .start = CH_UART0_RX,
371 .end = CH_UART0_RX+1,
372 .flags = IORESOURCE_DMA,
375 static struct platform_device bfin_sir0_device = {
378 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
379 .resource = bfin_sir0_resources,
382 #ifdef CONFIG_BFIN_SIR1
383 static struct resource bfin_sir1_resources[] = {
387 .flags = IORESOURCE_MEM,
390 .start = IRQ_UART1_RX,
391 .end = IRQ_UART1_RX+1,
392 .flags = IORESOURCE_IRQ,
395 .start = CH_UART1_RX,
396 .end = CH_UART1_RX+1,
397 .flags = IORESOURCE_DMA,
400 static struct platform_device bfin_sir1_device = {
403 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
404 .resource = bfin_sir1_resources,
407 #ifdef CONFIG_BFIN_SIR2
408 static struct resource bfin_sir2_resources[] = {
412 .flags = IORESOURCE_MEM,
415 .start = IRQ_UART2_RX,
416 .end = IRQ_UART2_RX+1,
417 .flags = IORESOURCE_IRQ,
420 .start = CH_UART2_RX,
421 .end = CH_UART2_RX+1,
422 .flags = IORESOURCE_DMA,
425 static struct platform_device bfin_sir2_device = {
428 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
429 .resource = bfin_sir2_resources,
432 #ifdef CONFIG_BFIN_SIR3
433 static struct resource bfin_sir3_resources[] = {
437 .flags = IORESOURCE_MEM,
440 .start = IRQ_UART3_RX,
441 .end = IRQ_UART3_RX+1,
442 .flags = IORESOURCE_IRQ,
445 .start = CH_UART3_RX,
446 .end = CH_UART3_RX+1,
447 .flags = IORESOURCE_DMA,
450 static struct platform_device bfin_sir3_device = {
453 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
454 .resource = bfin_sir3_resources,
459 #if IS_ENABLED(CONFIG_SMSC911X)
460 #include <linux/smsc911x.h>
462 static struct resource smsc911x_resources[] = {
464 .name = "smsc911x-memory",
466 .end = 0x24000000 + 0xFF,
467 .flags = IORESOURCE_MEM,
472 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
476 static struct smsc911x_platform_config smsc911x_config = {
477 .flags = SMSC911X_USE_16BIT,
478 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
479 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
480 .phy_interface = PHY_INTERFACE_MODE_MII,
483 static struct platform_device smsc911x_device = {
486 .num_resources = ARRAY_SIZE(smsc911x_resources),
487 .resource = smsc911x_resources,
489 .platform_data = &smsc911x_config,
494 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
495 static struct resource musb_resources[] = {
499 .flags = IORESOURCE_MEM,
501 [1] = { /* general IRQ */
502 .start = IRQ_USB_INT0,
504 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
507 [2] = { /* DMA IRQ */
508 .start = IRQ_USB_DMA,
510 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
515 static struct musb_hdrc_config musb_config = {
522 .gpio_vrsel = GPIO_PH6,
523 /* Some custom boards need to be active low, just set it to "0"
526 .gpio_vrsel_active = 1,
527 .clkin = 24, /* musb CLKIN in MHZ */
530 static struct musb_hdrc_platform_data musb_plat = {
531 #if defined(CONFIG_USB_MUSB_OTG)
533 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
535 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
536 .mode = MUSB_PERIPHERAL,
538 .config = &musb_config,
541 static u64 musb_dmamask = ~(u32)0;
543 static struct platform_device musb_device = {
544 .name = "musb-blackfin",
547 .dma_mask = &musb_dmamask,
548 .coherent_dma_mask = 0xffffffff,
549 .platform_data = &musb_plat,
551 .num_resources = ARRAY_SIZE(musb_resources),
552 .resource = musb_resources,
556 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
557 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
558 static struct resource bfin_sport0_uart_resources[] = {
560 .start = SPORT0_TCR1,
561 .end = SPORT0_MRCS3+4,
562 .flags = IORESOURCE_MEM,
565 .start = IRQ_SPORT0_RX,
566 .end = IRQ_SPORT0_RX+1,
567 .flags = IORESOURCE_IRQ,
570 .start = IRQ_SPORT0_ERROR,
571 .end = IRQ_SPORT0_ERROR,
572 .flags = IORESOURCE_IRQ,
576 static unsigned short bfin_sport0_peripherals[] = {
577 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
578 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
581 static struct platform_device bfin_sport0_uart_device = {
582 .name = "bfin-sport-uart",
584 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
585 .resource = bfin_sport0_uart_resources,
587 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
591 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
592 static struct resource bfin_sport1_uart_resources[] = {
594 .start = SPORT1_TCR1,
595 .end = SPORT1_MRCS3+4,
596 .flags = IORESOURCE_MEM,
599 .start = IRQ_SPORT1_RX,
600 .end = IRQ_SPORT1_RX+1,
601 .flags = IORESOURCE_IRQ,
604 .start = IRQ_SPORT1_ERROR,
605 .end = IRQ_SPORT1_ERROR,
606 .flags = IORESOURCE_IRQ,
610 static unsigned short bfin_sport1_peripherals[] = {
611 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
612 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
615 static struct platform_device bfin_sport1_uart_device = {
616 .name = "bfin-sport-uart",
618 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
619 .resource = bfin_sport1_uart_resources,
621 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
625 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
626 static struct resource bfin_sport2_uart_resources[] = {
628 .start = SPORT2_TCR1,
629 .end = SPORT2_MRCS3+4,
630 .flags = IORESOURCE_MEM,
633 .start = IRQ_SPORT2_RX,
634 .end = IRQ_SPORT2_RX+1,
635 .flags = IORESOURCE_IRQ,
638 .start = IRQ_SPORT2_ERROR,
639 .end = IRQ_SPORT2_ERROR,
640 .flags = IORESOURCE_IRQ,
644 static unsigned short bfin_sport2_peripherals[] = {
645 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
646 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
649 static struct platform_device bfin_sport2_uart_device = {
650 .name = "bfin-sport-uart",
652 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
653 .resource = bfin_sport2_uart_resources,
655 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
659 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
660 static struct resource bfin_sport3_uart_resources[] = {
662 .start = SPORT3_TCR1,
663 .end = SPORT3_MRCS3+4,
664 .flags = IORESOURCE_MEM,
667 .start = IRQ_SPORT3_RX,
668 .end = IRQ_SPORT3_RX+1,
669 .flags = IORESOURCE_IRQ,
672 .start = IRQ_SPORT3_ERROR,
673 .end = IRQ_SPORT3_ERROR,
674 .flags = IORESOURCE_IRQ,
678 static unsigned short bfin_sport3_peripherals[] = {
679 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
680 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
683 static struct platform_device bfin_sport3_uart_device = {
684 .name = "bfin-sport-uart",
686 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
687 .resource = bfin_sport3_uart_resources,
689 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
695 #if IS_ENABLED(CONFIG_PATA_BF54X)
696 static struct resource bfin_atapi_resources[] = {
700 .flags = IORESOURCE_MEM,
703 .start = IRQ_ATAPI_ERR,
704 .end = IRQ_ATAPI_ERR,
705 .flags = IORESOURCE_IRQ,
709 static struct platform_device bfin_atapi_device = {
710 .name = "pata-bf54x",
712 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
713 .resource = bfin_atapi_resources,
717 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
718 static struct mtd_partition partition_info[] = {
720 .name = "linux kernel(nand)",
722 .size = 4 * 1024 * 1024,
725 .name = "file system(nand)",
726 .offset = 4 * 1024 * 1024,
727 .size = (256 - 4) * 1024 * 1024,
731 static struct bf5xx_nand_platform bf5xx_nand_platform = {
732 .data_width = NFC_NWIDTH_8,
733 .partitions = partition_info,
734 .nr_partitions = ARRAY_SIZE(partition_info),
739 static struct resource bf5xx_nand_resources[] = {
743 .flags = IORESOURCE_MEM,
748 .flags = IORESOURCE_IRQ,
752 static struct platform_device bf5xx_nand_device = {
753 .name = "bf5xx-nand",
755 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
756 .resource = bf5xx_nand_resources,
758 .platform_data = &bf5xx_nand_platform,
763 #if IS_ENABLED(CONFIG_SDH_BFIN)
764 static struct bfin_sd_host bfin_sdh_data = {
766 .irq_int0 = IRQ_SDH_MASK0,
767 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
770 static struct platform_device bf54x_sdh_device = {
774 .platform_data = &bfin_sdh_data,
779 #if IS_ENABLED(CONFIG_CAN_BFIN)
780 static unsigned short bfin_can_peripherals[] = {
781 P_CAN0_RX, P_CAN0_TX, 0
784 static struct resource bfin_can_resources[] = {
788 .flags = IORESOURCE_MEM,
791 .start = IRQ_CAN0_RX,
793 .flags = IORESOURCE_IRQ,
796 .start = IRQ_CAN0_TX,
798 .flags = IORESOURCE_IRQ,
801 .start = IRQ_CAN0_ERROR,
802 .end = IRQ_CAN0_ERROR,
803 .flags = IORESOURCE_IRQ,
807 static struct platform_device bfin_can_device = {
809 .num_resources = ARRAY_SIZE(bfin_can_resources),
810 .resource = bfin_can_resources,
812 .platform_data = &bfin_can_peripherals, /* Passed to driver */
817 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
818 static struct mtd_partition para_partitions[] = {
820 .name = "bootloader(nor)",
824 .name = "linux kernel(nor)",
826 .offset = MTDPART_OFS_APPEND,
828 .name = "file system(nor)",
829 .size = MTDPART_SIZ_FULL,
830 .offset = MTDPART_OFS_APPEND,
834 static struct physmap_flash_data para_flash_data = {
836 .parts = para_partitions,
837 .nr_parts = ARRAY_SIZE(para_partitions),
840 static struct resource para_flash_resource = {
843 .flags = IORESOURCE_MEM,
846 static struct platform_device para_flash_device = {
847 .name = "physmap-flash",
850 .platform_data = ¶_flash_data,
853 .resource = ¶_flash_resource,
857 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
858 /* all SPI peripherals info goes here */
859 #if IS_ENABLED(CONFIG_MTD_M25P80)
860 /* SPI flash chip (m25p16) */
861 static struct mtd_partition bfin_spi_flash_partitions[] = {
863 .name = "bootloader(spi)",
866 .mask_flags = MTD_CAP_ROM
868 .name = "linux kernel(spi)",
874 static struct flash_platform_data bfin_spi_flash_data = {
876 .parts = bfin_spi_flash_partitions,
877 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
881 static struct bfin5xx_spi_chip spi_flash_chip_info = {
882 .enable_dma = 0, /* use dma transfer with this chip*/
886 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
887 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
889 .vref_delay_usecs = 50, /* internal, no capacitor */
892 .pressure_max = 1000,
894 .stopacq_polarity = 1,
895 .first_conversion_delay = 3,
896 .acquisition_time = 1,
898 .pen_down_acc_interval = 1,
902 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
903 #if IS_ENABLED(CONFIG_MTD_M25P80)
905 /* the modalias must be the same as spi device driver name */
906 .modalias = "m25p80", /* Name of spi_driver for this device */
907 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
908 .bus_num = 0, /* Framework bus number */
909 .chip_select = 1, /* SPI_SSEL1*/
910 .platform_data = &bfin_spi_flash_data,
911 .controller_data = &spi_flash_chip_info,
915 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
917 .modalias = "ad7877",
918 .platform_data = &bfin_ad7877_ts_info,
920 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
925 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
927 .modalias = "spidev",
928 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
936 static struct resource bfin_spi0_resource[] = {
938 .start = SPI0_REGBASE,
939 .end = SPI0_REGBASE + 0xFF,
940 .flags = IORESOURCE_MEM,
945 .flags = IORESOURCE_DMA,
950 .flags = IORESOURCE_IRQ,
955 static struct resource bfin_spi1_resource[] = {
957 .start = SPI1_REGBASE,
958 .end = SPI1_REGBASE + 0xFF,
959 .flags = IORESOURCE_MEM,
964 .flags = IORESOURCE_DMA,
969 .flags = IORESOURCE_IRQ,
973 /* SPI controller data */
974 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
976 .enable_dma = 1, /* master has the ability to do dma transfer */
977 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
980 static struct platform_device bf54x_spi_master0 = {
982 .id = 0, /* Bus number */
983 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
984 .resource = bfin_spi0_resource,
986 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
990 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
992 .enable_dma = 1, /* master has the ability to do dma transfer */
993 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
996 static struct platform_device bf54x_spi_master1 = {
998 .id = 1, /* Bus number */
999 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1000 .resource = bfin_spi1_resource,
1002 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1005 #endif /* spi master and devices */
1007 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1008 static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1010 static struct resource bfin_twi0_resource[] = {
1012 .start = TWI0_REGBASE,
1013 .end = TWI0_REGBASE + 0xFF,
1014 .flags = IORESOURCE_MEM,
1019 .flags = IORESOURCE_IRQ,
1023 static struct platform_device i2c_bfin_twi0_device = {
1024 .name = "i2c-bfin-twi",
1026 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1027 .resource = bfin_twi0_resource,
1029 .platform_data = &bfin_twi0_pins,
1033 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1034 static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1036 static struct resource bfin_twi1_resource[] = {
1038 .start = TWI1_REGBASE,
1039 .end = TWI1_REGBASE + 0xFF,
1040 .flags = IORESOURCE_MEM,
1045 .flags = IORESOURCE_IRQ,
1049 static struct platform_device i2c_bfin_twi1_device = {
1050 .name = "i2c-bfin-twi",
1052 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1053 .resource = bfin_twi1_resource,
1055 .platform_data = &bfin_twi1_pins,
1061 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1062 #include <linux/gpio_keys.h>
1064 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1065 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
1068 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1069 .buttons = bfin_gpio_keys_table,
1070 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1073 static struct platform_device bfin_device_gpiokeys = {
1074 .name = "gpio-keys",
1076 .platform_data = &bfin_gpio_keys_data,
1081 static const unsigned int cclk_vlev_datasheet[] =
1084 * Internal VLEV BF54XSBBC1533
1085 ****temporarily using these values until data sheet is updated
1087 VRPAIR(VLEV_085, 150000000),
1088 VRPAIR(VLEV_090, 250000000),
1089 VRPAIR(VLEV_110, 276000000),
1090 VRPAIR(VLEV_115, 301000000),
1091 VRPAIR(VLEV_120, 525000000),
1092 VRPAIR(VLEV_125, 550000000),
1093 VRPAIR(VLEV_130, 600000000),
1096 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1097 .tuple_tab = cclk_vlev_datasheet,
1098 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1099 .vr_settling_time = 25 /* us */,
1102 static struct platform_device bfin_dpmc = {
1103 .name = "bfin dpmc",
1105 .platform_data = &bfin_dmpc_vreg_data,
1109 static struct platform_device *cm_bf548_devices[] __initdata = {
1113 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
1117 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
1118 #ifdef CONFIG_SERIAL_BFIN_UART0
1121 #ifdef CONFIG_SERIAL_BFIN_UART1
1124 #ifdef CONFIG_SERIAL_BFIN_UART2
1127 #ifdef CONFIG_SERIAL_BFIN_UART3
1132 #if IS_ENABLED(CONFIG_BFIN_SIR)
1133 #ifdef CONFIG_BFIN_SIR0
1136 #ifdef CONFIG_BFIN_SIR1
1139 #ifdef CONFIG_BFIN_SIR2
1142 #ifdef CONFIG_BFIN_SIR3
1147 #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
1148 &bf54x_lq043_device,
1151 #if IS_ENABLED(CONFIG_SMSC911X)
1155 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
1159 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
1160 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1161 &bfin_sport0_uart_device,
1163 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1164 &bfin_sport1_uart_device,
1166 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1167 &bfin_sport2_uart_device,
1169 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1170 &bfin_sport3_uart_device,
1174 #if IS_ENABLED(CONFIG_PATA_BF54X)
1178 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
1182 #if IS_ENABLED(CONFIG_SDH_BFIN)
1186 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
1191 #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
1195 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1196 &i2c_bfin_twi0_device,
1197 #if !defined(CONFIG_BF542)
1198 &i2c_bfin_twi1_device,
1202 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1203 &bfin_device_gpiokeys,
1206 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
1210 #if IS_ENABLED(CONFIG_CAN_BFIN)
1216 static int __init cm_bf548_init(void)
1218 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1219 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
1221 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
1222 spi_register_board_info(bf54x_spi_board_info,
1223 ARRAY_SIZE(bf54x_spi_board_info));
1229 arch_initcall(cm_bf548_init);
1231 static struct platform_device *cm_bf548_early_devices[] __initdata = {
1232 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1233 #ifdef CONFIG_SERIAL_BFIN_UART0
1236 #ifdef CONFIG_SERIAL_BFIN_UART1
1239 #ifdef CONFIG_SERIAL_BFIN_UART2
1242 #ifdef CONFIG_SERIAL_BFIN_UART3
1247 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1248 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1249 &bfin_sport0_uart_device,
1251 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1252 &bfin_sport1_uart_device,
1254 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1255 &bfin_sport2_uart_device,
1257 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1258 &bfin_sport3_uart_device,
1263 void __init native_machine_early_platform_add_devices(void)
1265 printk(KERN_INFO "register early platform devices\n");
1266 early_platform_add_devices(cm_bf548_early_devices,
1267 ARRAY_SIZE(cm_bf548_early_devices));