diff mbox

[U-Boot,SPEAr13xx,3/7] spear1340evb: Add support for evb machine

Message ID 248550f5e28a83f28dc3e117594184a9039e4fee.1351877394.git.vipin.kumar@st.com
State Deferred
Delegated to: Vipin Kumar
Headers show

Commit Message

Vipin Kumar Nov. 2, 2012, 5:39 p.m. UTC
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 MAINTAINERS                           |   1 +
 board/st/spear13xx/Makefile           |  50 ++++++++++++++
 board/st/spear13xx/config.mk          |  26 ++++++++
 board/st/spear13xx/spear1340evb.c     |  94 +++++++++++++++++++++++++++
 board/st/spear13xx/spear13xx_common.c |  49 ++++++++++++++
 boards.cfg                            |   3 +
 include/configs/spear1340-evb.h       | 119 ++++++++++++++++++++++++++++++++++
 include/configs/spear1340.h           |  30 +++++++++
 include/configs/spear13xx.h           |  72 ++++++++++++++++++++
 9 files changed, 444 insertions(+)
 create mode 100644 board/st/spear13xx/Makefile
 create mode 100644 board/st/spear13xx/config.mk
 create mode 100644 board/st/spear13xx/spear1340evb.c
 create mode 100644 board/st/spear13xx/spear13xx_common.c
 create mode 100644 include/configs/spear1340-evb.h
 create mode 100644 include/configs/spear1340.h
 create mode 100644 include/configs/spear13xx.h
diff mbox

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 18e9b6c..fe74c6e 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)
+	spear1340-evb	ARM ARMV7 (spear1340 SoC)
 
 Sergey Lapin <slapin@ossfans.org>
 
diff --git a/board/st/spear13xx/Makefile b/board/st/spear13xx/Makefile
new file mode 100644
index 0000000..73a9450
--- /dev/null
+++ b/board/st/spear13xx/Makefile
@@ -0,0 +1,50 @@ 
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+SOBJS-y	:=
+COBJS-y	:=
+
+COBJS-y	+= spear13xx_common.o
+COBJS-$(CONFIG_MACH_SPEAR1340EVB) += spear1340evb.o
+
+COBJS	:= $(sort $(COBJS-y))
+SOBJS	:= $(sort $(SOBJS-y))
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/st/spear13xx/config.mk b/board/st/spear13xx/config.mk
new file mode 100644
index 0000000..9d5de65
--- /dev/null
+++ b/board/st/spear13xx/config.mk
@@ -0,0 +1,26 @@ 
+#
+# Copyright (C) 2012 ST Microelectronics
+# Vipin Kumar <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_SPL_BUILD
+ALL-y += $(obj)u-boot.img
+endif
diff --git a/board/st/spear13xx/spear1340evb.c b/board/st/spear13xx/spear1340evb.c
new file mode 100644
index 0000000..57efe8a
--- /dev/null
+++ b/board/st/spear13xx/spear1340evb.c
@@ -0,0 +1,94 @@ 
+/*
+ * (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)
+{
+	spear1340_pins_default();
+
+	spear1340_enable_pins(PMX_FSMCNAND, PMX_NAND_8BIT);
+	spear1340_enable_pins(PMX_UART0, PMX_UART_SIMPLE);
+	spear1340_enable_pins(PMX_I2C0, 0);
+	spear1340_enable_pins(PMX_SSP0, PMX_SSP_CS0);
+	spear1340_enable_pins(PMX_SSP0, PMX_SSP_CS1);
+	spear1340_enable_pins(PMX_SMI, 0);
+	spear1340_enable_pins(PMX_SDMMC, 0);
+	spear1340_enable_pins(PMX_ETH0, PMX_ETH_RGMII);
+
+	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_RMII;
+#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_DW_AUTONEG)
+	interface = PHY_INTERFACE_MODE_RGMII;
+#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
new file mode 100644
index 0000000..b14e3fb
--- /dev/null
+++ b/board/st/spear13xx/spear13xx_common.c
@@ -0,0 +1,49 @@ 
+/*
+ * (C) Copyright 2009
+ * 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 <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void lowlevel_init(void)
+{
+}
+
+int checkboard(void)
+{
+#ifdef CONFIG_MACH_SPEAR1340EVB
+	printf("BOARD: SPEAr1340-EVB\n");
+#else
+#error BOARD not supported
+#endif
+	return 0;
+}
+
+int dram_init(void)
+{
+	/* Store complete RAM size and return */
+	gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, SDRAM_MAX_SIZE);
+
+	return 0;
+}
diff --git a/boards.cfg b/boards.cfg
index 0375e9e..0214abe 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
+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
 trats                        arm         armv7       trats               samsung        exynos
 harmony                      arm         armv7:arm720t harmony           nvidia         tegra20
 seaboard                     arm         armv7:arm720t seaboard          nvidia         tegra20
