Skip to contentSkip to conversation

ARM: tegra: Prepare for 64-bit support

PATCH New Thierry Reding 4 participants 12 messages Mar 20, 2015 – Mar 25, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 ARM: tegra: Prepare for 64-bit support

From: Thierry Reding <[email protected]>

Move various selects from the TEGRA symbol to the symbols for 32-bit Tegra boards. This is necessary because these settings do not extend to U-Boot for 64-bit Tegra SoCs. Also tie the private libgcc build to SPL, it isn't needed on 64-bit Tegra.

---
 arch/arm/Kconfig            |  4 ----
 arch/arm/mach-tegra/Kconfig | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/Kconfig +0 -4
index b9ebee104628..40d2fac32e91 100644
@@ -620,10 +620,6 @@ config TARGET_XILINX_ZYNQMP
 
 config TEGRA
 	bool "NVIDIA Tegra"
-	select SUPPORT_SPL
-	select SPL
-	select OF_CONTROL
-	select CPU_V7
 
 config TARGET_VEXPRESS64_AEMV8A
 	bool "Support vexpress_aemv8a"
arch/arm/mach-tegra/Kconfig +17 -0
index fccfd79648ac..9b54a4b141f8 100644
@@ -5,15 +5,31 @@ choice
 
 config TEGRA20
 	bool "Tegra20 family"
+	select SUPPORT_SPL
+	select SPL
+	select OF_CONTROL
+	select CPU_V7
 
 config TEGRA30
 	bool "Tegra30 family"
+	select SUPPORT_SPL
+	select SPL
+	select OF_CONTROL
+	select CPU_V7
 
 config TEGRA114
 	bool "Tegra114 family"
+	select SUPPORT_SPL
+	select SPL
+	select OF_CONTROL
+	select CPU_V7
 
 config TEGRA124
 	bool "Tegra124 family"
+	select SUPPORT_SPL
+	select SPL
+	select OF_CONTROL
+	select CPU_V7
 
 endchoice
 
@@ -24,6 +40,7 @@ config SYS_MALLOC_F_LEN
 	default 0x1800
 
 config USE_PRIVATE_LIBGCC
+	depends on SPL
 	default y
 
 config DM
Signature · 1 line
2.3.2
#1 lore raw

PATCH 2/6 ARM: tegra: Disable SPL and non-cached memory on 64-bit

From: Thierry Reding <[email protected]>

For 64-bit ARM SoCs we rely on non-U-Boot code to bring up the CPU in AArch64 mode so that we don't need the SPL. Non-cached memory is not implemented (yet) for 64-bit ARM.

---
 include/configs/tegra-common.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/tegra-common.h +4 -0
index 2cf1f68404b1..5581d0878380 100644
@@ -43,7 +43,9 @@
 #define CONFIG_SYS_MALLOC_LEN		(4 << 20)	/* 4MB  */
 #endif
 
+#ifndef CONFIG_ARM64
 #define CONFIG_SYS_NONCACHED_MEMORY	(1 << 20)       /* 1 MiB */
