From patchwork Wed Apr 14 18:45:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Chemparathy X-Patchwork-Id: 92459 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3EIm6b6001446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 14 Apr 2010 18:48:42 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o3EIm5FI008346 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 14 Apr 2010 13:48:06 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o3EIm53L028615 for ; Wed, 14 Apr 2010 13:48:05 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 13FF980769 for ; Wed, 14 Apr 2010 13:47:16 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlep33.itg.ti.com (dlep33.itg.ti.com [157.170.170.112]) by linux.omap.com (Postfix) with ESMTP id 5F81A80630 for ; Wed, 14 Apr 2010 13:45:12 -0500 (CDT) Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o3EIj99B025487; Wed, 14 Apr 2010 13:45:09 -0500 (CDT) Received: from gtrgwdeb (gtrgwdeb.telogy.design.ti.com [158.218.102.24]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o3EIj8Z05978; Wed, 14 Apr 2010 13:45:08 -0500 (CDT) Received: by gtrgwdeb (Postfix, from userid 39959) id CCA1E1E068D; Wed, 14 Apr 2010 14:45:06 -0400 (EDT) From: Cyril Chemparathy To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH v3 16/16] Davinci: tnetv107x evm board initial support Date: Wed, 14 Apr 2010 14:45:02 -0400 Message-Id: <1271270702-28307-17-git-send-email-cyril@ti.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1271270702-28307-16-git-send-email-cyril@ti.com> References: <1271270702-28307-1-git-send-email-cyril@ti.com> <1271270702-28307-2-git-send-email-cyril@ti.com> <1271270702-28307-3-git-send-email-cyril@ti.com> <1271270702-28307-4-git-send-email-cyril@ti.com> <1271270702-28307-5-git-send-email-cyril@ti.com> <1271270702-28307-6-git-send-email-cyril@ti.com> <1271270702-28307-7-git-send-email-cyril@ti.com> <1271270702-28307-8-git-send-email-cyril@ti.com> <1271270702-28307-9-git-send-email-cyril@ti.com> <1271270702-28307-10-git-send-email-cyril@ti.com> <1271270702-28307-11-git-send-email-cyril@ti.com> <1271270702-28307-12-git-send-email-cyril@ti.com> <1271270702-28307-13-git-send-email-cyril@ti.com> <1271270702-28307-14-git-send-email-cyril@ti.com> <1271270702-28307-15-git-send-email-cyril@ti.com> <1271270702-28307-16-git-send-email-cyril@ti.com> Cc: sshtylyov@mvista.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 14 Apr 2010 18:48:44 +0000 (UTC) diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index a67b47b..71f90f8 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig @@ -178,6 +178,13 @@ config DA850_UI_RMII endchoice +config MACH_TNETV107X + bool "TI TNETV107X Reference Platform" + default ARCH_DAVINCI_TNETV107X + depends on ARCH_DAVINCI_TNETV107X + help + Say Y here to select the TI TNETV107X Evaluation Module. + config DAVINCI_MUX bool "DAVINCI multiplexing support" depends on ARCH_DAVINCI diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 62c5116..eab4c0f 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_MACH_DAVINCI_DM6467_EVM) += board-dm646x-evm.o cdce949.o obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o +obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o # Power Management obj-$(CONFIG_CPU_FREQ) += cpufreq.o diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c new file mode 100644 index 0000000..2fa06ec --- /dev/null +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -0,0 +1,281 @@ +/* + * TI TNETV107X EVM board + * + * Author: Cyril Chemparathy + * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ + * + * Derived from: arch/arm/mach-davinci/board-da830-evm.c + * Original copyrights follow. + * + * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* Base addresses for on-chip devices */ +#define TNETV107X_SDIO1_BASE 0x08088800 +#define TNETV107X_ASYNC_EMIF_CNTRL_BASE 0x08200000 +#define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE 0x30000000 +#define TNETV107X_DDR_BASE 0x80000000 + +#define TNETV107X_DMACH_SDIO1_RX 28 +#define TNETV107X_DMACH_SDIO1_TX 29 + +#define TNETV107X_EVM_MMC_WP_GPIO 21 +#define TNETV107X_EVM_MMC_CD_GPIO 24 + +static struct plat_serial8250_port tnetv107x_serial_pdata[] = { + { + .mapbase = TNETV107X_UART0_BASE, + .irq = IRQ_TNETV107X_UART0, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | + UPF_FIXED_TYPE | UPF_IOREMAP, + .type = PORT_AR7, + .iotype = UPIO_MEM32, + .regshift = 2, + }, + { + .mapbase = TNETV107X_UART1_BASE, + .irq = IRQ_TNETV107X_UART1, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | + UPF_FIXED_TYPE | UPF_IOREMAP, + .type = PORT_AR7, + .iotype = UPIO_MEM32, + .regshift = 2, + }, + { + .flags = 0, + }, +}; + +static struct platform_device tnetv107x_serial_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = tnetv107x_serial_pdata, + }, +}; + +static int tnetv107x_evm_mmc_get_ro(int index) +{ + return gpio_get_value(TNETV107X_EVM_MMC_WP_GPIO); +} + +static int tnetv107x_evm_mmc_get_cd(int index) +{ + return !gpio_get_value(TNETV107X_EVM_MMC_CD_GPIO); +} + +static struct resource tnetv107x_evm_mmc_resources[] = { + { /* Memory mapped registers */ + .start = TNETV107X_SDIO1_BASE, + .end = TNETV107X_SDIO1_BASE + 0x0ff, + .flags = IORESOURCE_MEM + }, + { /* MMC interrupt */ + .start = IRQ_TNETV107X_MMC1, + .flags = IORESOURCE_IRQ + }, + { /* SDIO interrupt */ + .start = IRQ_TNETV107X_SDIO1, + .flags = IORESOURCE_IRQ + }, + { /* DMA RX */ + .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO1_RX), + .flags = IORESOURCE_DMA + }, + { /* DMA TX */ + .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO1_TX), + .flags = IORESOURCE_DMA + }, +}; + +static struct davinci_mmc_config tnetv107x_evm_mmc_config = { + .get_cd = tnetv107x_evm_mmc_get_cd, + .get_ro = tnetv107x_evm_mmc_get_ro, + .wires = 4, + .max_freq = 50000000, + .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, + .version = MMC_CTLR_VERSION_1, +}; + +static u64 tnetv107x_evm_mmc_dma_mask = DMA_BIT_MASK(32); + +static struct platform_device tnetv107x_evm_mmc_device = { + .name = "davinci_mmc", + .id = 1, + .dev = { + .dma_mask = &tnetv107x_evm_mmc_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tnetv107x_evm_mmc_config, + }, + .num_resources = ARRAY_SIZE(tnetv107x_evm_mmc_resources), + .resource = tnetv107x_evm_mmc_resources +}; + +static const short tnetv107x_sdio1_pins[] = { + TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1, + TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1, + TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1, + -1 +}; + +const short tnetv107x_uart1_pins[] = { + TNETV107X_UART1_RD, TNETV107X_UART1_TD, + -1 +}; + +static const short tnetv107x_gpio_pins[] = { + TNETV107X_GPIO21, TNETV107X_GPIO24, TNETV107X_GPIO23, + -1 +}; + +static struct mtd_partition tnetv107x_evm_nand_partitions[] = { + /* bootloader (U-Boot, etc) in first 12 sectors */ + { + .name = "bootloader", + .offset = 0, + .size = (12*SZ_128K), + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, + /* bootloader params in the next sector */ + { + .name = "params", + .offset = MTDPART_OFS_NXTBLK, + .size = SZ_128K, + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, + /* kernel */ + { + .name = "kernel", + .offset = MTDPART_OFS_NXTBLK, + .size = SZ_4M, + .mask_flags = 0, + }, + /* file system */ + { + .name = "filesystem", + .offset = MTDPART_OFS_NXTBLK, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0, + } +}; + +static struct davinci_nand_pdata tnetv107x_evm_nand_data = { + .mask_cle = 0x4000, + .mask_ale = 0x2000, + .parts = tnetv107x_evm_nand_partitions, + .nr_parts = ARRAY_SIZE(tnetv107x_evm_nand_partitions), + .ecc_mode = NAND_ECC_HW, +}; + +static struct resource tnetv107x_evm_nand_resources[] = { + { + .start = TNETV107X_ASYNC_EMIF_DATA_CE0_BASE, + .end = TNETV107X_ASYNC_EMIF_DATA_CE0_BASE + + SZ_32K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = TNETV107X_ASYNC_EMIF_CNTRL_BASE, + .end = TNETV107X_ASYNC_EMIF_CNTRL_BASE + + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device tnetv107x_evm_nand_device = { + .name = "davinci_nand", + .id = 0, /* chip select 0 */ + .dev = { + .platform_data = &tnetv107x_evm_nand_data, + }, + .num_resources = ARRAY_SIZE(tnetv107x_evm_nand_resources), + .resource = tnetv107x_evm_nand_resources, +}; + +static struct platform_device *tnetv107x_evm_devices[] __initdata = { + &tnetv107x_serial_device, + &tnetv107x_evm_nand_device, + &tnetv107x_evm_mmc_device, +}; + +static __init void tnetv107x_evm_board_init(void) +{ + int status; + + davinci_cfg_reg_list(tnetv107x_sdio1_pins); + davinci_cfg_reg_list(tnetv107x_uart1_pins); + davinci_cfg_reg_list(tnetv107x_gpio_pins); + + tnetv107x_edma_init(); + tnetv107x_watchdog_init(); + tnetv107x_serial_init(tnetv107x_serial_pdata); + + status = gpio_request(TNETV107X_EVM_MMC_WP_GPIO, "MMC WP\n"); + if (status < 0) { + printk(KERN_ERR "cannot open mmcsd write protect gpio %d\n", + TNETV107X_EVM_MMC_WP_GPIO); + tnetv107x_evm_mmc_config.get_ro = NULL; + } else { + gpio_direction_input(TNETV107X_EVM_MMC_WP_GPIO); + } + + status = gpio_request(TNETV107X_EVM_MMC_CD_GPIO, "MMC CD\n"); + if (status < 0) { + printk(KERN_ERR "cannot open mmcsd card detect gpio %d\n", + TNETV107X_EVM_MMC_CD_GPIO); + tnetv107x_evm_mmc_config.get_cd = NULL; + } else { + gpio_direction_input(TNETV107X_EVM_MMC_CD_GPIO); + } + + platform_add_devices(tnetv107x_evm_devices, + ARRAY_SIZE(tnetv107x_evm_devices)); +} + +#ifdef CONFIG_SERIAL_8250_CONSOLE +static int __init tnetv107x_evm_console_init(void) +{ + return add_preferred_console("ttyS", 1, "115200"); +} +console_initcall(tnetv107x_evm_console_init); +#endif + +static void __init map_io(void) +{ + tnetv107x_init(); +} + +MACHINE_START(TNETV107X, "TNETV107X EVM") + .phys_io = TNETV107X_IO_BASE, + .io_pg_offst = (TNETV107X_IO_VIRT >> 18) & 0xfffc, + .boot_params = (TNETV107X_DDR_BASE + 0x100), + .map_io = map_io, + .init_irq = tnetv107x_irq_init, + .timer = &davinci_timer, + .init_machine = tnetv107x_evm_board_init, +MACHINE_END