Path: blob/master/arch/blackfin/mach-bf533/boards/ip0x.c
15126 views
/*1* Copyright 2004-2009 Analog Devices Inc.2* 2007 David Rowe3* 2006 Intratrade Ltd.4* Ivan Danov <[email protected]>5* 2005 National ICT Australia (NICTA)6* Aidan Williams <[email protected]>7*8* Licensed under the GPL-2 or later.9*/1011#include <linux/device.h>12#include <linux/platform_device.h>13#include <linux/mtd/mtd.h>14#include <linux/mtd/partitions.h>15#include <linux/spi/spi.h>16#include <linux/spi/flash.h>17#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)18#include <linux/usb/isp1362.h>19#endif20#include <asm/irq.h>21#include <asm/dma.h>22#include <asm/bfin5xx_spi.h>23#include <asm/portmux.h>2425/*26* Name the Board for the /proc/cpuinfo27*/28const char bfin_board_name[] = "IP04/IP08";2930/*31* Driver needs to know address, irq and flag pin.32*/33#if defined(CONFIG_BFIN532_IP0X)34#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)3536#include <linux/dm9000.h>3738static struct resource dm9000_resource1[] = {39{40.start = 0x20100000,41.end = 0x20100000 + 1,42.flags = IORESOURCE_MEM43},{44.start = 0x20100000 + 2,45.end = 0x20100000 + 3,46.flags = IORESOURCE_MEM47},{48.start = IRQ_PF15,49.end = IRQ_PF15,50.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE51}52};5354static struct resource dm9000_resource2[] = {55{56.start = 0x20200000,57.end = 0x20200000 + 1,58.flags = IORESOURCE_MEM59},{60.start = 0x20200000 + 2,61.end = 0x20200000 + 3,62.flags = IORESOURCE_MEM63},{64.start = IRQ_PF14,65.end = IRQ_PF14,66.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE67}68};6970/*71* for the moment we limit ourselves to 16bit IO until some72* better IO routines can be written and tested73*/74static struct dm9000_plat_data dm9000_platdata1 = {75.flags = DM9000_PLATF_16BITONLY,76};7778static struct platform_device dm9000_device1 = {79.name = "dm9000",80.id = 0,81.num_resources = ARRAY_SIZE(dm9000_resource1),82.resource = dm9000_resource1,83.dev = {84.platform_data = &dm9000_platdata1,85}86};8788static struct dm9000_plat_data dm9000_platdata2 = {89.flags = DM9000_PLATF_16BITONLY,90};9192static struct platform_device dm9000_device2 = {93.name = "dm9000",94.id = 1,95.num_resources = ARRAY_SIZE(dm9000_resource2),96.resource = dm9000_resource2,97.dev = {98.platform_data = &dm9000_platdata2,99}100};101102#endif103#endif104105106#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)107/* all SPI peripherals info goes here */108109#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)110static struct bfin5xx_spi_chip mmc_spi_chip_info = {111.enable_dma = 0, /* if 1 - block!!! */112.bits_per_word = 8,113};114#endif115116/* Notice: for blackfin, the speed_hz is the value of register117* SPI_BAUD, not the real baudrate */118static struct spi_board_info bfin_spi_board_info[] __initdata = {119#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)120{121.modalias = "mmc_spi",122.max_speed_hz = 2,123.bus_num = 1,124.chip_select = 5,125.controller_data = &mmc_spi_chip_info,126},127#endif128};129130/* SPI controller data */131static struct bfin5xx_spi_master spi_bfin_master_info = {132.num_chipselect = 8,133.enable_dma = 1, /* master has the ability to do dma transfer */134};135136static struct platform_device spi_bfin_master_device = {137.name = "bfin-spi-master",138.id = 1, /* Bus number */139.dev = {140.platform_data = &spi_bfin_master_info, /* Passed to driver */141},142};143#endif /* spi master and devices */144145#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)146#ifdef CONFIG_SERIAL_BFIN_UART0147static struct resource bfin_uart0_resources[] = {148{149.start = BFIN_UART_THR,150.end = BFIN_UART_GCTL+2,151.flags = IORESOURCE_MEM,152},153{154.start = IRQ_UART0_RX,155.end = IRQ_UART0_RX + 1,156.flags = IORESOURCE_IRQ,157},158{159.start = IRQ_UART0_ERROR,160.end = IRQ_UART0_ERROR,161.flags = IORESOURCE_IRQ,162},163{164.start = CH_UART0_TX,165.end = CH_UART0_TX,166.flags = IORESOURCE_DMA,167},168{169.start = CH_UART0_RX,170.end = CH_UART0_RX,171.flags = IORESOURCE_DMA,172},173};174175static unsigned short bfin_uart0_peripherals[] = {176P_UART0_TX, P_UART0_RX, 0177};178179static struct platform_device bfin_uart0_device = {180.name = "bfin-uart",181.id = 0,182.num_resources = ARRAY_SIZE(bfin_uart0_resources),183.resource = bfin_uart0_resources,184.dev = {185.platform_data = &bfin_uart0_peripherals, /* Passed to driver */186},187};188#endif189#endif190191#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)192#ifdef CONFIG_BFIN_SIR0193static struct resource bfin_sir0_resources[] = {194{195.start = 0xFFC00400,196.end = 0xFFC004FF,197.flags = IORESOURCE_MEM,198},199{200.start = IRQ_UART0_RX,201.end = IRQ_UART0_RX+1,202.flags = IORESOURCE_IRQ,203},204{205.start = CH_UART0_RX,206.end = CH_UART0_RX+1,207.flags = IORESOURCE_DMA,208},209};210211static struct platform_device bfin_sir0_device = {212.name = "bfin_sir",213.id = 0,214.num_resources = ARRAY_SIZE(bfin_sir0_resources),215.resource = bfin_sir0_resources,216};217#endif218#endif219220#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)221static struct resource isp1362_hcd_resources[] = {222{223.start = 0x20300000,224.end = 0x20300000 + 1,225.flags = IORESOURCE_MEM,226},{227.start = 0x20300000 + 2,228.end = 0x20300000 + 3,229.flags = IORESOURCE_MEM,230},{231.start = IRQ_PF11,232.end = IRQ_PF11,233.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,234},235};236237static struct isp1362_platform_data isp1362_priv = {238.sel15Kres = 1,239.clknotstop = 0,240.oc_enable = 0, /* external OC */241.int_act_high = 0,242.int_edge_triggered = 0,243.remote_wakeup_connected = 0,244.no_power_switching = 1,245.power_switching_mode = 0,246};247248static struct platform_device isp1362_hcd_device = {249.name = "isp1362-hcd",250.id = 0,251.dev = {252.platform_data = &isp1362_priv,253},254.num_resources = ARRAY_SIZE(isp1362_hcd_resources),255.resource = isp1362_hcd_resources,256};257#endif258259260static struct platform_device *ip0x_devices[] __initdata = {261#if defined(CONFIG_BFIN532_IP0X)262#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)263&dm9000_device1,264&dm9000_device2,265#endif266#endif267268#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)269&spi_bfin_master_device,270#endif271272#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)273#ifdef CONFIG_SERIAL_BFIN_UART0274&bfin_uart0_device,275#endif276#endif277278#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)279#ifdef CONFIG_BFIN_SIR0280&bfin_sir0_device,281#endif282#endif283284#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)285&isp1362_hcd_device,286#endif287};288289static int __init ip0x_init(void)290{291printk(KERN_INFO "%s(): registering device resources\n", __func__);292platform_add_devices(ip0x_devices, ARRAY_SIZE(ip0x_devices));293294spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));295296return 0;297}298299arch_initcall(ip0x_init);300301static struct platform_device *ip0x_early_devices[] __initdata = {302#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)303#ifdef CONFIG_SERIAL_BFIN_UART0304&bfin_uart0_device,305#endif306#endif307};308309void __init native_machine_early_platform_add_devices(void)310{311printk(KERN_INFO "register early platform devices\n");312early_platform_add_devices(ip0x_early_devices,313ARRAY_SIZE(ip0x_early_devices));314}315316317