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/i2c.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/musb.h>
20 #include <linux/leds.h>
21 #include <linux/input.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/reboot.h>
26 #include <asm/portmux.h>
28 #include <linux/spi/ad7877.h>
29 #include <asm/bfin_sport.h>
32 * Name the Board for the /proc/cpuinfo
34 #ifdef CONFIG_BFIN527_EZKIT_V2
35 const char bfin_board_name[] = "ADI BF527-EZKIT V2";
37 const char bfin_board_name[] = "ADI BF527-EZKIT";
41 * Driver needs to know address, irq and flag pin.
44 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
45 #include <linux/usb/isp1760.h>
46 static struct resource bfin_isp1760_resources[] = {
49 .end = 0x203C0000 + 0x000fffff,
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 defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
80 static struct resource musb_resources[] = {
84 .flags = IORESOURCE_MEM,
86 [1] = { /* general IRQ */
87 .start = IRQ_USB_INT0,
89 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
100 static struct musb_hdrc_config musb_config = {
107 .gpio_vrsel = GPIO_PG13,
108 /* Some custom boards need to be active low, just set it to "0"
111 .gpio_vrsel_active = 1,
112 .clkin = 24, /* musb CLKIN in MHZ */
115 static struct musb_hdrc_platform_data musb_plat = {
116 #if defined(CONFIG_USB_MUSB_OTG)
118 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
120 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
121 .mode = MUSB_PERIPHERAL,
123 .config = &musb_config,
126 static u64 musb_dmamask = ~(u32)0;
128 static struct platform_device musb_device = {
129 .name = "musb-blackfin",
132 .dma_mask = &musb_dmamask,
133 .coherent_dma_mask = 0xffffffff,
134 .platform_data = &musb_plat,
136 .num_resources = ARRAY_SIZE(musb_resources),
137 .resource = musb_resources,
141 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
143 static struct resource bf52x_t350mcqb_resources[] = {
145 .start = IRQ_PPI_ERROR,
146 .end = IRQ_PPI_ERROR,
147 .flags = IORESOURCE_IRQ,
151 static struct platform_device bf52x_t350mcqb_device = {
152 .name = "bfin-t350mcqb",
154 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
155 .resource = bf52x_t350mcqb_resources,
159 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
160 #include <asm/bfin-lq035q1.h>
162 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
163 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
164 .ppi_mode = USE_RGB565_8_BIT_PPI,
167 static struct resource bfin_lq035q1_resources[] = {
169 .start = IRQ_PPI_ERROR,
170 .end = IRQ_PPI_ERROR,
171 .flags = IORESOURCE_IRQ,
175 static struct platform_device bfin_lq035q1_device = {
176 .name = "bfin-lq035q1",
178 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
179 .resource = bfin_lq035q1_resources,
181 .platform_data = &bfin_lq035q1_data,
186 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
187 static struct mtd_partition ezkit_partitions[] = {
189 .name = "bootloader(nor)",
193 .name = "linux kernel(nor)",
195 .offset = MTDPART_OFS_APPEND,
197 .name = "file system(nor)",
198 .size = MTDPART_SIZ_FULL,
199 .offset = MTDPART_OFS_APPEND,
203 static struct physmap_flash_data ezkit_flash_data = {
205 .parts = ezkit_partitions,
206 .nr_parts = ARRAY_SIZE(ezkit_partitions),
209 static struct resource ezkit_flash_resource = {
212 .flags = IORESOURCE_MEM,
215 static struct platform_device ezkit_flash_device = {
216 .name = "physmap-flash",
219 .platform_data = &ezkit_flash_data,
222 .resource = &ezkit_flash_resource,
226 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
227 static struct mtd_partition partition_info[] = {
229 .name = "bootloader(nand)",
233 .name = "linux kernel(nand)",
234 .offset = MTDPART_OFS_APPEND,
235 .size = 4 * 1024 * 1024,
238 .name = "file system(nand)",
239 .offset = MTDPART_OFS_APPEND,
240 .size = MTDPART_SIZ_FULL,
244 static struct bf5xx_nand_platform bf5xx_nand_platform = {
245 .data_width = NFC_NWIDTH_8,
246 .partitions = partition_info,
247 .nr_partitions = ARRAY_SIZE(partition_info),
252 static struct resource bf5xx_nand_resources[] = {
255 .end = NFC_DATA_RD + 2,
256 .flags = IORESOURCE_MEM,
261 .flags = IORESOURCE_IRQ,
265 static struct platform_device bf5xx_nand_device = {
266 .name = "bf5xx-nand",
268 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
269 .resource = bf5xx_nand_resources,
271 .platform_data = &bf5xx_nand_platform,
276 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
277 static struct resource bfin_pcmcia_cf_resources[] = {
279 .start = 0x20310000, /* IO PORT */
281 .flags = IORESOURCE_MEM,
283 .start = 0x20311000, /* Attribute Memory */
285 .flags = IORESOURCE_MEM,
289 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
291 .start = 6, /* Card Detect PF6 */
293 .flags = IORESOURCE_IRQ,
297 static struct platform_device bfin_pcmcia_cf_device = {
298 .name = "bfin_cf_pcmcia",
300 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
301 .resource = bfin_pcmcia_cf_resources,
305 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
306 static struct platform_device rtc_device = {
312 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
313 #include <linux/smc91x.h>
315 static struct smc91x_platdata smc91x_info = {
316 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
317 .leda = RPC_LED_100_10,
318 .ledb = RPC_LED_TX_RX,
321 static struct resource smc91x_resources[] = {
323 .name = "smc91x-regs",
325 .end = 0x20300300 + 16,
326 .flags = IORESOURCE_MEM,
331 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
334 static struct platform_device smc91x_device = {
337 .num_resources = ARRAY_SIZE(smc91x_resources),
338 .resource = smc91x_resources,
340 .platform_data = &smc91x_info,
345 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
346 static struct resource dm9000_resources[] = {
349 .end = 0x203FB800 + 1,
350 .flags = IORESOURCE_MEM,
353 .start = 0x203FB800 + 4,
354 .end = 0x203FB800 + 5,
355 .flags = IORESOURCE_MEM,
360 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
364 static struct platform_device dm9000_device = {
367 .num_resources = ARRAY_SIZE(dm9000_resources),
368 .resource = dm9000_resources,
372 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
373 #include <linux/bfin_mac.h>
374 static const unsigned short bfin_mac_peripherals[] = P_RMII0;
376 static struct bfin_phydev_platform_data bfin_phydev_data[] = {
379 .irq = IRQ_MAC_PHYINT,
383 static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
385 .phydev_data = bfin_phydev_data,
386 .phy_mode = PHY_INTERFACE_MODE_RMII,
387 .mac_peripherals = bfin_mac_peripherals,
390 static struct platform_device bfin_mii_bus = {
391 .name = "bfin_mii_bus",
393 .platform_data = &bfin_mii_bus_data,
397 static struct platform_device bfin_mac_device = {
400 .platform_data = &bfin_mii_bus,
405 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
406 static struct resource net2272_bfin_resources[] = {
409 .end = 0x20300000 + 0x100,
410 .flags = IORESOURCE_MEM,
413 .flags = IORESOURCE_BUS,
417 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
421 static struct platform_device net2272_bfin_device = {
424 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
425 .resource = net2272_bfin_resources,
429 #if defined(CONFIG_MTD_M25P80) \
430 || defined(CONFIG_MTD_M25P80_MODULE)
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 defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
458 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
463 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
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 defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
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 defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
496 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
498 static const u16 bfin_snd_pin[][7] = {
499 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
500 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0},
501 {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
502 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0},
505 static struct bfin_snd_platform_data bfin_snd_data[] = {
507 .pin_req = &bfin_snd_pin[0][0],
510 .pin_req = &bfin_snd_pin[1][0],
514 #define BFIN_SND_RES(x) \
517 .start = SPORT##x##_TCR1, \
518 .end = SPORT##x##_TCR1, \
519 .flags = IORESOURCE_MEM \
522 .start = CH_SPORT##x##_RX, \
523 .end = CH_SPORT##x##_RX, \
524 .flags = IORESOURCE_DMA, \
527 .start = CH_SPORT##x##_TX, \
528 .end = CH_SPORT##x##_TX, \
529 .flags = IORESOURCE_DMA, \
532 .start = IRQ_SPORT##x##_ERROR, \
533 .end = IRQ_SPORT##x##_ERROR, \
534 .flags = IORESOURCE_IRQ, \
538 static struct resource bfin_snd_resources[][4] = {
544 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
545 static struct platform_device bfin_i2s_pcm = {
546 .name = "bfin-i2s-pcm-audio",
551 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
552 static struct platform_device bfin_tdm_pcm = {
553 .name = "bfin-tdm-pcm-audio",
558 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
559 static struct platform_device bfin_ac97_pcm = {
560 .name = "bfin-ac97-pcm-audio",
565 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
566 static struct platform_device bfin_i2s = {
568 .id = CONFIG_SND_BF5XX_SPORT_NUM,
569 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
570 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
572 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
577 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
578 static struct platform_device bfin_tdm = {
580 .id = CONFIG_SND_BF5XX_SPORT_NUM,
581 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
582 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
584 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
589 static struct spi_board_info bfin_spi_board_info[] __initdata = {
590 #if defined(CONFIG_MTD_M25P80) \
591 || defined(CONFIG_MTD_M25P80_MODULE)
593 /* the modalias must be the same as spi device driver name */
594 .modalias = "m25p80", /* Name of spi_driver for this device */
595 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
596 .bus_num = 0, /* Framework bus number */
597 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
598 .platform_data = &bfin_spi_flash_data,
599 .controller_data = &spi_flash_chip_info,
604 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
605 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
607 .modalias = "ad183x",
608 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
611 .platform_data = "ad1836",
615 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
617 .modalias = "mmc_spi",
618 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
621 .controller_data = &mmc_spi_chip_info,
626 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
628 .modalias = "ad7877",
629 .platform_data = &bfin_ad7877_ts_info,
631 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
636 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
638 .modalias = "ad7879",
639 .platform_data = &bfin_ad7879_ts_info,
641 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
644 .mode = SPI_CPHA | SPI_CPOL,
647 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
649 .modalias = "spidev",
650 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
655 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
657 .modalias = "bfin-lq035q1-spi",
658 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
661 .mode = SPI_CPHA | SPI_CPOL,
666 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
667 /* SPI controller data */
668 static struct bfin5xx_spi_master bfin_spi0_info = {
670 .enable_dma = 1, /* master has the ability to do dma transfer */
671 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
675 static struct resource bfin_spi0_resource[] = {
677 .start = SPI0_REGBASE,
678 .end = SPI0_REGBASE + 0xFF,
679 .flags = IORESOURCE_MEM,
684 .flags = IORESOURCE_DMA,
689 .flags = IORESOURCE_IRQ,
693 static struct platform_device bfin_spi0_device = {
695 .id = 0, /* Bus number */
696 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
697 .resource = bfin_spi0_resource,
699 .platform_data = &bfin_spi0_info, /* Passed to driver */
702 #endif /* spi master and devices */
704 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
705 #ifdef CONFIG_SERIAL_BFIN_UART0
706 static struct resource bfin_uart0_resources[] = {
710 .flags = IORESOURCE_MEM,
713 .start = IRQ_UART0_RX,
714 .end = IRQ_UART0_RX+1,
715 .flags = IORESOURCE_IRQ,
718 .start = IRQ_UART0_ERROR,
719 .end = IRQ_UART0_ERROR,
720 .flags = IORESOURCE_IRQ,
723 .start = CH_UART0_TX,
725 .flags = IORESOURCE_DMA,
728 .start = CH_UART0_RX,
730 .flags = IORESOURCE_DMA,
734 static unsigned short bfin_uart0_peripherals[] = {
735 P_UART0_TX, P_UART0_RX, 0
738 static struct platform_device bfin_uart0_device = {
741 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
742 .resource = bfin_uart0_resources,
744 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
748 #ifdef CONFIG_SERIAL_BFIN_UART1
749 static struct resource bfin_uart1_resources[] = {
753 .flags = IORESOURCE_MEM,
756 .start = IRQ_UART1_RX,
757 .end = IRQ_UART1_RX+1,
758 .flags = IORESOURCE_IRQ,
761 .start = IRQ_UART1_ERROR,
762 .end = IRQ_UART1_ERROR,
763 .flags = IORESOURCE_IRQ,
766 .start = CH_UART1_TX,
768 .flags = IORESOURCE_DMA,
771 .start = CH_UART1_RX,
773 .flags = IORESOURCE_DMA,
775 #ifdef CONFIG_BFIN_UART1_CTSRTS
779 .flags = IORESOURCE_IO,
784 .flags = IORESOURCE_IO,
789 static unsigned short bfin_uart1_peripherals[] = {
790 P_UART1_TX, P_UART1_RX, 0
793 static struct platform_device bfin_uart1_device = {
796 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
797 .resource = bfin_uart1_resources,
799 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
805 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
806 #ifdef CONFIG_BFIN_SIR0
807 static struct resource bfin_sir0_resources[] = {
811 .flags = IORESOURCE_MEM,
814 .start = IRQ_UART0_RX,
815 .end = IRQ_UART0_RX+1,
816 .flags = IORESOURCE_IRQ,
819 .start = CH_UART0_RX,
820 .end = CH_UART0_RX+1,
821 .flags = IORESOURCE_DMA,
825 static struct platform_device bfin_sir0_device = {
828 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
829 .resource = bfin_sir0_resources,
832 #ifdef CONFIG_BFIN_SIR1
833 static struct resource bfin_sir1_resources[] = {
837 .flags = IORESOURCE_MEM,
840 .start = IRQ_UART1_RX,
841 .end = IRQ_UART1_RX+1,
842 .flags = IORESOURCE_IRQ,
845 .start = CH_UART1_RX,
846 .end = CH_UART1_RX+1,
847 .flags = IORESOURCE_DMA,
851 static struct platform_device bfin_sir1_device = {
854 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
855 .resource = bfin_sir1_resources,
860 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
861 static struct resource bfin_twi0_resource[] = {
863 .start = TWI0_REGBASE,
865 .flags = IORESOURCE_MEM,
870 .flags = IORESOURCE_IRQ,
874 static struct platform_device i2c_bfin_twi_device = {
875 .name = "i2c-bfin-twi",
877 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
878 .resource = bfin_twi0_resource,
882 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
883 #include <linux/mfd/adp5520.h>
886 * ADP5520/5501 LEDs Data
889 static struct led_info adp5520_leds[] = {
891 .name = "adp5520-led1",
892 .default_trigger = "none",
893 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
897 static struct adp5520_leds_platform_data adp5520_leds_data = {
898 .num_leds = ARRAY_SIZE(adp5520_leds),
899 .leds = adp5520_leds,
900 .fade_in = ADP5520_FADE_T_600ms,
901 .fade_out = ADP5520_FADE_T_600ms,
902 .led_on_time = ADP5520_LED_ONT_600ms,
906 * ADP5520 Keypad Data
909 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
910 [ADP5520_KEY(3, 3)] = KEY_1,
911 [ADP5520_KEY(2, 3)] = KEY_2,
912 [ADP5520_KEY(1, 3)] = KEY_3,
913 [ADP5520_KEY(0, 3)] = KEY_UP,
914 [ADP5520_KEY(3, 2)] = KEY_4,
915 [ADP5520_KEY(2, 2)] = KEY_5,
916 [ADP5520_KEY(1, 2)] = KEY_6,
917 [ADP5520_KEY(0, 2)] = KEY_DOWN,
918 [ADP5520_KEY(3, 1)] = KEY_7,
919 [ADP5520_KEY(2, 1)] = KEY_8,
920 [ADP5520_KEY(1, 1)] = KEY_9,
921 [ADP5520_KEY(0, 1)] = KEY_DOT,
922 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
923 [ADP5520_KEY(2, 0)] = KEY_0,
924 [ADP5520_KEY(1, 0)] = KEY_HELP,
925 [ADP5520_KEY(0, 0)] = KEY_ENTER,
928 static struct adp5520_keys_platform_data adp5520_keys_data = {
929 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
930 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
931 .keymap = adp5520_keymap,
932 .keymapsize = ARRAY_SIZE(adp5520_keymap),
937 * ADP5520/5501 Multifunction Device Init Data
940 static struct adp5520_platform_data adp5520_pdev_data = {
941 .leds = &adp5520_leds_data,
942 .keys = &adp5520_keys_data,
947 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
948 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
950 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
953 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
955 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
959 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
961 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
964 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
966 I2C_BOARD_INFO("ad7879", 0x2C),
968 .platform_data = (void *)&bfin_ad7879_ts_info,
971 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
973 I2C_BOARD_INFO("pmic-adp5520", 0x32),
975 .platform_data = (void *)&adp5520_pdev_data,
978 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
980 I2C_BOARD_INFO("ssm2602", 0x1b),
983 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
985 I2C_BOARD_INFO("ad5252", 0x2f),
988 #if defined(CONFIG_SND_SOC_ADAU1373) || defined(CONFIG_SND_SOC_ADAU1373_MODULE)
990 I2C_BOARD_INFO("adau1373", 0x1A),
995 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
996 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
997 static struct resource bfin_sport0_uart_resources[] = {
999 .start = SPORT0_TCR1,
1000 .end = SPORT0_MRCS3+4,
1001 .flags = IORESOURCE_MEM,
1004 .start = IRQ_SPORT0_RX,
1005 .end = IRQ_SPORT0_RX+1,
1006 .flags = IORESOURCE_IRQ,
1009 .start = IRQ_SPORT0_ERROR,
1010 .end = IRQ_SPORT0_ERROR,
1011 .flags = IORESOURCE_IRQ,
1015 static unsigned short bfin_sport0_peripherals[] = {
1016 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1017 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
1020 static struct platform_device bfin_sport0_uart_device = {
1021 .name = "bfin-sport-uart",
1023 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1024 .resource = bfin_sport0_uart_resources,
1026 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1030 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1031 static struct resource bfin_sport1_uart_resources[] = {
1033 .start = SPORT1_TCR1,
1034 .end = SPORT1_MRCS3+4,
1035 .flags = IORESOURCE_MEM,
1038 .start = IRQ_SPORT1_RX,
1039 .end = IRQ_SPORT1_RX+1,
1040 .flags = IORESOURCE_IRQ,
1043 .start = IRQ_SPORT1_ERROR,
1044 .end = IRQ_SPORT1_ERROR,
1045 .flags = IORESOURCE_IRQ,
1049 static unsigned short bfin_sport1_peripherals[] = {
1050 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1051 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
1054 static struct platform_device bfin_sport1_uart_device = {
1055 .name = "bfin-sport-uart",
1057 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1058 .resource = bfin_sport1_uart_resources,
1060 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1066 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1067 #include <linux/gpio_keys.h>
1069 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1070 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1071 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1074 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1075 .buttons = bfin_gpio_keys_table,
1076 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1079 static struct platform_device bfin_device_gpiokeys = {
1080 .name = "gpio-keys",
1082 .platform_data = &bfin_gpio_keys_data,
1087 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1088 #include <asm/bfin_rotary.h>
1090 static struct bfin_rotary_platform_data bfin_rotary_data = {
1091 /*.rotary_up_key = KEY_UP,*/
1092 /*.rotary_down_key = KEY_DOWN,*/
1093 .rotary_rel_code = REL_WHEEL,
1094 .rotary_button_key = KEY_ENTER,
1095 .debounce = 10, /* 0..17 */
1096 .mode = ROT_QUAD_ENC | ROT_DEBE,
1099 static struct resource bfin_rotary_resources[] = {
1103 .flags = IORESOURCE_IRQ,
1107 static struct platform_device bfin_rotary_device = {
1108 .name = "bfin-rotary",
1110 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1111 .resource = bfin_rotary_resources,
1113 .platform_data = &bfin_rotary_data,
1118 static const unsigned int cclk_vlev_datasheet[] =
1120 VRPAIR(VLEV_100, 400000000),
1121 VRPAIR(VLEV_105, 426000000),
1122 VRPAIR(VLEV_110, 500000000),
1123 VRPAIR(VLEV_115, 533000000),
1124 VRPAIR(VLEV_120, 600000000),
1127 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1128 .tuple_tab = cclk_vlev_datasheet,
1129 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1130 .vr_settling_time = 25 /* us */,
1133 static struct platform_device bfin_dpmc = {
1134 .name = "bfin dpmc",
1136 .platform_data = &bfin_dmpc_vreg_data,
1140 static struct platform_device *stamp_devices[] __initdata = {
1144 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1148 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1149 &bfin_pcmcia_cf_device,
1152 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1156 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1157 &bfin_isp1760_device,
1160 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1164 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1168 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1172 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1177 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1178 &net2272_bfin_device,
1181 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1185 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1186 &bf52x_t350mcqb_device,
1189 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1190 &bfin_lq035q1_device,
1193 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1194 #ifdef CONFIG_SERIAL_BFIN_UART0
1197 #ifdef CONFIG_SERIAL_BFIN_UART1
1202 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1203 #ifdef CONFIG_BFIN_SIR0
1206 #ifdef CONFIG_BFIN_SIR1
1211 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1212 &i2c_bfin_twi_device,
1215 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1216 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1217 &bfin_sport0_uart_device,
1219 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1220 &bfin_sport1_uart_device,
1224 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1225 &bfin_device_gpiokeys,
1228 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1229 &bfin_rotary_device,
1232 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1233 &ezkit_flash_device,
1236 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1240 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1244 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1248 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1252 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1257 static int __init ezkit_init(void)
1259 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1260 i2c_register_board_info(0, bfin_i2c_board_info,
1261 ARRAY_SIZE(bfin_i2c_board_info));
1262 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1263 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1267 arch_initcall(ezkit_init);
1269 static struct platform_device *ezkit_early_devices[] __initdata = {
1270 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1271 #ifdef CONFIG_SERIAL_BFIN_UART0
1274 #ifdef CONFIG_SERIAL_BFIN_UART1
1279 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1280 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1281 &bfin_sport0_uart_device,
1283 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1284 &bfin_sport1_uart_device,
1289 void __init native_machine_early_platform_add_devices(void)
1291 printk(KERN_INFO "register early platform devices\n");
1292 early_platform_add_devices(ezkit_early_devices,
1293 ARRAY_SIZE(ezkit_early_devices));
1296 void native_machine_restart(char *cmd)
1298 /* workaround reboot hang when booting from SPI */
1299 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1300 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1303 void bfin_get_ether_addr(char *addr)
1305 /* the MAC is stored in OTP memory page 0xDF */
1308 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1310 ret = otp_read(0xDF, 0x00, &otp_mac);
1312 char *otp_mac_p = (char *)&otp_mac;
1313 for (ret = 0; ret < 6; ++ret)
1314 addr[ret] = otp_mac_p[5 - ret];
1317 EXPORT_SYMBOL(bfin_get_ether_addr);