[U-Boot] [PATCH 1/6] ARM: tegra: Prepare for 64-bit support

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- arch/arm/Kconfig | 4 ---- arch/arm/mach-tegra/Kconfig | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b9ebee104628..40d2fac32e91 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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" diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index fccfd79648ac..9b54a4b141f8 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -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

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- include/configs/tegra-common.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 2cf1f68404b1..5581d0878380 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -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

On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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.
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
+#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?

On Fri, Mar 20, 2015 at 10:26:12AM -0600, Stephen Warren wrote:
On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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.
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
+#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).

On 03/20/2015 11:09 AM, Tom Rini wrote:
On Fri, Mar 20, 2015 at 10:26:12AM -0600, Stephen Warren wrote:
On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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.
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
+#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).
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?

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- arch/arm/mach-tegra/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c index 0ebaf1932556..7af1a44f49c5 100644 --- a/arch/arm/mach-tegra/board.c +++ b/arch/arm/mach-tegra/board.c @@ -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 */

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- board/nvidia/common/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index d945de456ea2..1134b31791db 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -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

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- include/configs/tegra-common-post.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h index c3ad8beb903d..c1272a0d5b64 100644 --- a/include/configs/tegra-common-post.h +++ b/include/configs/tegra-common-post.h @@ -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

From: Thierry Reding treding@nvidia.com
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.
Cc: Tom Warren twarren@nvidia.com Signed-off-by: Thierry Reding treding@nvidia.com --- arch/arm/include/asm/arch-tegra/pinmux.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/include/asm/arch-tegra/pinmux.h b/arch/arm/include/asm/arch-tegra/pinmux.h index 4212e5769930..9384985259db 100644 --- a/arch/arm/include/asm/arch-tegra/pinmux.h +++ b/arch/arm/include/asm/arch-tegra/pinmux.h @@ -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 */

On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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, Acked-by: Stephen Warren swarren@nvidia.com

On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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...

Hi.
2015-03-21 1:24 GMT+09:00 Stephen Warren swarren@wwwdotorg.org:
On 03/20/2015 06:24 AM, Thierry Reding wrote:
From: Thierry Reding treding@nvidia.com
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.
participants (4)
-
Masahiro Yamada
-
Stephen Warren
-
Thierry Reding
-
Tom Rini