+#endif
 
 /*
  * NS16550 Configuration
@@ -109,9 +111,11 @@
 #define CONFIG_SYS_MEMTEST_START	(NV_PA_SDRC_CS0 + 0x600000)
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 0x100000)
 
+#ifndef CONFIG_ARM64
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_USE_ARCH_MEMCPY
 #endif
+#endif
 
 /*-----------------------------------------------------------------------
  * Physical Memory Map
Signature · 1 line
2.3.2
#2 lore raw

PATCH 2/6 ARM: tegra: Disable SPL and non-cached memory on 64-bit

include/configs/tegra-common.h line 118

Quoted 13 lines · Thierry Reding

From: Thierry Reding <[email protected]>

For 64-bit ARM SoCs we rely on non-U-Boot code to bring up the CPU in AArch64 mode so that we don't need the SPL. Non-cached memory is not implemented (yet) for 64-bit ARM.

include/configs/tegra-common.h +2 -0
 
+#ifndef CONFIG_ARM64
  #ifndef CONFIG_SPL_BUILD
  #define CONFIG_USE_ARCH_MEMCPY
  #endif
+#endif

We don't need SPL, but that stanza used to enable ARCH_MEMCPY *except* for SPL. I would expect we still want ARCH_MEMCPY on ARM64, where presumably ifndef CONFIG_SPL_BUILD will always be true?

#3 lore raw

PATCH 2/6 ARM: tegra: Disable SPL and non-cached memory on 64-bit

Quoted 9 lines · Stephen Warren
Quoted 7 lines · Thierry Reding

From: Thierry Reding <[email protected]>

For 64-bit ARM SoCs we rely on non-U-Boot code to bring up the CPU in AArch64 mode so that we don't need the SPL. Non-cached memory is not implemented (yet) for 64-bit ARM.

include/configs/tegra-common.h +0 -0
Quoted 9 lines

include/configs/tegra-common.h line 118

Quoted 5 lines
include/configs/tegra-common.h +2 -0
+#ifndef CONFIG_ARM64
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_USE_ARCH_MEMCPY
 #endif
+#endif

We don't need SPL, but that stanza used to enable ARCH_MEMCPY *except* for SPL. I would expect we still want ARCH_MEMCPY on ARM64, where presumably ifndef CONFIG_SPL_BUILD will always be true?

First we need arch memcpy/memset for aarch64 copied over (and maybe update the 32bit one and get everyone using them).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150320/23ea86ac/attachment.sig>
#4 lore raw

PATCH 2/6 ARM: tegra: Disable SPL and non-cached memory on 64-bit

Quoted 20 lines · Tom Rini
Quoted 9 lines · Stephen Warren
Quoted 7 lines · Thierry Reding

From: Thierry Reding <[email protected]>

For 64-bit ARM SoCs we rely on non-U-Boot code to bring up the CPU in AArch64 mode so that we don't need the SPL. Non-cached memory is not implemented (yet) for 64-bit ARM.

include/configs/tegra-common.h +0 -0
Quoted 9 lines

include/configs/tegra-common.h line 118

Quoted 5 lines
include/configs/tegra-common.h +2 -0
+#ifndef CONFIG_ARM64
  #ifndef CONFIG_SPL_BUILD
  #define CONFIG_USE_ARCH_MEMCPY
  #endif
+#endif

We don't need SPL, but that stanza used to enable ARCH_MEMCPY *except* for SPL. I would expect we still want ARCH_MEMCPY on ARM64, where presumably ifndef CONFIG_SPL_BUILD will always be true?

Quoted 2 lines

First we need arch memcpy/memset for aarch64 copied over (and maybe update the 32bit one and get everyone using them).

Oh, that's missing? OK, it makes sense to disable it. However, the commit description probably shouldn't imply this is related to having SPL or not, but rather that ARM64 doesn't support ARCH_MEMCPY yet?

#5 lore raw

PATCH 3/6 ARM: tegra: Use standard cache enable for 64-bit

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

On 64-bit SoCs the I-cache isn't enabled in early code, so the default cache enable functions for 64-bit ARM can be used.

---
 arch/arm/mach-tegra/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-tegra/board.c +1 -1
index 0ebaf1932556..7af1a44f49c5 100644
@@ -190,7 +190,7 @@ void board_init_uart_f(void)
 	setup_uarts(uart_ids);
 }
 
-#ifndef CONFIG_SYS_DCACHE_OFF
+#if !defined(CONFIG_SYS_DCACHE_OFF) && !defined(CONFIG_ARM64)
 void enable_caches(void)
 {
 	/* Enable D-cache. I-cache is already enabled in start.S */
Signature · 1 line
2.3.2
#6 lore raw

PATCH 4/6 ARM: tegra: Restrict usable RAM to 32-bit on 64-bit SoCs

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Most peripherals on Tegra can do DMA only to the lower 32-bit address space, even on 64-bit SoCs. This limitation is typically overcome by the use of an IOMMU. Since the IOMMU is not entirely trivial to set up and serves no other purpose (I/O protection, ...) in U-Boot, restrict 64-bit Tegra SoCs to the lower 32-bit address space for RAM. This ensures that the physical addresses of buffers that are programmed into the various DMA engines are valid and don't alias to lower addresses.

---
 board/nvidia/common/board.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/nvidia/common/board.c +16 -0
index d945de456ea2..1134b31791db 100644
@@ -264,3 +264,19 @@ void pad_init_mmc(struct mmc_host *host)
 #endif	/* T30 */
 }
 #endif	/* MMC */
