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/export.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/i2c.h>
18 #include <linux/irq.h>
19 #include <linux/interrupt.h>
20 #include <linux/usb/musb.h>
21 #include <linux/leds.h>
22 #include <linux/input.h>
24 #include <asm/bfin5xx_spi.h>
25 #include <asm/reboot.h>
27 #include <asm/portmux.h>
29 #include <linux/spi/ad7877.h>
30 #include <asm/bfin_sport.h>
33 * Name the Board for the /proc/cpuinfo
35 #ifdef CONFIG_BFIN527_EZKIT_V2
36 const char bfin_board_name
[] = "ADI BF527-EZKIT V2";
38 const char bfin_board_name
[] = "ADI BF527-EZKIT";
42 * Driver needs to know address, irq and flag pin.
45 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
46 #include <linux/usb/isp1760.h>
47 static struct resource bfin_isp1760_resources
[] = {
50 .end
= 0x203C0000 + 0x000fffff,
51 .flags
= IORESOURCE_MEM
,
56 .flags
= IORESOURCE_IRQ
,
60 static struct isp1760_platform_data isp1760_priv
= {
65 .dack_polarity_high
= 0,
66 .dreq_polarity_high
= 0,
69 static struct platform_device bfin_isp1760_device
= {
73 .platform_data
= &isp1760_priv
,
75 .num_resources
= ARRAY_SIZE(bfin_isp1760_resources
),
76 .resource
= bfin_isp1760_resources
,
80 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
81 static struct resource musb_resources
[] = {
85 .flags
= IORESOURCE_MEM
,
87 [1] = { /* general IRQ */
88 .start
= IRQ_USB_INT0
,
90 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
96 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
101 static struct musb_hdrc_config musb_config
= {
108 .gpio_vrsel
= GPIO_PG13
,
109 /* Some custom boards need to be active low, just set it to "0"
112 .gpio_vrsel_active
= 1,
113 .clkin
= 24, /* musb CLKIN in MHZ */
116 static struct musb_hdrc_platform_data musb_plat
= {
117 #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
119 #elif defined(CONFIG_USB_MUSB_HDRC)
121 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
122 .mode
= MUSB_PERIPHERAL
,
124 .config
= &musb_config
,
127 static u64 musb_dmamask
= ~(u32
)0;
129 static struct platform_device musb_device
= {
130 .name
= "musb-blackfin",
133 .dma_mask
= &musb_dmamask
,
134 .coherent_dma_mask
= 0xffffffff,
135 .platform_data
= &musb_plat
,
137 .num_resources
= ARRAY_SIZE(musb_resources
),
138 .resource
= musb_resources
,
142 #if IS_ENABLED(CONFIG_FB_BFIN_T350MCQB)
144 static struct resource bf52x_t350mcqb_resources
[] = {
146 .start
= IRQ_PPI_ERROR
,
147 .end
= IRQ_PPI_ERROR
,
148 .flags
= IORESOURCE_IRQ
,
152 static struct platform_device bf52x_t350mcqb_device
= {
153 .name
= "bfin-t350mcqb",
155 .num_resources
= ARRAY_SIZE(bf52x_t350mcqb_resources
),
156 .resource
= bf52x_t350mcqb_resources
,
160 #if IS_ENABLED(CONFIG_FB_BFIN_LQ035Q1)
161 #include <asm/bfin-lq035q1.h>
163 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data
= {
164 .mode
= LQ035_NORM
| LQ035_RGB
| LQ035_RL
| LQ035_TB
,
165 .ppi_mode
= USE_RGB565_8_BIT_PPI
,
168 static struct resource bfin_lq035q1_resources
[] = {
170 .start
= IRQ_PPI_ERROR
,
171 .end
= IRQ_PPI_ERROR
,
172 .flags
= IORESOURCE_IRQ
,
176 static struct platform_device bfin_lq035q1_device
= {
177 .name
= "bfin-lq035q1",
179 .num_resources
= ARRAY_SIZE(bfin_lq035q1_resources
),
180 .resource
= bfin_lq035q1_resources
,
182 .platform_data
= &bfin_lq035q1_data
,
187 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
188 static struct mtd_partition ezkit_partitions
[] = {
190 .name
= "bootloader(nor)",
194 .name
= "linux kernel(nor)",
196 .offset
= MTDPART_OFS_APPEND
,
198 .name
= "file system(nor)",
199 .size
= MTDPART_SIZ_FULL
,
200 .offset
= MTDPART_OFS_APPEND
,
204 static struct physmap_flash_data ezkit_flash_data
= {
206 .parts
= ezkit_partitions
,
207 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
210 static struct resource ezkit_flash_resource
= {
213 .flags
= IORESOURCE_MEM
,
216 static struct platform_device ezkit_flash_device
= {
217 .name
= "physmap-flash",
220 .platform_data
= &ezkit_flash_data
,
223 .resource
= &ezkit_flash_resource
,
227 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
228 static struct mtd_partition partition_info
[] = {
230 .name
= "bootloader(nand)",
234 .name
= "linux kernel(nand)",
235 .offset
= MTDPART_OFS_APPEND
,
236 .size
= 4 * 1024 * 1024,
239 .name
= "file system(nand)",
240 .offset
= MTDPART_OFS_APPEND
,
241 .size
= MTDPART_SIZ_FULL
,
245 static struct bf5xx_nand_platform bf5xx_nand_platform
= {
246 .data_width
= NFC_NWIDTH_8
,
247 .partitions
= partition_info
,
248 .nr_partitions
= ARRAY_SIZE(partition_info
),
253 static struct resource bf5xx_nand_resources
[] = {
256 .end
= NFC_DATA_RD
+ 2,
257 .flags
= IORESOURCE_MEM
,
262 .flags
= IORESOURCE_IRQ
,
266 static struct platform_device bf5xx_nand_device
= {
267 .name
= "bf5xx-nand",
269 .num_resources
= ARRAY_SIZE(bf5xx_nand_resources
),
270 .resource
= bf5xx_nand_resources
,
272 .platform_data
= &bf5xx_nand_platform
,
277 #if IS_ENABLED(CONFIG_BFIN_CFPCMCIA)
278 static struct resource bfin_pcmcia_cf_resources
[] = {
280 .start
= 0x20310000, /* IO PORT */
282 .flags
= IORESOURCE_MEM
,
284 .start
= 0x20311000, /* Attribute Memory */
286 .flags
= IORESOURCE_MEM
,
290 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
292 .start
= 6, /* Card Detect PF6 */
294 .flags
= IORESOURCE_IRQ
,
298 static struct platform_device bfin_pcmcia_cf_device
= {
299 .name
= "bfin_cf_pcmcia",
301 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
302 .resource
= bfin_pcmcia_cf_resources
,
306 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
307 static struct platform_device rtc_device
= {
313 #if IS_ENABLED(CONFIG_SMC91X)
314 #include <linux/smc91x.h>
316 static struct smc91x_platdata smc91x_info
= {
317 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
318 .leda
= RPC_LED_100_10
,
319 .ledb
= RPC_LED_TX_RX
,
322 static struct resource smc91x_resources
[] = {
324 .name
= "smc91x-regs",
326 .end
= 0x20300300 + 16,
327 .flags
= IORESOURCE_MEM
,
332 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
335 static struct platform_device smc91x_device
= {
338 .num_resources
= ARRAY_SIZE(smc91x_resources
),
339 .resource
= smc91x_resources
,
341 .platform_data
= &smc91x_info
,
346 #if IS_ENABLED(CONFIG_DM9000)
347 static struct resource dm9000_resources
[] = {
350 .end
= 0x203FB800 + 1,
351 .flags
= IORESOURCE_MEM
,
354 .start
= 0x203FB800 + 4,
355 .end
= 0x203FB800 + 5,
356 .flags
= IORESOURCE_MEM
,
361 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
),
365 static struct platform_device dm9000_device
= {
368 .num_resources
= ARRAY_SIZE(dm9000_resources
),
369 .resource
= dm9000_resources
,
373 #if IS_ENABLED(CONFIG_BFIN_MAC)
374 #include <linux/bfin_mac.h>
375 static const unsigned short bfin_mac_peripherals
[] = P_RMII0
;
377 static struct bfin_phydev_platform_data bfin_phydev_data
[] = {
380 .irq
= IRQ_MAC_PHYINT
,
384 static struct bfin_mii_bus_platform_data bfin_mii_bus_data
= {
386 .phydev_data
= bfin_phydev_data
,
387 .phy_mode
= PHY_INTERFACE_MODE_RMII
,
388 .mac_peripherals
= bfin_mac_peripherals
,
391 static struct platform_device bfin_mii_bus
= {
392 .name
= "bfin_mii_bus",
394 .platform_data
= &bfin_mii_bus_data
,
398 static struct platform_device bfin_mac_device
= {
401 .platform_data
= &bfin_mii_bus
,
406 #if IS_ENABLED(CONFIG_USB_NET2272)
407 static struct resource net2272_bfin_resources
[] = {
410 .end
= 0x20300000 + 0x100,
411 .flags
= IORESOURCE_MEM
,
414 .flags
= IORESOURCE_BUS
,
418 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
422 static struct platform_device net2272_bfin_device
= {
425 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
426 .resource
= net2272_bfin_resources
,
430 #if IS_ENABLED(CONFIG_MTD_M25P80)
431 static struct mtd_partition bfin_spi_flash_partitions
[] = {
433 .name
= "bootloader(spi)",
436 .mask_flags
= MTD_CAP_ROM
438 .name
= "linux kernel(spi)",
439 .size
= MTDPART_SIZ_FULL
,
440 .offset
= MTDPART_OFS_APPEND
,
444 static struct flash_platform_data bfin_spi_flash_data
= {
446 .parts
= bfin_spi_flash_partitions
,
447 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
451 /* SPI flash chip (m25p64) */
452 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
453 .enable_dma
= 0, /* use dma transfer with this chip*/
457 #if IS_ENABLED(CONFIG_MMC_SPI)
458 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
463 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
464 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
466 .vref_delay_usecs
= 50, /* internal, no capacitor */
469 .pressure_max
= 1000,
471 .stopacq_polarity
= 1,
472 .first_conversion_delay
= 3,
473 .acquisition_time
= 1,
475 .pen_down_acc_interval
= 1,
479 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7879)
480 #include <linux/spi/ad7879.h>
481 static const struct ad7879_platform_data bfin_ad7879_ts_info
= {
482 .model
= 7879, /* Model = AD7879 */
483 .x_plate_ohms
= 620, /* 620 Ohm from the touch datasheet */
484 .pressure_max
= 10000,
486 .first_conversion_delay
= 3, /* wait 512us before do a first conversion */
487 .acquisition_time
= 1, /* 4us acquisition time per sample */
488 .median
= 2, /* do 8 measurements */
489 .averaging
= 1, /* take the average of 4 middle samples */
490 .pen_down_acc_interval
= 255, /* 9.4 ms */
491 .gpio_export
= 0, /* Export GPIO to gpiolib */
495 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
497 static const u16 bfin_snd_pin
[][7] = {
498 {P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
499 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0, 0},
500 {P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
501 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, P_SPORT1_TFS
, 0},
504 static struct bfin_snd_platform_data bfin_snd_data
[] = {
506 .pin_req
= &bfin_snd_pin
[0][0],
509 .pin_req
= &bfin_snd_pin
[1][0],
513 #define BFIN_SND_RES(x) \
516 .start = SPORT##x##_TCR1, \
517 .end = SPORT##x##_TCR1, \
518 .flags = IORESOURCE_MEM \
521 .start = CH_SPORT##x##_RX, \
522 .end = CH_SPORT##x##_RX, \
523 .flags = IORESOURCE_DMA, \
526 .start = CH_SPORT##x##_TX, \
527 .end = CH_SPORT##x##_TX, \
528 .flags = IORESOURCE_DMA, \
531 .start = IRQ_SPORT##x##_ERROR, \
532 .end = IRQ_SPORT##x##_ERROR, \
533 .flags = IORESOURCE_IRQ, \
537 static struct resource bfin_snd_resources
[][4] = {
543 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
544 static struct platform_device bfin_i2s_pcm
= {
545 .name
= "bfin-i2s-pcm-audio",
550 #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
551 static struct platform_device bfin_ac97_pcm
= {
552 .name
= "bfin-ac97-pcm-audio",
557 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
558 static struct platform_device bfin_i2s
= {
560 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
561 .num_resources
= ARRAY_SIZE(bfin_snd_resources
[CONFIG_SND_BF5XX_SPORT_NUM
]),
562 .resource
= bfin_snd_resources
[CONFIG_SND_BF5XX_SPORT_NUM
],
564 .platform_data
= &bfin_snd_data
[CONFIG_SND_BF5XX_SPORT_NUM
],
569 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
570 static const char * const ad1836_link
[] = {
574 static struct platform_device bfin_ad1836_machine
= {
575 .name
= "bfin-snd-ad1836",
578 .platform_data
= (void *)ad1836_link
,
583 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
584 #if IS_ENABLED(CONFIG_MTD_M25P80)
586 /* the modalias must be the same as spi device driver name */
587 .modalias
= "m25p80", /* Name of spi_driver for this device */
588 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
589 .bus_num
= 0, /* Framework bus number */
590 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
591 .platform_data
= &bfin_spi_flash_data
,
592 .controller_data
= &spi_flash_chip_info
,
597 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
599 .modalias
= "ad183x",
600 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
603 .platform_data
= "ad1836",
607 #if IS_ENABLED(CONFIG_MMC_SPI)
609 .modalias
= "mmc_spi",
610 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
613 .controller_data
= &mmc_spi_chip_info
,
618 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
620 .modalias
= "ad7877",
621 .platform_data
= &bfin_ad7877_ts_info
,
623 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
628 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7879_SPI)
630 .modalias
= "ad7879",
631 .platform_data
= &bfin_ad7879_ts_info
,
633 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
636 .mode
= SPI_CPHA
| SPI_CPOL
,
639 #if IS_ENABLED(CONFIG_SPI_SPIDEV)
641 .modalias
= "spidev",
642 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
647 #if IS_ENABLED(CONFIG_FB_BFIN_LQ035Q1)
649 .modalias
= "bfin-lq035q1-spi",
650 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
653 .mode
= SPI_CPHA
| SPI_CPOL
,
658 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
659 /* SPI controller data */
660 static struct bfin5xx_spi_master bfin_spi0_info
= {
662 .enable_dma
= 1, /* master has the ability to do dma transfer */
663 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
667 static struct resource bfin_spi0_resource
[] = {
669 .start
= SPI0_REGBASE
,
670 .end
= SPI0_REGBASE
+ 0xFF,
671 .flags
= IORESOURCE_MEM
,
676 .flags
= IORESOURCE_DMA
,
681 .flags
= IORESOURCE_IRQ
,
685 static struct platform_device bfin_spi0_device
= {
687 .id
= 0, /* Bus number */
688 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
689 .resource
= bfin_spi0_resource
,
691 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
694 #endif /* spi master and devices */
696 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
697 #ifdef CONFIG_SERIAL_BFIN_UART0
698 static struct resource bfin_uart0_resources
[] = {
702 .flags
= IORESOURCE_MEM
,
705 .start
= IRQ_UART0_TX
,
707 .flags
= IORESOURCE_IRQ
,
710 .start
= IRQ_UART0_RX
,
712 .flags
= IORESOURCE_IRQ
,
715 .start
= IRQ_UART0_ERROR
,
716 .end
= IRQ_UART0_ERROR
,
717 .flags
= IORESOURCE_IRQ
,
720 .start
= CH_UART0_TX
,
722 .flags
= IORESOURCE_DMA
,
725 .start
= CH_UART0_RX
,
727 .flags
= IORESOURCE_DMA
,
731 static unsigned short bfin_uart0_peripherals
[] = {
732 P_UART0_TX
, P_UART0_RX
, 0
735 static struct platform_device bfin_uart0_device
= {
738 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
739 .resource
= bfin_uart0_resources
,
741 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
745 #ifdef CONFIG_SERIAL_BFIN_UART1
746 static struct resource bfin_uart1_resources
[] = {
750 .flags
= IORESOURCE_MEM
,
753 .start
= IRQ_UART1_TX
,
755 .flags
= IORESOURCE_IRQ
,
758 .start
= IRQ_UART1_RX
,
760 .flags
= IORESOURCE_IRQ
,
763 .start
= IRQ_UART1_ERROR
,
764 .end
= IRQ_UART1_ERROR
,
765 .flags
= IORESOURCE_IRQ
,
768 .start
= CH_UART1_TX
,
770 .flags
= IORESOURCE_DMA
,
773 .start
= CH_UART1_RX
,
775 .flags
= IORESOURCE_DMA
,
777 #ifdef CONFIG_BFIN_UART1_CTSRTS
781 .flags
= IORESOURCE_IO
,
786 .flags
= IORESOURCE_IO
,
791 static unsigned short bfin_uart1_peripherals
[] = {
792 P_UART1_TX
, P_UART1_RX
, 0
795 static struct platform_device bfin_uart1_device
= {
798 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
799 .resource
= bfin_uart1_resources
,
801 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
807 #if IS_ENABLED(CONFIG_BFIN_SIR)
808 #ifdef CONFIG_BFIN_SIR0
809 static struct resource bfin_sir0_resources
[] = {
813 .flags
= IORESOURCE_MEM
,
816 .start
= IRQ_UART0_RX
,
817 .end
= IRQ_UART0_RX
+1,
818 .flags
= IORESOURCE_IRQ
,
821 .start
= CH_UART0_RX
,
822 .end
= CH_UART0_RX
+1,
823 .flags
= IORESOURCE_DMA
,
827 static struct platform_device bfin_sir0_device
= {
830 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
831 .resource
= bfin_sir0_resources
,
834 #ifdef CONFIG_BFIN_SIR1
835 static struct resource bfin_sir1_resources
[] = {
839 .flags
= IORESOURCE_MEM
,
842 .start
= IRQ_UART1_RX
,
843 .end
= IRQ_UART1_RX
+1,
844 .flags
= IORESOURCE_IRQ
,
847 .start
= CH_UART1_RX
,
848 .end
= CH_UART1_RX
+1,
849 .flags
= IORESOURCE_DMA
,
853 static struct platform_device bfin_sir1_device
= {
856 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
857 .resource
= bfin_sir1_resources
,
862 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
863 static const u16 bfin_twi0_pins
[] = {P_TWI0_SCL
, P_TWI0_SDA
, 0};
865 static struct resource bfin_twi0_resource
[] = {
867 .start
= TWI0_REGBASE
,
869 .flags
= IORESOURCE_MEM
,
874 .flags
= IORESOURCE_IRQ
,
878 static struct platform_device i2c_bfin_twi_device
= {
879 .name
= "i2c-bfin-twi",
881 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
882 .resource
= bfin_twi0_resource
,
884 .platform_data
= &bfin_twi0_pins
,
889 #if IS_ENABLED(CONFIG_PMIC_ADP5520)
890 #include <linux/mfd/adp5520.h>
893 * ADP5520/5501 LEDs Data
896 static struct led_info adp5520_leds
[] = {
898 .name
= "adp5520-led1",
899 .default_trigger
= "none",
900 .flags
= FLAG_ID_ADP5520_LED1_ADP5501_LED0
| ADP5520_LED_OFFT_600ms
,
904 static struct adp5520_leds_platform_data adp5520_leds_data
= {
905 .num_leds
= ARRAY_SIZE(adp5520_leds
),
906 .leds
= adp5520_leds
,
907 .fade_in
= ADP5520_FADE_T_600ms
,
908 .fade_out
= ADP5520_FADE_T_600ms
,
909 .led_on_time
= ADP5520_LED_ONT_600ms
,
913 * ADP5520 Keypad Data
916 static const unsigned short adp5520_keymap
[ADP5520_KEYMAPSIZE
] = {
917 [ADP5520_KEY(3, 3)] = KEY_1
,
918 [ADP5520_KEY(2, 3)] = KEY_2
,
919 [ADP5520_KEY(1, 3)] = KEY_3
,
920 [ADP5520_KEY(0, 3)] = KEY_UP
,
921 [ADP5520_KEY(3, 2)] = KEY_4
,
922 [ADP5520_KEY(2, 2)] = KEY_5
,
923 [ADP5520_KEY(1, 2)] = KEY_6
,
924 [ADP5520_KEY(0, 2)] = KEY_DOWN
,
925 [ADP5520_KEY(3, 1)] = KEY_7
,
926 [ADP5520_KEY(2, 1)] = KEY_8
,
927 [ADP5520_KEY(1, 1)] = KEY_9
,
928 [ADP5520_KEY(0, 1)] = KEY_DOT
,
929 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE
,
930 [ADP5520_KEY(2, 0)] = KEY_0
,
931 [ADP5520_KEY(1, 0)] = KEY_HELP
,
932 [ADP5520_KEY(0, 0)] = KEY_ENTER
,
935 static struct adp5520_keys_platform_data adp5520_keys_data
= {
936 .rows_en_mask
= ADP5520_ROW_R3
| ADP5520_ROW_R2
| ADP5520_ROW_R1
| ADP5520_ROW_R0
,
937 .cols_en_mask
= ADP5520_COL_C3
| ADP5520_COL_C2
| ADP5520_COL_C1
| ADP5520_COL_C0
,
938 .keymap
= adp5520_keymap
,
939 .keymapsize
= ARRAY_SIZE(adp5520_keymap
),
944 * ADP5520/5501 Multifunction Device Init Data
947 static struct adp5520_platform_data adp5520_pdev_data
= {
948 .leds
= &adp5520_leds_data
,
949 .keys
= &adp5520_keys_data
,
954 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
955 #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
957 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
960 #if IS_ENABLED(CONFIG_INPUT_PCF8574)
962 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
966 #if IS_ENABLED(CONFIG_FB_BFIN_7393)
968 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
971 #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7879_I2C)
973 I2C_BOARD_INFO("ad7879", 0x2C),
975 .platform_data
= (void *)&bfin_ad7879_ts_info
,
978 #if IS_ENABLED(CONFIG_PMIC_ADP5520)
980 I2C_BOARD_INFO("pmic-adp5520", 0x32),
982 .platform_data
= (void *)&adp5520_pdev_data
,
985 #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
987 I2C_BOARD_INFO("ssm2602", 0x1b),
990 #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
992 I2C_BOARD_INFO("ad5252", 0x2f),
995 #if IS_ENABLED(CONFIG_SND_SOC_ADAU1373)
997 I2C_BOARD_INFO("adau1373", 0x1A),
1002 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
1003 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1004 static struct resource bfin_sport0_uart_resources
[] = {
1006 .start
= SPORT0_TCR1
,
1007 .end
= SPORT0_MRCS3
+4,
1008 .flags
= IORESOURCE_MEM
,
1011 .start
= IRQ_SPORT0_RX
,
1012 .end
= IRQ_SPORT0_RX
+1,
1013 .flags
= IORESOURCE_IRQ
,
1016 .start
= IRQ_SPORT0_ERROR
,
1017 .end
= IRQ_SPORT0_ERROR
,
1018 .flags
= IORESOURCE_IRQ
,
1022 static unsigned short bfin_sport0_peripherals
[] = {
1023 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
1024 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
1027 static struct platform_device bfin_sport0_uart_device
= {
1028 .name
= "bfin-sport-uart",
1030 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
1031 .resource
= bfin_sport0_uart_resources
,
1033 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
1037 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1038 static struct resource bfin_sport1_uart_resources
[] = {
1040 .start
= SPORT1_TCR1
,
1041 .end
= SPORT1_MRCS3
+4,
1042 .flags
= IORESOURCE_MEM
,
1045 .start
= IRQ_SPORT1_RX
,
1046 .end
= IRQ_SPORT1_RX
+1,
1047 .flags
= IORESOURCE_IRQ
,
1050 .start
= IRQ_SPORT1_ERROR
,
1051 .end
= IRQ_SPORT1_ERROR
,
1052 .flags
= IORESOURCE_IRQ
,
1056 static unsigned short bfin_sport1_peripherals
[] = {
1057 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
1058 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
1061 static struct platform_device bfin_sport1_uart_device
= {
1062 .name
= "bfin-sport-uart",
1064 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
1065 .resource
= bfin_sport1_uart_resources
,
1067 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
1073 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1074 #include <linux/gpio_keys.h>
1076 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
1077 {BTN_0
, GPIO_PG0
, 1, "gpio-keys: BTN0"},
1078 {BTN_1
, GPIO_PG13
, 1, "gpio-keys: BTN1"},
1081 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
1082 .buttons
= bfin_gpio_keys_table
,
1083 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
1086 static struct platform_device bfin_device_gpiokeys
= {
1087 .name
= "gpio-keys",
1089 .platform_data
= &bfin_gpio_keys_data
,
1094 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
1095 #include <linux/platform_data/bfin_rotary.h>
1097 static const u16 per_cnt
[] = {
1104 static struct bfin_rotary_platform_data bfin_rotary_data
= {
1105 /*.rotary_up_key = KEY_UP,*/
1106 /*.rotary_down_key = KEY_DOWN,*/
1107 .rotary_rel_code
= REL_WHEEL
,
1108 .rotary_button_key
= KEY_ENTER
,
1109 .debounce
= 10, /* 0..17 */
1110 .mode
= ROT_QUAD_ENC
| ROT_DEBE
,
1112 .pin_list
= per_cnt
,
1115 static struct resource bfin_rotary_resources
[] = {
1117 .start
= CNT_CONFIG
,
1118 .end
= CNT_CONFIG
+ 0xff,
1119 .flags
= IORESOURCE_MEM
,
1124 .flags
= IORESOURCE_IRQ
,
1128 static struct platform_device bfin_rotary_device
= {
1129 .name
= "bfin-rotary",
1131 .num_resources
= ARRAY_SIZE(bfin_rotary_resources
),
1132 .resource
= bfin_rotary_resources
,
1134 .platform_data
= &bfin_rotary_data
,
1139 static const unsigned int cclk_vlev_datasheet
[] =
1141 VRPAIR(VLEV_100
, 400000000),
1142 VRPAIR(VLEV_105
, 426000000),
1143 VRPAIR(VLEV_110
, 500000000),
1144 VRPAIR(VLEV_115
, 533000000),
1145 VRPAIR(VLEV_120
, 600000000),
1148 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1149 .tuple_tab
= cclk_vlev_datasheet
,
1150 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1151 .vr_settling_time
= 25 /* us */,
1154 static struct platform_device bfin_dpmc
= {
1155 .name
= "bfin dpmc",
1157 .platform_data
= &bfin_dmpc_vreg_data
,
1161 static struct platform_device
*stamp_devices
[] __initdata
= {
1165 #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
1169 #if IS_ENABLED(CONFIG_BFIN_CFPCMCIA)
1170 &bfin_pcmcia_cf_device
,
1173 #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
1177 #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
1178 &bfin_isp1760_device
,
1181 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
1185 #if IS_ENABLED(CONFIG_SMC91X)
1189 #if IS_ENABLED(CONFIG_DM9000)
1193 #if IS_ENABLED(CONFIG_BFIN_MAC)
1198 #if IS_ENABLED(CONFIG_USB_NET2272)
1199 &net2272_bfin_device
,
1202 #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
1206 #if IS_ENABLED(CONFIG_FB_BFIN_T350MCQB)
1207 &bf52x_t350mcqb_device
,
1210 #if IS_ENABLED(CONFIG_FB_BFIN_LQ035Q1)
1211 &bfin_lq035q1_device
,
1214 #if IS_ENABLED(CONFIG_SERIAL_BFIN)
1215 #ifdef CONFIG_SERIAL_BFIN_UART0
1218 #ifdef CONFIG_SERIAL_BFIN_UART1
1223 #if IS_ENABLED(CONFIG_BFIN_SIR)
1224 #ifdef CONFIG_BFIN_SIR0
1227 #ifdef CONFIG_BFIN_SIR1
1232 #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
1233 &i2c_bfin_twi_device
,
1236 #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
1237 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1238 &bfin_sport0_uart_device
,
1240 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1241 &bfin_sport1_uart_device
,
1245 #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
1246 &bfin_device_gpiokeys
,
1249 #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
1250 &bfin_rotary_device
,
1253 #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
1254 &ezkit_flash_device
,
1257 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
1261 #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
1265 #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
1269 #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
1270 &bfin_ad1836_machine
,
1274 static int __init
ezkit_init(void)
1276 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
1277 i2c_register_board_info(0, bfin_i2c_board_info
,
1278 ARRAY_SIZE(bfin_i2c_board_info
));
1279 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
1280 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
1284 arch_initcall(ezkit_init
);
1286 static struct platform_device
*ezkit_early_devices
[] __initdata
= {
1287 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1288 #ifdef CONFIG_SERIAL_BFIN_UART0
1291 #ifdef CONFIG_SERIAL_BFIN_UART1
1296 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1297 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1298 &bfin_sport0_uart_device
,
1300 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1301 &bfin_sport1_uart_device
,
1306 void __init
native_machine_early_platform_add_devices(void)
1308 printk(KERN_INFO
"register early platform devices\n");
1309 early_platform_add_devices(ezkit_early_devices
,
1310 ARRAY_SIZE(ezkit_early_devices
));
1313 void native_machine_restart(char *cmd
)
1315 /* workaround reboot hang when booting from SPI */
1316 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1317 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS
);
1320 int bfin_get_ether_addr(char *addr
)
1322 /* the MAC is stored in OTP memory page 0xDF */
1325 u32 (*otp_read
)(u32 page
, u32 flags
, u64
*page_content
) = (void *)0xEF00001A;
1327 ret
= otp_read(0xDF, 0x00, &otp_mac
);
1329 char *otp_mac_p
= (char *)&otp_mac
;
1330 for (ret
= 0; ret
< 6; ++ret
)
1331 addr
[ret
] = otp_mac_p
[5 - ret
];
1335 EXPORT_SYMBOL(bfin_get_ether_addr
);