[U-Boot] [PATCH] tegra20: add assembly wrapper for lowlevel_init()

Allen Martin amartin at nvidia.com
Wed Aug 8 19:51:26 CEST 2012


lowlevel_init() is called before stack is initialized, so it's not
safe to call directly into C code.  Copy this wrapper from omap that
saves off the ip register and sets up a temporary stack.  This fixes a
hang using CodeSourcery toolchain.

Signed-off-by: Allen Martin <amartin at nvidia.com>
---
 arch/arm/cpu/armv7/tegra20/Makefile        |    5 +--
 arch/arm/cpu/armv7/tegra20/lowlevel_init.S |   48 ++++++++++++++++++++++++++++
 arch/arm/cpu/tegra20-common/ap20.c         |    2 +-
 3 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra20/lowlevel_init.S

diff --git a/arch/arm/cpu/armv7/tegra20/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile
index 5f4035d..2a22f1a 100644
--- a/arch/arm/cpu/armv7/tegra20/Makefile
+++ b/arch/arm/cpu/armv7/tegra20/Makefile
@@ -29,10 +29,11 @@ LIB	=  $(obj)lib$(SOC).o
 
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 COBJS-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o
+SOBJS	+= lowlevel_init.o
 
 COBJS	:= $(COBJS-y)
-SRCS	:= $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
 
 all:	 $(obj).depend $(LIB)
 
diff --git a/arch/arm/cpu/armv7/tegra20/lowlevel_init.S b/arch/arm/cpu/armv7/tegra20/lowlevel_init.S
new file mode 100644
index 0000000..7976dfb
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra20/lowlevel_init.S
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * Derived from code that is:
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *  Aneesh V	<aneesh at ti.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 <asm/arch/tegra20.h>
+#include <linux/linkage.h>
+
+ENTRY(lowlevel_init)
+	/*
+	 * Setup a temporary stack
+	 */
+	ldr	sp, =LOW_LEVEL_SRAM_STACK
+
+	/*
+	 * Save the old lr(passed in ip) and the current lr to stack
+	 */
+	push	{ip, lr}
+
+	/*
+	 * go setup pll, mux, memory
+	 */
+	bl	s_init
+	pop	{ip, pc}
+ENDPROC(lowlevel_init)
diff --git a/arch/arm/cpu/tegra20-common/ap20.c b/arch/arm/cpu/tegra20-common/ap20.c
index 2d4705a..00588da 100644
--- a/arch/arm/cpu/tegra20-common/ap20.c
+++ b/arch/arm/cpu/tegra20-common/ap20.c
@@ -114,7 +114,7 @@ static void init_pmc_scratch(void)
 	writel(odmdata, &pmc->pmc_scratch20);
 }
 
-void lowlevel_init(void)
+void s_init(void)
 {
 	/* Init PMC scratch memory */
 	init_pmc_scratch();
-- 
1.7.9.5



More information about the U-Boot mailing list