From patchwork Fri Nov 2 17:39:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Kumar X-Patchwork-Id: 196734 X-Patchwork-Delegate: vipin.kumar@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 777D02C007A for ; Sat, 3 Nov 2012 05:24:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7633C4B22D; Fri, 2 Nov 2012 19:20:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AeZx2LCIFTaC; Fri, 2 Nov 2012 19:20:22 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F5484AFA1; Fri, 2 Nov 2012 19:17:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7A674AF8D for ; Fri, 2 Nov 2012 19:17:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XmpvuVi2agHt for ; Fri, 2 Nov 2012 19:17:34 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com [207.126.144.113]) by theia.denx.de (Postfix) with ESMTPS id 1199F4AEC3 for ; Fri, 2 Nov 2012 19:16:48 +0100 (CET) Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKUJQOD0rrwcjY9+kKZP59sHOpA+AZ8eH/@postini.com; Fri, 02 Nov 2012 18:16:50 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 538E6139; Fri, 2 Nov 2012 17:35:14 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas2.st.com [10.80.176.10]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 8319B107D; Fri, 2 Nov 2012 17:43:27 +0000 (GMT) Received: from localhost (10.251.136.62) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.245.1; Sat, 3 Nov 2012 01:43:26 +0800 From: Vipin Kumar To: Date: Fri, 2 Nov 2012 23:09:40 +0530 Message-ID: <4b3498f3c137cae334cb1fbc172da0659d70ed20.1351877331.git.vipin.kumar@st.com> X-Mailer: git-send-email 1.7.10.rc2.10.gb47606 In-Reply-To: <5b2a27f38a3e2359d4667b59fd8243d0ae3212cc.1351877331.git.vipin.kumar@st.com> References: <5b2a27f38a3e2359d4667b59fd8243d0ae3212cc.1351877331.git.vipin.kumar@st.com> MIME-Version: 1.0 Cc: sr@denx.de, spear-devel@list.st.com Subject: [U-Boot] [SPEAr Enhancement PATCH 6/9] spear320-hmi: Add support for hmi machine X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Vipin Kumar --- MAINTAINERS | 1 + board/st/spear/Makefile | 1 + board/st/spear/spear320hmi.c | 120 +++++++++++++++++++++++++++++++++++++++++ board/st/spear/spear_common.c | 2 + boards.cfg | 2 + include/configs/spear320-hmi.h | 117 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 243 insertions(+) create mode 100644 board/st/spear/spear320hmi.c create mode 100644 include/configs/spear320-hmi.h diff --git a/MAINTAINERS b/MAINTAINERS index 1b2da94..18e9b6c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -745,6 +745,7 @@ Vipin Kumar spear300 ARM926EJS (spear300 Soc) spear310 ARM926EJS (spear310 Soc) spear320 ARM926EJS (spear320 Soc) + spear320-hmi ARM926EJS (spear320 SoC) spear600 ARM926EJS (spear600 Soc) Sergey Lapin diff --git a/board/st/spear/Makefile b/board/st/spear/Makefile index f925c19..d2634d8 100644 --- a/board/st/spear/Makefile +++ b/board/st/spear/Makefile @@ -38,6 +38,7 @@ endif COBJS-$(CONFIG_MACH_SPEAR300EVB) += spear300evb.o COBJS-$(CONFIG_MACH_SPEAR310EVB) += spear310evb.o COBJS-$(CONFIG_MACH_SPEAR320EVB) += spear320plc.o +COBJS-$(CONFIG_MACH_SPEAR320HMI) += spear320hmi.o COBJS-$(CONFIG_MACH_SPEAR600EVB) += spear600evb.o COBJS := $(sort $(COBJS-y)) diff --git a/board/st/spear/spear320hmi.c b/board/st/spear/spear320hmi.c new file mode 100644 index 0000000..562bdda --- /dev/null +++ b/board/st/spear/spear320hmi.c @@ -0,0 +1,120 @@ +/* + * (C) Copyright 2012 + * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_CMD_NAND) +static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE]; +#endif + +#if defined(CONFIG_BOARD_EARLY_INIT_F) +int board_early_init_f(void) +{ + spear320_select_mode(SPEAR320_EXTENDED_MODE); + + spear320_pins_default(); + + spear320_enable_pins(PMX_I2C0, 0); + spear320_enable_pins(PMX_SSP0, 0); + spear320_enable_pins(PMX_UART0, PMX_UART_SIMPLE); + spear320_enable_pins(PMX_FSMCNAND, PMX_NAND_8BIT); + spear320_enable_pins(PMX_ETH1_ETH2, PMX_ETH_RMII); + spear320_enable_pins(PMX_SDMMC, PMX_SDMMC_CD12); + + /* GPIO50 is used for card power on */ + spear320_configure_pin(50, PMX_GPIO); + spear320_plgpio_set(50, 0); + + return 0; +} +#endif + +#if defined(CONFIG_CMD_NAND) +/* + * board_nand_init - Board specific NAND initialization + * @nand: mtd private chip structure + * + * Called by nand_init_chip to initialize the board specific functions + */ +void board_nand_init() +{ + struct misc_regs *const misc_regs_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + struct nand_chip *nand = &nand_chip[0]; + + if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + MISC_SOCCFG30) || + ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + MISC_SOCCFG31)) { + + fsmc_nand_init(nand); + } + + return; +} +#endif + +#if defined(CONFIG_CMD_NET) +int board_eth_init(bd_t *bis) +{ + int ret = 0; + +#if defined(CONFIG_DESIGNWARE_ETH) + u32 interface = PHY_INTERFACE_MODE_MII; + if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY, + interface) >= 0) + ret++; +#endif +#if defined(CONFIG_MACB) + if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE, + CONFIG_MACB0_PHY) >= 0) + ret++; + if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE, + CONFIG_MACB1_PHY) >= 0) + ret++; +#endif + return ret; +} +#endif + +#if defined(CONFIG_CMD_MMC) +int board_mmc_init(bd_t *bis) +{ + int ret = 0; +#if defined(CONFIG_SPEAR_SDHCI) + if (spear_sdhci_init(CONFIG_SYS_MMC_BASE, 24000000, 6000000, 0) >= 0) + ret++; +#endif + return ret; +} +#endif diff --git a/board/st/spear/spear_common.c b/board/st/spear/spear_common.c index 2257779..9144dd8 100644 --- a/board/st/spear/spear_common.c +++ b/board/st/spear/spear_common.c @@ -47,6 +47,8 @@ int checkboard(void) printf("BOARD: SPEAr310-EVB\n"); #elif defined(CONFIG_MACH_SPEAR320EVB) printf("BOARD: SPEAr320-PLC\n"); +#elif defined(CONFIG_MACH_SPEAR320HMI) + printf("BOARD: SPEAr320-HMI\n"); #elif defined(CONFIG_MACH_SPEAR600EVB) printf("BOARD: SPEAr600-EVB\n"); #else diff --git a/boards.cfg b/boards.cfg index 3b0348a..0375e9e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -210,6 +210,8 @@ spear320 arm arm926ejs spear st spear320_pnor arm arm926ejs spear st spear spear320-evb:spear320,pnor spear320_nand arm arm926ejs spear st spear spear320-evb:spear320,nand spear320_usbtty arm arm926ejs spear st spear spear320-evb:spear320,usbtty +spear320_hmi arm arm926ejs spear st spear spear320-hmi:spear320 +spear320_hmi_nand arm arm926ejs spear st spear spear320-hmi:spear320,nand spear600 arm arm926ejs spear st spear spear600-evb:spear600 spear600_nand arm arm926ejs spear st spear spear600-evb:spear600,nand spear600_usbtty arm arm926ejs spear st spear spear600-evb:spear600,usbtty diff --git a/include/configs/spear320-hmi.h b/include/configs/spear320-hmi.h new file mode 100644 index 0000000..4649ed4 --- /dev/null +++ b/include/configs/spear320-hmi.h @@ -0,0 +1,117 @@ +/* + * (C) Copyright 2012 + * Vipin Kumar, STMicroelectronics, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#if defined(CONFIG_usbtty) + #define CONFIG_SPEAR_USBTTY +#endif + +#if defined(CONFIG_nand) + #define CONFIG_ENV_IS_IN_NAND +#else + #define CONFIG_ENV_IS_IN_FLASH +#endif + +#define CONFIG_MACH_SPEAR320HMI +#define CONFIG_MACH_TYPE MACH_TYPE_SPEAR320 + +/* ARASAN SD MMC configuration */ +#if !defined(CONFIG_SPEAR_USBTTY) + #define CONFIG_SPEAR_SDHCI +#endif + +/* MACB configurations */ +#if !defined(CONFIG_SPEAR_USBTTY) + #define CONFIG_MACB + #define CONFIG_MACB0_PHY 0x01 + #define CONFIG_MACB1_PHY 0x00 +#endif + +/* Designware I2C configurations */ +#if !defined(CONFIG_SPEAR_USBTTY) + #define CONFIG_DW_I2C + #define CONFIG_I2C_CHIPADDRESS 0x50 + #define CONFIG_SYS_I2C_SPEED 400000 + #define CONFIG_SYS_I2C_SLAVE 0x02 +#endif + +/* AMBA PL011 configurations */ +#define CONFIG_PL011_SERIAL +#define CONFIG_CONS_INDEX 0 + +/* GPIO configurations */ +#define CONFIG_SPEAR_GPIO + +/* USB EHCI configurations */ +#if !defined(CONFIG_SPEAR_USBTTY) + #define CONFIG_USB_EHCI_SPEAR +#endif + +/* Designware UDC configurations */ +#if defined(CONFIG_SPEAR_USBTTY) + #define CONFIG_DW_UDC +#endif + +/* FSMC NAND configurations */ +#define CONFIG_NAND_FSMC +#define CONFIG_SYS_FSMC_NAND_8BIT + +/* Flash configurations */ +#define CONFIG_ST_SMI + +/* SPL support */ +#define CONFIG_SPL +#define CONFIG_SPEAR_DDR_2HCLK +#define CONFIG_DDR_MT47H64M16 + +/* Environment Variable configs */ +#if defined(CONFIG_ENV_IS_IN_FLASH) + /* Environment is in serial NOR flash */ + #define CONFIG_ENV_ADDR 0xF8060000 + #define CONFIG_ENV_SECT_SIZE 0x00010000 + #define CONFIG_SPEAR_ROOTFSBLK "/dev/mtdblock5 " + #define CONFIG_BOOTCOMMAND \ + "bootm 0xf8080000 - 0xf8070000" +#elif defined(CONFIG_ENV_IS_IN_NAND) + /* Environment is in NAND */ + #define CONFIG_ENV_OFFSET 0x00140000 + #define CONFIG_SPEAR_ROOTFSBLK "/dev/mtdblock11 " + + #define CONFIG_BOOTCOMMAND "" \ + "nand read.jffs2 0x800000 0x180000 0x020000; " \ + "nand read.jffs2 0x900000 0x1c0000 0x4C0000; " \ + "bootm 0x900000 - 0x800000" +#endif + +#define CONFIG_BOOTARGS "console=ttyAMA0,115200 " \ + "root="CONFIG_SPEAR_ROOTFSBLK \ + "rootfstype=jffs2" + +#define CONFIG_BOARD_EXTRA_ENV "" \ + "loados=tftpboot 0x900000 $(rootpath)/spear3xx_uImage\0" \ + "loaddtb=tftpboot 0x800000 $(rootpath)/spear320-hmi.dtb\0" + +#include +#endif /* __CONFIG_H */