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 defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
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 defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
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 defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
123 static struct platform_device rtc_device = {
129 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
130 #ifdef CONFIG_SERIAL_BFIN_UART0
131 static struct resource bfin_uart0_resources[] = {
135 .flags = IORESOURCE_MEM,
138 .start = IRQ_UART0_RX,
139 .end = IRQ_UART0_RX+1,
140 .flags = IORESOURCE_IRQ,
143 .start = IRQ_UART0_ERROR,
144 .end = IRQ_UART0_ERROR,
145 .flags = IORESOURCE_IRQ,
148 .start = CH_UART0_TX,
150 .flags = IORESOURCE_DMA,
153 .start = CH_UART0_RX,
155 .flags = IORESOURCE_DMA,
159 unsigned short bfin_uart0_peripherals[] = {
160 P_UART0_TX, P_UART0_RX, 0
163 static struct platform_device bfin_uart0_device = {
166 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
167 .resource = bfin_uart0_resources,
169 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
173 #ifdef CONFIG_SERIAL_BFIN_UART1
174 static struct resource bfin_uart1_resources[] = {
178 .flags = IORESOURCE_MEM,
181 .start = IRQ_UART1_RX,
182 .end = IRQ_UART1_RX+1,
183 .flags = IORESOURCE_IRQ,
186 .start = IRQ_UART1_ERROR,
187 .end = IRQ_UART1_ERROR,
188 .flags = IORESOURCE_IRQ,
191 .start = CH_UART1_TX,
193 .flags = IORESOURCE_DMA,
196 .start = CH_UART1_RX,
198 .flags = IORESOURCE_DMA,
200 #ifdef CONFIG_BFIN_UART1_CTSRTS
201 { /* CTS pin -- 0 means not supported */
204 .flags = IORESOURCE_IO,
206 { /* RTS pin -- 0 means not supported */
209 .flags = IORESOURCE_IO,
214 unsigned short bfin_uart1_peripherals[] = {
215 P_UART1_TX, P_UART1_RX,
216 #ifdef CONFIG_BFIN_UART1_CTSRTS
217 P_UART1_RTS, P_UART1_CTS,
222 static struct platform_device bfin_uart1_device = {
225 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
226 .resource = bfin_uart1_resources,
228 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
232 #ifdef CONFIG_SERIAL_BFIN_UART2
233 static struct resource bfin_uart2_resources[] = {
237 .flags = IORESOURCE_MEM,
240 .start = IRQ_UART2_RX,
241 .end = IRQ_UART2_RX+1,
242 .flags = IORESOURCE_IRQ,
245 .start = IRQ_UART2_ERROR,
246 .end = IRQ_UART2_ERROR,
247 .flags = IORESOURCE_IRQ,
250 .start = CH_UART2_TX,
252 .flags = IORESOURCE_DMA,
255 .start = CH_UART2_RX,
257 .flags = IORESOURCE_DMA,
261 unsigned short bfin_uart2_peripherals[] = {
262 P_UART2_TX, P_UART2_RX, 0
265 static struct platform_device bfin_uart2_device = {
268 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
269 .resource = bfin_uart2_resources,
271 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
275 #ifdef CONFIG_SERIAL_BFIN_UART3
276 static struct resource bfin_uart3_resources[] = {
280 .flags = IORESOURCE_MEM,
283 .start = IRQ_UART3_RX,
284 .end = IRQ_UART3_RX+1,
285 .flags = IORESOURCE_IRQ,
288 .start = IRQ_UART3_ERROR,
289 .end = IRQ_UART3_ERROR,
290 .flags = IORESOURCE_IRQ,
293 .start = CH_UART3_TX,
295 .flags = IORESOURCE_DMA,
298 .start = CH_UART3_RX,
300 .flags = IORESOURCE_DMA,
302 #ifdef CONFIG_BFIN_UART3_CTSRTS
303 { /* CTS pin -- 0 means not supported */
306 .flags = IORESOURCE_IO,
308 { /* RTS pin -- 0 means not supported */
311 .flags = IORESOURCE_IO,
316 unsigned short bfin_uart3_peripherals[] = {
317 P_UART3_TX, P_UART3_RX,
318 #ifdef CONFIG_BFIN_UART3_CTSRTS
319 P_UART3_RTS, P_UART3_CTS,
324 static struct platform_device bfin_uart3_device = {
327 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
328 .resource = bfin_uart3_resources,
330 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
336 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
337 #ifdef CONFIG_BFIN_SIR0
338 static struct resource bfin_sir0_resources[] = {
342 .flags = IORESOURCE_MEM,
345 .start = IRQ_UART0_RX,
346 .end = IRQ_UART0_RX+1,
347 .flags = IORESOURCE_IRQ,
350 .start = CH_UART0_RX,
351 .end = CH_UART0_RX+1,
352 .flags = IORESOURCE_DMA,
355 static struct platform_device bfin_sir0_device = {
358 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
359 .resource = bfin_sir0_resources,
362 #ifdef CONFIG_BFIN_SIR1
363 static struct resource bfin_sir1_resources[] = {
367 .flags = IORESOURCE_MEM,
370 .start = IRQ_UART1_RX,
371 .end = IRQ_UART1_RX+1,
372 .flags = IORESOURCE_IRQ,
375 .start = CH_UART1_RX,
376 .end = CH_UART1_RX+1,
377 .flags = IORESOURCE_DMA,
380 static struct platform_device bfin_sir1_device = {
383 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
384 .resource = bfin_sir1_resources,
387 #ifdef CONFIG_BFIN_SIR2
388 static struct resource bfin_sir2_resources[] = {
392 .flags = IORESOURCE_MEM,
395 .start = IRQ_UART2_RX,
396 .end = IRQ_UART2_RX+1,
397 .flags = IORESOURCE_IRQ,
400 .start = CH_UART2_RX,
401 .end = CH_UART2_RX+1,
402 .flags = IORESOURCE_DMA,
405 static struct platform_device bfin_sir2_device = {
408 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
409 .resource = bfin_sir2_resources,
412 #ifdef CONFIG_BFIN_SIR3
413 static struct resource bfin_sir3_resources[] = {
417 .flags = IORESOURCE_MEM,
420 .start = IRQ_UART3_RX,
421 .end = IRQ_UART3_RX+1,
422 .flags = IORESOURCE_IRQ,
425 .start = CH_UART3_RX,
426 .end = CH_UART3_RX+1,
427 .flags = IORESOURCE_DMA,
430 static struct platform_device bfin_sir3_device = {
433 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
434 .resource = bfin_sir3_resources,
439 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
440 #include <linux/smsc911x.h>
442 static struct resource smsc911x_resources[] = {
444 .name = "smsc911x-memory",
446 .end = 0x24000000 + 0xFF,
447 .flags = IORESOURCE_MEM,
452 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
456 static struct smsc911x_platform_config smsc911x_config = {
457 .flags = SMSC911X_USE_16BIT,
458 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
459 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
460 .phy_interface = PHY_INTERFACE_MODE_MII,
463 static struct platform_device smsc911x_device = {
466 .num_resources = ARRAY_SIZE(smsc911x_resources),
467 .resource = smsc911x_resources,
469 .platform_data = &smsc911x_config,
474 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
475 static struct resource musb_resources[] = {
479 .flags = IORESOURCE_MEM,
481 [1] = { /* general IRQ */
482 .start = IRQ_USB_INT0,
484 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
487 [2] = { /* DMA IRQ */
488 .start = IRQ_USB_DMA,
490 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
495 static struct musb_hdrc_config musb_config = {
502 .gpio_vrsel = GPIO_PH6,
503 /* Some custom boards need to be active low, just set it to "0"
506 .gpio_vrsel_active = 1,
509 static struct musb_hdrc_platform_data musb_plat = {
510 #if defined(CONFIG_USB_MUSB_OTG)
512 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
514 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
515 .mode = MUSB_PERIPHERAL,
517 .config = &musb_config,
520 static u64 musb_dmamask = ~(u32)0;
522 static struct platform_device musb_device = {
523 .name = "musb-blackfin",
526 .dma_mask = &musb_dmamask,
527 .coherent_dma_mask = 0xffffffff,
528 .platform_data = &musb_plat,
530 .num_resources = ARRAY_SIZE(musb_resources),
531 .resource = musb_resources,
535 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
536 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
537 static struct resource bfin_sport0_uart_resources[] = {
539 .start = SPORT0_TCR1,
540 .end = SPORT0_MRCS3+4,
541 .flags = IORESOURCE_MEM,
544 .start = IRQ_SPORT0_RX,
545 .end = IRQ_SPORT0_RX+1,
546 .flags = IORESOURCE_IRQ,
549 .start = IRQ_SPORT0_ERROR,
550 .end = IRQ_SPORT0_ERROR,
551 .flags = IORESOURCE_IRQ,
555 unsigned short bfin_sport0_peripherals[] = {
556 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
557 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
560 static struct platform_device bfin_sport0_uart_device = {
561 .name = "bfin-sport-uart",
563 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
564 .resource = bfin_sport0_uart_resources,
566 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
570 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
571 static struct resource bfin_sport1_uart_resources[] = {
573 .start = SPORT1_TCR1,
574 .end = SPORT1_MRCS3+4,
575 .flags = IORESOURCE_MEM,
578 .start = IRQ_SPORT1_RX,
579 .end = IRQ_SPORT1_RX+1,
580 .flags = IORESOURCE_IRQ,
583 .start = IRQ_SPORT1_ERROR,
584 .end = IRQ_SPORT1_ERROR,
585 .flags = IORESOURCE_IRQ,
589 unsigned short bfin_sport1_peripherals[] = {
590 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
591 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
594 static struct platform_device bfin_sport1_uart_device = {
595 .name = "bfin-sport-uart",
597 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
598 .resource = bfin_sport1_uart_resources,
600 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
604 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
605 static struct resource bfin_sport2_uart_resources[] = {
607 .start = SPORT2_TCR1,
608 .end = SPORT2_MRCS3+4,
609 .flags = IORESOURCE_MEM,
612 .start = IRQ_SPORT2_RX,
613 .end = IRQ_SPORT2_RX+1,
614 .flags = IORESOURCE_IRQ,
617 .start = IRQ_SPORT2_ERROR,
618 .end = IRQ_SPORT2_ERROR,
619 .flags = IORESOURCE_IRQ,
623 unsigned short bfin_sport2_peripherals[] = {
624 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
625 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
628 static struct platform_device bfin_sport2_uart_device = {
629 .name = "bfin-sport-uart",
631 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
632 .resource = bfin_sport2_uart_resources,
634 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
638 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
639 static struct resource bfin_sport3_uart_resources[] = {
641 .start = SPORT3_TCR1,
642 .end = SPORT3_MRCS3+4,
643 .flags = IORESOURCE_MEM,
646 .start = IRQ_SPORT3_RX,
647 .end = IRQ_SPORT3_RX+1,
648 .flags = IORESOURCE_IRQ,
651 .start = IRQ_SPORT3_ERROR,
652 .end = IRQ_SPORT3_ERROR,
653 .flags = IORESOURCE_IRQ,
657 unsigned short bfin_sport3_peripherals[] = {
658 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
659 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
662 static struct platform_device bfin_sport3_uart_device = {
663 .name = "bfin-sport-uart",
665 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
666 .resource = bfin_sport3_uart_resources,
668 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
674 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
675 static struct resource bfin_atapi_resources[] = {
679 .flags = IORESOURCE_MEM,
682 .start = IRQ_ATAPI_ERR,
683 .end = IRQ_ATAPI_ERR,
684 .flags = IORESOURCE_IRQ,
688 static struct platform_device bfin_atapi_device = {
689 .name = "pata-bf54x",
691 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
692 .resource = bfin_atapi_resources,
696 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
697 static struct mtd_partition partition_info[] = {
699 .name = "linux kernel(nand)",
701 .size = 4 * 1024 * 1024,
704 .name = "file system(nand)",
705 .offset = 4 * 1024 * 1024,
706 .size = (256 - 4) * 1024 * 1024,
710 static struct bf5xx_nand_platform bf5xx_nand_platform = {
711 .data_width = NFC_NWIDTH_8,
712 .partitions = partition_info,
713 .nr_partitions = ARRAY_SIZE(partition_info),
718 static struct resource bf5xx_nand_resources[] = {
722 .flags = IORESOURCE_MEM,
727 .flags = IORESOURCE_IRQ,
731 static struct platform_device bf5xx_nand_device = {
732 .name = "bf5xx-nand",
734 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
735 .resource = bf5xx_nand_resources,
737 .platform_data = &bf5xx_nand_platform,
742 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
743 static struct bfin_sd_host bfin_sdh_data = {
745 .irq_int0 = IRQ_SDH_MASK0,
746 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
749 static struct platform_device bf54x_sdh_device = {
753 .platform_data = &bfin_sdh_data,
758 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
759 unsigned short bfin_can_peripherals[] = {
760 P_CAN0_RX, P_CAN0_TX, 0
763 static struct resource bfin_can_resources[] = {
767 .flags = IORESOURCE_MEM,
770 .start = IRQ_CAN0_RX,
772 .flags = IORESOURCE_IRQ,
775 .start = IRQ_CAN0_TX,
777 .flags = IORESOURCE_IRQ,
780 .start = IRQ_CAN0_ERROR,
781 .end = IRQ_CAN0_ERROR,
782 .flags = IORESOURCE_IRQ,
786 static struct platform_device bfin_can_device = {
788 .num_resources = ARRAY_SIZE(bfin_can_resources),
789 .resource = bfin_can_resources,
791 .platform_data = &bfin_can_peripherals, /* Passed to driver */
796 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
797 static struct mtd_partition para_partitions[] = {
799 .name = "bootloader(nor)",
803 .name = "linux kernel(nor)",
805 .offset = MTDPART_OFS_APPEND,
807 .name = "file system(nor)",
808 .size = MTDPART_SIZ_FULL,
809 .offset = MTDPART_OFS_APPEND,
813 static struct physmap_flash_data para_flash_data = {
815 .parts = para_partitions,
816 .nr_parts = ARRAY_SIZE(para_partitions),
819 static struct resource para_flash_resource = {
822 .flags = IORESOURCE_MEM,
825 static struct platform_device para_flash_device = {
826 .name = "physmap-flash",
829 .platform_data = ¶_flash_data,
832 .resource = ¶_flash_resource,
836 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
837 /* all SPI peripherals info goes here */
838 #if defined(CONFIG_MTD_M25P80) \
839 || defined(CONFIG_MTD_M25P80_MODULE)
840 /* SPI flash chip (m25p16) */
841 static struct mtd_partition bfin_spi_flash_partitions[] = {
843 .name = "bootloader(spi)",
846 .mask_flags = MTD_CAP_ROM
848 .name = "linux kernel(spi)",
854 static struct flash_platform_data bfin_spi_flash_data = {
856 .parts = bfin_spi_flash_partitions,
857 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
861 static struct bfin5xx_spi_chip spi_flash_chip_info = {
862 .enable_dma = 0, /* use dma transfer with this chip*/
867 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
868 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
873 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
875 .vref_delay_usecs = 50, /* internal, no capacitor */
878 .pressure_max = 1000,
880 .stopacq_polarity = 1,
881 .first_conversion_delay = 3,
882 .acquisition_time = 1,
884 .pen_down_acc_interval = 1,
888 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
889 static struct bfin5xx_spi_chip spidev_chip_info = {
895 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
896 #if defined(CONFIG_MTD_M25P80) \
897 || defined(CONFIG_MTD_M25P80_MODULE)
899 /* the modalias must be the same as spi device driver name */
900 .modalias = "m25p80", /* Name of spi_driver for this device */
901 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
902 .bus_num = 0, /* Framework bus number */
903 .chip_select = 1, /* SPI_SSEL1*/
904 .platform_data = &bfin_spi_flash_data,
905 .controller_data = &spi_flash_chip_info,
909 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
911 .modalias = "ad7877",
912 .platform_data = &bfin_ad7877_ts_info,
914 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
917 .controller_data = &spi_ad7877_chip_info,
920 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
922 .modalias = "spidev",
923 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
926 .controller_data = &spidev_chip_info,
932 static struct resource bfin_spi0_resource[] = {
934 .start = SPI0_REGBASE,
935 .end = SPI0_REGBASE + 0xFF,
936 .flags = IORESOURCE_MEM,
941 .flags = IORESOURCE_DMA,
946 .flags = IORESOURCE_IRQ,
951 static struct resource bfin_spi1_resource[] = {
953 .start = SPI1_REGBASE,
954 .end = SPI1_REGBASE + 0xFF,
955 .flags = IORESOURCE_MEM,
960 .flags = IORESOURCE_DMA,
965 .flags = IORESOURCE_IRQ,
969 /* SPI controller data */
970 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
972 .enable_dma = 1, /* master has the ability to do dma transfer */
973 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
976 static struct platform_device bf54x_spi_master0 = {
978 .id = 0, /* Bus number */
979 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
980 .resource = bfin_spi0_resource,
982 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
986 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
988 .enable_dma = 1, /* master has the ability to do dma transfer */
989 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
992 static struct platform_device bf54x_spi_master1 = {
994 .id = 1, /* Bus number */
995 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
996 .resource = bfin_spi1_resource,
998 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1001 #endif /* spi master and devices */
1003 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1004 static struct resource bfin_twi0_resource[] = {
1006 .start = TWI0_REGBASE,
1007 .end = TWI0_REGBASE + 0xFF,
1008 .flags = IORESOURCE_MEM,
1013 .flags = IORESOURCE_IRQ,
1017 static struct platform_device i2c_bfin_twi0_device = {
1018 .name = "i2c-bfin-twi",
1020 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1021 .resource = bfin_twi0_resource,
1024 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1025 static struct resource bfin_twi1_resource[] = {
1027 .start = TWI1_REGBASE,
1028 .end = TWI1_REGBASE + 0xFF,
1029 .flags = IORESOURCE_MEM,
1034 .flags = IORESOURCE_IRQ,
1038 static struct platform_device i2c_bfin_twi1_device = {
1039 .name = "i2c-bfin-twi",
1041 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1042 .resource = bfin_twi1_resource,
1047 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1048 #include <linux/gpio_keys.h>
1050 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1051 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
1054 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1055 .buttons = bfin_gpio_keys_table,
1056 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1059 static struct platform_device bfin_device_gpiokeys = {
1060 .name = "gpio-keys",
1062 .platform_data = &bfin_gpio_keys_data,
1067 static const unsigned int cclk_vlev_datasheet[] =
1070 * Internal VLEV BF54XSBBC1533
1071 ****temporarily using these values until data sheet is updated
1073 VRPAIR(VLEV_085, 150000000),
1074 VRPAIR(VLEV_090, 250000000),
1075 VRPAIR(VLEV_110, 276000000),
1076 VRPAIR(VLEV_115, 301000000),
1077 VRPAIR(VLEV_120, 525000000),
1078 VRPAIR(VLEV_125, 550000000),
1079 VRPAIR(VLEV_130, 600000000),
1082 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1083 .tuple_tab = cclk_vlev_datasheet,
1084 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1085 .vr_settling_time = 25 /* us */,
1088 static struct platform_device bfin_dpmc = {
1089 .name = "bfin dpmc",
1091 .platform_data = &bfin_dmpc_vreg_data,
1095 static struct platform_device *cm_bf548_devices[] __initdata = {
1099 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1103 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1104 #ifdef CONFIG_SERIAL_BFIN_UART0
1107 #ifdef CONFIG_SERIAL_BFIN_UART1
1110 #ifdef CONFIG_SERIAL_BFIN_UART2
1113 #ifdef CONFIG_SERIAL_BFIN_UART3
1118 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1119 #ifdef CONFIG_BFIN_SIR0
1122 #ifdef CONFIG_BFIN_SIR1
1125 #ifdef CONFIG_BFIN_SIR2
1128 #ifdef CONFIG_BFIN_SIR3
1133 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
1134 &bf54x_lq043_device,
1137 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
1141 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1145 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1146 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1147 &bfin_sport0_uart_device,
1149 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1150 &bfin_sport1_uart_device,
1152 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1153 &bfin_sport2_uart_device,
1155 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1156 &bfin_sport3_uart_device,
1160 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
1164 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1168 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1172 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1177 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
1181 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1182 &i2c_bfin_twi0_device,
1183 #if !defined(CONFIG_BF542)
1184 &i2c_bfin_twi1_device,
1188 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1189 &bfin_device_gpiokeys,
1192 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1196 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1202 static int __init cm_bf548_init(void)
1204 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1205 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
1207 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1208 spi_register_board_info(bf54x_spi_board_info,
1209 ARRAY_SIZE(bf54x_spi_board_info));
1215 arch_initcall(cm_bf548_init);
1217 static struct platform_device *cm_bf548_early_devices[] __initdata = {
1218 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1219 #ifdef CONFIG_SERIAL_BFIN_UART0
1222 #ifdef CONFIG_SERIAL_BFIN_UART1
1225 #ifdef CONFIG_SERIAL_BFIN_UART2
1228 #ifdef CONFIG_SERIAL_BFIN_UART3
1233 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1234 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1235 &bfin_sport0_uart_device,
1237 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1238 &bfin_sport1_uart_device,
1240 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1241 &bfin_sport2_uart_device,
1243 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1244 &bfin_sport3_uart_device,
1249 void __init native_machine_early_platform_add_devices(void)
1251 printk(KERN_INFO "register early platform devices\n");
1252 early_platform_add_devices(cm_bf548_early_devices,
1253 ARRAY_SIZE(cm_bf548_early_devices));