diff mbox

[U-Boot] ARM: tegra: allow passing cboot DTB to the kernel

Message ID 20161202192642.7134-1-swarren@wwwdotorg.org
State Accepted
Commit a182e69d794f0e61756fcc5de8fd05cc30c98b67
Delegated to: Tom Warren
Headers show

Commit Message

Stephen Warren Dec. 2, 2016, 7:26 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Some users may wish to pass the cboot-supplied DTB to the booted kernel
rather than having U-Boot load the DTB itself. To allow this, expose the
address of the cboot-supplied DTB in environment variable $fdt_addr. At
least when using extlinux.conf, if the user doesn't explicitly specify
which DTB to pass to the kernel, U-Boot passes the DTB referred to by
this variable.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/mach-tegra/tegra186/nvtboot_board.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Simon Glass Dec. 5, 2016, 6:24 a.m. UTC | #1
On 2 December 2016 at 12:26, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Some users may wish to pass the cboot-supplied DTB to the booted kernel
> rather than having U-Boot load the DTB itself. To allow this, expose the
> address of the cboot-supplied DTB in environment variable $fdt_addr. At
> least when using extlinux.conf, if the user doesn't explicitly specify
> which DTB to pass to the kernel, U-Boot passes the DTB referred to by
> this variable.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  arch/arm/mach-tegra/tegra186/nvtboot_board.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_board.c b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
index 1d78346f9843..feb935f0d908 100644
--- a/arch/arm/mach-tegra/tegra186/nvtboot_board.c
+++ b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
@@ -11,6 +11,19 @@ 
 
 extern unsigned long nvtboot_boot_x0;
 
+static int set_fdt_addr(void)
+{
+	int ret;
+
+	ret = setenv_hex("fdt_addr", nvtboot_boot_x0);
+	if (ret) {
+		printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 /*
  * Attempt to use /chosen/nvidia,ether-mac in the nvtboot DTB to U-Boot's
  * ethaddr environment variable if possible.
@@ -47,6 +60,11 @@  static int set_ethaddr_from_nvtboot(void)
 
 int tegra_soc_board_init_late(void)
 {
+	/*
+	 * Ignore errors here; the value may not be used depending on
+	 * extlinux.conf or boot script content.
+	 */
+	set_fdt_addr();
 	/* Ignore errors here; not all cases care about Ethernet addresses */
 	set_ethaddr_from_nvtboot();