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,
107 static struct musb_hdrc_platform_data musb_plat = {
108 #if defined(CONFIG_USB_MUSB_OTG)
110 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
112 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
113 .mode = MUSB_PERIPHERAL,
115 .config = &musb_config,
118 static u64 musb_dmamask = ~(u32)0;
120 static struct platform_device musb_device = {
124 .dma_mask = &musb_dmamask,
125 .coherent_dma_mask = 0xffffffff,
126 .platform_data = &musb_plat,
128 .num_resources = ARRAY_SIZE(musb_resources),
129 .resource = musb_resources,
133 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
135 static struct resource bf52x_t350mcqb_resources[] = {
137 .start = IRQ_PPI_ERROR,
138 .end = IRQ_PPI_ERROR,
139 .flags = IORESOURCE_IRQ,
143 static struct platform_device bf52x_t350mcqb_device = {
144 .name = "bfin-t350mcqb",
146 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
147 .resource = bf52x_t350mcqb_resources,
151 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
152 #include <asm/bfin-lq035q1.h>
154 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
155 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
156 .ppi_mode = USE_RGB565_8_BIT_PPI,
159 static struct resource bfin_lq035q1_resources[] = {
161 .start = IRQ_PPI_ERROR,
162 .end = IRQ_PPI_ERROR,
163 .flags = IORESOURCE_IRQ,
167 static struct platform_device bfin_lq035q1_device = {
168 .name = "bfin-lq035q1",
170 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
171 .resource = bfin_lq035q1_resources,
173 .platform_data = &bfin_lq035q1_data,
178 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
179 static struct mtd_partition ezkit_partitions[] = {
181 .name = "bootloader(nor)",
185 .name = "linux kernel(nor)",
187 .offset = MTDPART_OFS_APPEND,
189 .name = "file system(nor)",
190 .size = MTDPART_SIZ_FULL,
191 .offset = MTDPART_OFS_APPEND,
195 static struct physmap_flash_data ezkit_flash_data = {
197 .parts = ezkit_partitions,
198 .nr_parts = ARRAY_SIZE(ezkit_partitions),
201 static struct resource ezkit_flash_resource = {
204 .flags = IORESOURCE_MEM,
207 static struct platform_device ezkit_flash_device = {
208 .name = "physmap-flash",
211 .platform_data = &ezkit_flash_data,
214 .resource = &ezkit_flash_resource,
218 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
219 static struct mtd_partition partition_info[] = {
221 .name = "linux kernel(nand)",
223 .size = 4 * 1024 * 1024,
226 .name = "file system(nand)",
227 .offset = MTDPART_OFS_APPEND,
228 .size = MTDPART_SIZ_FULL,
232 static struct bf5xx_nand_platform bf5xx_nand_platform = {
233 .page_size = NFC_PG_SIZE_256,
234 .data_width = NFC_NWIDTH_8,
235 .partitions = partition_info,
236 .nr_partitions = ARRAY_SIZE(partition_info),
241 static struct resource bf5xx_nand_resources[] = {
244 .end = NFC_DATA_RD + 2,
245 .flags = IORESOURCE_MEM,
250 .flags = IORESOURCE_IRQ,
254 static struct platform_device bf5xx_nand_device = {
255 .name = "bf5xx-nand",
257 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
258 .resource = bf5xx_nand_resources,
260 .platform_data = &bf5xx_nand_platform,
265 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
266 static struct resource bfin_pcmcia_cf_resources[] = {
268 .start = 0x20310000, /* IO PORT */
270 .flags = IORESOURCE_MEM,
272 .start = 0x20311000, /* Attribute Memory */
274 .flags = IORESOURCE_MEM,
278 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
280 .start = 6, /* Card Detect PF6 */
282 .flags = IORESOURCE_IRQ,
286 static struct platform_device bfin_pcmcia_cf_device = {
287 .name = "bfin_cf_pcmcia",
289 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
290 .resource = bfin_pcmcia_cf_resources,
294 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
295 static struct platform_device rtc_device = {
301 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
302 #include <linux/smc91x.h>
304 static struct smc91x_platdata smc91x_info = {
305 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
306 .leda = RPC_LED_100_10,
307 .ledb = RPC_LED_TX_RX,
310 static struct resource smc91x_resources[] = {
312 .name = "smc91x-regs",
314 .end = 0x20300300 + 16,
315 .flags = IORESOURCE_MEM,
320 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
323 static struct platform_device smc91x_device = {
326 .num_resources = ARRAY_SIZE(smc91x_resources),
327 .resource = smc91x_resources,
329 .platform_data = &smc91x_info,
334 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
335 static struct resource dm9000_resources[] = {
338 .end = 0x203FB800 + 1,
339 .flags = IORESOURCE_MEM,
342 .start = 0x203FB800 + 4,
343 .end = 0x203FB800 + 5,
344 .flags = IORESOURCE_MEM,
349 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
353 static struct platform_device dm9000_device = {
356 .num_resources = ARRAY_SIZE(dm9000_resources),
357 .resource = dm9000_resources,
361 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
362 static struct platform_device bfin_mii_bus = {
363 .name = "bfin_mii_bus",
366 static struct platform_device bfin_mac_device = {
368 .dev.platform_data = &bfin_mii_bus,
372 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
373 static struct resource net2272_bfin_resources[] = {
376 .end = 0x20300000 + 0x100,
377 .flags = IORESOURCE_MEM,
381 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
385 static struct platform_device net2272_bfin_device = {
388 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
389 .resource = net2272_bfin_resources,
393 #if defined(CONFIG_MTD_M25P80) \
394 || defined(CONFIG_MTD_M25P80_MODULE)
395 static struct mtd_partition bfin_spi_flash_partitions[] = {
397 .name = "bootloader(spi)",
400 .mask_flags = MTD_CAP_ROM
402 .name = "linux kernel(spi)",
403 .size = MTDPART_SIZ_FULL,
404 .offset = MTDPART_OFS_APPEND,
408 static struct flash_platform_data bfin_spi_flash_data = {
410 .parts = bfin_spi_flash_partitions,
411 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
415 /* SPI flash chip (m25p64) */
416 static struct bfin5xx_spi_chip spi_flash_chip_info = {
417 .enable_dma = 0, /* use dma transfer with this chip*/
422 #if defined(CONFIG_BFIN_SPI_ADC) \
423 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
425 static struct bfin5xx_spi_chip spi_adc_chip_info = {
426 .enable_dma = 1, /* use dma transfer with this chip*/
431 #if defined(CONFIG_SND_BLACKFIN_AD183X) \
432 || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
433 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
439 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
440 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
446 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
447 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
452 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
454 .vref_delay_usecs = 50, /* internal, no capacitor */
457 .pressure_max = 1000,
459 .stopacq_polarity = 1,
460 .first_conversion_delay = 3,
461 .acquisition_time = 1,
463 .pen_down_acc_interval = 1,
467 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
468 #include <linux/spi/ad7879.h>
469 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
470 .model = 7879, /* Model = AD7879 */
471 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
472 .pressure_max = 10000,
474 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
475 .acquisition_time = 1, /* 4us acquisition time per sample */
476 .median = 2, /* do 8 measurements */
477 .averaging = 1, /* take the average of 4 middle samples */
478 .pen_down_acc_interval = 255, /* 9.4 ms */
479 .gpio_export = 0, /* Export GPIO to gpiolib */
483 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
484 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
490 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
491 static struct bfin5xx_spi_chip spidev_chip_info = {
497 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
498 static struct platform_device bfin_i2s = {
500 .id = CONFIG_SND_BF5XX_SPORT_NUM,
501 /* TODO: add platform data here */
505 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
506 static struct platform_device bfin_tdm = {
508 .id = CONFIG_SND_BF5XX_SPORT_NUM,
509 /* TODO: add platform data here */
513 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
514 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
520 static struct spi_board_info bfin_spi_board_info[] __initdata = {
521 #if defined(CONFIG_MTD_M25P80) \
522 || defined(CONFIG_MTD_M25P80_MODULE)
524 /* the modalias must be the same as spi device driver name */
525 .modalias = "m25p80", /* Name of spi_driver for this device */
526 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
527 .bus_num = 0, /* Framework bus number */
528 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
529 .platform_data = &bfin_spi_flash_data,
530 .controller_data = &spi_flash_chip_info,
535 #if defined(CONFIG_BFIN_SPI_ADC) \
536 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
538 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
539 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
540 .bus_num = 0, /* Framework bus number */
541 .chip_select = 1, /* Framework chip select. */
542 .platform_data = NULL, /* No spi_driver specific config */
543 .controller_data = &spi_adc_chip_info,
547 #if defined(CONFIG_SND_BLACKFIN_AD183X) \
548 || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
550 .modalias = "ad1836",
551 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
553 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
554 .controller_data = &ad1836_spi_chip_info,
557 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
559 .modalias = "mmc_spi",
560 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
563 .controller_data = &mmc_spi_chip_info,
568 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
570 .modalias = "ad7877",
571 .platform_data = &bfin_ad7877_ts_info,
573 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
576 .controller_data = &spi_ad7877_chip_info,
579 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
581 .modalias = "ad7879",
582 .platform_data = &bfin_ad7879_ts_info,
584 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
587 .controller_data = &spi_ad7879_chip_info,
588 .mode = SPI_CPHA | SPI_CPOL,
591 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
593 .modalias = "spidev",
594 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
597 .controller_data = &spidev_chip_info,
600 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
602 .modalias = "bfin-lq035q1-spi",
603 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
606 .controller_data = &lq035q1_spi_chip_info,
607 .mode = SPI_CPHA | SPI_CPOL,
612 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
613 /* SPI controller data */
614 static struct bfin5xx_spi_master bfin_spi0_info = {
616 .enable_dma = 1, /* master has the ability to do dma transfer */
617 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
621 static struct resource bfin_spi0_resource[] = {
623 .start = SPI0_REGBASE,
624 .end = SPI0_REGBASE + 0xFF,
625 .flags = IORESOURCE_MEM,
630 .flags = IORESOURCE_DMA,
635 .flags = IORESOURCE_IRQ,
639 static struct platform_device bfin_spi0_device = {
641 .id = 0, /* Bus number */
642 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
643 .resource = bfin_spi0_resource,
645 .platform_data = &bfin_spi0_info, /* Passed to driver */
648 #endif /* spi master and devices */
650 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
651 #ifdef CONFIG_SERIAL_BFIN_UART0
652 static struct resource bfin_uart0_resources[] = {
656 .flags = IORESOURCE_MEM,
659 .start = IRQ_UART0_RX,
660 .end = IRQ_UART0_RX+1,
661 .flags = IORESOURCE_IRQ,
664 .start = IRQ_UART0_ERROR,
665 .end = IRQ_UART0_ERROR,
666 .flags = IORESOURCE_IRQ,
669 .start = CH_UART0_TX,
671 .flags = IORESOURCE_DMA,
674 .start = CH_UART0_RX,
676 .flags = IORESOURCE_DMA,
680 unsigned short bfin_uart0_peripherals[] = {
681 P_UART0_TX, P_UART0_RX, 0
684 static struct platform_device bfin_uart0_device = {
687 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
688 .resource = bfin_uart0_resources,
690 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
694 #ifdef CONFIG_SERIAL_BFIN_UART1
695 static struct resource bfin_uart1_resources[] = {
699 .flags = IORESOURCE_MEM,
702 .start = IRQ_UART1_RX,
703 .end = IRQ_UART1_RX+1,
704 .flags = IORESOURCE_IRQ,
707 .start = IRQ_UART1_ERROR,
708 .end = IRQ_UART1_ERROR,
709 .flags = IORESOURCE_IRQ,
712 .start = CH_UART1_TX,
714 .flags = IORESOURCE_DMA,
717 .start = CH_UART1_RX,
719 .flags = IORESOURCE_DMA,
721 #ifdef CONFIG_BFIN_UART1_CTSRTS
725 .flags = IORESOURCE_IO,
730 .flags = IORESOURCE_IO,
735 unsigned short bfin_uart1_peripherals[] = {
736 P_UART1_TX, P_UART1_RX, 0
739 static struct platform_device bfin_uart1_device = {
742 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
743 .resource = bfin_uart1_resources,
745 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
751 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
752 #ifdef CONFIG_BFIN_SIR0
753 static struct resource bfin_sir0_resources[] = {
757 .flags = IORESOURCE_MEM,
760 .start = IRQ_UART0_RX,
761 .end = IRQ_UART0_RX+1,
762 .flags = IORESOURCE_IRQ,
765 .start = CH_UART0_RX,
766 .end = CH_UART0_RX+1,
767 .flags = IORESOURCE_DMA,
771 static struct platform_device bfin_sir0_device = {
774 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
775 .resource = bfin_sir0_resources,
778 #ifdef CONFIG_BFIN_SIR1
779 static struct resource bfin_sir1_resources[] = {
783 .flags = IORESOURCE_MEM,
786 .start = IRQ_UART1_RX,
787 .end = IRQ_UART1_RX+1,
788 .flags = IORESOURCE_IRQ,
791 .start = CH_UART1_RX,
792 .end = CH_UART1_RX+1,
793 .flags = IORESOURCE_DMA,
797 static struct platform_device bfin_sir1_device = {
800 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
801 .resource = bfin_sir1_resources,
806 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
807 static struct resource bfin_twi0_resource[] = {
809 .start = TWI0_REGBASE,
811 .flags = IORESOURCE_MEM,
816 .flags = IORESOURCE_IRQ,
820 static struct platform_device i2c_bfin_twi_device = {
821 .name = "i2c-bfin-twi",
823 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
824 .resource = bfin_twi0_resource,
828 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
829 #include <linux/mfd/adp5520.h>
832 * ADP5520/5501 LEDs Data
835 static struct led_info adp5520_leds[] = {
837 .name = "adp5520-led1",
838 .default_trigger = "none",
839 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
843 static struct adp5520_leds_platform_data adp5520_leds_data = {
844 .num_leds = ARRAY_SIZE(adp5520_leds),
845 .leds = adp5520_leds,
846 .fade_in = ADP5520_FADE_T_600ms,
847 .fade_out = ADP5520_FADE_T_600ms,
848 .led_on_time = ADP5520_LED_ONT_600ms,
852 * ADP5520 Keypad Data
855 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
856 [ADP5520_KEY(3, 3)] = KEY_1,
857 [ADP5520_KEY(2, 3)] = KEY_2,
858 [ADP5520_KEY(1, 3)] = KEY_3,
859 [ADP5520_KEY(0, 3)] = KEY_UP,
860 [ADP5520_KEY(3, 2)] = KEY_4,
861 [ADP5520_KEY(2, 2)] = KEY_5,
862 [ADP5520_KEY(1, 2)] = KEY_6,
863 [ADP5520_KEY(0, 2)] = KEY_DOWN,
864 [ADP5520_KEY(3, 1)] = KEY_7,
865 [ADP5520_KEY(2, 1)] = KEY_8,
866 [ADP5520_KEY(1, 1)] = KEY_9,
867 [ADP5520_KEY(0, 1)] = KEY_DOT,
868 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
869 [ADP5520_KEY(2, 0)] = KEY_0,
870 [ADP5520_KEY(1, 0)] = KEY_HELP,
871 [ADP5520_KEY(0, 0)] = KEY_ENTER,
874 static struct adp5520_keys_platform_data adp5520_keys_data = {
875 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
876 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
877 .keymap = adp5520_keymap,
878 .keymapsize = ARRAY_SIZE(adp5520_keymap),
883 * ADP5520/5501 Multifuction Device Init Data
886 static struct adp5520_platform_data adp5520_pdev_data = {
887 .leds = &adp5520_leds_data,
888 .keys = &adp5520_keys_data,
893 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
894 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
896 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
899 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
901 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
905 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
907 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
910 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
912 I2C_BOARD_INFO("ad7879", 0x2C),
914 .platform_data = (void *)&bfin_ad7879_ts_info,
917 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
919 I2C_BOARD_INFO("pmic-adp5520", 0x32),
921 .platform_data = (void *)&adp5520_pdev_data,
924 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
926 I2C_BOARD_INFO("ssm2602", 0x1b),
931 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
932 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
933 static struct resource bfin_sport0_uart_resources[] = {
935 .start = SPORT0_TCR1,
936 .end = SPORT0_MRCS3+4,
937 .flags = IORESOURCE_MEM,
940 .start = IRQ_SPORT0_RX,
941 .end = IRQ_SPORT0_RX+1,
942 .flags = IORESOURCE_IRQ,
945 .start = IRQ_SPORT0_ERROR,
946 .end = IRQ_SPORT0_ERROR,
947 .flags = IORESOURCE_IRQ,
951 unsigned short bfin_sport0_peripherals[] = {
952 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
953 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
956 static struct platform_device bfin_sport0_uart_device = {
957 .name = "bfin-sport-uart",
959 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
960 .resource = bfin_sport0_uart_resources,
962 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
966 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
967 static struct resource bfin_sport1_uart_resources[] = {
969 .start = SPORT1_TCR1,
970 .end = SPORT1_MRCS3+4,
971 .flags = IORESOURCE_MEM,
974 .start = IRQ_SPORT1_RX,
975 .end = IRQ_SPORT1_RX+1,
976 .flags = IORESOURCE_IRQ,
979 .start = IRQ_SPORT1_ERROR,
980 .end = IRQ_SPORT1_ERROR,
981 .flags = IORESOURCE_IRQ,
985 unsigned short bfin_sport1_peripherals[] = {
986 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
987 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
990 static struct platform_device bfin_sport1_uart_device = {
991 .name = "bfin-sport-uart",
993 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
994 .resource = bfin_sport1_uart_resources,
996 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1002 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1003 #include <linux/gpio_keys.h>
1005 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1006 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1007 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1010 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1011 .buttons = bfin_gpio_keys_table,
1012 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1015 static struct platform_device bfin_device_gpiokeys = {
1016 .name = "gpio-keys",
1018 .platform_data = &bfin_gpio_keys_data,
1023 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1024 #include <asm/bfin_rotary.h>
1026 static struct bfin_rotary_platform_data bfin_rotary_data = {
1027 /*.rotary_up_key = KEY_UP,*/
1028 /*.rotary_down_key = KEY_DOWN,*/
1029 .rotary_rel_code = REL_WHEEL,
1030 .rotary_button_key = KEY_ENTER,
1031 .debounce = 10, /* 0..17 */
1032 .mode = ROT_QUAD_ENC | ROT_DEBE,
1035 static struct resource bfin_rotary_resources[] = {
1039 .flags = IORESOURCE_IRQ,
1043 static struct platform_device bfin_rotary_device = {
1044 .name = "bfin-rotary",
1046 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1047 .resource = bfin_rotary_resources,
1049 .platform_data = &bfin_rotary_data,
1054 static const unsigned int cclk_vlev_datasheet[] =
1056 VRPAIR(VLEV_100, 400000000),
1057 VRPAIR(VLEV_105, 426000000),
1058 VRPAIR(VLEV_110, 500000000),
1059 VRPAIR(VLEV_115, 533000000),
1060 VRPAIR(VLEV_120, 600000000),
1063 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1064 .tuple_tab = cclk_vlev_datasheet,
1065 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1066 .vr_settling_time = 25 /* us */,
1069 static struct platform_device bfin_dpmc = {
1070 .name = "bfin dpmc",
1072 .platform_data = &bfin_dmpc_vreg_data,
1076 static struct platform_device *stamp_devices[] __initdata = {
1080 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1084 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1085 &bfin_pcmcia_cf_device,
1088 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1092 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1093 &bfin_isp1760_device,
1096 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1100 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1104 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1108 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1113 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1114 &net2272_bfin_device,
1117 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1121 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1122 &bf52x_t350mcqb_device,
1125 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1126 &bfin_lq035q1_device,
1129 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1130 #ifdef CONFIG_SERIAL_BFIN_UART0
1133 #ifdef CONFIG_SERIAL_BFIN_UART1
1138 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1139 #ifdef CONFIG_BFIN_SIR0
1142 #ifdef CONFIG_BFIN_SIR1
1147 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1148 &i2c_bfin_twi_device,
1151 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1152 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1153 &bfin_sport0_uart_device,
1155 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1156 &bfin_sport1_uart_device,
1160 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1161 &bfin_device_gpiokeys,
1164 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1165 &bfin_rotary_device,
1168 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1169 &ezkit_flash_device,
1172 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1176 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1181 static int __init ezkit_init(void)
1183 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1184 i2c_register_board_info(0, bfin_i2c_board_info,
1185 ARRAY_SIZE(bfin_i2c_board_info));
1186 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1187 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1191 arch_initcall(ezkit_init);
1193 static struct platform_device *ezkit_early_devices[] __initdata = {
1194 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1195 #ifdef CONFIG_SERIAL_BFIN_UART0
1198 #ifdef CONFIG_SERIAL_BFIN_UART1
1203 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1204 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1205 &bfin_sport0_uart_device,
1207 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1208 &bfin_sport1_uart_device,
1213 void __init native_machine_early_platform_add_devices(void)
1215 printk(KERN_INFO "register early platform devices\n");
1216 early_platform_add_devices(ezkit_early_devices,
1217 ARRAY_SIZE(ezkit_early_devices));
1220 void native_machine_restart(char *cmd)
1222 /* workaround reboot hang when booting from SPI */
1223 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1224 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1227 void bfin_get_ether_addr(char *addr)
1229 /* the MAC is stored in OTP memory page 0xDF */
1232 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1234 ret = otp_read(0xDF, 0x00, &otp_mac);
1236 char *otp_mac_p = (char *)&otp_mac;
1237 for (ret = 0; ret < 6; ++ret)
1238 addr[ret] = otp_mac_p[5 - ret];
1241 EXPORT_SYMBOL(bfin_get_ether_addr);