Path: blob/master/arch/blackfin/mach-bf527/boards/ezkit.c
15112 views
/*1* Copyright 2004-2009 Analog Devices Inc.2* 2005 National ICT Australia (NICTA)3* Aidan Williams <[email protected]>4*5* Licensed under the GPL-2 or later.6*/78#include <linux/device.h>9#include <linux/platform_device.h>10#include <linux/mtd/mtd.h>11#include <linux/mtd/partitions.h>12#include <linux/mtd/physmap.h>13#include <linux/spi/spi.h>14#include <linux/spi/flash.h>15#include <linux/i2c.h>16#include <linux/irq.h>17#include <linux/interrupt.h>18#include <linux/usb/musb.h>19#include <linux/leds.h>20#include <linux/input.h>21#include <asm/dma.h>22#include <asm/bfin5xx_spi.h>23#include <asm/reboot.h>24#include <asm/nand.h>25#include <asm/portmux.h>26#include <asm/dpmc.h>27#include <linux/spi/ad7877.h>28#include <asm/bfin_sport.h>2930/*31* Name the Board for the /proc/cpuinfo32*/33#ifdef CONFIG_BFIN527_EZKIT_V234const char bfin_board_name[] = "ADI BF527-EZKIT V2";35#else36const char bfin_board_name[] = "ADI BF527-EZKIT";37#endif3839/*40* Driver needs to know address, irq and flag pin.41*/4243#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)44#include <linux/usb/isp1760.h>45static struct resource bfin_isp1760_resources[] = {46[0] = {47.start = 0x203C0000,48.end = 0x203C0000 + 0x000fffff,49.flags = IORESOURCE_MEM,50},51[1] = {52.start = IRQ_PF7,53.end = IRQ_PF7,54.flags = IORESOURCE_IRQ,55},56};5758static struct isp1760_platform_data isp1760_priv = {59.is_isp1761 = 0,60.bus_width_16 = 1,61.port1_otg = 0,62.analog_oc = 0,63.dack_polarity_high = 0,64.dreq_polarity_high = 0,65};6667static struct platform_device bfin_isp1760_device = {68.name = "isp1760",69.id = 0,70.dev = {71.platform_data = &isp1760_priv,72},73.num_resources = ARRAY_SIZE(bfin_isp1760_resources),74.resource = bfin_isp1760_resources,75};76#endif7778#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)79static struct resource musb_resources[] = {80[0] = {81.start = 0xffc03800,82.end = 0xffc03cff,83.flags = IORESOURCE_MEM,84},85[1] = { /* general IRQ */86.start = IRQ_USB_INT0,87.end = IRQ_USB_INT0,88.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,89.name = "mc"90},91[2] = { /* DMA IRQ */92.start = IRQ_USB_DMA,93.end = IRQ_USB_DMA,94.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,95.name = "dma"96},97};9899static struct musb_hdrc_config musb_config = {100.multipoint = 0,101.dyn_fifo = 0,102.soft_con = 1,103.dma = 1,104.num_eps = 8,105.dma_channels = 8,106.gpio_vrsel = GPIO_PG13,107/* Some custom boards need to be active low, just set it to "0"108* if it is the case.109*/110.gpio_vrsel_active = 1,111.clkin = 24, /* musb CLKIN in MHZ */112};113114static struct musb_hdrc_platform_data musb_plat = {115#if defined(CONFIG_USB_MUSB_OTG)116.mode = MUSB_OTG,117#elif defined(CONFIG_USB_MUSB_HDRC_HCD)118.mode = MUSB_HOST,119#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)120.mode = MUSB_PERIPHERAL,121#endif122.config = &musb_config,123};124125static u64 musb_dmamask = ~(u32)0;126127static struct platform_device musb_device = {128.name = "musb-blackfin",129.id = 0,130.dev = {131.dma_mask = &musb_dmamask,132.coherent_dma_mask = 0xffffffff,133.platform_data = &musb_plat,134},135.num_resources = ARRAY_SIZE(musb_resources),136.resource = musb_resources,137};138#endif139140#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)141142static struct resource bf52x_t350mcqb_resources[] = {143{144.start = IRQ_PPI_ERROR,145.end = IRQ_PPI_ERROR,146.flags = IORESOURCE_IRQ,147},148};149150static struct platform_device bf52x_t350mcqb_device = {151.name = "bfin-t350mcqb",152.id = -1,153.num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),154.resource = bf52x_t350mcqb_resources,155};156#endif157158#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)159#include <asm/bfin-lq035q1.h>160161static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {162.mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,163.ppi_mode = USE_RGB565_8_BIT_PPI,164};165166static struct resource bfin_lq035q1_resources[] = {167{168.start = IRQ_PPI_ERROR,169.end = IRQ_PPI_ERROR,170.flags = IORESOURCE_IRQ,171},172};173174static struct platform_device bfin_lq035q1_device = {175.name = "bfin-lq035q1",176.id = -1,177.num_resources = ARRAY_SIZE(bfin_lq035q1_resources),178.resource = bfin_lq035q1_resources,179.dev = {180.platform_data = &bfin_lq035q1_data,181},182};183#endif184185#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)186static struct mtd_partition ezkit_partitions[] = {187{188.name = "bootloader(nor)",189.size = 0x40000,190.offset = 0,191}, {192.name = "linux kernel(nor)",193.size = 0x1C0000,194.offset = MTDPART_OFS_APPEND,195}, {196.name = "file system(nor)",197.size = MTDPART_SIZ_FULL,198.offset = MTDPART_OFS_APPEND,199}200};201202static struct physmap_flash_data ezkit_flash_data = {203.width = 2,204.parts = ezkit_partitions,205.nr_parts = ARRAY_SIZE(ezkit_partitions),206};207208static struct resource ezkit_flash_resource = {209.start = 0x20000000,210.end = 0x203fffff,211.flags = IORESOURCE_MEM,212};213214static struct platform_device ezkit_flash_device = {215.name = "physmap-flash",216.id = 0,217.dev = {218.platform_data = &ezkit_flash_data,219},220.num_resources = 1,221.resource = &ezkit_flash_resource,222};223#endif224225#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)226static struct mtd_partition partition_info[] = {227{228.name = "bootloader(nand)",229.offset = 0,230.size = 0x40000,231}, {232.name = "linux kernel(nand)",233.offset = MTDPART_OFS_APPEND,234.size = 4 * 1024 * 1024,235},236{237.name = "file system(nand)",238.offset = MTDPART_OFS_APPEND,239.size = MTDPART_SIZ_FULL,240},241};242243static struct bf5xx_nand_platform bf5xx_nand_platform = {244.data_width = NFC_NWIDTH_8,245.partitions = partition_info,246.nr_partitions = ARRAY_SIZE(partition_info),247.rd_dly = 3,248.wr_dly = 3,249};250251static struct resource bf5xx_nand_resources[] = {252{253.start = NFC_CTL,254.end = NFC_DATA_RD + 2,255.flags = IORESOURCE_MEM,256},257{258.start = CH_NFC,259.end = CH_NFC,260.flags = IORESOURCE_IRQ,261},262};263264static struct platform_device bf5xx_nand_device = {265.name = "bf5xx-nand",266.id = 0,267.num_resources = ARRAY_SIZE(bf5xx_nand_resources),268.resource = bf5xx_nand_resources,269.dev = {270.platform_data = &bf5xx_nand_platform,271},272};273#endif274275#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)276static struct resource bfin_pcmcia_cf_resources[] = {277{278.start = 0x20310000, /* IO PORT */279.end = 0x20312000,280.flags = IORESOURCE_MEM,281}, {282.start = 0x20311000, /* Attribute Memory */283.end = 0x20311FFF,284.flags = IORESOURCE_MEM,285}, {286.start = IRQ_PF4,287.end = IRQ_PF4,288.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,289}, {290.start = 6, /* Card Detect PF6 */291.end = 6,292.flags = IORESOURCE_IRQ,293},294};295296static struct platform_device bfin_pcmcia_cf_device = {297.name = "bfin_cf_pcmcia",298.id = -1,299.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),300.resource = bfin_pcmcia_cf_resources,301};302#endif303304#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)305static struct platform_device rtc_device = {306.name = "rtc-bfin",307.id = -1,308};309#endif310311#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)312#include <linux/smc91x.h>313314static struct smc91x_platdata smc91x_info = {315.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,316.leda = RPC_LED_100_10,317.ledb = RPC_LED_TX_RX,318};319320static struct resource smc91x_resources[] = {321{322.name = "smc91x-regs",323.start = 0x20300300,324.end = 0x20300300 + 16,325.flags = IORESOURCE_MEM,326}, {327328.start = IRQ_PF7,329.end = IRQ_PF7,330.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,331},332};333static struct platform_device smc91x_device = {334.name = "smc91x",335.id = 0,336.num_resources = ARRAY_SIZE(smc91x_resources),337.resource = smc91x_resources,338.dev = {339.platform_data = &smc91x_info,340},341};342#endif343344#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)345static struct resource dm9000_resources[] = {346[0] = {347.start = 0x203FB800,348.end = 0x203FB800 + 1,349.flags = IORESOURCE_MEM,350},351[1] = {352.start = 0x203FB800 + 4,353.end = 0x203FB800 + 5,354.flags = IORESOURCE_MEM,355},356[2] = {357.start = IRQ_PF9,358.end = IRQ_PF9,359.flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),360},361};362363static struct platform_device dm9000_device = {364.name = "dm9000",365.id = -1,366.num_resources = ARRAY_SIZE(dm9000_resources),367.resource = dm9000_resources,368};369#endif370371#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)372#include <linux/bfin_mac.h>373static const unsigned short bfin_mac_peripherals[] = P_RMII0;374375static struct bfin_phydev_platform_data bfin_phydev_data[] = {376{377.addr = 1,378.irq = IRQ_MAC_PHYINT,379},380};381382static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {383.phydev_number = 1,384.phydev_data = bfin_phydev_data,385.phy_mode = PHY_INTERFACE_MODE_RMII,386.mac_peripherals = bfin_mac_peripherals,387};388389static struct platform_device bfin_mii_bus = {390.name = "bfin_mii_bus",391.dev = {392.platform_data = &bfin_mii_bus_data,393}394};395396static struct platform_device bfin_mac_device = {397.name = "bfin_mac",398.dev = {399.platform_data = &bfin_mii_bus,400}401};402#endif403404#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)405static struct resource net2272_bfin_resources[] = {406{407.start = 0x20300000,408.end = 0x20300000 + 0x100,409.flags = IORESOURCE_MEM,410}, {411.start = IRQ_PF7,412.end = IRQ_PF7,413.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,414},415};416417static struct platform_device net2272_bfin_device = {418.name = "net2272",419.id = -1,420.num_resources = ARRAY_SIZE(net2272_bfin_resources),421.resource = net2272_bfin_resources,422};423#endif424425#if defined(CONFIG_MTD_M25P80) \426|| defined(CONFIG_MTD_M25P80_MODULE)427static struct mtd_partition bfin_spi_flash_partitions[] = {428{429.name = "bootloader(spi)",430.size = 0x00040000,431.offset = 0,432.mask_flags = MTD_CAP_ROM433}, {434.name = "linux kernel(spi)",435.size = MTDPART_SIZ_FULL,436.offset = MTDPART_OFS_APPEND,437}438};439440static struct flash_platform_data bfin_spi_flash_data = {441.name = "m25p80",442.parts = bfin_spi_flash_partitions,443.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),444.type = "m25p16",445};446447/* SPI flash chip (m25p64) */448static struct bfin5xx_spi_chip spi_flash_chip_info = {449.enable_dma = 0, /* use dma transfer with this chip*/450.bits_per_word = 8,451};452#endif453454#if defined(CONFIG_BFIN_SPI_ADC) \455|| defined(CONFIG_BFIN_SPI_ADC_MODULE)456/* SPI ADC chip */457static struct bfin5xx_spi_chip spi_adc_chip_info = {458.enable_dma = 1, /* use dma transfer with this chip*/459.bits_per_word = 16,460};461#endif462463#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \464|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)465static struct bfin5xx_spi_chip ad1836_spi_chip_info = {466.enable_dma = 0,467.bits_per_word = 16,468};469#endif470471#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)472static struct bfin5xx_spi_chip mmc_spi_chip_info = {473.enable_dma = 0,474.bits_per_word = 8,475};476#endif477478#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)479static struct bfin5xx_spi_chip spi_ad7877_chip_info = {480.enable_dma = 0,481.bits_per_word = 16,482};483484static const struct ad7877_platform_data bfin_ad7877_ts_info = {485.model = 7877,486.vref_delay_usecs = 50, /* internal, no capacitor */487.x_plate_ohms = 419,488.y_plate_ohms = 486,489.pressure_max = 1000,490.pressure_min = 0,491.stopacq_polarity = 1,492.first_conversion_delay = 3,493.acquisition_time = 1,494.averaging = 1,495.pen_down_acc_interval = 1,496};497#endif498499#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)500#include <linux/spi/ad7879.h>501static const struct ad7879_platform_data bfin_ad7879_ts_info = {502.model = 7879, /* Model = AD7879 */503.x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */504.pressure_max = 10000,505.pressure_min = 0,506.first_conversion_delay = 3, /* wait 512us before do a first conversion */507.acquisition_time = 1, /* 4us acquisition time per sample */508.median = 2, /* do 8 measurements */509.averaging = 1, /* take the average of 4 middle samples */510.pen_down_acc_interval = 255, /* 9.4 ms */511.gpio_export = 0, /* Export GPIO to gpiolib */512};513#endif514515#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)516static struct bfin5xx_spi_chip spi_ad7879_chip_info = {517.enable_dma = 0,518.bits_per_word = 16,519};520#endif521522#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)523static struct bfin5xx_spi_chip spidev_chip_info = {524.enable_dma = 0,525.bits_per_word = 8,526};527#endif528529#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \530defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)531532static const u16 bfin_snd_pin[][7] = {533{P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,534P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0},535{P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,536P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0},537};538539static struct bfin_snd_platform_data bfin_snd_data[] = {540{541.pin_req = &bfin_snd_pin[0][0],542},543{544.pin_req = &bfin_snd_pin[1][0],545},546};547548#define BFIN_SND_RES(x) \549[x] = { \550{ \551.start = SPORT##x##_TCR1, \552.end = SPORT##x##_TCR1, \553.flags = IORESOURCE_MEM \554}, \555{ \556.start = CH_SPORT##x##_RX, \557.end = CH_SPORT##x##_RX, \558.flags = IORESOURCE_DMA, \559}, \560{ \561.start = CH_SPORT##x##_TX, \562.end = CH_SPORT##x##_TX, \563.flags = IORESOURCE_DMA, \564}, \565{ \566.start = IRQ_SPORT##x##_ERROR, \567.end = IRQ_SPORT##x##_ERROR, \568.flags = IORESOURCE_IRQ, \569} \570}571572static struct resource bfin_snd_resources[][4] = {573BFIN_SND_RES(0),574BFIN_SND_RES(1),575};576577static struct platform_device bfin_pcm = {578.name = "bfin-pcm-audio",579.id = -1,580};581#endif582583#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)584static struct platform_device bfin_i2s = {585.name = "bfin-i2s",586.id = CONFIG_SND_BF5XX_SPORT_NUM,587.num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),588.resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],589.dev = {590.platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],591},592};593#endif594595#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)596static struct platform_device bfin_tdm = {597.name = "bfin-tdm",598.id = CONFIG_SND_BF5XX_SPORT_NUM,599.num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),600.resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],601.dev = {602.platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],603},604};605#endif606607#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)608static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {609.enable_dma = 0,610.bits_per_word = 8,611};612#endif613614static struct spi_board_info bfin_spi_board_info[] __initdata = {615#if defined(CONFIG_MTD_M25P80) \616|| defined(CONFIG_MTD_M25P80_MODULE)617{618/* the modalias must be the same as spi device driver name */619.modalias = "m25p80", /* Name of spi_driver for this device */620.max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */621.bus_num = 0, /* Framework bus number */622.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/623.platform_data = &bfin_spi_flash_data,624.controller_data = &spi_flash_chip_info,625.mode = SPI_MODE_3,626},627#endif628629#if defined(CONFIG_BFIN_SPI_ADC) \630|| defined(CONFIG_BFIN_SPI_ADC_MODULE)631{632.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */633.max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */634.bus_num = 0, /* Framework bus number */635.chip_select = 1, /* Framework chip select. */636.platform_data = NULL, /* No spi_driver specific config */637.controller_data = &spi_adc_chip_info,638},639#endif640641#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \642|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)643{644.modalias = "ad183x",645.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */646.bus_num = 0,647.chip_select = 4,648.platform_data = "ad1836",649.controller_data = &ad1836_spi_chip_info,650.mode = SPI_MODE_3,651},652#endif653#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)654{655.modalias = "mmc_spi",656.max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */657.bus_num = 0,658.chip_select = 3,659.controller_data = &mmc_spi_chip_info,660.mode = SPI_MODE_0,661},662#endif663664#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)665{666.modalias = "ad7877",667.platform_data = &bfin_ad7877_ts_info,668.irq = IRQ_PF8,669.max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */670.bus_num = 0,671.chip_select = 2,672.controller_data = &spi_ad7877_chip_info,673},674#endif675#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)676{677.modalias = "ad7879",678.platform_data = &bfin_ad7879_ts_info,679.irq = IRQ_PF8,680.max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */681.bus_num = 0,682.chip_select = 3,683.controller_data = &spi_ad7879_chip_info,684.mode = SPI_CPHA | SPI_CPOL,685},686#endif687#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)688{689.modalias = "spidev",690.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */691.bus_num = 0,692.chip_select = 1,693.controller_data = &spidev_chip_info,694},695#endif696#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)697{698.modalias = "bfin-lq035q1-spi",699.max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */700.bus_num = 0,701.chip_select = 7,702.controller_data = &lq035q1_spi_chip_info,703.mode = SPI_CPHA | SPI_CPOL,704},705#endif706};707708#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)709/* SPI controller data */710static struct bfin5xx_spi_master bfin_spi0_info = {711.num_chipselect = 8,712.enable_dma = 1, /* master has the ability to do dma transfer */713.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},714};715716/* SPI (0) */717static struct resource bfin_spi0_resource[] = {718[0] = {719.start = SPI0_REGBASE,720.end = SPI0_REGBASE + 0xFF,721.flags = IORESOURCE_MEM,722},723[1] = {724.start = CH_SPI,725.end = CH_SPI,726.flags = IORESOURCE_DMA,727},728[2] = {729.start = IRQ_SPI,730.end = IRQ_SPI,731.flags = IORESOURCE_IRQ,732},733};734735static struct platform_device bfin_spi0_device = {736.name = "bfin-spi",737.id = 0, /* Bus number */738.num_resources = ARRAY_SIZE(bfin_spi0_resource),739.resource = bfin_spi0_resource,740.dev = {741.platform_data = &bfin_spi0_info, /* Passed to driver */742},743};744#endif /* spi master and devices */745746#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)747#ifdef CONFIG_SERIAL_BFIN_UART0748static struct resource bfin_uart0_resources[] = {749{750.start = UART0_THR,751.end = UART0_GCTL+2,752.flags = IORESOURCE_MEM,753},754{755.start = IRQ_UART0_RX,756.end = IRQ_UART0_RX+1,757.flags = IORESOURCE_IRQ,758},759{760.start = IRQ_UART0_ERROR,761.end = IRQ_UART0_ERROR,762.flags = IORESOURCE_IRQ,763},764{765.start = CH_UART0_TX,766.end = CH_UART0_TX,767.flags = IORESOURCE_DMA,768},769{770.start = CH_UART0_RX,771.end = CH_UART0_RX,772.flags = IORESOURCE_DMA,773},774};775776static unsigned short bfin_uart0_peripherals[] = {777P_UART0_TX, P_UART0_RX, 0778};779780static struct platform_device bfin_uart0_device = {781.name = "bfin-uart",782.id = 0,783.num_resources = ARRAY_SIZE(bfin_uart0_resources),784.resource = bfin_uart0_resources,785.dev = {786.platform_data = &bfin_uart0_peripherals, /* Passed to driver */787},788};789#endif790#ifdef CONFIG_SERIAL_BFIN_UART1791static struct resource bfin_uart1_resources[] = {792{793.start = UART1_THR,794.end = UART1_GCTL+2,795.flags = IORESOURCE_MEM,796},797{798.start = IRQ_UART1_RX,799.end = IRQ_UART1_RX+1,800.flags = IORESOURCE_IRQ,801},802{803.start = IRQ_UART1_ERROR,804.end = IRQ_UART1_ERROR,805.flags = IORESOURCE_IRQ,806},807{808.start = CH_UART1_TX,809.end = CH_UART1_TX,810.flags = IORESOURCE_DMA,811},812{813.start = CH_UART1_RX,814.end = CH_UART1_RX,815.flags = IORESOURCE_DMA,816},817#ifdef CONFIG_BFIN_UART1_CTSRTS818{ /* CTS pin */819.start = GPIO_PF9,820.end = GPIO_PF9,821.flags = IORESOURCE_IO,822},823{ /* RTS pin */824.start = GPIO_PF10,825.end = GPIO_PF10,826.flags = IORESOURCE_IO,827},828#endif829};830831static unsigned short bfin_uart1_peripherals[] = {832P_UART1_TX, P_UART1_RX, 0833};834835static struct platform_device bfin_uart1_device = {836.name = "bfin-uart",837.id = 1,838.num_resources = ARRAY_SIZE(bfin_uart1_resources),839.resource = bfin_uart1_resources,840.dev = {841.platform_data = &bfin_uart1_peripherals, /* Passed to driver */842},843};844#endif845#endif846847#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)848#ifdef CONFIG_BFIN_SIR0849static struct resource bfin_sir0_resources[] = {850{851.start = 0xFFC00400,852.end = 0xFFC004FF,853.flags = IORESOURCE_MEM,854},855{856.start = IRQ_UART0_RX,857.end = IRQ_UART0_RX+1,858.flags = IORESOURCE_IRQ,859},860{861.start = CH_UART0_RX,862.end = CH_UART0_RX+1,863.flags = IORESOURCE_DMA,864},865};866867static struct platform_device bfin_sir0_device = {868.name = "bfin_sir",869.id = 0,870.num_resources = ARRAY_SIZE(bfin_sir0_resources),871.resource = bfin_sir0_resources,872};873#endif874#ifdef CONFIG_BFIN_SIR1875static struct resource bfin_sir1_resources[] = {876{877.start = 0xFFC02000,878.end = 0xFFC020FF,879.flags = IORESOURCE_MEM,880},881{882.start = IRQ_UART1_RX,883.end = IRQ_UART1_RX+1,884.flags = IORESOURCE_IRQ,885},886{887.start = CH_UART1_RX,888.end = CH_UART1_RX+1,889.flags = IORESOURCE_DMA,890},891};892893static struct platform_device bfin_sir1_device = {894.name = "bfin_sir",895.id = 1,896.num_resources = ARRAY_SIZE(bfin_sir1_resources),897.resource = bfin_sir1_resources,898};899#endif900#endif901902#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)903static struct resource bfin_twi0_resource[] = {904[0] = {905.start = TWI0_REGBASE,906.end = TWI0_REGBASE,907.flags = IORESOURCE_MEM,908},909[1] = {910.start = IRQ_TWI,911.end = IRQ_TWI,912.flags = IORESOURCE_IRQ,913},914};915916static struct platform_device i2c_bfin_twi_device = {917.name = "i2c-bfin-twi",918.id = 0,919.num_resources = ARRAY_SIZE(bfin_twi0_resource),920.resource = bfin_twi0_resource,921};922#endif923924#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)925#include <linux/mfd/adp5520.h>926927/*928* ADP5520/5501 LEDs Data929*/930931static struct led_info adp5520_leds[] = {932{933.name = "adp5520-led1",934.default_trigger = "none",935.flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,936},937};938939static struct adp5520_leds_platform_data adp5520_leds_data = {940.num_leds = ARRAY_SIZE(adp5520_leds),941.leds = adp5520_leds,942.fade_in = ADP5520_FADE_T_600ms,943.fade_out = ADP5520_FADE_T_600ms,944.led_on_time = ADP5520_LED_ONT_600ms,945};946947/*948* ADP5520 Keypad Data949*/950951static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {952[ADP5520_KEY(3, 3)] = KEY_1,953[ADP5520_KEY(2, 3)] = KEY_2,954[ADP5520_KEY(1, 3)] = KEY_3,955[ADP5520_KEY(0, 3)] = KEY_UP,956[ADP5520_KEY(3, 2)] = KEY_4,957[ADP5520_KEY(2, 2)] = KEY_5,958[ADP5520_KEY(1, 2)] = KEY_6,959[ADP5520_KEY(0, 2)] = KEY_DOWN,960[ADP5520_KEY(3, 1)] = KEY_7,961[ADP5520_KEY(2, 1)] = KEY_8,962[ADP5520_KEY(1, 1)] = KEY_9,963[ADP5520_KEY(0, 1)] = KEY_DOT,964[ADP5520_KEY(3, 0)] = KEY_BACKSPACE,965[ADP5520_KEY(2, 0)] = KEY_0,966[ADP5520_KEY(1, 0)] = KEY_HELP,967[ADP5520_KEY(0, 0)] = KEY_ENTER,968};969970static struct adp5520_keys_platform_data adp5520_keys_data = {971.rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,972.cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,973.keymap = adp5520_keymap,974.keymapsize = ARRAY_SIZE(adp5520_keymap),975.repeat = 0,976};977978/*979* ADP5520/5501 Multifunction Device Init Data980*/981982static struct adp5520_platform_data adp5520_pdev_data = {983.leds = &adp5520_leds_data,984.keys = &adp5520_keys_data,985};986987#endif988989static struct i2c_board_info __initdata bfin_i2c_board_info[] = {990#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)991{992I2C_BOARD_INFO("pcf8574_lcd", 0x22),993},994#endif995#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)996{997I2C_BOARD_INFO("pcf8574_keypad", 0x27),998.irq = IRQ_PF8,999},1000#endif1001#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)1002{1003I2C_BOARD_INFO("bfin-adv7393", 0x2B),1004},1005#endif1006#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)1007{1008I2C_BOARD_INFO("ad7879", 0x2C),1009.irq = IRQ_PF8,1010.platform_data = (void *)&bfin_ad7879_ts_info,1011},1012#endif1013#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)1014{1015I2C_BOARD_INFO("pmic-adp5520", 0x32),1016.irq = IRQ_PF9,1017.platform_data = (void *)&adp5520_pdev_data,1018},1019#endif1020#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)1021{1022I2C_BOARD_INFO("ssm2602", 0x1b),1023},1024#endif1025#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)1026{1027I2C_BOARD_INFO("ad5252", 0x2f),1028},1029#endif1030#if defined(CONFIG_SND_SOC_ADAU1373) || defined(CONFIG_SND_SOC_ADAU1373_MODULE)1031{1032I2C_BOARD_INFO("adau1373", 0x1A),1033},1034#endif1035};10361037#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)1038#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1039static struct resource bfin_sport0_uart_resources[] = {1040{1041.start = SPORT0_TCR1,1042.end = SPORT0_MRCS3+4,1043.flags = IORESOURCE_MEM,1044},1045{1046.start = IRQ_SPORT0_RX,1047.end = IRQ_SPORT0_RX+1,1048.flags = IORESOURCE_IRQ,1049},1050{1051.start = IRQ_SPORT0_ERROR,1052.end = IRQ_SPORT0_ERROR,1053.flags = IORESOURCE_IRQ,1054},1055};10561057static unsigned short bfin_sport0_peripherals[] = {1058P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,1059P_SPORT0_DRPRI, P_SPORT0_RSCLK, 01060};10611062static struct platform_device bfin_sport0_uart_device = {1063.name = "bfin-sport-uart",1064.id = 0,1065.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),1066.resource = bfin_sport0_uart_resources,1067.dev = {1068.platform_data = &bfin_sport0_peripherals, /* Passed to driver */1069},1070};1071#endif1072#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1073static struct resource bfin_sport1_uart_resources[] = {1074{1075.start = SPORT1_TCR1,1076.end = SPORT1_MRCS3+4,1077.flags = IORESOURCE_MEM,1078},1079{1080.start = IRQ_SPORT1_RX,1081.end = IRQ_SPORT1_RX+1,1082.flags = IORESOURCE_IRQ,1083},1084{1085.start = IRQ_SPORT1_ERROR,1086.end = IRQ_SPORT1_ERROR,1087.flags = IORESOURCE_IRQ,1088},1089};10901091static unsigned short bfin_sport1_peripherals[] = {1092P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,1093P_SPORT1_DRPRI, P_SPORT1_RSCLK, 01094};10951096static struct platform_device bfin_sport1_uart_device = {1097.name = "bfin-sport-uart",1098.id = 1,1099.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),1100.resource = bfin_sport1_uart_resources,1101.dev = {1102.platform_data = &bfin_sport1_peripherals, /* Passed to driver */1103},1104};1105#endif1106#endif11071108#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)1109#include <linux/gpio_keys.h>11101111static struct gpio_keys_button bfin_gpio_keys_table[] = {1112{BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},1113{BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},1114};11151116static struct gpio_keys_platform_data bfin_gpio_keys_data = {1117.buttons = bfin_gpio_keys_table,1118.nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),1119};11201121static struct platform_device bfin_device_gpiokeys = {1122.name = "gpio-keys",1123.dev = {1124.platform_data = &bfin_gpio_keys_data,1125},1126};1127#endif11281129#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)1130#include <asm/bfin_rotary.h>11311132static struct bfin_rotary_platform_data bfin_rotary_data = {1133/*.rotary_up_key = KEY_UP,*/1134/*.rotary_down_key = KEY_DOWN,*/1135.rotary_rel_code = REL_WHEEL,1136.rotary_button_key = KEY_ENTER,1137.debounce = 10, /* 0..17 */1138.mode = ROT_QUAD_ENC | ROT_DEBE,1139};11401141static struct resource bfin_rotary_resources[] = {1142{1143.start = IRQ_CNT,1144.end = IRQ_CNT,1145.flags = IORESOURCE_IRQ,1146},1147};11481149static struct platform_device bfin_rotary_device = {1150.name = "bfin-rotary",1151.id = -1,1152.num_resources = ARRAY_SIZE(bfin_rotary_resources),1153.resource = bfin_rotary_resources,1154.dev = {1155.platform_data = &bfin_rotary_data,1156},1157};1158#endif11591160static const unsigned int cclk_vlev_datasheet[] =1161{1162VRPAIR(VLEV_100, 400000000),1163VRPAIR(VLEV_105, 426000000),1164VRPAIR(VLEV_110, 500000000),1165VRPAIR(VLEV_115, 533000000),1166VRPAIR(VLEV_120, 600000000),1167};11681169static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {1170.tuple_tab = cclk_vlev_datasheet,1171.tabsize = ARRAY_SIZE(cclk_vlev_datasheet),1172.vr_settling_time = 25 /* us */,1173};11741175static struct platform_device bfin_dpmc = {1176.name = "bfin dpmc",1177.dev = {1178.platform_data = &bfin_dmpc_vreg_data,1179},1180};11811182static struct platform_device *stamp_devices[] __initdata = {11831184&bfin_dpmc,11851186#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)1187&bf5xx_nand_device,1188#endif11891190#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)1191&bfin_pcmcia_cf_device,1192#endif11931194#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)1195&rtc_device,1196#endif11971198#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)1199&bfin_isp1760_device,1200#endif12011202#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)1203&musb_device,1204#endif12051206#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)1207&smc91x_device,1208#endif12091210#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)1211&dm9000_device,1212#endif12131214#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)1215&bfin_mii_bus,1216&bfin_mac_device,1217#endif12181219#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)1220&net2272_bfin_device,1221#endif12221223#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)1224&bfin_spi0_device,1225#endif12261227#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)1228&bf52x_t350mcqb_device,1229#endif12301231#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)1232&bfin_lq035q1_device,1233#endif12341235#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)1236#ifdef CONFIG_SERIAL_BFIN_UART01237&bfin_uart0_device,1238#endif1239#ifdef CONFIG_SERIAL_BFIN_UART11240&bfin_uart1_device,1241#endif1242#endif12431244#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)1245#ifdef CONFIG_BFIN_SIR01246&bfin_sir0_device,1247#endif1248#ifdef CONFIG_BFIN_SIR11249&bfin_sir1_device,1250#endif1251#endif12521253#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)1254&i2c_bfin_twi_device,1255#endif12561257#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)1258#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1259&bfin_sport0_uart_device,1260#endif1261#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1262&bfin_sport1_uart_device,1263#endif1264#endif12651266#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)1267&bfin_device_gpiokeys,1268#endif12691270#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)1271&bfin_rotary_device,1272#endif12731274#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)1275&ezkit_flash_device,1276#endif12771278#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \1279defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)1280&bfin_pcm,1281#endif12821283#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)1284&bfin_i2s,1285#endif12861287#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)1288&bfin_tdm,1289#endif1290};12911292static int __init ezkit_init(void)1293{1294printk(KERN_INFO "%s(): registering device resources\n", __func__);1295i2c_register_board_info(0, bfin_i2c_board_info,1296ARRAY_SIZE(bfin_i2c_board_info));1297platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));1298spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));1299return 0;1300}13011302arch_initcall(ezkit_init);13031304static struct platform_device *ezkit_early_devices[] __initdata = {1305#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)1306#ifdef CONFIG_SERIAL_BFIN_UART01307&bfin_uart0_device,1308#endif1309#ifdef CONFIG_SERIAL_BFIN_UART11310&bfin_uart1_device,1311#endif1312#endif13131314#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)1315#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1316&bfin_sport0_uart_device,1317#endif1318#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1319&bfin_sport1_uart_device,1320#endif1321#endif1322};13231324void __init native_machine_early_platform_add_devices(void)1325{1326printk(KERN_INFO "register early platform devices\n");1327early_platform_add_devices(ezkit_early_devices,1328ARRAY_SIZE(ezkit_early_devices));1329}13301331void native_machine_restart(char *cmd)1332{1333/* workaround reboot hang when booting from SPI */1334if ((bfin_read_SYSCR() & 0x7) == 0x3)1335bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);1336}13371338void bfin_get_ether_addr(char *addr)1339{1340/* the MAC is stored in OTP memory page 0xDF */1341u32 ret;1342u64 otp_mac;1343u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;13441345ret = otp_read(0xDF, 0x00, &otp_mac);1346if (!(ret & 0x1)) {1347char *otp_mac_p = (char *)&otp_mac;1348for (ret = 0; ret < 6; ++ret)1349addr[ret] = otp_mac_p[5 - ret];1350}1351}1352EXPORT_SYMBOL(bfin_get_ether_addr);135313541355