Path: blob/master/arch/blackfin/mach-bf527/boards/tll6527m.c
15112 views
/* File: arch/blackfin/mach-bf527/boards/tll6527m.c1* Based on: arch/blackfin/mach-bf527/boards/ezkit.c2* Author: Ashish Gupta3*4* Copyright: 2010 - The Learning Labs Inc.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/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>22#include <asm/dma.h>23#include <asm/bfin5xx_spi.h>24#include <asm/reboot.h>25#include <asm/nand.h>26#include <asm/portmux.h>27#include <asm/dpmc.h>2829#if defined(CONFIG_TOUCHSCREEN_AD7879) \30|| defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)31#include <linux/spi/ad7879.h>32#define LCD_BACKLIGHT_GPIO 0x4033/* TLL6527M uses TLL7UIQ35 / ADI LCD EZ Extender. AD7879 AUX GPIO is used for34* LCD Backlight Enable35*/36#endif3738/*39* Name the Board for the /proc/cpuinfo40*/41const char bfin_board_name[] = "TLL6527M";42/*43* Driver needs to know address, irq and flag pin.44*/4546#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)47static struct resource musb_resources[] = {48[0] = {49.start = 0xffc03800,50.end = 0xffc03cff,51.flags = IORESOURCE_MEM,52},53[1] = { /* general IRQ */54.start = IRQ_USB_INT0,55.end = IRQ_USB_INT0,56.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,57},58[2] = { /* DMA IRQ */59.start = IRQ_USB_DMA,60.end = IRQ_USB_DMA,61.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,62},63};6465static struct musb_hdrc_config musb_config = {66.multipoint = 0,67.dyn_fifo = 0,68.soft_con = 1,69.dma = 1,70.num_eps = 8,71.dma_channels = 8,72/*.gpio_vrsel = GPIO_PG13,*/73/* Some custom boards need to be active low, just set it to "0"74* if it is the case.75*/76.gpio_vrsel_active = 1,77};7879static struct musb_hdrc_platform_data musb_plat = {80#if defined(CONFIG_USB_MUSB_OTG)81.mode = MUSB_OTG,82#elif defined(CONFIG_USB_MUSB_HDRC_HCD)83.mode = MUSB_HOST,84#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)85.mode = MUSB_PERIPHERAL,86#endif87.config = &musb_config,88};8990static u64 musb_dmamask = ~(u32)0;9192static struct platform_device musb_device = {93.name = "musb-blackfin",94.id = 0,95.dev = {96.dma_mask = &musb_dmamask,97.coherent_dma_mask = 0xffffffff,98.platform_data = &musb_plat,99},100.num_resources = ARRAY_SIZE(musb_resources),101.resource = musb_resources,102};103#endif104105#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)106#include <asm/bfin-lq035q1.h>107108static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {109.mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,110.ppi_mode = USE_RGB565_16_BIT_PPI,111.use_bl = 1,112.gpio_bl = LCD_BACKLIGHT_GPIO,113};114115static struct resource bfin_lq035q1_resources[] = {116{117.start = IRQ_PPI_ERROR,118.end = IRQ_PPI_ERROR,119.flags = IORESOURCE_IRQ,120},121};122123static struct platform_device bfin_lq035q1_device = {124.name = "bfin-lq035q1",125.id = -1,126.num_resources = ARRAY_SIZE(bfin_lq035q1_resources),127.resource = bfin_lq035q1_resources,128.dev = {129.platform_data = &bfin_lq035q1_data,130},131};132#endif133134#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)135static struct mtd_partition tll6527m_partitions[] = {136{137.name = "bootloader(nor)",138.size = 0xA0000,139.offset = 0,140}, {141.name = "linux kernel(nor)",142.size = 0xD00000,143.offset = MTDPART_OFS_APPEND,144}, {145.name = "file system(nor)",146.size = MTDPART_SIZ_FULL,147.offset = MTDPART_OFS_APPEND,148}149};150151static struct physmap_flash_data tll6527m_flash_data = {152.width = 2,153.parts = tll6527m_partitions,154.nr_parts = ARRAY_SIZE(tll6527m_partitions),155};156157static unsigned tll6527m_flash_gpios[] = { GPIO_PG11, GPIO_PH11, GPIO_PH12 };158159static struct resource tll6527m_flash_resource[] = {160{161.name = "cfi_probe",162.start = 0x20000000,163.end = 0x201fffff,164.flags = IORESOURCE_MEM,165}, {166.start = (unsigned long)tll6527m_flash_gpios,167.end = ARRAY_SIZE(tll6527m_flash_gpios),168.flags = IORESOURCE_IRQ,169}170};171172static struct platform_device tll6527m_flash_device = {173.name = "gpio-addr-flash",174.id = 0,175.dev = {176.platform_data = &tll6527m_flash_data,177},178.num_resources = ARRAY_SIZE(tll6527m_flash_resource),179.resource = tll6527m_flash_resource,180};181#endif182183#if defined(CONFIG_GPIO_DECODER) || defined(CONFIG_GPIO_DECODER_MODULE)184/* An SN74LVC138A 3:8 decoder chip has been used to generate 7 augmented185* outputs used as SPI CS lines for all SPI SLAVE devices on TLL6527v1-0.186* EXP_GPIO_SPISEL_BASE is the base number for the expanded outputs being187* used as SPI CS lines, this should be > MAX_BLACKFIN_GPIOS188*/189#include <linux/gpio-decoder.h>190#define EXP_GPIO_SPISEL_BASE 0x64191static unsigned gpio_addr_inputs[] = {192GPIO_PG1, GPIO_PH9, GPIO_PH10193};194195static struct gpio_decoder_platform_data spi_decoded_cs = {196.base = EXP_GPIO_SPISEL_BASE,197.input_addrs = gpio_addr_inputs,198.nr_input_addrs = ARRAY_SIZE(gpio_addr_inputs),199.default_output = 0,200/* .default_output = (1 << ARRAY_SIZE(gpio_addr_inputs)) - 1 */201};202203static struct platform_device spi_decoded_gpio = {204.name = "gpio-decoder",205.id = 0,206.dev = {207.platform_data = &spi_decoded_cs,208},209};210211#else212#define EXP_GPIO_SPISEL_BASE 0x0213214#endif215216#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)217#include <linux/input/adxl34x.h>218static const struct adxl34x_platform_data adxl345_info = {219.x_axis_offset = 0,220.y_axis_offset = 0,221.z_axis_offset = 0,222.tap_threshold = 0x31,223.tap_duration = 0x10,224.tap_latency = 0x60,225.tap_window = 0xF0,226.tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,227.act_axis_control = 0xFF,228.activity_threshold = 5,229.inactivity_threshold = 2,230.inactivity_time = 2,231.free_fall_threshold = 0x7,232.free_fall_time = 0x20,233.data_rate = 0x8,234.data_range = ADXL_FULL_RES,235236.ev_type = EV_ABS,237.ev_code_x = ABS_X, /* EV_REL */238.ev_code_y = ABS_Y, /* EV_REL */239.ev_code_z = ABS_Z, /* EV_REL */240241.ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */242243/* .ev_code_ff = KEY_F,*/ /* EV_KEY */244.ev_code_act_inactivity = KEY_A, /* EV_KEY */245.use_int2 = 1,246.power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,247.fifo_mode = ADXL_FIFO_STREAM,248};249#endif250251#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)252static struct platform_device rtc_device = {253.name = "rtc-bfin",254.id = -1,255};256#endif257258#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)259#include <linux/bfin_mac.h>260static const unsigned short bfin_mac_peripherals[] = P_RMII0;261262static struct bfin_phydev_platform_data bfin_phydev_data[] = {263{264.addr = 1,265.irq = IRQ_MAC_PHYINT,266},267};268269static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {270.phydev_number = 1,271.phydev_data = bfin_phydev_data,272.phy_mode = PHY_INTERFACE_MODE_RMII,273.mac_peripherals = bfin_mac_peripherals,274};275276static struct platform_device bfin_mii_bus = {277.name = "bfin_mii_bus",278.dev = {279.platform_data = &bfin_mii_bus_data,280}281};282283static struct platform_device bfin_mac_device = {284.name = "bfin_mac",285.dev = {286.platform_data = &bfin_mii_bus,287}288};289#endif290291#if defined(CONFIG_MTD_M25P80) \292|| defined(CONFIG_MTD_M25P80_MODULE)293static struct mtd_partition bfin_spi_flash_partitions[] = {294{295.name = "bootloader(spi)",296.size = 0x00040000,297.offset = 0,298.mask_flags = MTD_CAP_ROM299}, {300.name = "linux kernel(spi)",301.size = MTDPART_SIZ_FULL,302.offset = MTDPART_OFS_APPEND,303}304};305306static struct flash_platform_data bfin_spi_flash_data = {307.name = "m25p80",308.parts = bfin_spi_flash_partitions,309.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),310.type = "m25p16",311};312313/* SPI flash chip (m25p64) */314static struct bfin5xx_spi_chip spi_flash_chip_info = {315.enable_dma = 0, /* use dma transfer with this chip*/316.bits_per_word = 8,317};318#endif319320#if defined(CONFIG_BFIN_SPI_ADC) \321|| defined(CONFIG_BFIN_SPI_ADC_MODULE)322/* SPI ADC chip */323static struct bfin5xx_spi_chip spi_adc_chip_info = {324.enable_dma = 0, /* use dma transfer with this chip*/325/*326* tll6527m V1.0 does not support native spi slave selects327* hence DMA mode will not be useful since the ADC needs328* CS to toggle for each sample and cs_change_per_word329* seems to be removed from spi_bfin5xx.c330*/331.bits_per_word = 16,332};333#endif334335#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)336static struct bfin5xx_spi_chip mmc_spi_chip_info = {337.enable_dma = 0,338.bits_per_word = 8,339};340#endif341342#if defined(CONFIG_TOUCHSCREEN_AD7879) \343|| defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)344static const struct ad7879_platform_data bfin_ad7879_ts_info = {345.model = 7879, /* Model = AD7879 */346.x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */347.pressure_max = 10000,348.pressure_min = 0,349.first_conversion_delay = 3,350/* wait 512us before do a first conversion */351.acquisition_time = 1, /* 4us acquisition time per sample */352.median = 2, /* do 8 measurements */353.averaging = 1,354/* take the average of 4 middle samples */355.pen_down_acc_interval = 255, /* 9.4 ms */356.gpio_export = 1, /* configure AUX as GPIO output*/357.gpio_base = LCD_BACKLIGHT_GPIO,358};359#endif360361#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) \362|| defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)363static struct bfin5xx_spi_chip spi_ad7879_chip_info = {364.enable_dma = 0,365.bits_per_word = 16,366};367#endif368369#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)370static struct bfin5xx_spi_chip spidev_chip_info = {371.enable_dma = 0,372.bits_per_word = 8,373};374#endif375376#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)377static struct platform_device bfin_i2s = {378.name = "bfin-i2s",379.id = CONFIG_SND_BF5XX_SPORT_NUM,380/* TODO: add platform data here */381};382#endif383384#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)385static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {386.enable_dma = 0,387.bits_per_word = 8,388};389#endif390391#if defined(CONFIG_GPIO_MCP23S08) || defined(CONFIG_GPIO_MCP23S08_MODULE)392static struct bfin5xx_spi_chip spi_mcp23s08_sys_chip_info = {393.enable_dma = 0,394.bits_per_word = 8,395};396397static struct bfin5xx_spi_chip spi_mcp23s08_usr_chip_info = {398.enable_dma = 0,399.bits_per_word = 8,400};401402#include <linux/spi/mcp23s08.h>403static const struct mcp23s08_platform_data bfin_mcp23s08_sys_gpio_info = {404.chip[0].is_present = true,405.base = 0x30,406};407static const struct mcp23s08_platform_data bfin_mcp23s08_usr_gpio_info = {408.chip[2].is_present = true,409.base = 0x38,410};411#endif412413static struct spi_board_info bfin_spi_board_info[] __initdata = {414#if defined(CONFIG_MTD_M25P80) \415|| defined(CONFIG_MTD_M25P80_MODULE)416{417/* the modalias must be the same as spi device driver name */418.modalias = "m25p80", /* Name of spi_driver for this device */419.max_speed_hz = 25000000,420/* max spi clock (SCK) speed in HZ */421.bus_num = 0, /* Framework bus number */422.chip_select = EXP_GPIO_SPISEL_BASE + 0x04 + MAX_CTRL_CS,423/* Can be connected to TLL6527M GPIO connector */424/* Either SPI_ADC or M25P80 FLASH can be installed at a time */425.platform_data = &bfin_spi_flash_data,426.controller_data = &spi_flash_chip_info,427.mode = SPI_MODE_3,428},429#endif430431#if defined(CONFIG_BFIN_SPI_ADC)432|| defined(CONFIG_BFIN_SPI_ADC_MODULE)433{434.modalias = "bfin_spi_adc",435/* Name of spi_driver for this device */436.max_speed_hz = 10000000,437/* max spi clock (SCK) speed in HZ */438.bus_num = 0, /* Framework bus number */439.chip_select = EXP_GPIO_SPISEL_BASE + 0x04 + MAX_CTRL_CS,440/* Framework chip select. */441.platform_data = NULL, /* No spi_driver specific config */442.controller_data = &spi_adc_chip_info,443.mode = SPI_MODE_0,444},445#endif446447#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)448{449.modalias = "mmc_spi",450/*451* TLL6527M V1.0 does not support SD Card at SPI Clock > 10 MHz due to452* SPI buffer limitations453*/454.max_speed_hz = 10000000,455/* max spi clock (SCK) speed in HZ */456.bus_num = 0,457.chip_select = EXP_GPIO_SPISEL_BASE + 0x05 + MAX_CTRL_CS,458.controller_data = &mmc_spi_chip_info,459.mode = SPI_MODE_0,460},461#endif462#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) \463|| defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)464{465.modalias = "ad7879",466.platform_data = &bfin_ad7879_ts_info,467.irq = IRQ_PH14,468.max_speed_hz = 5000000,469/* max spi clock (SCK) speed in HZ */470.bus_num = 0,471.chip_select = EXP_GPIO_SPISEL_BASE + 0x07 + MAX_CTRL_CS,472.controller_data = &spi_ad7879_chip_info,473.mode = SPI_CPHA | SPI_CPOL,474},475#endif476#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)477{478.modalias = "spidev",479.max_speed_hz = 10000000,480/* TLL6527Mv1-0 supports max spi clock (SCK) speed = 10 MHz */481.bus_num = 0,482.chip_select = EXP_GPIO_SPISEL_BASE + 0x03 + MAX_CTRL_CS,483.mode = SPI_CPHA | SPI_CPOL,484.controller_data = &spidev_chip_info,485},486#endif487#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)488{489.modalias = "bfin-lq035q1-spi",490.max_speed_hz = 20000000,491.bus_num = 0,492.chip_select = EXP_GPIO_SPISEL_BASE + 0x06 + MAX_CTRL_CS,493.controller_data = &lq035q1_spi_chip_info,494.mode = SPI_CPHA | SPI_CPOL,495},496#endif497#if defined(CONFIG_GPIO_MCP23S08) || defined(CONFIG_GPIO_MCP23S08_MODULE)498{499.modalias = "mcp23s08",500.platform_data = &bfin_mcp23s08_sys_gpio_info,501.max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */502.bus_num = 0,503.chip_select = EXP_GPIO_SPISEL_BASE + 0x01 + MAX_CTRL_CS,504.controller_data = &spi_mcp23s08_sys_chip_info,505.mode = SPI_CPHA | SPI_CPOL,506},507{508.modalias = "mcp23s08",509.platform_data = &bfin_mcp23s08_usr_gpio_info,510.max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */511.bus_num = 0,512.chip_select = EXP_GPIO_SPISEL_BASE + 0x02 + MAX_CTRL_CS,513.controller_data = &spi_mcp23s08_usr_chip_info,514.mode = SPI_CPHA | SPI_CPOL,515},516#endif517};518519#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)520/* SPI controller data */521static struct bfin5xx_spi_master bfin_spi0_info = {522.num_chipselect = EXP_GPIO_SPISEL_BASE + 8 + MAX_CTRL_CS,523/* EXP_GPIO_SPISEL_BASE will be > MAX_BLACKFIN_GPIOS */524.enable_dma = 1, /* master has the ability to do dma transfer */525.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},526};527528/* SPI (0) */529static struct resource bfin_spi0_resource[] = {530[0] = {531.start = SPI0_REGBASE,532.end = SPI0_REGBASE + 0xFF,533.flags = IORESOURCE_MEM,534},535[1] = {536.start = CH_SPI,537.end = CH_SPI,538.flags = IORESOURCE_DMA,539},540[2] = {541.start = IRQ_SPI,542.end = IRQ_SPI,543.flags = IORESOURCE_IRQ,544},545};546547static struct platform_device bfin_spi0_device = {548.name = "bfin-spi",549.id = 0, /* Bus number */550.num_resources = ARRAY_SIZE(bfin_spi0_resource),551.resource = bfin_spi0_resource,552.dev = {553.platform_data = &bfin_spi0_info, /* Passed to driver */554},555};556#endif /* spi master and devices */557558#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)559#ifdef CONFIG_SERIAL_BFIN_UART0560static struct resource bfin_uart0_resources[] = {561{562.start = UART0_THR,563.end = UART0_GCTL+2,564.flags = IORESOURCE_MEM,565},566{567.start = IRQ_UART0_RX,568.end = IRQ_UART0_RX+1,569.flags = IORESOURCE_IRQ,570},571{572.start = IRQ_UART0_ERROR,573.end = IRQ_UART0_ERROR,574.flags = IORESOURCE_IRQ,575},576{577.start = CH_UART0_TX,578.end = CH_UART0_TX,579.flags = IORESOURCE_DMA,580},581{582.start = CH_UART0_RX,583.end = CH_UART0_RX,584.flags = IORESOURCE_DMA,585},586};587588static unsigned short bfin_uart0_peripherals[] = {589P_UART0_TX, P_UART0_RX, 0590};591592static struct platform_device bfin_uart0_device = {593.name = "bfin-uart",594.id = 0,595.num_resources = ARRAY_SIZE(bfin_uart0_resources),596.resource = bfin_uart0_resources,597.dev = {598.platform_data = &bfin_uart0_peripherals,599/* Passed to driver */600},601};602#endif603#ifdef CONFIG_SERIAL_BFIN_UART1604static struct resource bfin_uart1_resources[] = {605{606.start = UART1_THR,607.end = UART1_GCTL+2,608.flags = IORESOURCE_MEM,609},610{611.start = IRQ_UART1_RX,612.end = IRQ_UART1_RX+1,613.flags = IORESOURCE_IRQ,614},615{616.start = IRQ_UART1_ERROR,617.end = IRQ_UART1_ERROR,618.flags = IORESOURCE_IRQ,619},620{621.start = CH_UART1_TX,622.end = CH_UART1_TX,623.flags = IORESOURCE_DMA,624},625{626.start = CH_UART1_RX,627.end = CH_UART1_RX,628.flags = IORESOURCE_DMA,629},630#ifdef CONFIG_BFIN_UART1_CTSRTS631{ /* CTS pin */632.start = GPIO_PF9,633.end = GPIO_PF9,634.flags = IORESOURCE_IO,635},636{ /* RTS pin */637.start = GPIO_PF10,638.end = GPIO_PF10,639.flags = IORESOURCE_IO,640},641#endif642};643644static unsigned short bfin_uart1_peripherals[] = {645P_UART1_TX, P_UART1_RX, 0646};647648static struct platform_device bfin_uart1_device = {649.name = "bfin-uart",650.id = 1,651.num_resources = ARRAY_SIZE(bfin_uart1_resources),652.resource = bfin_uart1_resources,653.dev = {654.platform_data = &bfin_uart1_peripherals,655/* Passed to driver */656},657};658#endif659#endif660661#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)662#ifdef CONFIG_BFIN_SIR0663static struct resource bfin_sir0_resources[] = {664{665.start = 0xFFC00400,666.end = 0xFFC004FF,667.flags = IORESOURCE_MEM,668},669{670.start = IRQ_UART0_RX,671.end = IRQ_UART0_RX+1,672.flags = IORESOURCE_IRQ,673},674{675.start = CH_UART0_RX,676.end = CH_UART0_RX+1,677.flags = IORESOURCE_DMA,678},679};680681static struct platform_device bfin_sir0_device = {682.name = "bfin_sir",683.id = 0,684.num_resources = ARRAY_SIZE(bfin_sir0_resources),685.resource = bfin_sir0_resources,686};687#endif688#ifdef CONFIG_BFIN_SIR1689static struct resource bfin_sir1_resources[] = {690{691.start = 0xFFC02000,692.end = 0xFFC020FF,693.flags = IORESOURCE_MEM,694},695{696.start = IRQ_UART1_RX,697.end = IRQ_UART1_RX+1,698.flags = IORESOURCE_IRQ,699},700{701.start = CH_UART1_RX,702.end = CH_UART1_RX+1,703.flags = IORESOURCE_DMA,704},705};706707static struct platform_device bfin_sir1_device = {708.name = "bfin_sir",709.id = 1,710.num_resources = ARRAY_SIZE(bfin_sir1_resources),711.resource = bfin_sir1_resources,712};713#endif714#endif715716#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)717static struct resource bfin_twi0_resource[] = {718[0] = {719.start = TWI0_REGBASE,720.end = TWI0_REGBASE,721.flags = IORESOURCE_MEM,722},723[1] = {724.start = IRQ_TWI,725.end = IRQ_TWI,726.flags = IORESOURCE_IRQ,727},728};729730static struct platform_device i2c_bfin_twi_device = {731.name = "i2c-bfin-twi",732.id = 0,733.num_resources = ARRAY_SIZE(bfin_twi0_resource),734.resource = bfin_twi0_resource,735};736#endif737738static struct i2c_board_info __initdata bfin_i2c_board_info[] = {739#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)740{741I2C_BOARD_INFO("pcf8574_lcd", 0x22),742},743#endif744745#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)746{747I2C_BOARD_INFO("bfin-adv7393", 0x2B),748},749#endif750#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) \751|| defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)752{753I2C_BOARD_INFO("ad7879", 0x2C),754.irq = IRQ_PH14,755.platform_data = (void *)&bfin_ad7879_ts_info,756},757#endif758#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)759{760I2C_BOARD_INFO("ssm2602", 0x1b),761},762#endif763{764I2C_BOARD_INFO("adm1192", 0x2e),765},766767{768I2C_BOARD_INFO("ltc3576", 0x09),769},770#if defined(CONFIG_INPUT_ADXL34X_I2C) \771|| defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)772{773I2C_BOARD_INFO("adxl34x", 0x53),774.irq = IRQ_PH13,775.platform_data = (void *)&adxl345_info,776},777#endif778};779780#if defined(CONFIG_SERIAL_BFIN_SPORT) \781|| defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)782#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART783static struct resource bfin_sport0_uart_resources[] = {784{785.start = SPORT0_TCR1,786.end = SPORT0_MRCS3+4,787.flags = IORESOURCE_MEM,788},789{790.start = IRQ_SPORT0_RX,791.end = IRQ_SPORT0_RX+1,792.flags = IORESOURCE_IRQ,793},794{795.start = IRQ_SPORT0_ERROR,796.end = IRQ_SPORT0_ERROR,797.flags = IORESOURCE_IRQ,798},799};800801static unsigned short bfin_sport0_peripherals[] = {802P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,803P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0804};805806static struct platform_device bfin_sport0_uart_device = {807.name = "bfin-sport-uart",808.id = 0,809.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),810.resource = bfin_sport0_uart_resources,811.dev = {812.platform_data = &bfin_sport0_peripherals,813/* Passed to driver */814},815};816#endif817#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART818static struct resource bfin_sport1_uart_resources[] = {819{820.start = SPORT1_TCR1,821.end = SPORT1_MRCS3+4,822.flags = IORESOURCE_MEM,823},824{825.start = IRQ_SPORT1_RX,826.end = IRQ_SPORT1_RX+1,827.flags = IORESOURCE_IRQ,828},829{830.start = IRQ_SPORT1_ERROR,831.end = IRQ_SPORT1_ERROR,832.flags = IORESOURCE_IRQ,833},834};835836static unsigned short bfin_sport1_peripherals[] = {837P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,838P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0839};840841static struct platform_device bfin_sport1_uart_device = {842.name = "bfin-sport-uart",843.id = 1,844.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),845.resource = bfin_sport1_uart_resources,846.dev = {847.platform_data = &bfin_sport1_peripherals,848/* Passed to driver */849},850};851#endif852#endif853854static const unsigned int cclk_vlev_datasheet[] = {855VRPAIR(VLEV_100, 400000000),856VRPAIR(VLEV_105, 426000000),857VRPAIR(VLEV_110, 500000000),858VRPAIR(VLEV_115, 533000000),859VRPAIR(VLEV_120, 600000000),860};861862static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {863.tuple_tab = cclk_vlev_datasheet,864.tabsize = ARRAY_SIZE(cclk_vlev_datasheet),865.vr_settling_time = 25 /* us */,866};867868static struct platform_device bfin_dpmc = {869.name = "bfin dpmc",870.dev = {871.platform_data = &bfin_dmpc_vreg_data,872},873};874875static struct platform_device *tll6527m_devices[] __initdata = {876877&bfin_dpmc,878879#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)880&rtc_device,881#endif882883#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)884&musb_device,885#endif886887#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)888&bfin_mii_bus,889&bfin_mac_device,890#endif891892#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)893&bfin_spi0_device,894#endif895896#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)897&bfin_lq035q1_device,898#endif899900#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)901#ifdef CONFIG_SERIAL_BFIN_UART0902&bfin_uart0_device,903#endif904#ifdef CONFIG_SERIAL_BFIN_UART1905&bfin_uart1_device,906#endif907#endif908909#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)910#ifdef CONFIG_BFIN_SIR0911&bfin_sir0_device,912#endif913#ifdef CONFIG_BFIN_SIR1914&bfin_sir1_device,915#endif916#endif917918#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)919&i2c_bfin_twi_device,920#endif921922#if defined(CONFIG_SERIAL_BFIN_SPORT) \923|| defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)924#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART925&bfin_sport0_uart_device,926#endif927#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART928&bfin_sport1_uart_device,929#endif930#endif931932#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)933&tll6527m_flash_device,934#endif935936#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)937&bfin_i2s,938#endif939940#if defined(CONFIG_GPIO_DECODER) || defined(CONFIG_GPIO_DECODER_MODULE)941&spi_decoded_gpio,942#endif943};944945static int __init tll6527m_init(void)946{947printk(KERN_INFO "%s(): registering device resources\n", __func__);948i2c_register_board_info(0, bfin_i2c_board_info,949ARRAY_SIZE(bfin_i2c_board_info));950platform_add_devices(tll6527m_devices, ARRAY_SIZE(tll6527m_devices));951spi_register_board_info(bfin_spi_board_info,952ARRAY_SIZE(bfin_spi_board_info));953return 0;954}955956arch_initcall(tll6527m_init);957958static struct platform_device *tll6527m_early_devices[] __initdata = {959#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)960#ifdef CONFIG_SERIAL_BFIN_UART0961&bfin_uart0_device,962#endif963#ifdef CONFIG_SERIAL_BFIN_UART1964&bfin_uart1_device,965#endif966#endif967968#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)969#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART970&bfin_sport0_uart_device,971#endif972#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART973&bfin_sport1_uart_device,974#endif975#endif976};977978void __init native_machine_early_platform_add_devices(void)979{980printk(KERN_INFO "register early platform devices\n");981early_platform_add_devices(tll6527m_early_devices,982ARRAY_SIZE(tll6527m_early_devices));983}984985void native_machine_restart(char *cmd)986{987/* workaround reboot hang when booting from SPI */988if ((bfin_read_SYSCR() & 0x7) == 0x3)989bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);990}991992void bfin_get_ether_addr(char *addr)993{994/* the MAC is stored in OTP memory page 0xDF */995u32 ret;996u64 otp_mac;997u32 (*otp_read)(u32 page, u32 flags,998u64 *page_content) = (void *)0xEF00001A;9991000ret = otp_read(0xDF, 0x00, &otp_mac);1001if (!(ret & 0x1)) {1002char *otp_mac_p = (char *)&otp_mac;1003for (ret = 0; ret < 6; ++ret)1004addr[ret] = otp_mac_p[5 - ret];1005}1006}1007EXPORT_SYMBOL(bfin_get_ether_addr);100810091010