Patchwork [U-Boot,SPEAr,Enhancement,6/9] spear320-hmi: Add support for hmi machine

login
register
mail settings
Submitter Vipin Kumar
Date Nov. 2, 2012, 5:39 p.m.
Message ID <4b3498f3c137cae334cb1fbc172da0659d70ed20.1351877331.git.vipin.kumar@st.com>
Download mbox | patch
Permalink /patch/196734/
State New
Delegated to: Vipin Kumar
Headers show

Comments

Vipin Kumar - Nov. 2, 2012, 5:39 p.m.
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 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

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1b2da94..18e9b6c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -745,6 +745,7 @@  Vipin Kumar <vipin.kumar@st.com>
 	spear300	ARM926EJS (spear300 Soc)
 	spear310	ARM926EJS (spear310 Soc)
 	spear320	ARM926EJS (spear320 Soc)
+	spear320-hmi	ARM926EJS (spear320 SoC)
 	spear600	ARM926EJS (spear600 Soc)
 
 Sergey Lapin <slapin@ossfans.org>
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 <common.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <linux/mtd/fsmc_nand.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/generic.h>
+#include <asm/arch/misc.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/pinmux.h>
+
+#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, <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
+ */
+
+#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 <configs/spear320.h>
+#endif /* __CONFIG_H */