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>
31 * Name the Board for the /proc/cpuinfo
33 #ifdef CONFIG_BFIN527_EZKIT_V2
34 const char bfin_board_name
[] = "ADI BF527-EZKIT V2";
36 const char bfin_board_name
[] = "ADI BF527-EZKIT";
40 * Driver needs to know address, irq and flag pin.
43 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
44 #include <linux/usb/isp1760.h>
45 static struct resource bfin_isp1760_resources
[] = {
48 .end
= 0x203C0000 + 0x000fffff,
49 .flags
= IORESOURCE_MEM
,
54 .flags
= IORESOURCE_IRQ
,
58 static struct isp1760_platform_data isp1760_priv
= {
63 .dack_polarity_high
= 0,
64 .dreq_polarity_high
= 0,
67 static struct platform_device bfin_isp1760_device
= {
71 .platform_data
= &isp1760_priv
,
73 .num_resources
= ARRAY_SIZE(bfin_isp1760_resources
),
74 .resource
= bfin_isp1760_resources
,
78 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
79 static struct resource musb_resources
[] = {
83 .flags
= IORESOURCE_MEM
,
85 [1] = { /* general IRQ */
86 .start
= IRQ_USB_INT0
,
88 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
93 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
97 static struct musb_hdrc_config musb_config
= {
104 .gpio_vrsel
= GPIO_PG13
,
105 /* Some custom boards need to be active low, just set it to "0"
108 .gpio_vrsel_active
= 1,
111 static struct musb_hdrc_platform_data musb_plat
= {
112 #if defined(CONFIG_USB_MUSB_OTG)
114 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
116 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
117 .mode
= MUSB_PERIPHERAL
,
119 .config
= &musb_config
,
122 static u64 musb_dmamask
= ~(u32
)0;
124 static struct platform_device musb_device
= {
128 .dma_mask
= &musb_dmamask
,
129 .coherent_dma_mask
= 0xffffffff,
130 .platform_data
= &musb_plat
,
132 .num_resources
= ARRAY_SIZE(musb_resources
),
133 .resource
= musb_resources
,
137 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
139 static struct resource bf52x_t350mcqb_resources
[] = {
141 .start
= IRQ_PPI_ERROR
,
142 .end
= IRQ_PPI_ERROR
,
143 .flags
= IORESOURCE_IRQ
,
147 static struct platform_device bf52x_t350mcqb_device
= {
148 .name
= "bfin-t350mcqb",
150 .num_resources
= ARRAY_SIZE(bf52x_t350mcqb_resources
),
151 .resource
= bf52x_t350mcqb_resources
,
155 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
156 #include <asm/bfin-lq035q1.h>
158 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data
= {
159 .mode
= LQ035_NORM
| LQ035_RGB
| LQ035_RL
| LQ035_TB
,
160 .ppi_mode
= USE_RGB565_8_BIT_PPI
,
163 static struct resource bfin_lq035q1_resources
[] = {
165 .start
= IRQ_PPI_ERROR
,
166 .end
= IRQ_PPI_ERROR
,
167 .flags
= IORESOURCE_IRQ
,
171 static struct platform_device bfin_lq035q1_device
= {
172 .name
= "bfin-lq035q1",
174 .num_resources
= ARRAY_SIZE(bfin_lq035q1_resources
),
175 .resource
= bfin_lq035q1_resources
,
177 .platform_data
= &bfin_lq035q1_data
,
182 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
183 static struct mtd_partition ezkit_partitions
[] = {
185 .name
= "bootloader(nor)",
189 .name
= "linux kernel(nor)",
191 .offset
= MTDPART_OFS_APPEND
,
193 .name
= "file system(nor)",
194 .size
= MTDPART_SIZ_FULL
,
195 .offset
= MTDPART_OFS_APPEND
,
199 static struct physmap_flash_data ezkit_flash_data
= {
201 .parts
= ezkit_partitions
,
202 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
205 static struct resource ezkit_flash_resource
= {
208 .flags
= IORESOURCE_MEM
,
211 static struct platform_device ezkit_flash_device
= {
212 .name
= "physmap-flash",
215 .platform_data
= &ezkit_flash_data
,
218 .resource
= &ezkit_flash_resource
,
222 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
223 static struct mtd_partition partition_info
[] = {
225 .name
= "bootloader(nand)",
229 .name
= "linux kernel(nand)",
230 .offset
= MTDPART_OFS_APPEND
,
231 .size
= 4 * 1024 * 1024,
234 .name
= "file system(nand)",
235 .offset
= MTDPART_OFS_APPEND
,
236 .size
= MTDPART_SIZ_FULL
,
240 static struct bf5xx_nand_platform bf5xx_nand_platform
= {
241 .data_width
= NFC_NWIDTH_8
,
242 .partitions
= partition_info
,
243 .nr_partitions
= ARRAY_SIZE(partition_info
),
248 static struct resource bf5xx_nand_resources
[] = {
251 .end
= NFC_DATA_RD
+ 2,
252 .flags
= IORESOURCE_MEM
,
257 .flags
= IORESOURCE_IRQ
,
261 static struct platform_device bf5xx_nand_device
= {
262 .name
= "bf5xx-nand",
264 .num_resources
= ARRAY_SIZE(bf5xx_nand_resources
),
265 .resource
= bf5xx_nand_resources
,
267 .platform_data
= &bf5xx_nand_platform
,
272 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
273 static struct resource bfin_pcmcia_cf_resources
[] = {
275 .start
= 0x20310000, /* IO PORT */
277 .flags
= IORESOURCE_MEM
,
279 .start
= 0x20311000, /* Attribute Memory */
281 .flags
= IORESOURCE_MEM
,
285 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
287 .start
= 6, /* Card Detect PF6 */
289 .flags
= IORESOURCE_IRQ
,
293 static struct platform_device bfin_pcmcia_cf_device
= {
294 .name
= "bfin_cf_pcmcia",
296 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
297 .resource
= bfin_pcmcia_cf_resources
,
301 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
302 static struct platform_device rtc_device
= {
308 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
309 #include <linux/smc91x.h>
311 static struct smc91x_platdata smc91x_info
= {
312 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
313 .leda
= RPC_LED_100_10
,
314 .ledb
= RPC_LED_TX_RX
,
317 static struct resource smc91x_resources
[] = {
319 .name
= "smc91x-regs",
321 .end
= 0x20300300 + 16,
322 .flags
= IORESOURCE_MEM
,
327 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
330 static struct platform_device smc91x_device
= {
333 .num_resources
= ARRAY_SIZE(smc91x_resources
),
334 .resource
= smc91x_resources
,
336 .platform_data
= &smc91x_info
,
341 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
342 static struct resource dm9000_resources
[] = {
345 .end
= 0x203FB800 + 1,
346 .flags
= IORESOURCE_MEM
,
349 .start
= 0x203FB800 + 4,
350 .end
= 0x203FB800 + 5,
351 .flags
= IORESOURCE_MEM
,
356 .flags
= (IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
),
360 static struct platform_device dm9000_device
= {
363 .num_resources
= ARRAY_SIZE(dm9000_resources
),
364 .resource
= dm9000_resources
,
368 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
369 static struct platform_device bfin_mii_bus
= {
370 .name
= "bfin_mii_bus",
373 static struct platform_device bfin_mac_device
= {
375 .dev
.platform_data
= &bfin_mii_bus
,
379 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
380 static struct resource net2272_bfin_resources
[] = {
383 .end
= 0x20300000 + 0x100,
384 .flags
= IORESOURCE_MEM
,
388 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
392 static struct platform_device net2272_bfin_device
= {
395 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
396 .resource
= net2272_bfin_resources
,
400 #if defined(CONFIG_MTD_M25P80) \
401 || defined(CONFIG_MTD_M25P80_MODULE)
402 static struct mtd_partition bfin_spi_flash_partitions
[] = {
404 .name
= "bootloader(spi)",
407 .mask_flags
= MTD_CAP_ROM
409 .name
= "linux kernel(spi)",
410 .size
= MTDPART_SIZ_FULL
,
411 .offset
= MTDPART_OFS_APPEND
,
415 static struct flash_platform_data bfin_spi_flash_data
= {
417 .parts
= bfin_spi_flash_partitions
,
418 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
422 /* SPI flash chip (m25p64) */
423 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
424 .enable_dma
= 0, /* use dma transfer with this chip*/
429 #if defined(CONFIG_BFIN_SPI_ADC) \
430 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
432 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
433 .enable_dma
= 1, /* use dma transfer with this chip*/
438 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
439 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
440 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
446 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
447 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
453 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
454 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
459 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
461 .vref_delay_usecs
= 50, /* internal, no capacitor */
464 .pressure_max
= 1000,
466 .stopacq_polarity
= 1,
467 .first_conversion_delay
= 3,
468 .acquisition_time
= 1,
470 .pen_down_acc_interval
= 1,
474 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
475 #include <linux/spi/ad7879.h>
476 static const struct ad7879_platform_data bfin_ad7879_ts_info
= {
477 .model
= 7879, /* Model = AD7879 */
478 .x_plate_ohms
= 620, /* 620 Ohm from the touch datasheet */
479 .pressure_max
= 10000,
481 .first_conversion_delay
= 3, /* wait 512us before do a first conversion */
482 .acquisition_time
= 1, /* 4us acquisition time per sample */
483 .median
= 2, /* do 8 measurements */
484 .averaging
= 1, /* take the average of 4 middle samples */
485 .pen_down_acc_interval
= 255, /* 9.4 ms */
486 .gpio_export
= 0, /* Export GPIO to gpiolib */
490 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
491 static struct bfin5xx_spi_chip spi_ad7879_chip_info
= {
497 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
498 static struct bfin5xx_spi_chip spidev_chip_info
= {
504 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
505 static struct platform_device bfin_i2s
= {
507 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
508 /* TODO: add platform data here */
512 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
513 static struct platform_device bfin_tdm
= {
515 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
516 /* TODO: add platform data here */
520 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
521 static struct bfin5xx_spi_chip lq035q1_spi_chip_info
= {
527 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
528 #if defined(CONFIG_MTD_M25P80) \
529 || defined(CONFIG_MTD_M25P80_MODULE)
531 /* the modalias must be the same as spi device driver name */
532 .modalias
= "m25p80", /* Name of spi_driver for this device */
533 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
534 .bus_num
= 0, /* Framework bus number */
535 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
536 .platform_data
= &bfin_spi_flash_data
,
537 .controller_data
= &spi_flash_chip_info
,
542 #if defined(CONFIG_BFIN_SPI_ADC) \
543 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
545 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
546 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
547 .bus_num
= 0, /* Framework bus number */
548 .chip_select
= 1, /* Framework chip select. */
549 .platform_data
= NULL
, /* No spi_driver specific config */
550 .controller_data
= &spi_adc_chip_info
,
554 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
555 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
557 .modalias
= "ad183x",
558 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
561 .controller_data
= &ad1836_spi_chip_info
,
564 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
566 .modalias
= "mmc_spi",
567 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
570 .controller_data
= &mmc_spi_chip_info
,
575 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
577 .modalias
= "ad7877",
578 .platform_data
= &bfin_ad7877_ts_info
,
580 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
583 .controller_data
= &spi_ad7877_chip_info
,
586 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
588 .modalias
= "ad7879",
589 .platform_data
= &bfin_ad7879_ts_info
,
591 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
594 .controller_data
= &spi_ad7879_chip_info
,
595 .mode
= SPI_CPHA
| SPI_CPOL
,
598 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
600 .modalias
= "spidev",
601 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
604 .controller_data
= &spidev_chip_info
,
607 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
609 .modalias
= "bfin-lq035q1-spi",
610 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
613 .controller_data
= &lq035q1_spi_chip_info
,
614 .mode
= SPI_CPHA
| SPI_CPOL
,
619 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
620 /* SPI controller data */
621 static struct bfin5xx_spi_master bfin_spi0_info
= {
623 .enable_dma
= 1, /* master has the ability to do dma transfer */
624 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
628 static struct resource bfin_spi0_resource
[] = {
630 .start
= SPI0_REGBASE
,
631 .end
= SPI0_REGBASE
+ 0xFF,
632 .flags
= IORESOURCE_MEM
,
637 .flags
= IORESOURCE_DMA
,
642 .flags
= IORESOURCE_IRQ
,
646 static struct platform_device bfin_spi0_device
= {
648 .id
= 0, /* Bus number */
649 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
650 .resource
= bfin_spi0_resource
,
652 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
655 #endif /* spi master and devices */
657 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
658 #ifdef CONFIG_SERIAL_BFIN_UART0
659 static struct resource bfin_uart0_resources
[] = {
663 .flags
= IORESOURCE_MEM
,
666 .start
= IRQ_UART0_RX
,
667 .end
= IRQ_UART0_RX
+1,
668 .flags
= IORESOURCE_IRQ
,
671 .start
= IRQ_UART0_ERROR
,
672 .end
= IRQ_UART0_ERROR
,
673 .flags
= IORESOURCE_IRQ
,
676 .start
= CH_UART0_TX
,
678 .flags
= IORESOURCE_DMA
,
681 .start
= CH_UART0_RX
,
683 .flags
= IORESOURCE_DMA
,
687 unsigned short bfin_uart0_peripherals
[] = {
688 P_UART0_TX
, P_UART0_RX
, 0
691 static struct platform_device bfin_uart0_device
= {
694 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
695 .resource
= bfin_uart0_resources
,
697 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
701 #ifdef CONFIG_SERIAL_BFIN_UART1
702 static struct resource bfin_uart1_resources
[] = {
706 .flags
= IORESOURCE_MEM
,
709 .start
= IRQ_UART1_RX
,
710 .end
= IRQ_UART1_RX
+1,
711 .flags
= IORESOURCE_IRQ
,
714 .start
= IRQ_UART1_ERROR
,
715 .end
= IRQ_UART1_ERROR
,
716 .flags
= IORESOURCE_IRQ
,
719 .start
= CH_UART1_TX
,
721 .flags
= IORESOURCE_DMA
,
724 .start
= CH_UART1_RX
,
726 .flags
= IORESOURCE_DMA
,
728 #ifdef CONFIG_BFIN_UART1_CTSRTS
732 .flags
= IORESOURCE_IO
,
737 .flags
= IORESOURCE_IO
,
742 unsigned short bfin_uart1_peripherals
[] = {
743 P_UART1_TX
, P_UART1_RX
, 0
746 static struct platform_device bfin_uart1_device
= {
749 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
750 .resource
= bfin_uart1_resources
,
752 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
758 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
759 #ifdef CONFIG_BFIN_SIR0
760 static struct resource bfin_sir0_resources
[] = {
764 .flags
= IORESOURCE_MEM
,
767 .start
= IRQ_UART0_RX
,
768 .end
= IRQ_UART0_RX
+1,
769 .flags
= IORESOURCE_IRQ
,
772 .start
= CH_UART0_RX
,
773 .end
= CH_UART0_RX
+1,
774 .flags
= IORESOURCE_DMA
,
778 static struct platform_device bfin_sir0_device
= {
781 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
782 .resource
= bfin_sir0_resources
,
785 #ifdef CONFIG_BFIN_SIR1
786 static struct resource bfin_sir1_resources
[] = {
790 .flags
= IORESOURCE_MEM
,
793 .start
= IRQ_UART1_RX
,
794 .end
= IRQ_UART1_RX
+1,
795 .flags
= IORESOURCE_IRQ
,
798 .start
= CH_UART1_RX
,
799 .end
= CH_UART1_RX
+1,
800 .flags
= IORESOURCE_DMA
,
804 static struct platform_device bfin_sir1_device
= {
807 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
808 .resource
= bfin_sir1_resources
,
813 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
814 static struct resource bfin_twi0_resource
[] = {
816 .start
= TWI0_REGBASE
,
818 .flags
= IORESOURCE_MEM
,
823 .flags
= IORESOURCE_IRQ
,
827 static struct platform_device i2c_bfin_twi_device
= {
828 .name
= "i2c-bfin-twi",
830 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
831 .resource
= bfin_twi0_resource
,
835 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
836 #include <linux/mfd/adp5520.h>
839 * ADP5520/5501 LEDs Data
842 static struct led_info adp5520_leds
[] = {
844 .name
= "adp5520-led1",
845 .default_trigger
= "none",
846 .flags
= FLAG_ID_ADP5520_LED1_ADP5501_LED0
| ADP5520_LED_OFFT_600ms
,
850 static struct adp5520_leds_platform_data adp5520_leds_data
= {
851 .num_leds
= ARRAY_SIZE(adp5520_leds
),
852 .leds
= adp5520_leds
,
853 .fade_in
= ADP5520_FADE_T_600ms
,
854 .fade_out
= ADP5520_FADE_T_600ms
,
855 .led_on_time
= ADP5520_LED_ONT_600ms
,
859 * ADP5520 Keypad Data
862 static const unsigned short adp5520_keymap
[ADP5520_KEYMAPSIZE
] = {
863 [ADP5520_KEY(3, 3)] = KEY_1
,
864 [ADP5520_KEY(2, 3)] = KEY_2
,
865 [ADP5520_KEY(1, 3)] = KEY_3
,
866 [ADP5520_KEY(0, 3)] = KEY_UP
,
867 [ADP5520_KEY(3, 2)] = KEY_4
,
868 [ADP5520_KEY(2, 2)] = KEY_5
,
869 [ADP5520_KEY(1, 2)] = KEY_6
,
870 [ADP5520_KEY(0, 2)] = KEY_DOWN
,
871 [ADP5520_KEY(3, 1)] = KEY_7
,
872 [ADP5520_KEY(2, 1)] = KEY_8
,
873 [ADP5520_KEY(1, 1)] = KEY_9
,
874 [ADP5520_KEY(0, 1)] = KEY_DOT
,
875 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE
,
876 [ADP5520_KEY(2, 0)] = KEY_0
,
877 [ADP5520_KEY(1, 0)] = KEY_HELP
,
878 [ADP5520_KEY(0, 0)] = KEY_ENTER
,
881 static struct adp5520_keys_platform_data adp5520_keys_data
= {
882 .rows_en_mask
= ADP5520_ROW_R3
| ADP5520_ROW_R2
| ADP5520_ROW_R1
| ADP5520_ROW_R0
,
883 .cols_en_mask
= ADP5520_COL_C3
| ADP5520_COL_C2
| ADP5520_COL_C1
| ADP5520_COL_C0
,
884 .keymap
= adp5520_keymap
,
885 .keymapsize
= ARRAY_SIZE(adp5520_keymap
),
890 * ADP5520/5501 Multifunction Device Init Data
893 static struct adp5520_platform_data adp5520_pdev_data
= {
894 .leds
= &adp5520_leds_data
,
895 .keys
= &adp5520_keys_data
,
900 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
901 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
903 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
906 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
908 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
912 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
914 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
917 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
919 I2C_BOARD_INFO("ad7879", 0x2C),
921 .platform_data
= (void *)&bfin_ad7879_ts_info
,
924 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
926 I2C_BOARD_INFO("pmic-adp5520", 0x32),
928 .platform_data
= (void *)&adp5520_pdev_data
,
931 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
933 I2C_BOARD_INFO("ssm2602", 0x1b),
936 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
938 I2C_BOARD_INFO("ad5252", 0x2f),
943 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
944 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
945 static struct resource bfin_sport0_uart_resources
[] = {
947 .start
= SPORT0_TCR1
,
948 .end
= SPORT0_MRCS3
+4,
949 .flags
= IORESOURCE_MEM
,
952 .start
= IRQ_SPORT0_RX
,
953 .end
= IRQ_SPORT0_RX
+1,
954 .flags
= IORESOURCE_IRQ
,
957 .start
= IRQ_SPORT0_ERROR
,
958 .end
= IRQ_SPORT0_ERROR
,
959 .flags
= IORESOURCE_IRQ
,
963 unsigned short bfin_sport0_peripherals
[] = {
964 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
965 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, P_SPORT0_DRSEC
, P_SPORT0_DTSEC
, 0
968 static struct platform_device bfin_sport0_uart_device
= {
969 .name
= "bfin-sport-uart",
971 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
972 .resource
= bfin_sport0_uart_resources
,
974 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
978 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
979 static struct resource bfin_sport1_uart_resources
[] = {
981 .start
= SPORT1_TCR1
,
982 .end
= SPORT1_MRCS3
+4,
983 .flags
= IORESOURCE_MEM
,
986 .start
= IRQ_SPORT1_RX
,
987 .end
= IRQ_SPORT1_RX
+1,
988 .flags
= IORESOURCE_IRQ
,
991 .start
= IRQ_SPORT1_ERROR
,
992 .end
= IRQ_SPORT1_ERROR
,
993 .flags
= IORESOURCE_IRQ
,
997 unsigned short bfin_sport1_peripherals
[] = {
998 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
999 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, P_SPORT1_DRSEC
, P_SPORT1_DTSEC
, 0
1002 static struct platform_device bfin_sport1_uart_device
= {
1003 .name
= "bfin-sport-uart",
1005 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
1006 .resource
= bfin_sport1_uart_resources
,
1008 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
1014 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1015 #include <linux/gpio_keys.h>
1017 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
1018 {BTN_0
, GPIO_PG0
, 1, "gpio-keys: BTN0"},
1019 {BTN_1
, GPIO_PG13
, 1, "gpio-keys: BTN1"},
1022 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
1023 .buttons
= bfin_gpio_keys_table
,
1024 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
1027 static struct platform_device bfin_device_gpiokeys
= {
1028 .name
= "gpio-keys",
1030 .platform_data
= &bfin_gpio_keys_data
,
1035 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1036 #include <asm/bfin_rotary.h>
1038 static struct bfin_rotary_platform_data bfin_rotary_data
= {
1039 /*.rotary_up_key = KEY_UP,*/
1040 /*.rotary_down_key = KEY_DOWN,*/
1041 .rotary_rel_code
= REL_WHEEL
,
1042 .rotary_button_key
= KEY_ENTER
,
1043 .debounce
= 10, /* 0..17 */
1044 .mode
= ROT_QUAD_ENC
| ROT_DEBE
,
1047 static struct resource bfin_rotary_resources
[] = {
1051 .flags
= IORESOURCE_IRQ
,
1055 static struct platform_device bfin_rotary_device
= {
1056 .name
= "bfin-rotary",
1058 .num_resources
= ARRAY_SIZE(bfin_rotary_resources
),
1059 .resource
= bfin_rotary_resources
,
1061 .platform_data
= &bfin_rotary_data
,
1066 static const unsigned int cclk_vlev_datasheet
[] =
1068 VRPAIR(VLEV_100
, 400000000),
1069 VRPAIR(VLEV_105
, 426000000),
1070 VRPAIR(VLEV_110
, 500000000),
1071 VRPAIR(VLEV_115
, 533000000),
1072 VRPAIR(VLEV_120
, 600000000),
1075 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1076 .tuple_tab
= cclk_vlev_datasheet
,
1077 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1078 .vr_settling_time
= 25 /* us */,
1081 static struct platform_device bfin_dpmc
= {
1082 .name
= "bfin dpmc",
1084 .platform_data
= &bfin_dmpc_vreg_data
,
1088 static struct platform_device
*stamp_devices
[] __initdata
= {
1092 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1096 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1097 &bfin_pcmcia_cf_device
,
1100 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1104 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1105 &bfin_isp1760_device
,
1108 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1112 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1116 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1120 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1125 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1126 &net2272_bfin_device
,
1129 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1133 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1134 &bf52x_t350mcqb_device
,
1137 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1138 &bfin_lq035q1_device
,
1141 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1142 #ifdef CONFIG_SERIAL_BFIN_UART0
1145 #ifdef CONFIG_SERIAL_BFIN_UART1
1150 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1151 #ifdef CONFIG_BFIN_SIR0
1154 #ifdef CONFIG_BFIN_SIR1
1159 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1160 &i2c_bfin_twi_device
,
1163 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1164 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1165 &bfin_sport0_uart_device
,
1167 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1168 &bfin_sport1_uart_device
,
1172 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1173 &bfin_device_gpiokeys
,
1176 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1177 &bfin_rotary_device
,
1180 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1181 &ezkit_flash_device
,
1184 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1188 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1193 static int __init
ezkit_init(void)
1195 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
1196 i2c_register_board_info(0, bfin_i2c_board_info
,
1197 ARRAY_SIZE(bfin_i2c_board_info
));
1198 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
1199 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
1203 arch_initcall(ezkit_init
);
1205 static struct platform_device
*ezkit_early_devices
[] __initdata
= {
1206 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1207 #ifdef CONFIG_SERIAL_BFIN_UART0
1210 #ifdef CONFIG_SERIAL_BFIN_UART1
1215 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1216 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1217 &bfin_sport0_uart_device
,
1219 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1220 &bfin_sport1_uart_device
,
1225 void __init
native_machine_early_platform_add_devices(void)
1227 printk(KERN_INFO
"register early platform devices\n");
1228 early_platform_add_devices(ezkit_early_devices
,
1229 ARRAY_SIZE(ezkit_early_devices
));
1232 void native_machine_restart(char *cmd
)
1234 /* workaround reboot hang when booting from SPI */
1235 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1236 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS
);
1239 void bfin_get_ether_addr(char *addr
)
1241 /* the MAC is stored in OTP memory page 0xDF */
1244 u32 (*otp_read
)(u32 page
, u32 flags
, u64
*page_content
) = (void *)0xEF00001A;
1246 ret
= otp_read(0xDF, 0x00, &otp_mac
);
1248 char *otp_mac_p
= (char *)&otp_mac
;
1249 for (ret
= 0; ret
< 6; ++ret
)
1250 addr
[ret
] = otp_mac_p
[5 - ret
];
1253 EXPORT_SYMBOL(bfin_get_ether_addr
);