Path: blob/master/arch/blackfin/mach-bf527/boards/cm_bf527.c
15112 views
/*1* Copyright 2004-2009 Analog Devices Inc.2* 2008-2009 Bluetechnix3* 2005 National ICT Australia (NICTA)4* Aidan Williams <[email protected]>5*6* Licensed under the GPL-2 or later.7*/89#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/etherdevice.h>17#include <linux/i2c.h>18#include <linux/irq.h>19#include <linux/interrupt.h>20#include <linux/usb/musb.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>2829/*30* Name the Board for the /proc/cpuinfo31*/32const char bfin_board_name[] = "Bluetechnix CM-BF527";3334/*35* Driver needs to know address, irq and flag pin.36*/3738#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)39#include <linux/usb/isp1760.h>40static struct resource bfin_isp1760_resources[] = {41[0] = {42.start = 0x203C0000,43.end = 0x203C0000 + 0x000fffff,44.flags = IORESOURCE_MEM,45},46[1] = {47.start = IRQ_PF7,48.end = IRQ_PF7,49.flags = IORESOURCE_IRQ,50},51};5253static struct isp1760_platform_data isp1760_priv = {54.is_isp1761 = 0,55.bus_width_16 = 1,56.port1_otg = 0,57.analog_oc = 0,58.dack_polarity_high = 0,59.dreq_polarity_high = 0,60};6162static struct platform_device bfin_isp1760_device = {63.name = "isp1760",64.id = 0,65.dev = {66.platform_data = &isp1760_priv,67},68.num_resources = ARRAY_SIZE(bfin_isp1760_resources),69.resource = bfin_isp1760_resources,70};71#endif7273#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)74static struct resource musb_resources[] = {75[0] = {76.start = 0xffc03800,77.end = 0xffc03cff,78.flags = IORESOURCE_MEM,79},80[1] = { /* general IRQ */81.start = IRQ_USB_INT0,82.end = IRQ_USB_INT0,83.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,84.name = "mc"85},86[2] = { /* DMA IRQ */87.start = IRQ_USB_DMA,88.end = IRQ_USB_DMA,89.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,90.name = "dma"91},92};9394static struct musb_hdrc_config musb_config = {95.multipoint = 0,96.dyn_fifo = 0,97.soft_con = 1,98.dma = 1,99.num_eps = 8,100.dma_channels = 8,101.gpio_vrsel = GPIO_PF11,102/* Some custom boards need to be active low, just set it to "0"103* if it is the case.104*/105.gpio_vrsel_active = 1,106.clkin = 24, /* musb CLKIN in MHZ */107};108109static struct musb_hdrc_platform_data musb_plat = {110#if defined(CONFIG_USB_MUSB_OTG)111.mode = MUSB_OTG,112#elif defined(CONFIG_USB_MUSB_HDRC_HCD)113.mode = MUSB_HOST,114#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)115.mode = MUSB_PERIPHERAL,116#endif117.config = &musb_config,118};119120static u64 musb_dmamask = ~(u32)0;121122static struct platform_device musb_device = {123.name = "musb-blackfin",124.id = 0,125.dev = {126.dma_mask = &musb_dmamask,127.coherent_dma_mask = 0xffffffff,128.platform_data = &musb_plat,129},130.num_resources = ARRAY_SIZE(musb_resources),131.resource = musb_resources,132};133#endif134135#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)136static struct mtd_partition partition_info[] = {137{138.name = "linux kernel(nand)",139.offset = 0,140.size = 4 * 1024 * 1024,141},142{143.name = "file system(nand)",144.offset = MTDPART_OFS_APPEND,145.size = MTDPART_SIZ_FULL,146},147};148149static struct bf5xx_nand_platform bf5xx_nand_platform = {150.data_width = NFC_NWIDTH_8,151.partitions = partition_info,152.nr_partitions = ARRAY_SIZE(partition_info),153.rd_dly = 3,154.wr_dly = 3,155};156157static struct resource bf5xx_nand_resources[] = {158{159.start = NFC_CTL,160.end = NFC_DATA_RD + 2,161.flags = IORESOURCE_MEM,162},163{164.start = CH_NFC,165.end = CH_NFC,166.flags = IORESOURCE_IRQ,167},168};169170static struct platform_device bf5xx_nand_device = {171.name = "bf5xx-nand",172.id = 0,173.num_resources = ARRAY_SIZE(bf5xx_nand_resources),174.resource = bf5xx_nand_resources,175.dev = {176.platform_data = &bf5xx_nand_platform,177},178};179#endif180181#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)182static struct resource bfin_pcmcia_cf_resources[] = {183{184.start = 0x20310000, /* IO PORT */185.end = 0x20312000,186.flags = IORESOURCE_MEM,187}, {188.start = 0x20311000, /* Attribute Memory */189.end = 0x20311FFF,190.flags = IORESOURCE_MEM,191}, {192.start = IRQ_PF4,193.end = IRQ_PF4,194.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,195}, {196.start = 6, /* Card Detect PF6 */197.end = 6,198.flags = IORESOURCE_IRQ,199},200};201202static struct platform_device bfin_pcmcia_cf_device = {203.name = "bfin_cf_pcmcia",204.id = -1,205.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),206.resource = bfin_pcmcia_cf_resources,207};208#endif209210#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)211static struct platform_device rtc_device = {212.name = "rtc-bfin",213.id = -1,214};215#endif216217#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)218#include <linux/smc91x.h>219220static struct smc91x_platdata smc91x_info = {221.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,222.leda = RPC_LED_100_10,223.ledb = RPC_LED_TX_RX,224};225226static struct resource smc91x_resources[] = {227{228.name = "smc91x-regs",229.start = 0x20300300,230.end = 0x20300300 + 16,231.flags = IORESOURCE_MEM,232}, {233234.start = IRQ_PF7,235.end = IRQ_PF7,236.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,237},238};239static struct platform_device smc91x_device = {240.name = "smc91x",241.id = 0,242.num_resources = ARRAY_SIZE(smc91x_resources),243.resource = smc91x_resources,244.dev = {245.platform_data = &smc91x_info,246},247};248#endif249250#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)251static struct resource dm9000_resources[] = {252[0] = {253.start = 0x203FB800,254.end = 0x203FB800 + 1,255.flags = IORESOURCE_MEM,256},257[1] = {258.start = 0x203FB804,259.end = 0x203FB804 + 1,260.flags = IORESOURCE_MEM,261},262[2] = {263.start = IRQ_PF9,264.end = IRQ_PF9,265.flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),266},267};268269static struct platform_device dm9000_device = {270.name = "dm9000",271.id = -1,272.num_resources = ARRAY_SIZE(dm9000_resources),273.resource = dm9000_resources,274};275#endif276277#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)278#include <linux/bfin_mac.h>279static const unsigned short bfin_mac_peripherals[] = P_RMII0;280281static struct bfin_phydev_platform_data bfin_phydev_data[] = {282{283.addr = 1,284.irq = IRQ_MAC_PHYINT,285},286};287288static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {289.phydev_number = 1,290.phydev_data = bfin_phydev_data,291.phy_mode = PHY_INTERFACE_MODE_RMII,292.mac_peripherals = bfin_mac_peripherals,293};294295static struct platform_device bfin_mii_bus = {296.name = "bfin_mii_bus",297.dev = {298.platform_data = &bfin_mii_bus_data,299}300};301302static struct platform_device bfin_mac_device = {303.name = "bfin_mac",304.dev = {305.platform_data = &bfin_mii_bus,306}307};308#endif309310#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)311static struct resource net2272_bfin_resources[] = {312{313.start = 0x20300000,314.end = 0x20300000 + 0x100,315.flags = IORESOURCE_MEM,316}, {317.start = IRQ_PF7,318.end = IRQ_PF7,319.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,320},321};322323static struct platform_device net2272_bfin_device = {324.name = "net2272",325.id = -1,326.num_resources = ARRAY_SIZE(net2272_bfin_resources),327.resource = net2272_bfin_resources,328};329#endif330331#if defined(CONFIG_MTD_M25P80) \332|| defined(CONFIG_MTD_M25P80_MODULE)333static struct mtd_partition bfin_spi_flash_partitions[] = {334{335.name = "bootloader(spi)",336.size = 0x00040000,337.offset = 0,338.mask_flags = MTD_CAP_ROM339}, {340.name = "linux kernel(spi)",341.size = MTDPART_SIZ_FULL,342.offset = MTDPART_OFS_APPEND,343}344};345346static struct flash_platform_data bfin_spi_flash_data = {347.name = "m25p80",348.parts = bfin_spi_flash_partitions,349.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),350.type = "m25p16",351};352353/* SPI flash chip (m25p64) */354static struct bfin5xx_spi_chip spi_flash_chip_info = {355.enable_dma = 0, /* use dma transfer with this chip*/356.bits_per_word = 8,357};358#endif359360#if defined(CONFIG_BFIN_SPI_ADC) \361|| defined(CONFIG_BFIN_SPI_ADC_MODULE)362/* SPI ADC chip */363static struct bfin5xx_spi_chip spi_adc_chip_info = {364.enable_dma = 1, /* use dma transfer with this chip*/365.bits_per_word = 16,366};367#endif368369#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \370|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)371static struct bfin5xx_spi_chip ad1836_spi_chip_info = {372.enable_dma = 0,373.bits_per_word = 16,374};375#endif376377#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)378static struct bfin5xx_spi_chip mmc_spi_chip_info = {379.enable_dma = 0,380.bits_per_word = 8,381};382#endif383384#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)385static struct bfin5xx_spi_chip spi_ad7877_chip_info = {386.enable_dma = 0,387.bits_per_word = 16,388};389390static const struct ad7877_platform_data bfin_ad7877_ts_info = {391.model = 7877,392.vref_delay_usecs = 50, /* internal, no capacitor */393.x_plate_ohms = 419,394.y_plate_ohms = 486,395.pressure_max = 1000,396.pressure_min = 0,397.stopacq_polarity = 1,398.first_conversion_delay = 3,399.acquisition_time = 1,400.averaging = 1,401.pen_down_acc_interval = 1,402};403#endif404405#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \406&& defined(CONFIG_SND_SOC_WM8731_SPI)407static struct bfin5xx_spi_chip spi_wm8731_chip_info = {408.enable_dma = 0,409.bits_per_word = 16,410};411#endif412413#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)414static struct bfin5xx_spi_chip spidev_chip_info = {415.enable_dma = 0,416.bits_per_word = 8,417};418#endif419420static struct spi_board_info bfin_spi_board_info[] __initdata = {421#if defined(CONFIG_MTD_M25P80) \422|| defined(CONFIG_MTD_M25P80_MODULE)423{424/* the modalias must be the same as spi device driver name */425.modalias = "m25p80", /* Name of spi_driver for this device */426.max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */427.bus_num = 0, /* Framework bus number */428.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/429.platform_data = &bfin_spi_flash_data,430.controller_data = &spi_flash_chip_info,431.mode = SPI_MODE_3,432},433#endif434435#if defined(CONFIG_BFIN_SPI_ADC) \436|| defined(CONFIG_BFIN_SPI_ADC_MODULE)437{438.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */439.max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */440.bus_num = 0, /* Framework bus number */441.chip_select = 1, /* Framework chip select. */442.platform_data = NULL, /* No spi_driver specific config */443.controller_data = &spi_adc_chip_info,444},445#endif446447#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \448|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)449{450.modalias = "ad183x",451.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */452.bus_num = 0,453.chip_select = 4,454.controller_data = &ad1836_spi_chip_info,455},456#endif457#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)458{459.modalias = "mmc_spi",460.max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */461.bus_num = 0,462.chip_select = 5,463.controller_data = &mmc_spi_chip_info,464.mode = SPI_MODE_3,465},466#endif467#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)468{469.modalias = "ad7877",470.platform_data = &bfin_ad7877_ts_info,471.irq = IRQ_PF8,472.max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */473.bus_num = 0,474.chip_select = 2,475.controller_data = &spi_ad7877_chip_info,476},477#endif478#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \479&& defined(CONFIG_SND_SOC_WM8731_SPI)480{481.modalias = "wm8731",482.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */483.bus_num = 0,484.chip_select = 5,485.controller_data = &spi_wm8731_chip_info,486.mode = SPI_MODE_0,487},488#endif489#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)490{491.modalias = "spidev",492.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */493.bus_num = 0,494.chip_select = 1,495.controller_data = &spidev_chip_info,496},497#endif498};499500#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)501/* SPI controller data */502static struct bfin5xx_spi_master bfin_spi0_info = {503.num_chipselect = 8,504.enable_dma = 1, /* master has the ability to do dma transfer */505.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},506};507508/* SPI (0) */509static struct resource bfin_spi0_resource[] = {510[0] = {511.start = SPI0_REGBASE,512.end = SPI0_REGBASE + 0xFF,513.flags = IORESOURCE_MEM,514},515[1] = {516.start = CH_SPI,517.end = CH_SPI,518.flags = IORESOURCE_DMA,519},520[2] = {521.start = IRQ_SPI,522.end = IRQ_SPI,523.flags = IORESOURCE_IRQ,524},525};526527static struct platform_device bfin_spi0_device = {528.name = "bfin-spi",529.id = 0, /* Bus number */530.num_resources = ARRAY_SIZE(bfin_spi0_resource),531.resource = bfin_spi0_resource,532.dev = {533.platform_data = &bfin_spi0_info, /* Passed to driver */534},535};536#endif /* spi master and devices */537538#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)539static struct mtd_partition cm_partitions[] = {540{541.name = "bootloader(nor)",542.size = 0x40000,543.offset = 0,544}, {545.name = "linux kernel(nor)",546.size = 0x100000,547.offset = MTDPART_OFS_APPEND,548}, {549.name = "file system(nor)",550.size = MTDPART_SIZ_FULL,551.offset = MTDPART_OFS_APPEND,552}553};554555static struct physmap_flash_data cm_flash_data = {556.width = 2,557.parts = cm_partitions,558.nr_parts = ARRAY_SIZE(cm_partitions),559};560561static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };562563static struct resource cm_flash_resource[] = {564{565.name = "cfi_probe",566.start = 0x20000000,567.end = 0x201fffff,568.flags = IORESOURCE_MEM,569}, {570.start = (unsigned long)cm_flash_gpios,571.end = ARRAY_SIZE(cm_flash_gpios),572.flags = IORESOURCE_IRQ,573}574};575576static struct platform_device cm_flash_device = {577.name = "gpio-addr-flash",578.id = 0,579.dev = {580.platform_data = &cm_flash_data,581},582.num_resources = ARRAY_SIZE(cm_flash_resource),583.resource = cm_flash_resource,584};585#endif586587#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)588#ifdef CONFIG_SERIAL_BFIN_UART0589static struct resource bfin_uart0_resources[] = {590{591.start = UART0_THR,592.end = UART0_GCTL+2,593.flags = IORESOURCE_MEM,594},595{596.start = IRQ_UART0_RX,597.end = IRQ_UART0_RX+1,598.flags = IORESOURCE_IRQ,599},600{601.start = IRQ_UART0_ERROR,602.end = IRQ_UART0_ERROR,603.flags = IORESOURCE_IRQ,604},605{606.start = CH_UART0_TX,607.end = CH_UART0_TX,608.flags = IORESOURCE_DMA,609},610{611.start = CH_UART0_RX,612.end = CH_UART0_RX,613.flags = IORESOURCE_DMA,614},615};616617static unsigned short bfin_uart0_peripherals[] = {618P_UART0_TX, P_UART0_RX, 0619};620621static struct platform_device bfin_uart0_device = {622.name = "bfin-uart",623.id = 0,624.num_resources = ARRAY_SIZE(bfin_uart0_resources),625.resource = bfin_uart0_resources,626.dev = {627.platform_data = &bfin_uart0_peripherals, /* Passed to driver */628},629};630#endif631#ifdef CONFIG_SERIAL_BFIN_UART1632static struct resource bfin_uart1_resources[] = {633{634.start = UART1_THR,635.end = UART1_GCTL+2,636.flags = IORESOURCE_MEM,637},638{639.start = IRQ_UART1_RX,640.end = IRQ_UART1_RX+1,641.flags = IORESOURCE_IRQ,642},643{644.start = IRQ_UART1_ERROR,645.end = IRQ_UART1_ERROR,646.flags = IORESOURCE_IRQ,647},648{649.start = CH_UART1_TX,650.end = CH_UART1_TX,651.flags = IORESOURCE_DMA,652},653{654.start = CH_UART1_RX,655.end = CH_UART1_RX,656.flags = IORESOURCE_DMA,657},658#ifdef CONFIG_BFIN_UART1_CTSRTS659{ /* CTS pin */660.start = GPIO_PF9,661.end = GPIO_PF9,662.flags = IORESOURCE_IO,663},664{ /* RTS pin */665.start = GPIO_PF10,666.end = GPIO_PF10,667.flags = IORESOURCE_IO,668},669#endif670};671672static unsigned short bfin_uart1_peripherals[] = {673P_UART1_TX, P_UART1_RX, 0674};675676static struct platform_device bfin_uart1_device = {677.name = "bfin-uart",678.id = 1,679.num_resources = ARRAY_SIZE(bfin_uart1_resources),680.resource = bfin_uart1_resources,681.dev = {682.platform_data = &bfin_uart1_peripherals, /* Passed to driver */683},684};685#endif686#endif687688#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)689#ifdef CONFIG_BFIN_SIR0690static struct resource bfin_sir0_resources[] = {691{692.start = 0xFFC00400,693.end = 0xFFC004FF,694.flags = IORESOURCE_MEM,695},696{697.start = IRQ_UART0_RX,698.end = IRQ_UART0_RX+1,699.flags = IORESOURCE_IRQ,700},701{702.start = CH_UART0_RX,703.end = CH_UART0_RX+1,704.flags = IORESOURCE_DMA,705},706};707708static struct platform_device bfin_sir0_device = {709.name = "bfin_sir",710.id = 0,711.num_resources = ARRAY_SIZE(bfin_sir0_resources),712.resource = bfin_sir0_resources,713};714#endif715#ifdef CONFIG_BFIN_SIR1716static struct resource bfin_sir1_resources[] = {717{718.start = 0xFFC02000,719.end = 0xFFC020FF,720.flags = IORESOURCE_MEM,721},722{723.start = IRQ_UART1_RX,724.end = IRQ_UART1_RX+1,725.flags = IORESOURCE_IRQ,726},727{728.start = CH_UART1_RX,729.end = CH_UART1_RX+1,730.flags = IORESOURCE_DMA,731},732};733734static struct platform_device bfin_sir1_device = {735.name = "bfin_sir",736.id = 1,737.num_resources = ARRAY_SIZE(bfin_sir1_resources),738.resource = bfin_sir1_resources,739};740#endif741#endif742743#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)744static struct resource bfin_twi0_resource[] = {745[0] = {746.start = TWI0_REGBASE,747.end = TWI0_REGBASE,748.flags = IORESOURCE_MEM,749},750[1] = {751.start = IRQ_TWI,752.end = IRQ_TWI,753.flags = IORESOURCE_IRQ,754},755};756757static struct platform_device i2c_bfin_twi_device = {758.name = "i2c-bfin-twi",759.id = 0,760.num_resources = ARRAY_SIZE(bfin_twi0_resource),761.resource = bfin_twi0_resource,762};763#endif764765static struct i2c_board_info __initdata bfin_i2c_board_info[] = {766#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)767{768I2C_BOARD_INFO("pcf8574_lcd", 0x22),769},770#endif771#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)772{773I2C_BOARD_INFO("pcf8574_keypad", 0x27),774.irq = IRQ_PF8,775},776#endif777#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)778{779I2C_BOARD_INFO("bfin-adv7393", 0x2B),780},781#endif782};783784#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)785#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART786static struct resource bfin_sport0_uart_resources[] = {787{788.start = SPORT0_TCR1,789.end = SPORT0_MRCS3+4,790.flags = IORESOURCE_MEM,791},792{793.start = IRQ_SPORT0_RX,794.end = IRQ_SPORT0_RX+1,795.flags = IORESOURCE_IRQ,796},797{798.start = IRQ_SPORT0_ERROR,799.end = IRQ_SPORT0_ERROR,800.flags = IORESOURCE_IRQ,801},802};803804static unsigned short bfin_sport0_peripherals[] = {805P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,806P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0807};808809static struct platform_device bfin_sport0_uart_device = {810.name = "bfin-sport-uart",811.id = 0,812.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),813.resource = bfin_sport0_uart_resources,814.dev = {815.platform_data = &bfin_sport0_peripherals, /* Passed to driver */816},817};818#endif819#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART820static struct resource bfin_sport1_uart_resources[] = {821{822.start = SPORT1_TCR1,823.end = SPORT1_MRCS3+4,824.flags = IORESOURCE_MEM,825},826{827.start = IRQ_SPORT1_RX,828.end = IRQ_SPORT1_RX+1,829.flags = IORESOURCE_IRQ,830},831{832.start = IRQ_SPORT1_ERROR,833.end = IRQ_SPORT1_ERROR,834.flags = IORESOURCE_IRQ,835},836};837838static unsigned short bfin_sport1_peripherals[] = {839P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,840P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0841};842843static struct platform_device bfin_sport1_uart_device = {844.name = "bfin-sport-uart",845.id = 1,846.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),847.resource = bfin_sport1_uart_resources,848.dev = {849.platform_data = &bfin_sport1_peripherals, /* Passed to driver */850},851};852#endif853#endif854855#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)856#include <linux/input.h>857#include <linux/gpio_keys.h>858859static struct gpio_keys_button bfin_gpio_keys_table[] = {860{BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},861};862863static struct gpio_keys_platform_data bfin_gpio_keys_data = {864.buttons = bfin_gpio_keys_table,865.nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),866};867868static struct platform_device bfin_device_gpiokeys = {869.name = "gpio-keys",870.dev = {871.platform_data = &bfin_gpio_keys_data,872},873};874#endif875876static const unsigned int cclk_vlev_datasheet[] =877{878VRPAIR(VLEV_100, 400000000),879VRPAIR(VLEV_105, 426000000),880VRPAIR(VLEV_110, 500000000),881VRPAIR(VLEV_115, 533000000),882VRPAIR(VLEV_120, 600000000),883};884885static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {886.tuple_tab = cclk_vlev_datasheet,887.tabsize = ARRAY_SIZE(cclk_vlev_datasheet),888.vr_settling_time = 25 /* us */,889};890891static struct platform_device bfin_dpmc = {892.name = "bfin dpmc",893.dev = {894.platform_data = &bfin_dmpc_vreg_data,895},896};897898static struct platform_device *cmbf527_devices[] __initdata = {899900&bfin_dpmc,901902#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)903&bf5xx_nand_device,904#endif905906#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)907&bfin_pcmcia_cf_device,908#endif909910#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)911&rtc_device,912#endif913914#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)915&bfin_isp1760_device,916#endif917918#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)919&musb_device,920#endif921922#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)923&smc91x_device,924#endif925926#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)927&dm9000_device,928#endif929930#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)931&bfin_mii_bus,932&bfin_mac_device,933#endif934935#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)936&net2272_bfin_device,937#endif938939#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)940&bfin_spi0_device,941#endif942943#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)944#ifdef CONFIG_SERIAL_BFIN_UART0945&bfin_uart0_device,946#endif947#ifdef CONFIG_SERIAL_BFIN_UART1948&bfin_uart1_device,949#endif950#endif951952#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)953#ifdef CONFIG_BFIN_SIR0954&bfin_sir0_device,955#endif956#ifdef CONFIG_BFIN_SIR1957&bfin_sir1_device,958#endif959#endif960961#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)962&i2c_bfin_twi_device,963#endif964965#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)966#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART967&bfin_sport0_uart_device,968#endif969#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART970&bfin_sport1_uart_device,971#endif972#endif973974#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)975&bfin_device_gpiokeys,976#endif977978#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)979&cm_flash_device,980#endif981};982983static int __init cm_init(void)984{985printk(KERN_INFO "%s(): registering device resources\n", __func__);986i2c_register_board_info(0, bfin_i2c_board_info,987ARRAY_SIZE(bfin_i2c_board_info));988platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));989spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));990return 0;991}992993arch_initcall(cm_init);994995static struct platform_device *cmbf527_early_devices[] __initdata = {996#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)997#ifdef CONFIG_SERIAL_BFIN_UART0998&bfin_uart0_device,999#endif1000#ifdef CONFIG_SERIAL_BFIN_UART11001&bfin_uart1_device,1002#endif1003#endif10041005#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)1006#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1007&bfin_sport0_uart_device,1008#endif1009#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1010&bfin_sport1_uart_device,1011#endif1012#endif1013};10141015void __init native_machine_early_platform_add_devices(void)1016{1017printk(KERN_INFO "register early platform devices\n");1018early_platform_add_devices(cmbf527_early_devices,1019ARRAY_SIZE(cmbf527_early_devices));1020}10211022void native_machine_restart(char *cmd)1023{1024/* workaround reboot hang when booting from SPI */1025if ((bfin_read_SYSCR() & 0x7) == 0x3)1026bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);1027}10281029void bfin_get_ether_addr(char *addr)1030{1031random_ether_addr(addr);1032printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);1033}1034EXPORT_SYMBOL(bfin_get_ether_addr);103510361037