+
+#ifdef CONFIG_ARM64
+/*
+ * Most hardware on 64-bit Tegra is still restricted to DMA to the lower
+ * 32-bits of the physical address space. Cap the maximum usable RAM area
+ * at 4 GiB to avoid DMA buffers from being allocated beyond the 32-bit
+ * boundary that most devices can address.
+ */
+ulong board_get_usable_ram_top(ulong total_size)
+{
+	if (gd->ram_top > 0x100000000)
+		return 0x100000000;
+
+	return gd->ram_top;
+}
+#endif
Signature · 1 line
2.3.2
#7 lore raw

PATCH 5/6 ARM: tegra: Skip FDT and initrd relocation on 64-bit

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

U-Boot inspects the initrd_high and fdt_high environment variables and skips relocation of the initial ramdisk and FDT, respectively, if these variables are set to all-ones. The Tegra configuration sets these variables to ffffffff in the default environment. However on 64-bit SoC generations this will cause the all-ones match to fail, so extend these variables to 64 ones on 64-bit SoCs.

---
 include/configs/tegra-common-post.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
include/configs/tegra-common-post.h +10 -2
index c3ad8beb903d..c1272a0d5b64 100644
@@ -50,11 +50,19 @@
 #define BOARD_EXTRA_ENV_SETTINGS
 #endif
 
+#ifdef CONFIG_ARM64
+#define FDT_HIGH "ffffffffffffffff"
+#define INITRD_HIGH "ffffffffffffffff"
+#else
+#define FDT_HIGH "ffffffff"
+#define INITRD_HIGH "ffffffff"
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	TEGRA_DEVICE_SETTINGS \
 	MEM_LAYOUT_ENV_SETTINGS \
-	"fdt_high=ffffffff\0" \
-	"initrd_high=ffffffff\0" \
+	"fdt_high=" FDT_HIGH "\0" \
+	"initrd_high=" INITRD_HIGH "\0" \
 	BOOTENV \
 	BOARD_EXTRA_ENV_SETTINGS
 
Signature · 1 line
2.3.2
#8 lore raw

PATCH 6/6 ARM: tegra: Make pinmux.h standalone includible

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

This header file uses type definitions (u8, u32) from linux/types.h but doesn't include it. If includes aren't carefully ordered this can cause build failures.

---
 arch/arm/include/asm/arch-tegra/pinmux.h | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/include/asm/arch-tegra/pinmux.h +2 -0
index 4212e5769930..9384985259db 100644
@@ -8,6 +8,8 @@
 #ifndef _TEGRA_PINMUX_H_
 #define _TEGRA_PINMUX_H_
 
+#include <linux/types.h>
+
 #include <asm/arch/tegra.h>
 
 /* The pullup/pulldown state of a pin group */
Signature · 1 line
2.3.2
#9 lore raw

PATCH 6/6 ARM: tegra: Make pinmux.h standalone includible

Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

This header file uses type definitions (u8, u32) from linux/types.h but doesn't include it. If includes aren't carefully ordered this can cause build failures.

I think patches 3-6 look fine, so they're,

#10 lore raw

PATCH 1/6 ARM: tegra: Prepare for 64-bit support

In reply to Thierry Reding
Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Move various selects from the TEGRA symbol to the symbols for 32-bit Tegra boards. This is necessary because these settings do not extend to U-Boot for 64-bit Tegra SoCs. Also tie the private libgcc build to SPL, it isn't needed on 64-bit Tegra.

I vaguely recall Masahiro enabling SPL for all Tegra builds recently for some reason...

#11 lore raw

PATCH 1/6 ARM: tegra: Prepare for 64-bit support

Hi.

2015-03-21 1:24 GMT+09:00 Stephen Warren <[email protected]>:

Quoted 12 lines · Thierry Reding
Quoted 7 lines

From: Thierry Reding <[email protected]>

Move various selects from the TEGRA symbol to the symbols for 32-bit Tegra boards. This is necessary because these settings do not extend to U-Boot for 64-bit Tegra SoCs. Also tie the private libgcc build to SPL, it isn't needed on 64-bit Tegra.

I vaguely recall Masahiro enabling SPL for all Tegra builds recently for some reason...

Yes.
I enabled the private library for the U-boot proper of Tegra as well as SPL.

This change happened when we stitched into the single .config configuration as CONFIG_SPL_BUILD no longer appears in Kconfig.

This thread:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/212545/focus=212771

As for Kconfig side, this patch looks good to me.

Signature · 2 lines
Best Regards
Masahiro Yamada