Path: blob/master/arch/arm/mach-ixp4xx/ixdp425-setup.c
10817 views
/*1* arch/arm/mach-ixp4xx/ixdp425-setup.c2*3* IXDP425/IXCDP1100 board-setup4*5* Copyright (C) 2003-2005 MontaVista Software, Inc.6*7* Author: Deepak Saxena <[email protected]>8*/910#include <linux/kernel.h>11#include <linux/init.h>12#include <linux/device.h>13#include <linux/serial.h>14#include <linux/tty.h>15#include <linux/serial_8250.h>16#include <linux/i2c-gpio.h>17#include <linux/io.h>18#include <linux/mtd/mtd.h>19#include <linux/mtd/nand.h>20#include <linux/mtd/partitions.h>21#include <linux/delay.h>22#include <asm/types.h>23#include <asm/setup.h>24#include <asm/memory.h>25#include <mach/hardware.h>26#include <asm/mach-types.h>27#include <asm/irq.h>28#include <asm/mach/arch.h>29#include <asm/mach/flash.h>3031#define IXDP425_SDA_PIN 732#define IXDP425_SCL_PIN 63334/* NAND Flash pins */35#define IXDP425_NAND_NCE_PIN 123637#define IXDP425_NAND_CMD_BYTE 0x0138#define IXDP425_NAND_ADDR_BYTE 0x023940static struct flash_platform_data ixdp425_flash_data = {41.map_name = "cfi_probe",42.width = 2,43};4445static struct resource ixdp425_flash_resource = {46.flags = IORESOURCE_MEM,47};4849static struct platform_device ixdp425_flash = {50.name = "IXP4XX-Flash",51.id = 0,52.dev = {53.platform_data = &ixdp425_flash_data,54},55.num_resources = 1,56.resource = &ixdp425_flash_resource,57};5859#if defined(CONFIG_MTD_NAND_PLATFORM) || \60defined(CONFIG_MTD_NAND_PLATFORM_MODULE)6162const char *part_probes[] = { "cmdlinepart", NULL };6364static struct mtd_partition ixdp425_partitions[] = {65{66.name = "ixp400 NAND FS 0",67.offset = 0,68.size = SZ_8M69}, {70.name = "ixp400 NAND FS 1",71.offset = MTDPART_OFS_APPEND,72.size = MTDPART_SIZ_FULL73},74};7576static void77ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)78{79struct nand_chip *this = mtd->priv;80int offset = (int)this->priv;8182if (ctrl & NAND_CTRL_CHANGE) {83if (ctrl & NAND_NCE) {84gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW);85udelay(5);86} else87gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH);8889offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;90offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;91this->priv = (void *)offset;92}9394if (cmd != NAND_CMD_NONE)95writeb(cmd, this->IO_ADDR_W + offset);96}9798static struct platform_nand_data ixdp425_flash_nand_data = {99.chip = {100.nr_chips = 1,101.chip_delay = 30,102.options = NAND_NO_AUTOINCR,103.part_probe_types = part_probes,104.partitions = ixdp425_partitions,105.nr_partitions = ARRAY_SIZE(ixdp425_partitions),106},107.ctrl = {108.cmd_ctrl = ixdp425_flash_nand_cmd_ctrl109}110};111112static struct resource ixdp425_flash_nand_resource = {113.flags = IORESOURCE_MEM,114};115116static struct platform_device ixdp425_flash_nand = {117.name = "gen_nand",118.id = -1,119.dev = {120.platform_data = &ixdp425_flash_nand_data,121},122.num_resources = 1,123.resource = &ixdp425_flash_nand_resource,124};125#endif /* CONFIG_MTD_NAND_PLATFORM */126127static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = {128.sda_pin = IXDP425_SDA_PIN,129.scl_pin = IXDP425_SCL_PIN,130};131132static struct platform_device ixdp425_i2c_gpio = {133.name = "i2c-gpio",134.id = 0,135.dev = {136.platform_data = &ixdp425_i2c_gpio_data,137},138};139140static struct resource ixdp425_uart_resources[] = {141{142.start = IXP4XX_UART1_BASE_PHYS,143.end = IXP4XX_UART1_BASE_PHYS + 0x0fff,144.flags = IORESOURCE_MEM145},146{147.start = IXP4XX_UART2_BASE_PHYS,148.end = IXP4XX_UART2_BASE_PHYS + 0x0fff,149.flags = IORESOURCE_MEM150}151};152153static struct plat_serial8250_port ixdp425_uart_data[] = {154{155.mapbase = IXP4XX_UART1_BASE_PHYS,156.membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,157.irq = IRQ_IXP4XX_UART1,158.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,159.iotype = UPIO_MEM,160.regshift = 2,161.uartclk = IXP4XX_UART_XTAL,162},163{164.mapbase = IXP4XX_UART2_BASE_PHYS,165.membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,166.irq = IRQ_IXP4XX_UART2,167.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,168.iotype = UPIO_MEM,169.regshift = 2,170.uartclk = IXP4XX_UART_XTAL,171},172{ },173};174175static struct platform_device ixdp425_uart = {176.name = "serial8250",177.id = PLAT8250_DEV_PLATFORM,178.dev.platform_data = ixdp425_uart_data,179.num_resources = 2,180.resource = ixdp425_uart_resources181};182183/* Built-in 10/100 Ethernet MAC interfaces */184static struct eth_plat_info ixdp425_plat_eth[] = {185{186.phy = 0,187.rxq = 3,188.txreadyq = 20,189}, {190.phy = 1,191.rxq = 4,192.txreadyq = 21,193}194};195196static struct platform_device ixdp425_eth[] = {197{198.name = "ixp4xx_eth",199.id = IXP4XX_ETH_NPEB,200.dev.platform_data = ixdp425_plat_eth,201}, {202.name = "ixp4xx_eth",203.id = IXP4XX_ETH_NPEC,204.dev.platform_data = ixdp425_plat_eth + 1,205}206};207208static struct platform_device *ixdp425_devices[] __initdata = {209&ixdp425_i2c_gpio,210&ixdp425_flash,211#if defined(CONFIG_MTD_NAND_PLATFORM) || \212defined(CONFIG_MTD_NAND_PLATFORM_MODULE)213&ixdp425_flash_nand,214#endif215&ixdp425_uart,216&ixdp425_eth[0],217&ixdp425_eth[1],218};219220static void __init ixdp425_init(void)221{222ixp4xx_sys_init();223224ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);225ixdp425_flash_resource.end =226IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;227228#if defined(CONFIG_MTD_NAND_PLATFORM) || \229defined(CONFIG_MTD_NAND_PLATFORM_MODULE)230ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),231ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;232233gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT);234235/* Configure expansion bus for NAND Flash */236*IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |237IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */238IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */239IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/240IXP4XX_EXP_BUS_WR_EN |241IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */242#endif243244if (cpu_is_ixp43x()) {245ixdp425_uart.num_resources = 1;246ixdp425_uart_data[1].flags = 0;247}248249platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));250}251252#ifdef CONFIG_ARCH_IXDP425253MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")254/* Maintainer: MontaVista Software, Inc. */255.map_io = ixp4xx_map_io,256.init_irq = ixp4xx_init_irq,257.timer = &ixp4xx_timer,258.boot_params = 0x0100,259.init_machine = ixdp425_init,260MACHINE_END261#endif262263#ifdef CONFIG_MACH_IXDP465264MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")265/* Maintainer: MontaVista Software, Inc. */266.map_io = ixp4xx_map_io,267.init_irq = ixp4xx_init_irq,268.timer = &ixp4xx_timer,269.boot_params = 0x0100,270.init_machine = ixdp425_init,271MACHINE_END272#endif273274#ifdef CONFIG_ARCH_PRPMC1100275MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")276/* Maintainer: MontaVista Software, Inc. */277.map_io = ixp4xx_map_io,278.init_irq = ixp4xx_init_irq,279.timer = &ixp4xx_timer,280.boot_params = 0x0100,281.init_machine = ixdp425_init,282MACHINE_END283#endif284285#ifdef CONFIG_MACH_KIXRP435286MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")287/* Maintainer: MontaVista Software, Inc. */288.map_io = ixp4xx_map_io,289.init_irq = ixp4xx_init_irq,290.timer = &ixp4xx_timer,291.boot_params = 0x0100,292.init_machine = ixdp425_init,293MACHINE_END294#endif295296297