Patchwork [U-Boot,SPEAr13xx,4/7] spear1310evb: Add support for evb machine

login
register
mail settings
Submitter Vipin Kumar
Date Nov. 2, 2012, 5:39 p.m.
Message ID <d066a31ed501de59ab97dc8c633b572f8f74991d.1351877394.git.vipin.kumar@st.com>
Download mbox | patch
Permalink /patch/196697/
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/spear13xx/Makefile           |   1 +
 board/st/spear13xx/spear1310evb.c     |  93 ++++++++++++++++++++++++++++
 board/st/spear13xx/spear13xx_common.c |   2 +
 boards.cfg                            |   3 +
 include/configs/spear1310-evb.h       | 113 ++++++++++++++++++++++++++++++++++
 include/configs/spear1310.h           |  35 +++++++++++
 7 files changed, 248 insertions(+)
 create mode 100644 board/st/spear13xx/spear1310evb.c
 create mode 100644 include/configs/spear1310-evb.h
 create mode 100644 include/configs/spear1310.h

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index fe74c6e..f97b2cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -747,6 +747,7 @@  Vipin Kumar <vipin.kumar@st.com>
 	spear320	ARM926EJS (spear320 Soc)
 	spear320-hmi	ARM926EJS (spear320 SoC)
 	spear600	ARM926EJS (spear600 Soc)
+	spear1310-evb	ARM ARMV7 (spear1310 SoC)
 	spear1340-evb	ARM ARMV7 (spear1340 SoC)
 
 Sergey Lapin <slapin@ossfans.org>
diff --git a/board/st/spear13xx/Makefile b/board/st/spear13xx/Makefile
index 73a9450..abddc7b 100644
--- a/board/st/spear13xx/Makefile
+++ b/board/st/spear13xx/Makefile
@@ -29,6 +29,7 @@  SOBJS-y	:=
 COBJS-y	:=
 
 COBJS-y	+= spear13xx_common.o