diff --git a/include/configs/spear1340-evb.h b/include/configs/spear1340-evb.h
new file mode 100644
index 0000000..05ae8fb
--- /dev/null
+++ b/include/configs/spear1340-evb.h
@@ -0,0 +1,119 @@ 
+/*
+ * (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_SPEAR1340EVB
+#define CONFIG_MACH_TYPE			3394
+
+/* Timer configurations */
+#define CONFIG_ARMV7_CA9LTIMER
+#define CONFIG_ARMV7_LTMR_CLK			250000000
+
+/* AMBA PL022 SSP-SPI configurations */
+#if !defined(CONFIG_SPEAR_USBTTY)
+	#define CONFIG_PL022_SPI
+	#define CONFIG_SPI_FLASH
+#endif
+
+/* 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			1
+	#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/mtdblock6 "
+	#define CONFIG_BOOTCOMMAND		"" \
+		"bootm 0xe6080000 - 0xe6070000"
+
+#elif defined(CONFIG_ENV_IS_IN_NAND)
+	/* Environment is in NAND */
+	#define CONFIG_ENV_OFFSET		0x00400000
+	#define CONFIG_SPEAR_ROOTFSBLK		"/dev/mtdblock12 "
+
+	#define CONFIG_BOOTCOMMAND		"" \
+		"nand read.jffs2 0x800000 0x500000 0x020000; " \
+		"nand read.jffs2 0x900000 0x600000 0x500000; " \
+		"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)/spear1340-evb.dtb\0"
+
+#include <configs/spear1340.h>
+#endif
diff --git a/include/configs/spear1340.h b/include/configs/spear1340.h
new file mode 100644
index 0000000..8cf3d1a
--- /dev/null
+++ b/include/configs/spear1340.h
@@ -0,0 +1,30 @@ 
+/*
+ * (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_SPEAR1340_H
+#define __CONFIG_SPEAR1340_H
+
+#define CONFIG_SOC_SPEAR1340
+
+#include <configs/spear13xx.h>
+#endif /* __CONFIG_SPEAR1340_H */
diff --git a/include/configs/spear13xx.h b/include/configs/spear13xx.h
new file mode 100644
index 0000000..fc40e14
--- /dev/null
+++ b/include/configs/spear13xx.h
@@ -0,0 +1,72 @@ 
+/*
+ * (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_SPEAR13XX_H
+#define __CONFIG_SPEAR13XX_H
+
+#define CONFIG_ARCH_SPEAR13XX
+
+/* AMBA PL022 SPI configurations */
+#if defined(CONFIG_PL022_SPI)
+	#define CONFIG_SYS_SPI_CLK		83000000
+#endif
+
+/* Designware Ethernet configurations */
+#if defined(CONFIG_DESIGNWARE_ETH)
+	#define CONFIG_DW_ALTDESCRIPTOR
+#endif
+
+/* ST SMI (Serial flash) configurations */
+#if defined(CONFIG_ST_SMI)
+	#define CONFIG_SYS_MAX_FLASH_BANKS	2
+	#define CONFIG_SYS_FLASH_BASE		0xE6000000
+	#define CONFIG_SYS_CS1_FLASH_BASE	0xE7000000
+	#define CONFIG_SYS_FLASH_BANK_SIZE	0x01000000
+	#define CONFIG_SYS_FLASH_ADDR_BASE	{CONFIG_SYS_FLASH_BASE, \
+						CONFIG_SYS_CS1_FLASH_BASE}
+	#define CONFIG_SYS_MAX_FLASH_SECT	128
+#endif
+
+/* PL011 UART configurations */
+#if defined(CONFIG_PL011_SERIAL)
+	#define CONFIG_PL011_CLOCK		(48 * 1000 * 1000)
+	#define CONFIG_SYS_SERIAL0		0xE0000000
+	#define CONFIG_PL01x_PORTS		{(void *)CONFIG_SYS_SERIAL0}
+
+#endif
+
+/* FSMC NAND UART configurations */
+#if defined(CONFIG_NAND_FSMC)
+	#define CONFIG_SYS_NAND_BASE		0xB0800000
+#endif
+
+/* Timer configurations */
+#if defined(CONFIG_ARMV7_CA9LTIMER)
+#endif
+
+/* Internal memory address for spear3xx */
+#define CONFIG_SYS_INIT_SP_ADDR			(0xB3800000 + 0x8000 - \
+						GENERATED_GBL_DATA_SIZE)
+
+#include <configs/spear.h>
+#endif /* __CONFIG_SPEAR13XX_H */