Path: blob/master/arch/blackfin/mach-bf537/boards/minotaur.c
15112 views
/*1* Copyright 2004-2009 Analog Devices Inc.2* 2008-2009 Cambridge Signal Processing3* 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/spi/spi.h>14#include <linux/spi/flash.h>15#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)16#include <linux/usb/isp1362.h>17#endif18#include <linux/ata_platform.h>19#include <linux/irq.h>20#include <linux/interrupt.h>21#include <linux/usb/sl811.h>22#include <asm/dma.h>23#include <asm/bfin5xx_spi.h>24#include <asm/reboot.h>25#include <asm/portmux.h>26#include <linux/spi/ad7877.h>2728/*29* Name the Board for the /proc/cpuinfo30*/31const char bfin_board_name[] = "CamSig Minotaur BF537";3233#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)34static struct resource bfin_pcmcia_cf_resources[] = {35{36.start = 0x20310000, /* IO PORT */37.end = 0x20312000,38.flags = IORESOURCE_MEM,39}, {40.start = 0x20311000, /* Attribute Memory */41.end = 0x20311FFF,42.flags = IORESOURCE_MEM,43}, {44.start = IRQ_PF4,45.end = IRQ_PF4,46.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,47}, {48.start = IRQ_PF6, /* Card Detect PF6 */49.end = IRQ_PF6,50.flags = IORESOURCE_IRQ,51},52};5354static struct platform_device bfin_pcmcia_cf_device = {55.name = "bfin_cf_pcmcia",56.id = -1,57.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),58.resource = bfin_pcmcia_cf_resources,59};60#endif6162#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)63static struct platform_device rtc_device = {64.name = "rtc-bfin",65.id = -1,66};67#endif6869#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)70#include <linux/bfin_mac.h>71static const unsigned short bfin_mac_peripherals[] = P_MII0;7273static struct bfin_phydev_platform_data bfin_phydev_data[] = {74{75.addr = 1,76.irq = IRQ_MAC_PHYINT,77},78};7980static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {81.phydev_number = 1,82.phydev_data = bfin_phydev_data,83.phy_mode = PHY_INTERFACE_MODE_MII,84.mac_peripherals = bfin_mac_peripherals,85};8687static struct platform_device bfin_mii_bus = {88.name = "bfin_mii_bus",89.dev = {90.platform_data = &bfin_mii_bus_data,91}92};9394static struct platform_device bfin_mac_device = {95.name = "bfin_mac",96.dev = {97.platform_data = &bfin_mii_bus,98}99};100#endif101102#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)103static struct resource net2272_bfin_resources[] = {104{105.start = 0x20300000,106.end = 0x20300000 + 0x100,107.flags = IORESOURCE_MEM,108}, {109.start = IRQ_PF7,110.end = IRQ_PF7,111.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,112},113};114115static struct platform_device net2272_bfin_device = {116.name = "net2272",117.id = -1,118.num_resources = ARRAY_SIZE(net2272_bfin_resources),119.resource = net2272_bfin_resources,120};121#endif122123#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)124/* all SPI peripherals info goes here */125126#if defined(CONFIG_MTD_M25P80) \127|| defined(CONFIG_MTD_M25P80_MODULE)128129/* Partition sizes */130#define FLASH_SIZE 0x00400000131#define PSIZE_UBOOT 0x00030000132#define PSIZE_INITRAMFS 0x00240000133134static struct mtd_partition bfin_spi_flash_partitions[] = {135{136.name = "bootloader(spi)",137.size = PSIZE_UBOOT,138.offset = 0x000000,139.mask_flags = MTD_CAP_ROM140}, {141.name = "initramfs(spi)",142.size = PSIZE_INITRAMFS,143.offset = PSIZE_UBOOT144}, {145.name = "opt(spi)",146.size = FLASH_SIZE - (PSIZE_UBOOT + PSIZE_INITRAMFS),147.offset = PSIZE_UBOOT + PSIZE_INITRAMFS,148}149};150151static struct flash_platform_data bfin_spi_flash_data = {152.name = "m25p80",153.parts = bfin_spi_flash_partitions,154.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),155.type = "m25p64",156};157158/* SPI flash chip (m25p64) */159static struct bfin5xx_spi_chip spi_flash_chip_info = {160.enable_dma = 0, /* use dma transfer with this chip*/161.bits_per_word = 8,162};163#endif164165#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)166static struct bfin5xx_spi_chip mmc_spi_chip_info = {167.enable_dma = 0,168.bits_per_word = 8,169};170#endif171172static struct spi_board_info bfin_spi_board_info[] __initdata = {173#if defined(CONFIG_MTD_M25P80) \174|| defined(CONFIG_MTD_M25P80_MODULE)175{176/* the modalias must be the same as spi device driver name */177.modalias = "m25p80", /* Name of spi_driver for this device */178.max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */179.bus_num = 0, /* Framework bus number */180.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/181.platform_data = &bfin_spi_flash_data,182.controller_data = &spi_flash_chip_info,183.mode = SPI_MODE_3,184},185#endif186187#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)188{189.modalias = "mmc_spi",190.max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */191.bus_num = 0,192.chip_select = 5,193.controller_data = &mmc_spi_chip_info,194.mode = SPI_MODE_3,195},196#endif197};198199/* SPI controller data */200static struct bfin5xx_spi_master bfin_spi0_info = {201.num_chipselect = 8,202.enable_dma = 1, /* master has the ability to do dma transfer */203};204205/* SPI (0) */206static struct resource bfin_spi0_resource[] = {207[0] = {208.start = SPI0_REGBASE,209.end = SPI0_REGBASE + 0xFF,210.flags = IORESOURCE_MEM,211},212[1] = {213.start = CH_SPI,214.end = CH_SPI,215.flags = IORESOURCE_DMA,216},217[2] = {218.start = IRQ_SPI,219.end = IRQ_SPI,220.flags = IORESOURCE_IRQ,221},222};223224static struct platform_device bfin_spi0_device = {225.name = "bfin-spi",226.id = 0, /* Bus number */227.num_resources = ARRAY_SIZE(bfin_spi0_resource),228.resource = bfin_spi0_resource,229.dev = {230.platform_data = &bfin_spi0_info, /* Passed to driver */231},232};233#endif /* spi master and devices */234235#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)236#ifdef CONFIG_SERIAL_BFIN_UART0237static struct resource bfin_uart0_resources[] = {238{239.start = UART0_THR,240.end = UART0_GCTL+2,241.flags = IORESOURCE_MEM,242},243{244.start = IRQ_UART0_RX,245.end = IRQ_UART0_RX+1,246.flags = IORESOURCE_IRQ,247},248{249.start = IRQ_UART0_ERROR,250.end = IRQ_UART0_ERROR,251.flags = IORESOURCE_IRQ,252},253{254.start = CH_UART0_TX,255.end = CH_UART0_TX,256.flags = IORESOURCE_DMA,257},258{259.start = CH_UART0_RX,260.end = CH_UART0_RX,261.flags = IORESOURCE_DMA,262},263};264265static unsigned short bfin_uart0_peripherals[] = {266P_UART0_TX, P_UART0_RX, 0267};268269static struct platform_device bfin_uart0_device = {270.name = "bfin-uart",271.id = 0,272.num_resources = ARRAY_SIZE(bfin_uart0_resources),273.resource = bfin_uart0_resources,274.dev = {275.platform_data = &bfin_uart0_peripherals, /* Passed to driver */276},277};278#endif279#ifdef CONFIG_SERIAL_BFIN_UART1280static struct resource bfin_uart1_resources[] = {281{282.start = UART1_THR,283.end = UART1_GCTL+2,284.flags = IORESOURCE_MEM,285},286{287.start = IRQ_UART1_RX,288.end = IRQ_UART1_RX+1,289.flags = IORESOURCE_IRQ,290},291{292.start = IRQ_UART1_ERROR,293.end = IRQ_UART1_ERROR,294.flags = IORESOURCE_IRQ,295},296{297.start = CH_UART1_TX,298.end = CH_UART1_TX,299.flags = IORESOURCE_DMA,300},301{302.start = CH_UART1_RX,303.end = CH_UART1_RX,304.flags = IORESOURCE_DMA,305},306};307308static unsigned short bfin_uart1_peripherals[] = {309P_UART1_TX, P_UART1_RX, 0310};311312static struct platform_device bfin_uart1_device = {313.name = "bfin-uart",314.id = 1,315.num_resources = ARRAY_SIZE(bfin_uart1_resources),316.resource = bfin_uart1_resources,317.dev = {318.platform_data = &bfin_uart1_peripherals, /* Passed to driver */319},320};321#endif322#endif323324#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)325#ifdef CONFIG_BFIN_SIR0326static struct resource bfin_sir0_resources[] = {327{328.start = 0xFFC00400,329.end = 0xFFC004FF,330.flags = IORESOURCE_MEM,331},332{333.start = IRQ_UART0_RX,334.end = IRQ_UART0_RX+1,335.flags = IORESOURCE_IRQ,336},337{338.start = CH_UART0_RX,339.end = CH_UART0_RX+1,340.flags = IORESOURCE_DMA,341},342};343344static struct platform_device bfin_sir0_device = {345.name = "bfin_sir",346.id = 0,347.num_resources = ARRAY_SIZE(bfin_sir0_resources),348.resource = bfin_sir0_resources,349};350#endif351#ifdef CONFIG_BFIN_SIR1352static struct resource bfin_sir1_resources[] = {353{354.start = 0xFFC02000,355.end = 0xFFC020FF,356.flags = IORESOURCE_MEM,357},358{359.start = IRQ_UART1_RX,360.end = IRQ_UART1_RX+1,361.flags = IORESOURCE_IRQ,362},363{364.start = CH_UART1_RX,365.end = CH_UART1_RX+1,366.flags = IORESOURCE_DMA,367},368};369370static struct platform_device bfin_sir1_device = {371.name = "bfin_sir",372.id = 1,373.num_resources = ARRAY_SIZE(bfin_sir1_resources),374.resource = bfin_sir1_resources,375};376#endif377#endif378379#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)380static struct resource bfin_twi0_resource[] = {381[0] = {382.start = TWI0_REGBASE,383.end = TWI0_REGBASE + 0xFF,384.flags = IORESOURCE_MEM,385},386[1] = {387.start = IRQ_TWI,388.end = IRQ_TWI,389.flags = IORESOURCE_IRQ,390},391};392393static struct platform_device i2c_bfin_twi_device = {394.name = "i2c-bfin-twi",395.id = 0,396.num_resources = ARRAY_SIZE(bfin_twi0_resource),397.resource = bfin_twi0_resource,398};399#endif400401#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)402#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART403static struct resource bfin_sport0_uart_resources[] = {404{405.start = SPORT0_TCR1,406.end = SPORT0_MRCS3+4,407.flags = IORESOURCE_MEM,408},409{410.start = IRQ_SPORT0_RX,411.end = IRQ_SPORT0_RX+1,412.flags = IORESOURCE_IRQ,413},414{415.start = IRQ_SPORT0_ERROR,416.end = IRQ_SPORT0_ERROR,417.flags = IORESOURCE_IRQ,418},419};420421static unsigned short bfin_sport0_peripherals[] = {422P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,423P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0424};425426static struct platform_device bfin_sport0_uart_device = {427.name = "bfin-sport-uart",428.id = 0,429.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),430.resource = bfin_sport0_uart_resources,431.dev = {432.platform_data = &bfin_sport0_peripherals, /* Passed to driver */433},434};435#endif436#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART437static struct resource bfin_sport1_uart_resources[] = {438{439.start = SPORT1_TCR1,440.end = SPORT1_MRCS3+4,441.flags = IORESOURCE_MEM,442},443{444.start = IRQ_SPORT1_RX,445.end = IRQ_SPORT1_RX+1,446.flags = IORESOURCE_IRQ,447},448{449.start = IRQ_SPORT1_ERROR,450.end = IRQ_SPORT1_ERROR,451.flags = IORESOURCE_IRQ,452},453};454455static unsigned short bfin_sport1_peripherals[] = {456P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,457P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0458};459460static struct platform_device bfin_sport1_uart_device = {461.name = "bfin-sport-uart",462.id = 1,463.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),464.resource = bfin_sport1_uart_resources,465.dev = {466.platform_data = &bfin_sport1_peripherals, /* Passed to driver */467},468};469#endif470#endif471472static struct platform_device *minotaur_devices[] __initdata = {473#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)474&bfin_pcmcia_cf_device,475#endif476477#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)478&rtc_device,479#endif480481#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)482&bfin_mii_bus,483&bfin_mac_device,484#endif485486#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)487&net2272_bfin_device,488#endif489490#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)491&bfin_spi0_device,492#endif493494#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)495#ifdef CONFIG_SERIAL_BFIN_UART0496&bfin_uart0_device,497#endif498#ifdef CONFIG_SERIAL_BFIN_UART1499&bfin_uart1_device,500#endif501#endif502503#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)504#ifdef CONFIG_BFIN_SIR0505&bfin_sir0_device,506#endif507#ifdef CONFIG_BFIN_SIR1508&bfin_sir1_device,509#endif510#endif511512#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)513&i2c_bfin_twi_device,514#endif515516#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)517#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART518&bfin_sport0_uart_device,519#endif520#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART521&bfin_sport1_uart_device,522#endif523#endif524525};526527static int __init minotaur_init(void)528{529printk(KERN_INFO "%s(): registering device resources\n", __func__);530platform_add_devices(minotaur_devices, ARRAY_SIZE(minotaur_devices));531#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)532spi_register_board_info(bfin_spi_board_info,533ARRAY_SIZE(bfin_spi_board_info));534#endif535536return 0;537}538539arch_initcall(minotaur_init);540541static struct platform_device *minotaur_early_devices[] __initdata = {542#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)543#ifdef CONFIG_SERIAL_BFIN_UART0544&bfin_uart0_device,545#endif546#ifdef CONFIG_SERIAL_BFIN_UART1547&bfin_uart1_device,548#endif549#endif550551#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)552#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART553&bfin_sport0_uart_device,554#endif555#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART556&bfin_sport1_uart_device,557#endif558#endif559};560561void __init native_machine_early_platform_add_devices(void)562{563printk(KERN_INFO "register early platform devices\n");564early_platform_add_devices(minotaur_early_devices,565ARRAY_SIZE(minotaur_early_devices));566}567568void native_machine_restart(char *cmd)569{570/* workaround reboot hang when booting from SPI */571if ((bfin_read_SYSCR() & 0x7) == 0x3)572bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);573}574575576