split tegra arm7 code into separate SPL
cover split tegra arm7 code into separate SPL
This patch series fixes a long standing problem with the tegra2 u-boot build. Tegra2 contains an ARM7TDMI boot processor and a Cortex A9 main processor. Prior to this patch series this was accomplished by #ifdefing out any armv7 code from the early boot sequence and creating a single binary that runs on both both the ARM7TDMI and A9. This was very fragile as changes to compiler options or any additions or rearranging of the early boot code could add additional armv7 specific code causing it to fail on the ARM7TDMI.
This patch series pulls all the armv4t code out into a separate SPL that does nothing more than initialize the A9 and transfer control to it. The resultint SPL and armv7 u-boot are concatenated together into a single image.
[PATCH 1/9] tegra2: move tegra2 SoC code to arch/arm/cpu/tegra2-common [PATCH 2/9] mkconfig: add support for SPL CPU
[PATCH 3/9] ARM: Fix arm720t SPL build
[PATCH 4/9] tegra: Add SPL build support to tegra boards [PATCH 5/9] ARM: add tegra support to arm720t
[PATCH 6/9] tegra: enable SPL build for seaboard
[PATCH 7/9] tegra: add u-boot.t2 target
[PATCH 8/9] tegra2: Remove CPU init code from tegra2 u-boot [PATCH 9/9] tegra2: Remove USE_PRIVATE_LIBGCC and armv4t build flags
Makefile | 9 + arch/arm/cpu/arm720t/cpu.c | 3 +- arch/arm/cpu/arm720t/interrupts.c | 5 +- arch/arm/cpu/arm720t/start.S | 19 +- arch/arm/cpu/arm720t/tegra2/Makefile | 48 ++ arch/arm/cpu/arm720t/tegra2/board.h | 25 + arch/arm/cpu/arm720t/tegra2/cpu.c | 259 +++++++ arch/arm/cpu/arm720t/tegra2/cpu.h | 99 +++ arch/arm/cpu/arm720t/tegra2/spl.c | 133 ++++ arch/arm/cpu/armv7/start.S | 2 - arch/arm/cpu/armv7/tegra2/Makefile | 12 +- arch/arm/cpu/armv7/tegra2/ap20.c | 324 --------- arch/arm/cpu/armv7/tegra2/ap20.h | 102 --- arch/arm/cpu/armv7/tegra2/board.c | 151 ---- arch/arm/cpu/armv7/tegra2/clock.c | 1052 --------------------------- arch/arm/cpu/armv7/tegra2/config.mk | 8 - arch/arm/cpu/armv7/tegra2/funcmux.c | 184 ----- arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 41 -- arch/arm/cpu/armv7/tegra2/pinmux.c | 572 --------------- arch/arm/cpu/armv7/tegra2/sys_info.c | 35 - arch/arm/cpu/armv7/tegra2/timer.c | 111 --- arch/arm/cpu/tegra2-common/Makefile | 56 ++ arch/arm/cpu/tegra2-common/ap20.c | 73 ++ arch/arm/cpu/tegra2-common/board.c | 129 ++++ arch/arm/cpu/tegra2-common/clock.c | 1052 +++++++++++++++++++++++++++ arch/arm/cpu/tegra2-common/funcmux.c | 184 +++++ arch/arm/cpu/tegra2-common/lowlevel_init.S | 41 ++ arch/arm/cpu/tegra2-common/pinmux.c | 572 +++++++++++++++ arch/arm/cpu/tegra2-common/sys_info.c | 35 + arch/arm/cpu/tegra2-common/timer.c | 111 +++ arch/arm/include/asm/arch-tegra2/hardware.h | 29 + board/nvidia/common/Makefile | 2 +- board/nvidia/common/board.c | 2 + board/nvidia/seaboard/config.mk | 1 + boards.cfg | 7 +- doc/README.SPL | 12 + include/configs/seaboard.h | 9 + include/configs/tegra2-common.h | 23 +- mkconfig | 15 +- spl/Makefile | 4 + 40 files changed, 2949 insertions(+), 2602 deletions(-)
--
nvpublic
PATCH 1/9 tegra2: move tegra2 SoC code to arch/arm/cpu/tegra2-common
In preparation for splitting out the armv4t code from tegra2, move the tegra2 SoC code to arch/arm/cpu/tegra2-common. This code will be compiled armv4t for the arm7tdmi and armv7 for the cortex A9.
---
Makefile | 3 ++
arch/arm/cpu/armv7/tegra2/Makefile | 12 +----
arch/arm/cpu/tegra2-common/Makefile | 56 ++++++++++++++++++++
.../arm/cpu/{armv7/tegra2 => tegra2-common}/ap20.c | 0
.../arm/cpu/{armv7/tegra2 => tegra2-common}/ap20.h | 0
.../cpu/{armv7/tegra2 => tegra2-common}/board.c | 0
.../cpu/{armv7/tegra2 => tegra2-common}/clock.c | 0
.../cpu/{armv7/tegra2 => tegra2-common}/funcmux.c | 0
.../tegra2 => tegra2-common}/lowlevel_init.S | 0
.../cpu/{armv7/tegra2 => tegra2-common}/pinmux.c | 0
.../cpu/{armv7/tegra2 => tegra2-common}/sys_info.c | 0
.../cpu/{armv7/tegra2 => tegra2-common}/timer.c | 0
spl/Makefile | 4 ++
13 files changed, 65 insertions(+), 10 deletions(-)
create mode 100644 arch/arm/cpu/tegra2-common/Makefile
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/ap20.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/ap20.h (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/board.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/clock.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/funcmux.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/lowlevel_init.S (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/pinmux.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/sys_info.c (100%)
rename arch/arm/cpu/{armv7/tegra2 => tegra2-common}/timer.c (100%)Makefile +3 -0
@@ -319,6 +319,9 @@ endif ifeq ($(SOC),exynos) LIBS += $(CPUDIR)/s5p-common/libs5p-common.o endif +ifeq ($(SOC),tegra2) +LIBS += $(OBJTREE)/arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o +endif LIBS := $(addprefix $(obj),$(sort $(LIBS))) .PHONY : $(LIBS)
arch/arm/cpu/armv7/tegra2/Makefile +2 -10
@@ -22,23 +22,15 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - -# The AVP is ARMv4T architecture so we must use special compiler -# flags for any startup files it might use. -CFLAGS_arch/arm/cpu/armv7/tegra2/ap20.o += -march=armv4t -CFLAGS_arch/arm/cpu/armv7/tegra2/clock.o += -march=armv4t - include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -SOBJS := lowlevel_init.o -COBJS-y := ap20.o board.o clock.o funcmux.o pinmux.o sys_info.o timer.o COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o COBJS := $(COBJS-y) -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) all: $(obj).depend $(LIB)
arch/arm/cpu/tegra2-common/Makefile new file +56 -0
56 lines not on this page · raw message
arch/arm/cpu/tegra2-common/ap20.c renamed from arch/arm/cpu/armv7/tegra2/ap20.c +0 -0
arch/arm/cpu/tegra2-common/ap20.h renamed from arch/arm/cpu/armv7/tegra2/ap20.h +0 -0
arch/arm/cpu/tegra2-common/board.c renamed from arch/arm/cpu/armv7/tegra2/board.c +0 -0
arch/arm/cpu/tegra2-common/clock.c renamed from arch/arm/cpu/armv7/tegra2/clock.c +0 -0
arch/arm/cpu/tegra2-common/funcmux.c renamed from arch/arm/cpu/armv7/tegra2/funcmux.c +0 -0
arch/arm/cpu/tegra2-common/lowlevel_init.S renamed from arch/arm/cpu/armv7/tegra2/lowlevel_init.S +0 -0
arch/arm/cpu/tegra2-common/pinmux.c renamed from arch/arm/cpu/armv7/tegra2/pinmux.c +0 -0
arch/arm/cpu/tegra2-common/sys_info.c renamed from arch/arm/cpu/armv7/tegra2/sys_info.c +0 -0
arch/arm/cpu/tegra2-common/timer.c renamed from arch/arm/cpu/armv7/tegra2/timer.c +0 -0
spl/Makefile +4 -0
@@ -62,6 +62,10 @@ ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) LIBS-y += $(CPUDIR)/omap-common/libomap-common.o endif +ifneq ($(CONFIG_TEGRA2),) +LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o +endif + START := $(addprefix $(SPLTREE)/,$(START)) LIBS := $(addprefix $(SPLTREE)/,$(sort $(LIBS-y)))
Signature · 1 line
1.7.9.5
PATCH 2/9 mkconfig: add support for SPL CPU
In reply to Allen MartinAdd support for specifying a differnt CPU for main u-boot and SPL u-boot builds. This is done by adding an optional SPL CPU after the main CPU in boards.cfg as follows:
normal_cpu:spl_cpu
This this case CPU will be set to "normal_cpu" during the main u-boot build and "spl_cpu" during the SPL build.
--- boards.cfg | 5 +++++ doc/README.SPL | 12 ++++++++++++ mkconfig | 15 ++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-)
boards.cfg +5 -0
@@ -11,6 +11,11 @@ # Lines starting with '#' are comments. # Blank lines are ignored. # +# The CPU field takes the form: +# cpu[:spl_cpu] +# If spl_cpu is specified the make variable CPU will be set to this +# during the SPL build. +# # The options field takes the form: # <board config name>[:comma separated config options] # Each config option has the form (value defaults to "1"):
doc/README.SPL +12 -0
@@ -66,3 +66,15 @@ CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) + + +Normally CPU is assumed to be the same between the SPL and normal +u-boot build. However it is possible to specify a different CPU for +the SPL build for cases where the SPL is expected to run on a +different CPU model from the main u-boot. This is done by specifying +an SPL CPU in boards.cfg as follows: + + normal_cpu:spl_cpu + +This this case CPU will be set to "normal_cpu" during the main u-boot +build and "spl_cpu" during the SPL build.
mkconfig +14 -1
@@ -60,6 +60,11 @@ CONFIG_NAME="${1%_config}" arch="$2" cpu="$3" +tmp="${cpu#*:}" +if [ "$tmp" != "$cpu" ] ; then + spl_cpu=$tmp + cpu="${cpu%:*}" +fi if [ "$4" = "-" ] ; then board=${BOARD_NAME} else
@@ -131,7 +136,15 @@ fi # Create include file for Make # echo "ARCH = ${arch}" > config.mk -echo "CPU = ${cpu}" >> config.mk +if [ ! -z "$spl_cpu" ] ; then + echo 'ifeq ($(CONFIG_SPL_BUILD),y)' >> config.mk + echo "CPU = ${spl_cpu}" >> config.mk + echo "else" >> config.mk + echo "CPU = ${cpu}" >> config.mk + echo "endif" >> config.mk +else + echo "CPU = ${cpu}" >> config.mk +fi echo "BOARD = ${board}" >> config.mk [ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
Signature · 1 line
1.7.9.5
PATCH 3/9 ARM: Fix arm720t SPL build
In reply to Allen MartinTake a few SPL fixes from armv7 and apply them to arm720t:
-Use dummy exception handlers for SPL build
-Initialize relocation register r9 to 0 for the case of no relocation -ifdef out interrupt handler code
--- arch/arm/cpu/arm720t/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/cpu/arm720t/start.S +13 -0
@@ -51,6 +51,15 @@ _start: b reset ldr pc, _irq ldr pc, _fiq +#ifdef CONFIG_SPL_BUILD +_undefined_instruction: .word _undefined_instruction +_software_interrupt: .word _software_interrupt +_prefetch_abort: .word _prefetch_abort +_data_abort: .word _data_abort +_not_used: .word _not_used +_irq: .word _irq +_fiq: .word _fiq +#else _undefined_instruction: .word undefined_instruction _software_interrupt: .word software_interrupt _prefetch_abort: .word prefetch_abort
@@ -58,6 +67,7 @@ _data_abort: .word data_abort _not_used: .word not_used _irq: .word irq _fiq: .word fiq +#endif /* CONFIG_SPL_BUILD */ .balignl 16,0xdeadbeef
@@ -167,6 +177,7 @@ stack_setup: adr r0, _start cmp r0, r6 + moveq r9, #0 /* no relocation. relocation offset(r9) = 0 */ beq clear_bss /* skip relocation */ mov r1, r6 /* r1 <- scratch for copy_loop */ ldr r3, _bss_start_ofs
@@ -425,6 +436,7 @@ lock_loop: mov pc, lr +#ifndef CONFIG_SPL_BUILD /* ************************************************************************* *
@@ -587,6 +599,7 @@ fiq: bl do_fiq #endif +#endif /* CONFIG_SPL_BUILD */ #if defined(CONFIG_NETARM) .align 5
Signature · 1 line
1.7.9.5
PATCH 4/9 tegra: Add SPL build support to tegra boards
In reply to Allen MartinInclude board.c for both SPL and non-SPL build. Don't use timer_init from board.c for SPL build.
--- board/nvidia/common/Makefile | 2 +- board/nvidia/common/board.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
board/nvidia/common/Makefile +1 -1
@@ -25,7 +25,7 @@ endif LIB = $(obj)lib$(VENDOR).o -COBJS-y += board.o +COBJS-$(CONFIG_ARMCORTEXA9) += board.o COBJS-$(CONFIG_SPI_UART_SWITCH) += uart-spi-switch.o COBJS := $(COBJS-y)
board/nvidia/common/board.c +2 -0
@@ -43,6 +43,7 @@ const struct tegra2_sysinfo sysinfo = { CONFIG_TEGRA2_BOARD_STRING }; +#ifndef CONFIG_SPL_BUILD /* * Routine: timer_init * Description: init the timestamp and lastinc value
@@ -51,6 +52,7 @@ int timer_init(void) {return 0 ; } +#endif void __pin_mux_usb (void ) {
Signature · 1 line
1.7.9.5
PATCH 4/9 tegra: Add SPL build support to tegra boards
board/nvidia/common/Makefile
Quoted 6 lines · Allen Martin
Include
board.cfor both SPL and non-SPL build. Don't usetimer_initfromboard.cfor SPL build.Signed-off-by Allen Martin <[email protected]>board/nvidia/common/Makefile +0
-0
If we're already not building board.c for non-Cortex A9 (so not for SPL)
board/nvidia/common/board.c const struct tegra2_sysinfo sysinfo = { · line 46
Quoted 6 lines
board/nvidia/common/Makefile +1
-1-COBJS-y += board.o +COBJS-$(CONFIG_ARMCORTEXA9) += board.oboard/nvidia/common/board.c +1
-0+#ifndef CONFIG_SPL_BUILD
I'm not sure that this ifdef is necessary since !CONFIG_SPL_BUILD any time this file is compiled?
PATCH 4/9 tegra: Add SPL build support to tegra boards
Quoted 13 lines · Stephen Warren
board/nvidia/common/Makefile
Quoted 6 lines · Allen Martin
Include
board.cfor both SPL and non-SPL build. Don't usetimer_initfromboard.cfor SPL build.Signed-off-by Allen Martin <[email protected]>board/nvidia/common/Makefile +0
-0If we're already not building
board.cfor non-Cortex A9 (so not for SPL)Quoted 2 lines
board/nvidia/common/Makefile +1
-1-COBJS-y += board.o +COBJS-$(CONFIG_ARMCORTEXA9) += board.o
Quoted 6 lines
board/nvidia/common/board.c const struct tegra2_sysinfo sysinfo = { · line 46
Quoted 3 lines
board/nvidia/common/board.c +1
-0+#ifndef CONFIG_SPL_BUILD I'm not sure that this ifdef is necessary since !CONFIG_SPL_BUILD any time this file is compiled?
Oh you're right, looks like my commit message is wrong too, I'll take another look.
-Allen
Signature · 1 line
nvpublic
PATCH 5/9 ARM: add tegra support to arm720t
In reply to Allen MartinAdd support for tegra arm7 boot processor. This processor is used to power on the Cortex A9 and transfer control to it.
--- arch/arm/cpu/arm720t/cpu.c | 3 +- arch/arm/cpu/arm720t/interrupts.c | 5 +- arch/arm/cpu/arm720t/start.S | 6 +- arch/arm/cpu/arm720t/tegra2/Makefile | 48 +++++ arch/arm/cpu/arm720t/tegra2/board.h | 25 +++ arch/arm/cpu/arm720t/tegra2/cpu.c | 259 +++++++++++++++++++++++++++ arch/arm/cpu/arm720t/tegra2/cpu.h | 99 ++++++++++ arch/arm/cpu/arm720t/tegra2/spl.c | 133 ++++++++++++++ arch/arm/include/asm/arch-tegra2/hardware.h | 29 +++ 9 files changed, 604 insertions(+), 3 deletions(-) create mode 100644 arch/arm/cpu/arm720t/tegra2/Makefile create mode 100644 arch/arm/cpu/arm720t/tegra2/board.h create mode 100644 arch/arm/cpu/arm720t/tegra2/cpu.c create mode 100644 arch/arm/cpu/arm720t/tegra2/cpu.h create mode 100644 arch/arm/cpu/arm720t/tegra2/spl.c create mode 100644 arch/arm/include/asm/arch-tegra2/hardware.h
arch/arm/cpu/arm720t/cpu.c +2 -1
@@ -33,7 +33,6 @@#include <common.h> #include <command.h> #include <clps7111.h> -#include <asm/hardware.h> #include <asm/system.h> int cleanup_before_linux (void )
@@ -51,6 +50,8 @@ int cleanup_before_linux (void)/* Nothing more needed */ #elif defined(CONFIG_INTEGRATOR ) && defined(CONFIG_ARCH_INTEGRATOR )/* No cleanup before linux for IntegratorAP/CM720T as yet */ +#elif defined (CONFIG_MACH_TEGRA_GENERIC ) +/* No cleanup before linux for tegra as yet */ #else #error No cleanup_before_linux() defined for this CPU type#endif
arch/arm/cpu/arm720t/interrupts.c +4 -1
@@ -29,7 +29,6 @@#include <common.h> #include <clps7111.h> #include <asm/proc-armv/ptrace.h> -#include <asm/hardware.h> #ifndef CONFIG_NETARM /* we always count down the max. */
@@ -180,6 +179,8 @@ int timer_init (void)PUT32 (T0TC ,0 );PUT32 (T0TCR ,1 );/* enable timer0 */ +#elif defined(CONFIG_MACH_TEGRA_GENERIC ) +/* No timer routines for tegra as yet */ #else #error No timer_init() defined for this CPU type#endif
@@ -282,6 +283,8 @@ void __udelay (unsigned long usec)#elif defined(CONFIG_INTEGRATOR ) && defined(CONFIG_ARCH_INTEGRATOR )/* No timer routines for IntegratorAP/CM720T as yet */ +#elif defined(CONFIG_MACH_TEGRA_GENERIC ) +/* No timer routines for tegra as yet */ #else #error Timer routines not defined for this CPU type#endif
arch/arm/cpu/arm720t/start.S +5 -1
@@ -407,6 +407,8 @@ lock_loop: ldr r0, VPBDIV_ADR mov r1, #0x01 /* VPB clock is same as process clock */ str r1, [r0] +#elif defined(CONFIG_MACH_TEGRA_GENERIC) + /* No cpu_init_crit for tegra as yet */ #else #error No cpu_init_crit() defined for current CPU type #endif
@@ -422,7 +424,7 @@ lock_loop: str r1, [r0] #endif -#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2292) && !defined(CONFIG_MACH_TEGRA_GENERIC) mov ip, lr /* * before relocating, we have to setup RAM timing
@@ -631,6 +633,8 @@ reset_cpu: .globl reset_cpu reset_cpu: mov pc, r0 +#elif defined(CONFIG_MACH_TEGRA_GENERIC) + /* No specific reset actions for tegra as yet */ #else #error No reset_cpu() defined for current CPU type #endif
arch/arm/cpu/arm720t/tegra2/Makefile new file +48 -0
48 lines not on this page · raw message
arch/arm/cpu/arm720t/tegra2/board.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* (C) Copyright 2010-2011 +* NVIDIA Corporation <www.nvidia.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 +*/ + +void board_init_uart_f (void ); +void gpio_config_uart (void );
arch/arm/cpu/arm720t/tegra2/cpu.c new file +259 -0
259 lines not on this page · raw message
arch/arm/cpu/arm720t/tegra2/cpu.h new file +99 -0
99 lines not on this page · raw message
arch/arm/cpu/arm720t/tegra2/spl.c new file +133 -0
133 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/hardware.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* (C) Copyright 2010-2011 +* NVIDIA Corporation <www.nvidia.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 __TEGRA2_HW_H +#define __TEGRA2_HW_H + +/* include tegra specific hardware definitions */ + +#endif /* __TEGRA2_HW_H */
Signature · 1 line
1.7.9.5
PATCH 5/9 ARM: add tegra support to arm720t
arch/arm/cpu/arm720t/tegra2/cpu.c line 173
Quoted 12 lines · Allen Martin
Add support for tegra arm7 boot processor. This processor is used to power on the Cortex A9 and transfer control to it.
arch/arm/cpu/arm720t/tegra2/cpu.c new file +8
-0+static void enable_cpu_power_rail(void) + /* + * The TI PMU65861C needs a 3.75ms delay between enabling + * the power rail and enabling the CPU clock. This delay + * between SM1EN and SM1 is for switching time + the ramp + * up of the voltage to the CPU (VDD_CPU from PMU). + */ + udelay(3750);
Not all boards use that PMU. Can this be conditional on a define that enables that PMU, or part of the PMU diver or something?
arch/arm/cpu/arm720t/tegra2/cpu.h
Quoted 6 lines
arch/arm/cpu/arm720t/tegra2/cpu.h +4
-0+* 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.
Is this new code you just wrote? If so, shouldn't it be GPL v2 not GPL v2+?
PATCH 5/9 ARM: add tegra support to arm720t
Quoted 6 lines · Stephen Warren
Quoted 4 lines · Allen Martin
Add support for tegra arm7 boot processor. This processor is used to power on the Cortex A9 and transfer control to it.
+static void
enable_cpu_power_rail(void)
Quoted 10 lines
arch/arm/cpu/arm720t/tegra2/cpu.c line 173
Quoted 7 lines
arch/arm/cpu/arm720t/tegra2/cpu.c new file +7
-0+/* +* The TI PMU65861C needs a 3.75ms delay between enabling +* the power rail and enabling the CPU clock. This delay +* between SM1EN and SM1 is for switching time + the ramp +* up of the voltage to the CPU (VDD_CPU from PMU). +*/ +udelay (3750 );Not all boards use that PMU. Can this be conditional on a define that enables that PMU, or part of the PMU diver or something?
Sounds reasonable, although I think it should be part of a separate patch. This code I just moved unmodified from ap20.c in the armv7 tegra2 directory.
Quoted 9 lines
arch/arm/cpu/arm720t/tegra2/cpu.h
Quoted 7 lines
arch/arm/cpu/arm720t/tegra2/cpu.h +4
-0+* 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. Is this new code you just wrote? If so, shouldn't it be GPL v2 not GPL v2+?
Again I just moved it unmodified (copyright and all) from ap20.h.
-Allen
Signature · 1 line
nvpublic
PATCH 5/9 ARM: add tegra support to arm720t
Quoted 24 lines · Allen Martin
Quoted 6 lines · Stephen Warren
Quoted 4 lines · Allen Martin
Add support for tegra arm7 boot processor. This processor is used to power on the Cortex A9 and transfer control to it.
+static void
enable_cpu_power_rail(void)Quoted 10 lines
arch/arm/cpu/arm720t/tegra2/cpu.c line 173
Quoted 7 lines
arch/arm/cpu/arm720t/tegra2/cpu.c new file +7
-0+/* +* The TI PMU65861C needs a 3.75ms delay between enabling +* the power rail and enabling the CPU clock. This delay +* between SM1EN and SM1 is for switching time + the ramp +* up of the voltage to the CPU (VDD_CPU from PMU). +*/ +udelay (3750 );Not all boards use that PMU. Can this be conditional on a define that enables that PMU, or part of the PMU diver or something?
Sounds reasonable, although I think it should be part of a separate patch. This code I just moved unmodified from
ap20.cin the armv7 tegra2 directory.Quoted 2 lines
Quoted 1 line
arch/arm/cpu/arm720t/tegra2/cpu.h +0
-0
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
+ * 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.Is this new code you just wrote? If so, shouldn't it be GPL v2 not GPL v2+?
Again I just moved it unmodified (copyright and all) from
ap20.h.
Oh right. I think if you pass "-M" or better "-C" to "git format-patch", it'll highlight that fact better; it should make the patch file indicate that the relevant files were moved or copied, and just show the diffs to the file during the move/copy (which may be zero or tiny), rather than showing the entire file as new code.
PATCH 5/9 ARM: add tegra support to arm720t
Quoted 5 lines · Stephen Warren
Oh right. I think if you pass "-M" or better "-C" to "git format-patch", it'll highlight that fact better; it should make the patch file indicate that the relevant files were moved or copied, and just show the diffs to the file during the move/copy (which may be zero or tiny), rather than showing the entire file as new code.
Sorry about that, I did it correctly in my earlier posting of this patch, but incorrectly when I posted the entire patch series. I'll use -C when I post V2.
-Allen
Signature · 1 line
nvpublic
PATCH 6/9 tegra: enable SPL build for seaboard
In reply to Allen Martin--- boards.cfg | 2 +- include/configs/seaboard.h | 9 +++++++++ include/configs/tegra2-common.h | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)
boards.cfg +1 -1
@@ -230,7 +230,7 @@ smdk5250 arm armv7 smdk5250 samsung exynos smdkv310 arm armv7 smdkv310 samsung exynos trats arm armv7 trats samsung exynos harmony arm armv7 harmony nvidia tegra2 -seaboard arm armv7 seaboard nvidia tegra2 +seaboard arm armv7:arm720t seaboard nvidia tegra2 ventana arm armv7 ventana nvidia tegra2 u8500_href arm armv7 u8500 st-ericsson u8500 actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2
include/configs/seaboard.h +9 -0
@@ -27,10 +27,12 @@#include <asm/sizes.h> #include "tegra2-common.h" +#ifndef CONFIG_SPL_BUILD /* Enable fdt support for Seaboard. Flash the image in u-boot-dtb.bin */ #define CONFIG_DEFAULT_DEVICE_TREE tegra2-seaboard#define CONFIG_OF_CONTROL #define CONFIG_OF_SEPARATE +#endif /* High-level configuration options */ #define TEGRA2_SYSMEM "mem=384M at 0M nvmem=128M at 384M mem=512M at 512M"
@@ -38,7 +40,9 @@#define CONFIG_TEGRA2_BOARD_STRING "NVIDIA Seaboard"/* Board-specific serial config */ +#ifndef CONFIG_SPL_BUILD #define CONFIG_SERIAL_MULTI +#endif #define CONFIG_TEGRA2_ENABLE_UARTD #define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTD_BASE
@@ -59,6 +63,7 @@#define CONFIG_CMD_SF #define CONFIG_SPI_FLASH_SIZE (4 << 20) +#ifndef CONFIG_SPL_BUILD /* I2C */ #define CONFIG_TEGRA_I2C #define CONFIG_SYS_I2C_INIT_BOARD
@@ -78,6 +83,8 @@#define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT +#endif +/* Environment in SPI */ #define CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_ENV_SPI_MAX_HZ 48000000
@@ -86,10 +93,12 @@#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE#define CONFIG_ENV_OFFSET (CONFIG_SPI_FLASH_SIZE - CONFIG_ENV_SECT_SIZE) +#ifndef CONFIG_SPL_BUILD /* USB Host support */ #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_TEGRA #define CONFIG_USB_STORAGE #define CONFIG_CMD_USB +#endif #endif /* __CONFIG_H */
include/configs/tegra2-common.h +19 -0
@@ -90,9 +90,11 @@* parameter, the default (2) causes occasional Data Buffer Errors in OUT * packets depending on the buffer address and size. */ +#ifndef CONFIG_SPL_BUILD #define CONFIG_USB_EHCI_TXFIFO_THRESH 10#define CONFIG_EHCI_IS_TDI #define CONFIG_EHCI_DCACHE +#endif /* Total I2C ports on Tegra2 */ #define TEGRA_I2C_NUM_CONTROLLERS 4
@@ -175,4 +177,21 @@#define CONFIG_TEGRA2_GPIO #define CONFIG_CMD_GPIO + +/* Defines for SPL */ +#define CONFIG_SPL +#define CONFIG_SPL_NAND_SIMPLE +#define CONFIG_SPL_TEXT_BASE 0x00008000 +#define CONFIG_SPL_MAX_SIZE 0x00078000 +#define CONFIG_SYS_SPL_MALLOC_START 0x00080000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 +#define CONFIG_SPL_STACK 0x0009fffc + +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_POWER_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT +#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/tegra2/u-boot-spl.lds" +#endif /* __TEGRA2_COMMON_H */
Signature · 1 line
1.7.9.5
PATCH 6/9 tegra: enable SPL build for seaboard
boards.cfg smdk5250 arm armv7 smdk5250 samsung exynos · line 233
Quoted 6 lines · Allen Martin
Signed-off-by Allen Martin <[email protected]>boards.cfg +1
-1-seaboard arm armv7 seaboard nvidia tegra2 +seaboard arm armv7:arm720t seaboard nvidia tegra2
Hmmm. We'll have to duplicate this change for all boards. Is there some way to do set up the SPL CPU for all Tegra boards so we don't have to do that?
include/configs/seaboard.h
Quoted 3 lines
include/configs/seaboard.h +1
-0+#ifndef CONFIG_SPL_BUILD
And every Tegra board's config header will have to ifdef a bunch of stuff out for SPL.
Perhaps we can just create a new tegra_spl board for the SPL rather than having an SPL variant for each board. Still, I don't know how we'd represent the UART differences if we did that though.
PATCH 6/9 tegra: enable SPL build for seaboard
Quoted 11 lines · Stephen Warren
boards.cfg smdk5250 arm armv7 smdk5250 samsung exynos · line 233
Quoted 6 lines · Allen Martin
Signed-off-by Allen Martin <[email protected]>boards.cfg +1
-1-seaboard arm armv7 seaboard nvidia tegra2 +seaboard arm armv7:arm720t seaboard nvidia tegra2Hmmm. We'll have to duplicate this change for all boards. Is there some way to do set up the SPL CPU for all Tegra boards so we don't have to do that?
I would have to think what that would look like. The boards.cfg file has one entry per board and doesn't really have any place to store information on groups of boards or any type of per vendor or per architecture settings. This decision on the CPU needs to be made at mkconfig time or else I wouldn't have touched boards.cfg format at all and stuck it in some tegra specific config file or Makefile. I can't see any way to do what you're asking without making the change even more invasive.
Quoted 6 lines
include/configs/seaboard.h
Quoted 3 lines
include/configs/seaboard.h +1
-0+#ifndef CONFIG_SPL_BUILD And every Tegra board's config header will have to ifdef a bunch of stuff out for SPL.
I'll take a pass at trying to pull some of that out into a common header.
Quoted 3 lines
Perhaps we can just create a new
tegra_splboard for the SPL rather than having an SPL variant for each board. Still, I don't know how we'd represent the UART differences if we did that though.
I tossed out that idea as part of the discussion about using a separate toolchain for the SPL, but Wolfgang shot it down:
http://lists.denx.de/pipermail/u-boot/2012-April/122248.html
-Allen
Signature · 1 line
nvpublic
PATCH 6/9 tegra: enable SPL build for seaboard
Quoted 2 lines · Allen Martin
Quoted 1 line · Stephen Warren
On 05/10/2012 01:02 AM, Allen Martin wrote:
...
Quoted 8 lines
Quoted 3 lines
Perhaps we can just create a new
tegra_splboard for the SPL rather than having an SPL variant for each board. Still, I don't know how we'd represent the UART differences if we did that though.I tossed out that idea as part of the discussion about using a separate toolchain for the SPL, but Wolfgang shot it down:
http://lists.denx.de/pipermail/u-boot/2012-April/122248.html
Is that the right link? That message seems to be talking about a CROSS_COMPILE_SPL variable rather than having a separate boards.cfg entry for a Tegra SPL.
PATCH 6/9 tegra: enable SPL build for seaboard
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Allen Martin
Quoted 1 line · Stephen Warren
On 05/10/2012 01:02 AM, Allen Martin wrote:
...
Quoted 4 lines
Quoted 3 lines
Perhaps we can just create a new
tegra_splboard for the SPL rather than having an SPL variant for each board. Still, I don't know how we'd represent the UART differences if we did that though.
Quoted 8 lines
Quoted 4 lines
I tossed out that idea as part of the discussion about using a separate toolchain for the SPL, but Wolfgang shot it down:
http://lists.denx.de/pipermail/u-boot/2012-April/122248.html
Is that the right link? That message seems to be talking about a
CROSS_COMPILE_SPLvariable rather than having a separate boards.cfg entry for a Tegra SPL.
This was the piece I was referring to, which was a conversation about exactly this topic (armv4 SPL and armv7 u-boot):
Quoted 5 lines
Quoted 2 lines
The architecture seems harder to fix. It seems like I really have to have two entries in boards.cfg, which means two passes of config/make.
This should be not needed; I also do not think this would be an acceptable approach.
-Allen
Signature · 1 line
nvpublic
PATCH 7/9 tegra: add u-boot.t2 target
In reply to Allen MartinAdd target for tegra2 u-boot image. This is a concatenation of tegra spl and normal u-boot binaries.
--- Makefile | 6 ++++++ board/nvidia/seaboard/config.mk | 1 + 2 files changed, 7 insertions(+) create mode 100644 board/nvidia/seaboard/config.mk
Makefile +6 -0
@@ -456,6 +456,11 @@ $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \ -o $(obj)u-boot.sb +$(obj)u-boot.t2: $(obj)spl/u-boot-spl.bin $(obj)u-boot-dtb.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin + cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot-dtb.bin > $(obj)u-boot.t2 + rm $(obj)spl/u-boot-spl-pad.bin + ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \ cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
@@ -768,6 +773,7 @@ clobber: tidy @rm -f $(obj)u-boot.ais @rm -f $(obj)u-boot.dtb @rm -f $(obj)u-boot.sb + @rm -f $(obj)u-boot.t2 @rm -f $(obj)tools/inca-swap-bytes @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c @rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
board/nvidia/seaboard/config.mk new file +1 -0
@@ -0,0 +1 @@ +PAD_TO=0x00108000
Signature · 1 line
1.7.9.5
PATCH 7/9 tegra: add u-boot.t2 target
Makefile $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin · line 459
Quoted 6 lines · Allen Martin
Add target for tegra2 u-boot image. This is a concatenation of tegra spl and normal u-boot binaries.
Makefile +1
-0+$(obj)u-boot.t2: $(obj)spl/u-boot-spl.bin $(obj)u-boot-dtb.bin
Hmmm. Only some boards boot using DT, so that second file is sometimes just u-boot.bin. Is there any way we can make this handle both cases? Perhaps we just need to convert all Tegra boards to DT to solve this.
PATCH 7/9 tegra: add u-boot.t2 target
Quoted 11 lines · Stephen Warren
Makefile $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin · line 459
Quoted 6 lines · Allen Martin
Add target for tegra2 u-boot image. This is a concatenation of tegra spl and normal u-boot binaries.
Makefile +1
-0+$(obj)u-boot.t2: $(obj)spl/u-boot-spl.bin $(obj)u-boot-dtb.binHmmm. Only some boards boot using DT, so that second file is sometimes just u-boot.bin. Is there any way we can make this handle both cases? Perhaps we just need to convert all Tegra boards to DT to solve this.
I can make it handle both, shouldn't be a problem.
-Allen
Signature · 1 line
nvpublic
PATCH 8/9 tegra2: Remove CPU init code from tegra2 u-boot
In reply to Allen MartinThis code is now included in the tegra2 SPL
--- arch/arm/cpu/armv7/start.S | 2 - arch/arm/cpu/tegra2-common/ap20.c | 257 +----------------------------------- arch/arm/cpu/tegra2-common/ap20.h | 102 -------------- arch/arm/cpu/tegra2-common/board.c | 22 --- include/configs/tegra2-common.h | 4 - 5 files changed, 3 insertions(+), 384 deletions(-) delete mode 100644 arch/arm/cpu/tegra2-common/ap20.h
arch/arm/cpu/armv7/start.S +0 -2
@@ -132,7 +132,6 @@ reset: orr r0, r0, #0xd3 msr cpsr,r0 -#if !defined(CONFIG_TEGRA2) /* * Setup vector: * (OMAP4 spl TEXT_BASE is not 32 byte aligned.
@@ -148,7 +147,6 @@ reset: ldr r0, =_start mcr p15, 0, r0, c12, c0, 0 @Set VBAR #endif -#endif /* !Tegra2 */ /* the mask ROM code should have PLL and others stable */ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
arch/arm/cpu/tegra2-common/ap20.c +3 -254
281 lines not on this page · raw message
arch/arm/cpu/tegra2-common/ap20.h deleted +0 -102
102 lines not on this page · raw message
arch/arm/cpu/tegra2-common/board.c +0 -22
@@ -23,7 +23,6 @@#include <common.h> #include <asm/io.h> -#include "ap20.h" #include <asm/arch/clock.h> #include <asm/arch/funcmux.h> #include <asm/arch/sys_proto.h>
@@ -80,27 +79,6 @@ int checkboard(void) }#endif /* CONFIG_DISPLAY_BOARDINFO */ -#ifdef CONFIG_ARCH_CPU_INIT -/* -* Note this function is executed by the ARM7TDMI AVP. It does not return -* in this case. It is also called once the A9 starts up, but does nothing in -* that case. -*/ -int arch_cpu_init (void ) -{ -/* Fire up the Cortex A9 */ -tegra2_start (); - -/* We didn't do this init in start.S, so do it now */ -cpu_init_cp15 (); - -/* Initialize essential common plls */ -clock_early_init (); - -return 0 ; -} -#endif -/** * Set up the specified uarts *
include/configs/tegra2-common.h +0 -4
@@ -35,8 +35,6 @@#define CONFIG_SYS_CACHELINE_SIZE 32 -#define CONFIG_ARCH_CPU_INIT /* Fire up the A9 core */ -#include <asm/arch/tegra2.h> /* get chip and board defs */ /*
@@ -45,8 +43,6 @@#define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO -#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_OF_LIBFDT /* enable passing of devicetree */
Signature · 1 line
1.7.9.5
PATCH 9/9 tegra2: Remove USE_PRIVATE_LIBGCC and armv4t build flags
In reply to Allen MartinThese flags were necessary when building tegra2 as a single binary that supported ARM7TDMI and Cortex A9. Now that the ARM7TDMI support is split into a separate SPL, this is no longer necessary.
--- arch/arm/cpu/armv7/tegra2/config.mk | 8 -------- 1 file changed, 8 deletions(-)
arch/arm/cpu/armv7/tegra2/config.mk +0 -8
@@ -24,12 +24,4 @@ # MA 02111-1307 USA # -# Tegra has an ARMv4T CPU which runs board_init_f(), so we must build this -# file with compatible flags -ifdef CONFIG_TEGRA2 -CFLAGS_arch/arm/lib/board.o += -march=armv4t -endif - -USE_PRIVATE_LIBGCC = yes - CONFIG_ARCH_DEVICE_TREE := tegra20
Signature · 1 line
1.7.9.5
PATCH 9/9 tegra2: Remove USE_PRIVATE_LIBGCC and armv4t build flags
arch/arm/cpu/armv7/tegra2/config.mk line 31
Quoted 11 lines · Allen Martin
These flags were necessary when building tegra2 as a single binary that supported ARM7TDMI and Cortex A9. Now that the ARM7TDMI support is split into a separate SPL, this is no longer necessary.
arch/arm/cpu/armv7/tegra2/config.mk +0
-5-# Tegra has an ARMv4T CPU which runs board_init_f(), so we must build this -# file with compatible flags -ifdef CONFIG_TEGRA2 -CFLAGS_arch/arm/lib/board.o += -march=armv4t -endif
That makes sense since the CFLAGS for the SPL build will be set up appropriately for the AVP.
Quoted 1 line
-USE_PRIVATE_LIBGCC = yes
However, we force this because the toolchains we typically use for U-Boot are targeted at the A9 CPUs, and hence the libgcc there contains ARMv7 instructions. Did I miss something in this series or earlier that uses a different toolchain for the SPL, which includes an ARMv4 build of libgcc?
PATCH 9/9 tegra2: Remove USE_PRIVATE_LIBGCC and armv4t build flags
Quoted 8 lines · Stephen Warren
Quoted 1 line · Allen Martin
-USE_PRIVATE_LIBGCC = yes
However, we force this because the toolchains we typically use for U-Boot are targeted at the A9 CPUs, and hence the libgcc there contains ARMv7 instructions. Did I miss something in this series or earlier that uses a different toolchain for the SPL, which includes an ARMv4 build of libgcc?
You're right, that's a mistake, I'll revert that line. There is a problem right now where if you have both SPL and USE_PRIVATE_LIBGCC turned on, the SPL build of libgcc tries to link against the main u-boot libgcc, which in itself is probably fine, except on a clean build it hasn't been built yet. So I'll have to fix that.
-Allen
Signature · 1 line
nvpublic