+COBJS-$(CONFIG_MACH_SPEAR1310EVB) += spear1310evb.o
 COBJS-$(CONFIG_MACH_SPEAR1340EVB) += spear1340evb.o
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/board/st/spear13xx/spear1310evb.c b/board/st/spear13xx/spear1310evb.c
new file mode 100644
index 0000000..dab298c
--- /dev/null
+++ b/board/st/spear13xx/spear1310evb.c
@@ -0,0 +1,93 @@ 
+/*
+ * (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 <netdev.h>
+#include <nand.h>
+#include <phy.h>
+#include <linux/mtd/fsmc_nand.h>
+#include <asm/arch/hardware.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)
+{
+	spear1310_pins_default();
+
+	spear1310_enable_pins(PMX_FSMCNAND, PMX_NAND_8BIT);
+	spear1310_enable_pins(PMX_UART0, PMX_UART_SIMPLE);
+	spear1310_enable_pins(PMX_I2C0, 0);
+	spear1310_enable_pins(PMX_SSP0, PMX_SSP_CS0);
+	spear1310_enable_pins(PMX_SMI, PMX_SMI_2CHIPS);
+	spear1310_enable_pins(PMX_SDMMC, 0);
+	spear1310_enable_pins(PMX_ETH0, PMX_ETH_GMII);
+
+	return 0;
+}
+#endif
+
+#if defined(CONFIG_CMD_NAND)
+/*
+ * board_nand_init - Board specific NAND initialization
+ */
+void board_nand_init(void)
+{
+#if defined(CONFIG_NAND_FSMC)
+	fsmc_nand_init(&nand_chip[0]);
+#endif
+}
+#endif
+
+#if defined(CONFIG_CMD_NET)
+int board_eth_init(bd_t *bis)
+{
+	int ret = 0;
+	u32 interface = PHY_INTERFACE_MODE_MII;
+#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_DW_AUTONEG)
+	interface = PHY_INTERFACE_MODE_GMII;
+#endif
+	if (designware_initialize(0, CONFIG_SYS_ETH_BASE, CONFIG_DW0_PHY,
+				interface) >= 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/spear13xx/spear13xx_common.c b/board/st/spear13xx/spear13xx_common.c
index b14e3fb..d996c34 100644
--- a/board/st/spear13xx/spear13xx_common.c
+++ b/board/st/spear13xx/spear13xx_common.c
@@ -34,6 +34,8 @@  int checkboard(void)
 {
 #ifdef CONFIG_MACH_SPEAR1340EVB
 	printf("BOARD: SPEAr1340-EVB\n");
+#elif defined(CONFIG_MACH_SPEAR1310EVB)
+	printf("BOARD: SPEAr1310-EVB\n");
 #else
 #error BOARD not supported
 #endif
diff --git a/boards.cfg b/boards.cfg
index 0214abe..aecee77 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -269,6 +269,9 @@  origen			     arm	 armv7	     origen		 samsung	exynos
 s5pc210_universal            arm         armv7       universal_c210      samsung        exynos
 smdk5250		     arm	 armv7	     smdk5250		 samsung	exynos
 smdkv310		     arm	 armv7	     smdkv310		 samsung	exynos
+spear1310                    arm         armv7       spear13xx           st             spear13xx       spear1310-evb:spear1310
+spear1310_nand               arm         armv7       spear13xx           st             spear13xx       spear1310-evb:spear1310,nand
+spear1310_usbtty             arm         armv7       spear13xx           st             spear13xx       spear1310-evb:spear1310,usbtty
 spear1340                    arm         armv7       spear13xx           st             spear13xx       spear1340-evb:spear1340
 spear1340_nand               arm         armv7       spear13xx           st             spear13xx       spear1340-evb:spear1340,nand
 spear1340_usbtty             arm         armv7       spear13xx           st             spear13xx       spear1340-evb:spear1340,usbtty
diff --git a/include/configs/spear1310-evb.h b/include/configs/spear1310-evb.h
new file mode 100644
index 0000000..6c21cf4
--- /dev/null
+++ b/include/configs/spear1310-evb.h
@@ -0,0 +1,113 @@ 
+/*
+ * (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_SPEAR1310EVB
+#define CONFIG_MACH_TYPE			2881
+
+/* Timer configurations */
+#define CONFIG_ARMV7_CA9LTIMER
+#define CONFIG_ARMV7_LTMR_CLK			250000000
+
+/* ARASAN SD MMC configuration */
+#if !defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_SPEAR_SDHCI
+#endif
+
+/* Designware Ethernet configurations */
+#if !defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_DESIGNWARE_ETH
+	#define CONFIG_DW_SEARCH_PHY
+	#define CONFIG_PHY_GIGE
+	#define CONFIG_DW0_PHY			5
+	#define CONFIG_PHY_RESET_DELAY		10000		/* in usec */
+	#define CONFIG_DW_AUTONEG
+#endif
+
+/* Designware UDC configurations */
+#if defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_DW_OTG
+	#define CONFIG_DW_OTG_PHYINIT
+#endif
+
+/* ST SMI (Serial flash) configurations */
+#define CONFIG_ST_SMI
+
+/* GPIO configurations */
+#define CONFIG_SPEAR_GPIO
+
+/* AMBA PL011 configurations */
+#define CONFIG_PL011_SERIAL
+#define CONFIG_CONS_INDEX			0
+
+/* USB EHCI configurations */
+#if !defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_USB_EHCI_SPEAR
+#endif
+
+/* FSMC NAND configurations */
+#define CONFIG_NAND_FSMC
+#define CONFIG_SYS_FSMC_NAND_8BIT
+
+/* Environment Variable configs */
+#if defined(CONFIG_ENV_IS_IN_FLASH)
+	/* Environment is in serial NOR flash */
+	#define CONFIG_ENV_ADDR			0xE6060000
+	#define CONFIG_ENV_SECT_SIZE		0x00010000
+	#define CONFIG_SPEAR_ROOTFSBLK		"/dev/mtdblock5 "
+	#define CONFIG_BOOTCOMMAND		"" \
+		"bootm 0xe6080000 - 0xe6070000"
+
+#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)/spear13xx_uImage\0"	\
+	"loaddtb=tftpboot 0x800000 $(rootpath)/spear1310-evb.dtb\0"
+
+#include <configs/spear1310.h>
+#endif
diff --git a/include/configs/spear1310.h b/include/configs/spear1310.h
new file mode 100644
index 0000000..ad348f7
--- /dev/null
+++ b/include/configs/spear1310.h
@@ -0,0 +1,35 @@ 
+/*
+ * (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_SPEAR1310_H
+#define __CONFIG_SPEAR1310_H
+
+#define CONFIG_SOC_SPEAR1310
+
+#if defined(CONFIG_DDR_ECC_ENABLE)
+	#define CONFIG_C3
+	#define CONFIG_SPL_MISC_SUPPORT
+#endif
+
+#include <configs/spear13xx.h>
+#endif /* __CONFIG_SPEAR1310_H */