Path: blob/master/arch/blackfin/mach-bf548/boards/cm_bf548.c
15126 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/irq.h>17#include <linux/interrupt.h>18#include <linux/usb/musb.h>19#include <asm/bfin5xx_spi.h>20#include <asm/dma.h>21#include <asm/gpio.h>22#include <asm/nand.h>23#include <asm/portmux.h>24#include <asm/bfin_sdh.h>25#include <mach/bf54x_keys.h>26#include <asm/dpmc.h>27#include <linux/input.h>28#include <linux/spi/ad7877.h>2930/*31* Name the Board for the /proc/cpuinfo32*/33const char bfin_board_name[] = "Bluetechnix CM-BF548";3435/*36* Driver needs to know address, irq and flag pin.37*/3839#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)4041#include <mach/bf54x-lq043.h>4243static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {44.width = 480,45.height = 272,46.xres = {480, 480, 480},47.yres = {272, 272, 272},48.bpp = {24, 24, 24},49.disp = GPIO_PE3,50};5152static struct resource bf54x_lq043_resources[] = {53{54.start = IRQ_EPPI0_ERR,55.end = IRQ_EPPI0_ERR,56.flags = IORESOURCE_IRQ,57},58};5960static struct platform_device bf54x_lq043_device = {61.name = "bf54x-lq043",62.id = -1,63.num_resources = ARRAY_SIZE(bf54x_lq043_resources),64.resource = bf54x_lq043_resources,65.dev = {66.platform_data = &bf54x_lq043_data,67},68};69#endif7071#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)72static unsigned int bf548_keymap[] = {73KEYVAL(0, 0, KEY_ENTER),74KEYVAL(0, 1, KEY_HELP),75KEYVAL(0, 2, KEY_0),76KEYVAL(0, 3, KEY_BACKSPACE),77KEYVAL(1, 0, KEY_TAB),78KEYVAL(1, 1, KEY_9),79KEYVAL(1, 2, KEY_8),80KEYVAL(1, 3, KEY_7),81KEYVAL(2, 0, KEY_DOWN),82KEYVAL(2, 1, KEY_6),83KEYVAL(2, 2, KEY_5),84KEYVAL(2, 3, KEY_4),85KEYVAL(3, 0, KEY_UP),86KEYVAL(3, 1, KEY_3),87KEYVAL(3, 2, KEY_2),88KEYVAL(3, 3, KEY_1),89};9091static struct bfin_kpad_platform_data bf54x_kpad_data = {92.rows = 4,93.cols = 4,94.keymap = bf548_keymap,95.keymapsize = ARRAY_SIZE(bf548_keymap),96.repeat = 0,97.debounce_time = 5000, /* ns (5ms) */98.coldrive_time = 1000, /* ns (1ms) */99.keyup_test_interval = 50, /* ms (50ms) */100};101102static struct resource bf54x_kpad_resources[] = {103{104.start = IRQ_KEY,105.end = IRQ_KEY,106.flags = IORESOURCE_IRQ,107},108};109110static struct platform_device bf54x_kpad_device = {111.name = "bf54x-keys",112.id = -1,113.num_resources = ARRAY_SIZE(bf54x_kpad_resources),114.resource = bf54x_kpad_resources,115.dev = {116.platform_data = &bf54x_kpad_data,117},118};119#endif120121#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)122static struct platform_device rtc_device = {123.name = "rtc-bfin",124.id = -1,125};126#endif127128#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)129#ifdef CONFIG_SERIAL_BFIN_UART0130static struct resource bfin_uart0_resources[] = {131{132.start = UART0_DLL,133.end = UART0_RBR+2,134.flags = IORESOURCE_MEM,135},136{137.start = IRQ_UART0_RX,138.end = IRQ_UART0_RX+1,139.flags = IORESOURCE_IRQ,140},141{142.start = IRQ_UART0_ERROR,143.end = IRQ_UART0_ERROR,144.flags = IORESOURCE_IRQ,145},146{147.start = CH_UART0_TX,148.end = CH_UART0_TX,149.flags = IORESOURCE_DMA,150},151{152.start = CH_UART0_RX,153.end = CH_UART0_RX,154.flags = IORESOURCE_DMA,155},156};157158static unsigned short bfin_uart0_peripherals[] = {159P_UART0_TX, P_UART0_RX, 0160};161162static struct platform_device bfin_uart0_device = {163.name = "bfin-uart",164.id = 0,165.num_resources = ARRAY_SIZE(bfin_uart0_resources),166.resource = bfin_uart0_resources,167.dev = {168.platform_data = &bfin_uart0_peripherals, /* Passed to driver */169},170};171#endif172#ifdef CONFIG_SERIAL_BFIN_UART1173static struct resource bfin_uart1_resources[] = {174{175.start = UART1_DLL,176.end = UART1_RBR+2,177.flags = IORESOURCE_MEM,178},179{180.start = IRQ_UART1_RX,181.end = IRQ_UART1_RX+1,182.flags = IORESOURCE_IRQ,183},184{185.start = IRQ_UART1_ERROR,186.end = IRQ_UART1_ERROR,187.flags = IORESOURCE_IRQ,188},189{190.start = CH_UART1_TX,191.end = CH_UART1_TX,192.flags = IORESOURCE_DMA,193},194{195.start = CH_UART1_RX,196.end = CH_UART1_RX,197.flags = IORESOURCE_DMA,198},199#ifdef CONFIG_BFIN_UART1_CTSRTS200{ /* CTS pin -- 0 means not supported */201.start = GPIO_PE10,202.end = GPIO_PE10,203.flags = IORESOURCE_IO,204},205{ /* RTS pin -- 0 means not supported */206.start = GPIO_PE9,207.end = GPIO_PE9,208.flags = IORESOURCE_IO,209},210#endif211};212213static unsigned short bfin_uart1_peripherals[] = {214P_UART1_TX, P_UART1_RX,215#ifdef CONFIG_BFIN_UART1_CTSRTS216P_UART1_RTS, P_UART1_CTS,217#endif2180219};220221static struct platform_device bfin_uart1_device = {222.name = "bfin-uart",223.id = 1,224.num_resources = ARRAY_SIZE(bfin_uart1_resources),225.resource = bfin_uart1_resources,226.dev = {227.platform_data = &bfin_uart1_peripherals, /* Passed to driver */228},229};230#endif231#ifdef CONFIG_SERIAL_BFIN_UART2232static struct resource bfin_uart2_resources[] = {233{234.start = UART2_DLL,235.end = UART2_RBR+2,236.flags = IORESOURCE_MEM,237},238{239.start = IRQ_UART2_RX,240.end = IRQ_UART2_RX+1,241.flags = IORESOURCE_IRQ,242},243{244.start = IRQ_UART2_ERROR,245.end = IRQ_UART2_ERROR,246.flags = IORESOURCE_IRQ,247},248{249.start = CH_UART2_TX,250.end = CH_UART2_TX,251.flags = IORESOURCE_DMA,252},253{254.start = CH_UART2_RX,255.end = CH_UART2_RX,256.flags = IORESOURCE_DMA,257},258};259260static unsigned short bfin_uart2_peripherals[] = {261P_UART2_TX, P_UART2_RX, 0262};263264static struct platform_device bfin_uart2_device = {265.name = "bfin-uart",266.id = 2,267.num_resources = ARRAY_SIZE(bfin_uart2_resources),268.resource = bfin_uart2_resources,269.dev = {270.platform_data = &bfin_uart2_peripherals, /* Passed to driver */271},272};273#endif274#ifdef CONFIG_SERIAL_BFIN_UART3275static struct resource bfin_uart3_resources[] = {276{277.start = UART3_DLL,278.end = UART3_RBR+2,279.flags = IORESOURCE_MEM,280},281{282.start = IRQ_UART3_RX,283.end = IRQ_UART3_RX+1,284.flags = IORESOURCE_IRQ,285},286{287.start = IRQ_UART3_ERROR,288.end = IRQ_UART3_ERROR,289.flags = IORESOURCE_IRQ,290},291{292.start = CH_UART3_TX,293.end = CH_UART3_TX,294.flags = IORESOURCE_DMA,295},296{297.start = CH_UART3_RX,298.end = CH_UART3_RX,299.flags = IORESOURCE_DMA,300},301#ifdef CONFIG_BFIN_UART3_CTSRTS302{ /* CTS pin -- 0 means not supported */303.start = GPIO_PB3,304.end = GPIO_PB3,305.flags = IORESOURCE_IO,306},307{ /* RTS pin -- 0 means not supported */308.start = GPIO_PB2,309.end = GPIO_PB2,310.flags = IORESOURCE_IO,311},312#endif313};314315static unsigned short bfin_uart3_peripherals[] = {316P_UART3_TX, P_UART3_RX,317#ifdef CONFIG_BFIN_UART3_CTSRTS318P_UART3_RTS, P_UART3_CTS,319#endif3200321};322323static struct platform_device bfin_uart3_device = {324.name = "bfin-uart",325.id = 3,326.num_resources = ARRAY_SIZE(bfin_uart3_resources),327.resource = bfin_uart3_resources,328.dev = {329.platform_data = &bfin_uart3_peripherals, /* Passed to driver */330},331};332#endif333#endif334335#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)336#ifdef CONFIG_BFIN_SIR0337static struct resource bfin_sir0_resources[] = {338{339.start = 0xFFC00400,340.end = 0xFFC004FF,341.flags = IORESOURCE_MEM,342},343{344.start = IRQ_UART0_RX,345.end = IRQ_UART0_RX+1,346.flags = IORESOURCE_IRQ,347},348{349.start = CH_UART0_RX,350.end = CH_UART0_RX+1,351.flags = IORESOURCE_DMA,352},353};354static struct platform_device bfin_sir0_device = {355.name = "bfin_sir",356.id = 0,357.num_resources = ARRAY_SIZE(bfin_sir0_resources),358.resource = bfin_sir0_resources,359};360#endif361#ifdef CONFIG_BFIN_SIR1362static struct resource bfin_sir1_resources[] = {363{364.start = 0xFFC02000,365.end = 0xFFC020FF,366.flags = IORESOURCE_MEM,367},368{369.start = IRQ_UART1_RX,370.end = IRQ_UART1_RX+1,371.flags = IORESOURCE_IRQ,372},373{374.start = CH_UART1_RX,375.end = CH_UART1_RX+1,376.flags = IORESOURCE_DMA,377},378};379static struct platform_device bfin_sir1_device = {380.name = "bfin_sir",381.id = 1,382.num_resources = ARRAY_SIZE(bfin_sir1_resources),383.resource = bfin_sir1_resources,384};385#endif386#ifdef CONFIG_BFIN_SIR2387static struct resource bfin_sir2_resources[] = {388{389.start = 0xFFC02100,390.end = 0xFFC021FF,391.flags = IORESOURCE_MEM,392},393{394.start = IRQ_UART2_RX,395.end = IRQ_UART2_RX+1,396.flags = IORESOURCE_IRQ,397},398{399.start = CH_UART2_RX,400.end = CH_UART2_RX+1,401.flags = IORESOURCE_DMA,402},403};404static struct platform_device bfin_sir2_device = {405.name = "bfin_sir",406.id = 2,407.num_resources = ARRAY_SIZE(bfin_sir2_resources),408.resource = bfin_sir2_resources,409};410#endif411#ifdef CONFIG_BFIN_SIR3412static struct resource bfin_sir3_resources[] = {413{414.start = 0xFFC03100,415.end = 0xFFC031FF,416.flags = IORESOURCE_MEM,417},418{419.start = IRQ_UART3_RX,420.end = IRQ_UART3_RX+1,421.flags = IORESOURCE_IRQ,422},423{424.start = CH_UART3_RX,425.end = CH_UART3_RX+1,426.flags = IORESOURCE_DMA,427},428};429static struct platform_device bfin_sir3_device = {430.name = "bfin_sir",431.id = 3,432.num_resources = ARRAY_SIZE(bfin_sir3_resources),433.resource = bfin_sir3_resources,434};435#endif436#endif437438#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)439#include <linux/smsc911x.h>440441static struct resource smsc911x_resources[] = {442{443.name = "smsc911x-memory",444.start = 0x24000000,445.end = 0x24000000 + 0xFF,446.flags = IORESOURCE_MEM,447},448{449.start = IRQ_PE6,450.end = IRQ_PE6,451.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,452},453};454455static struct smsc911x_platform_config smsc911x_config = {456.flags = SMSC911X_USE_16BIT,457.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,458.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,459.phy_interface = PHY_INTERFACE_MODE_MII,460};461462static struct platform_device smsc911x_device = {463.name = "smsc911x",464.id = 0,465.num_resources = ARRAY_SIZE(smsc911x_resources),466.resource = smsc911x_resources,467.dev = {468.platform_data = &smsc911x_config,469},470};471#endif472473#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)474static struct resource musb_resources[] = {475[0] = {476.start = 0xFFC03C00,477.end = 0xFFC040FF,478.flags = IORESOURCE_MEM,479},480[1] = { /* general IRQ */481.start = IRQ_USB_INT0,482.end = IRQ_USB_INT0,483.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,484.name = "mc"485},486[2] = { /* DMA IRQ */487.start = IRQ_USB_DMA,488.end = IRQ_USB_DMA,489.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,490.name = "dma"491},492};493494static struct musb_hdrc_config musb_config = {495.multipoint = 0,496.dyn_fifo = 0,497.soft_con = 1,498.dma = 1,499.num_eps = 8,500.dma_channels = 8,501.gpio_vrsel = GPIO_PH6,502/* Some custom boards need to be active low, just set it to "0"503* if it is the case.504*/505.gpio_vrsel_active = 1,506.clkin = 24, /* musb CLKIN in MHZ */507};508509static struct musb_hdrc_platform_data musb_plat = {510#if defined(CONFIG_USB_MUSB_OTG)511.mode = MUSB_OTG,512#elif defined(CONFIG_USB_MUSB_HDRC_HCD)513.mode = MUSB_HOST,514#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)515.mode = MUSB_PERIPHERAL,516#endif517.config = &musb_config,518};519520static u64 musb_dmamask = ~(u32)0;521522static struct platform_device musb_device = {523.name = "musb-blackfin",524.id = 0,525.dev = {526.dma_mask = &musb_dmamask,527.coherent_dma_mask = 0xffffffff,528.platform_data = &musb_plat,529},530.num_resources = ARRAY_SIZE(musb_resources),531.resource = musb_resources,532};533#endif534535#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)536#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART537static struct resource bfin_sport0_uart_resources[] = {538{539.start = SPORT0_TCR1,540.end = SPORT0_MRCS3+4,541.flags = IORESOURCE_MEM,542},543{544.start = IRQ_SPORT0_RX,545.end = IRQ_SPORT0_RX+1,546.flags = IORESOURCE_IRQ,547},548{549.start = IRQ_SPORT0_ERROR,550.end = IRQ_SPORT0_ERROR,551.flags = IORESOURCE_IRQ,552},553};554555static unsigned short bfin_sport0_peripherals[] = {556P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,557P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0558};559560static struct platform_device bfin_sport0_uart_device = {561.name = "bfin-sport-uart",562.id = 0,563.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),564.resource = bfin_sport0_uart_resources,565.dev = {566.platform_data = &bfin_sport0_peripherals, /* Passed to driver */567},568};569#endif570#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART571static struct resource bfin_sport1_uart_resources[] = {572{573.start = SPORT1_TCR1,574.end = SPORT1_MRCS3+4,575.flags = IORESOURCE_MEM,576},577{578.start = IRQ_SPORT1_RX,579.end = IRQ_SPORT1_RX+1,580.flags = IORESOURCE_IRQ,581},582{583.start = IRQ_SPORT1_ERROR,584.end = IRQ_SPORT1_ERROR,585.flags = IORESOURCE_IRQ,586},587};588589static unsigned short bfin_sport1_peripherals[] = {590P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,591P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0592};593594static struct platform_device bfin_sport1_uart_device = {595.name = "bfin-sport-uart",596.id = 1,597.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),598.resource = bfin_sport1_uart_resources,599.dev = {600.platform_data = &bfin_sport1_peripherals, /* Passed to driver */601},602};603#endif604#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART605static struct resource bfin_sport2_uart_resources[] = {606{607.start = SPORT2_TCR1,608.end = SPORT2_MRCS3+4,609.flags = IORESOURCE_MEM,610},611{612.start = IRQ_SPORT2_RX,613.end = IRQ_SPORT2_RX+1,614.flags = IORESOURCE_IRQ,615},616{617.start = IRQ_SPORT2_ERROR,618.end = IRQ_SPORT2_ERROR,619.flags = IORESOURCE_IRQ,620},621};622623static unsigned short bfin_sport2_peripherals[] = {624P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,625P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0626};627628static struct platform_device bfin_sport2_uart_device = {629.name = "bfin-sport-uart",630.id = 2,631.num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),632.resource = bfin_sport2_uart_resources,633.dev = {634.platform_data = &bfin_sport2_peripherals, /* Passed to driver */635},636};637#endif638#ifdef CONFIG_SERIAL_BFIN_SPORT3_UART639static struct resource bfin_sport3_uart_resources[] = {640{641.start = SPORT3_TCR1,642.end = SPORT3_MRCS3+4,643.flags = IORESOURCE_MEM,644},645{646.start = IRQ_SPORT3_RX,647.end = IRQ_SPORT3_RX+1,648.flags = IORESOURCE_IRQ,649},650{651.start = IRQ_SPORT3_ERROR,652.end = IRQ_SPORT3_ERROR,653.flags = IORESOURCE_IRQ,654},655};656657static unsigned short bfin_sport3_peripherals[] = {658P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,659P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0660};661662static struct platform_device bfin_sport3_uart_device = {663.name = "bfin-sport-uart",664.id = 3,665.num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),666.resource = bfin_sport3_uart_resources,667.dev = {668.platform_data = &bfin_sport3_peripherals, /* Passed to driver */669},670};671#endif672#endif673674#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)675static struct resource bfin_atapi_resources[] = {676{677.start = 0xFFC03800,678.end = 0xFFC0386F,679.flags = IORESOURCE_MEM,680},681{682.start = IRQ_ATAPI_ERR,683.end = IRQ_ATAPI_ERR,684.flags = IORESOURCE_IRQ,685},686};687688static struct platform_device bfin_atapi_device = {689.name = "pata-bf54x",690.id = -1,691.num_resources = ARRAY_SIZE(bfin_atapi_resources),692.resource = bfin_atapi_resources,693};694#endif695696#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)697static struct mtd_partition partition_info[] = {698{699.name = "linux kernel(nand)",700.offset = 0,701.size = 4 * 1024 * 1024,702},703{704.name = "file system(nand)",705.offset = 4 * 1024 * 1024,706.size = (256 - 4) * 1024 * 1024,707},708};709710static struct bf5xx_nand_platform bf5xx_nand_platform = {711.data_width = NFC_NWIDTH_8,712.partitions = partition_info,713.nr_partitions = ARRAY_SIZE(partition_info),714.rd_dly = 3,715.wr_dly = 3,716};717718static struct resource bf5xx_nand_resources[] = {719{720.start = 0xFFC03B00,721.end = 0xFFC03B4F,722.flags = IORESOURCE_MEM,723},724{725.start = CH_NFC,726.end = CH_NFC,727.flags = IORESOURCE_IRQ,728},729};730731static struct platform_device bf5xx_nand_device = {732.name = "bf5xx-nand",733.id = 0,734.num_resources = ARRAY_SIZE(bf5xx_nand_resources),735.resource = bf5xx_nand_resources,736.dev = {737.platform_data = &bf5xx_nand_platform,738},739};740#endif741742#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)743static struct bfin_sd_host bfin_sdh_data = {744.dma_chan = CH_SDH,745.irq_int0 = IRQ_SDH_MASK0,746.pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},747};748749static struct platform_device bf54x_sdh_device = {750.name = "bfin-sdh",751.id = 0,752.dev = {753.platform_data = &bfin_sdh_data,754},755};756#endif757758#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)759static unsigned short bfin_can_peripherals[] = {760P_CAN0_RX, P_CAN0_TX, 0761};762763static struct resource bfin_can_resources[] = {764{765.start = 0xFFC02A00,766.end = 0xFFC02FFF,767.flags = IORESOURCE_MEM,768},769{770.start = IRQ_CAN0_RX,771.end = IRQ_CAN0_RX,772.flags = IORESOURCE_IRQ,773},774{775.start = IRQ_CAN0_TX,776.end = IRQ_CAN0_TX,777.flags = IORESOURCE_IRQ,778},779{780.start = IRQ_CAN0_ERROR,781.end = IRQ_CAN0_ERROR,782.flags = IORESOURCE_IRQ,783},784};785786static struct platform_device bfin_can_device = {787.name = "bfin_can",788.num_resources = ARRAY_SIZE(bfin_can_resources),789.resource = bfin_can_resources,790.dev = {791.platform_data = &bfin_can_peripherals, /* Passed to driver */792},793};794#endif795796#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)797static struct mtd_partition para_partitions[] = {798{799.name = "bootloader(nor)",800.size = 0x40000,801.offset = 0,802}, {803.name = "linux kernel(nor)",804.size = 0x100000,805.offset = MTDPART_OFS_APPEND,806}, {807.name = "file system(nor)",808.size = MTDPART_SIZ_FULL,809.offset = MTDPART_OFS_APPEND,810}811};812813static struct physmap_flash_data para_flash_data = {814.width = 2,815.parts = para_partitions,816.nr_parts = ARRAY_SIZE(para_partitions),817};818819static struct resource para_flash_resource = {820.start = 0x20000000,821.end = 0x207fffff,822.flags = IORESOURCE_MEM,823};824825static struct platform_device para_flash_device = {826.name = "physmap-flash",827.id = 0,828.dev = {829.platform_data = ¶_flash_data,830},831.num_resources = 1,832.resource = ¶_flash_resource,833};834#endif835836#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)837/* all SPI peripherals info goes here */838#if defined(CONFIG_MTD_M25P80) \839|| defined(CONFIG_MTD_M25P80_MODULE)840/* SPI flash chip (m25p16) */841static struct mtd_partition bfin_spi_flash_partitions[] = {842{843.name = "bootloader(spi)",844.size = 0x00040000,845.offset = 0,846.mask_flags = MTD_CAP_ROM847}, {848.name = "linux kernel(spi)",849.size = 0x1c0000,850.offset = 0x40000851}852};853854static struct flash_platform_data bfin_spi_flash_data = {855.name = "m25p80",856.parts = bfin_spi_flash_partitions,857.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),858.type = "m25p16",859};860861static struct bfin5xx_spi_chip spi_flash_chip_info = {862.enable_dma = 0, /* use dma transfer with this chip*/863.bits_per_word = 8,864};865#endif866867#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)868static struct bfin5xx_spi_chip spi_ad7877_chip_info = {869.enable_dma = 0,870.bits_per_word = 16,871};872873static const struct ad7877_platform_data bfin_ad7877_ts_info = {874.model = 7877,875.vref_delay_usecs = 50, /* internal, no capacitor */876.x_plate_ohms = 419,877.y_plate_ohms = 486,878.pressure_max = 1000,879.pressure_min = 0,880.stopacq_polarity = 1,881.first_conversion_delay = 3,882.acquisition_time = 1,883.averaging = 1,884.pen_down_acc_interval = 1,885};886#endif887888#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)889static struct bfin5xx_spi_chip spidev_chip_info = {890.enable_dma = 0,891.bits_per_word = 8,892};893#endif894895static struct spi_board_info bf54x_spi_board_info[] __initdata = {896#if defined(CONFIG_MTD_M25P80) \897|| defined(CONFIG_MTD_M25P80_MODULE)898{899/* the modalias must be the same as spi device driver name */900.modalias = "m25p80", /* Name of spi_driver for this device */901.max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */902.bus_num = 0, /* Framework bus number */903.chip_select = 1, /* SPI_SSEL1*/904.platform_data = &bfin_spi_flash_data,905.controller_data = &spi_flash_chip_info,906.mode = SPI_MODE_3,907},908#endif909#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)910{911.modalias = "ad7877",912.platform_data = &bfin_ad7877_ts_info,913.irq = IRQ_PJ11,914.max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */915.bus_num = 0,916.chip_select = 2,917.controller_data = &spi_ad7877_chip_info,918},919#endif920#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)921{922.modalias = "spidev",923.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */924.bus_num = 0,925.chip_select = 1,926.controller_data = &spidev_chip_info,927},928#endif929};930931/* SPI (0) */932static struct resource bfin_spi0_resource[] = {933[0] = {934.start = SPI0_REGBASE,935.end = SPI0_REGBASE + 0xFF,936.flags = IORESOURCE_MEM,937},938[1] = {939.start = CH_SPI0,940.end = CH_SPI0,941.flags = IORESOURCE_DMA,942},943[2] = {944.start = IRQ_SPI0,945.end = IRQ_SPI0,946.flags = IORESOURCE_IRQ,947}948};949950/* SPI (1) */951static struct resource bfin_spi1_resource[] = {952[0] = {953.start = SPI1_REGBASE,954.end = SPI1_REGBASE + 0xFF,955.flags = IORESOURCE_MEM,956},957[1] = {958.start = CH_SPI1,959.end = CH_SPI1,960.flags = IORESOURCE_DMA,961},962[2] = {963.start = IRQ_SPI1,964.end = IRQ_SPI1,965.flags = IORESOURCE_IRQ,966}967};968969/* SPI controller data */970static struct bfin5xx_spi_master bf54x_spi_master_info0 = {971.num_chipselect = 4,972.enable_dma = 1, /* master has the ability to do dma transfer */973.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},974};975976static struct platform_device bf54x_spi_master0 = {977.name = "bfin-spi",978.id = 0, /* Bus number */979.num_resources = ARRAY_SIZE(bfin_spi0_resource),980.resource = bfin_spi0_resource,981.dev = {982.platform_data = &bf54x_spi_master_info0, /* Passed to driver */983},984};985986static struct bfin5xx_spi_master bf54x_spi_master_info1 = {987.num_chipselect = 4,988.enable_dma = 1, /* master has the ability to do dma transfer */989.pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},990};991992static struct platform_device bf54x_spi_master1 = {993.name = "bfin-spi",994.id = 1, /* Bus number */995.num_resources = ARRAY_SIZE(bfin_spi1_resource),996.resource = bfin_spi1_resource,997.dev = {998.platform_data = &bf54x_spi_master_info1, /* Passed to driver */999},1000};1001#endif /* spi master and devices */10021003#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)1004static struct resource bfin_twi0_resource[] = {1005[0] = {1006.start = TWI0_REGBASE,1007.end = TWI0_REGBASE + 0xFF,1008.flags = IORESOURCE_MEM,1009},1010[1] = {1011.start = IRQ_TWI0,1012.end = IRQ_TWI0,1013.flags = IORESOURCE_IRQ,1014},1015};10161017static struct platform_device i2c_bfin_twi0_device = {1018.name = "i2c-bfin-twi",1019.id = 0,1020.num_resources = ARRAY_SIZE(bfin_twi0_resource),1021.resource = bfin_twi0_resource,1022};10231024#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */1025static struct resource bfin_twi1_resource[] = {1026[0] = {1027.start = TWI1_REGBASE,1028.end = TWI1_REGBASE + 0xFF,1029.flags = IORESOURCE_MEM,1030},1031[1] = {1032.start = IRQ_TWI1,1033.end = IRQ_TWI1,1034.flags = IORESOURCE_IRQ,1035},1036};10371038static struct platform_device i2c_bfin_twi1_device = {1039.name = "i2c-bfin-twi",1040.id = 1,1041.num_resources = ARRAY_SIZE(bfin_twi1_resource),1042.resource = bfin_twi1_resource,1043};1044#endif1045#endif10461047#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)1048#include <linux/gpio_keys.h>10491050static struct gpio_keys_button bfin_gpio_keys_table[] = {1051{BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},1052};10531054static struct gpio_keys_platform_data bfin_gpio_keys_data = {1055.buttons = bfin_gpio_keys_table,1056.nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),1057};10581059static struct platform_device bfin_device_gpiokeys = {1060.name = "gpio-keys",1061.dev = {1062.platform_data = &bfin_gpio_keys_data,1063},1064};1065#endif10661067static const unsigned int cclk_vlev_datasheet[] =1068{1069/*1070* Internal VLEV BF54XSBBC15331071****temporarily using these values until data sheet is updated1072*/1073VRPAIR(VLEV_085, 150000000),1074VRPAIR(VLEV_090, 250000000),1075VRPAIR(VLEV_110, 276000000),1076VRPAIR(VLEV_115, 301000000),1077VRPAIR(VLEV_120, 525000000),1078VRPAIR(VLEV_125, 550000000),1079VRPAIR(VLEV_130, 600000000),1080};10811082static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {1083.tuple_tab = cclk_vlev_datasheet,1084.tabsize = ARRAY_SIZE(cclk_vlev_datasheet),1085.vr_settling_time = 25 /* us */,1086};10871088static struct platform_device bfin_dpmc = {1089.name = "bfin dpmc",1090.dev = {1091.platform_data = &bfin_dmpc_vreg_data,1092},1093};10941095static struct platform_device *cm_bf548_devices[] __initdata = {10961097&bfin_dpmc,10981099#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)1100&rtc_device,1101#endif11021103#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)1104#ifdef CONFIG_SERIAL_BFIN_UART01105&bfin_uart0_device,1106#endif1107#ifdef CONFIG_SERIAL_BFIN_UART11108&bfin_uart1_device,1109#endif1110#ifdef CONFIG_SERIAL_BFIN_UART21111&bfin_uart2_device,1112#endif1113#ifdef CONFIG_SERIAL_BFIN_UART31114&bfin_uart3_device,1115#endif1116#endif11171118#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)1119#ifdef CONFIG_BFIN_SIR01120&bfin_sir0_device,1121#endif1122#ifdef CONFIG_BFIN_SIR11123&bfin_sir1_device,1124#endif1125#ifdef CONFIG_BFIN_SIR21126&bfin_sir2_device,1127#endif1128#ifdef CONFIG_BFIN_SIR31129&bfin_sir3_device,1130#endif1131#endif11321133#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)1134&bf54x_lq043_device,1135#endif11361137#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)1138&smsc911x_device,1139#endif11401141#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)1142&musb_device,1143#endif11441145#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)1146#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1147&bfin_sport0_uart_device,1148#endif1149#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1150&bfin_sport1_uart_device,1151#endif1152#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART1153&bfin_sport2_uart_device,1154#endif1155#ifdef CONFIG_SERIAL_BFIN_SPORT3_UART1156&bfin_sport3_uart_device,1157#endif1158#endif11591160#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)1161&bfin_atapi_device,1162#endif11631164#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)1165&bf5xx_nand_device,1166#endif11671168#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)1169&bf54x_sdh_device,1170#endif11711172#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)1173&bf54x_spi_master0,1174&bf54x_spi_master1,1175#endif11761177#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)1178&bf54x_kpad_device,1179#endif11801181#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)1182&i2c_bfin_twi0_device,1183#if !defined(CONFIG_BF542)1184&i2c_bfin_twi1_device,1185#endif1186#endif11871188#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)1189&bfin_device_gpiokeys,1190#endif11911192#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)1193¶_flash_device,1194#endif11951196#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)1197&bfin_can_device,1198#endif11991200};12011202static int __init cm_bf548_init(void)1203{1204printk(KERN_INFO "%s(): registering device resources\n", __func__);1205platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));12061207#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)1208spi_register_board_info(bf54x_spi_board_info,1209ARRAY_SIZE(bf54x_spi_board_info));1210#endif12111212return 0;1213}12141215arch_initcall(cm_bf548_init);12161217static struct platform_device *cm_bf548_early_devices[] __initdata = {1218#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)1219#ifdef CONFIG_SERIAL_BFIN_UART01220&bfin_uart0_device,1221#endif1222#ifdef CONFIG_SERIAL_BFIN_UART11223&bfin_uart1_device,1224#endif1225#ifdef CONFIG_SERIAL_BFIN_UART21226&bfin_uart2_device,1227#endif1228#ifdef CONFIG_SERIAL_BFIN_UART31229&bfin_uart3_device,1230#endif1231#endif12321233#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)1234#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART1235&bfin_sport0_uart_device,1236#endif1237#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART1238&bfin_sport1_uart_device,1239#endif1240#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART1241&bfin_sport2_uart_device,1242#endif1243#ifdef CONFIG_SERIAL_BFIN_SPORT3_UART1244&bfin_sport3_uart_device,1245#endif1246#endif1247};12481249void __init native_machine_early_platform_add_devices(void)1250{1251printk(KERN_INFO "register early platform devices\n");1252early_platform_add_devices(cm_bf548_early_devices,1253ARRAY_SIZE(cm_bf548_early_devices));1254}125512561257