Skip to contentSkip to conversation

Misc fixes for Tegra

PATCH New twarren at nvidia.com 3 participants 19 messages Mar 16, 2020 – Mar 18, 2020

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

cover Misc fixes for Tegra

From: Tom Warren <[email protected]>

These fixes originated on our downstream L4T U-Boot, and include fdt, pinmux, pll and code relocation changes.

JC Kuo (1):
t210: do not enable PLLE and UPHY PLL HW PWRSEQ

Stephen Warren (1):
ARM: tegra: rework fdt_serial_tag_setup_one

Tom Warren (2):
fdt: Fix 'system' command
ARM: Tegra: Use calculated env var feature on all T186/T210 boards

Vishruth (1):
ARM: tegra: p2771-0000: enable PIE relocation

 arch/arm/cpu/armv8/cpu.c                      |  5 ++
 arch/arm/include/asm/arch-tegra/xusb-padctl.h |  1 +
 arch/arm/mach-tegra/board2.c                  |  6 +++
 arch/arm/mach-tegra/ft_board_info.c           | 77 +++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h           | 23 ++++++++
 arch/arm/mach-tegra/tegra210/clock.c          | 19 -------
 arch/arm/mach-tegra/tegra210/xusb-padctl.c    | 68 ++++++++++++++---------
 arch/arm/mach-tegra/xusb-padctl-dummy.c       |  4 ++
 cmd/fdt.c                                     |  2 +-
 configs/p2771-0000-000_defconfig              |  1 +
 configs/p2771-0000-500_defconfig              |  1 +
 include/configs/p2771-0000.h                  | 23 +-------
 include/configs/tegra186-common.h             | 22 +++++++-
 include/configs/tegra210-common.h             | 23 ++++++--
 14 files changed, 204 insertions(+), 71 deletions(-)
 create mode 100644 arch/arm/mach-tegra/ft_board_info.c
 create mode 100644 arch/arm/mach-tegra/ft_board_info.h
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#1 lore raw

PATCH 1/5 ARM: tegra: rework fdt_serial_tag_setup_one

From: Stephen Warren <[email protected]>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied to CONFIG_SERIAL_TAG, and rename the function to better indicate its purpose. This will allow it to be re-used by future board info related code.

---
 arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 arch/arm/mach-tegra/ft_board_info.c
 create mode 100644 arch/arm/mach-tegra/ft_board_info.h
arch/arm/mach-tegra/ft_board_info.c new file +77 -0
new file mode 100644
index 0000000..7dd3a40
@@ -0,0 +1,77 @@
+/*
+ *  (C) Copyright 2010-2016
+ *  NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <fdtdec.h>
+#include "ft_board_info.h"
+
+int ft_board_info_set(void *blob, const struct ft_board_info *bi,
+		      const char *chosen_subnode_name)
+{
+	int chosen, offset, ret;
+	u32 val;
+
+	chosen = fdt_path_offset(blob, "/chosen");
+	if (!chosen) {
+		chosen = fdt_add_subnode(blob, 0, "chosen");
+		if (chosen < 0) {
+			error("fdt_add_subnode(/, chosen) failed: %s.\n",
+			      fdt_strerror(chosen));
+			return chosen;
+		}
+	}
+
+	offset = fdt_add_subnode(blob, chosen, chosen_subnode_name);
+	if (offset < 0) {
+		error("fdt_add_subnode(/chosen, %s): %s.\n",
+			chosen_subnode_name, fdt_strerror(offset));
+		return offset;
+	}
+
+	val = cpu_to_fdt32(bi->id);
+	ret = fdt_setprop(blob, offset, "id", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update id property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->sku);
+	ret = fdt_setprop(blob, offset, "sku", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update sku property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->fab);
+	ret = fdt_setprop(blob, offset, "fab", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update fab property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->major);
+	ret = fdt_setprop(blob, offset, "major_revision", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update major_revision property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	val = cpu_to_fdt32(bi->minor);
+	ret = fdt_setprop(blob, offset, "minor_revision", &val, sizeof(val));
+	if (ret < 0) {
+		error("could not update minor_revision property %s.\n",
+		      fdt_strerror(ret));
+		return ret;
+	}
+
+	return 0;
+}
arch/arm/mach-tegra/ft_board_info.h new file +23 -0
new file mode 100644
index 0000000..c320aee
@@ -0,0 +1,23 @@
+/*
+ * Board info related definitions
+ *
+ * (C) Copyright 2015 NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BOARD_INFO_H_
+#define _BOARD_INFO_H_
+
+struct ft_board_info {
+	u32 id;
+	u32 sku;
+	u32 fab;
+	u32 major;
+	u32 minor;
+};
+
+int ft_board_info_set(void *blob, const struct ft_board_info *bi,
+		      const char *chosen_subnode_name);
+
+#endif
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#2 lore raw

PATCH 1/5 ARM: tegra: rework fdt_serial_tag_setup_one

Quoted 9 lines · twarren at nvidia.com

From: Stephen Warren <[email protected]>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied to CONFIG_SERIAL_TAG, and rename the function to better indicate its purpose. This will allow it to be re-used by future board info related code.

 arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++

I don't think this series was based on upstream, or there are missing patches in between upstream and this series; those files don't exist upstream.

#3 lore raw

PATCH 1/5 ARM: tegra: rework fdt_serial_tag_setup_one

Quoted 8 lines · Stephen Warren
Quoted 6 lines · twarren at nvidia.com

From: Stephen Warren <[email protected]>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied to CONFIG_SERIAL_TAG, and rename the function to better indicate its purpose. This will allow it to be re-used by future board info related code.

Quoted 6 lines
Quoted 2 lines
 arch/arm/mach-tegra/ft_board_info.c | 77 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++

I don't think this series was based on upstream, or there are missing patches in between upstream and this series; those files don't exist upstream.

Oh. This patch adds those files. But the commit description says it's reworking some existing logic. I guess the description is from some squashed patch, and doesn't describe what the patch actually does? Also, the new file isn't added to any Makefile, and no edits are made to any other file in order to call the newly added functionality.

author
#4 lore raw

PATCH 1/5 ARM: tegra: rework fdt_serial_tag_setup_one

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:18 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de; Stephen Warren <[email protected]>
Subject: Re: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

External email: Use caution opening links or attachments

Quoted 8 lines · Stephen Warren
Quoted 6 lines · twarren at nvidia.com

From: Stephen Warren <[email protected]>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied to CONFIG_SERIAL_TAG, and rename the function to better indicate its purpose. This will allow it to be re-used by future board info related code.

Quoted 7 lines
Quoted 3 lines
 arch/arm/mach-tegra/ft_board_info.c | 77 
+++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++

I don't think this series was based on upstream, or there are missing patches in between upstream and this series; those files don't exist upstream.

Oh. This patch adds those files. But the commit description says it's reworking some existing logic. I guess the description is from some squashed patch, and doesn't describe what the patch actually does? Also, the new file isn't added to any Makefile, and no edits are made to any other file in order to call the newly added functionality. [Tom] Yeah, this got messed up when I squashed/edited the transition from nvtboot to cboot support files in arch/arm/mach-tegra. I'll have to revisit this, as the code isn't called anywhere currently in my upstream work, nor build by a Makefile.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

author
#5 lore raw

PATCH 1/5 ARM: tegra: rework fdt_serial_tag_setup_one

-----Original Message-----
From: Tom Warren
Sent: Tuesday, March 17, 2020 10:43 AM
To: Stephen Warren <[email protected]>
Cc: u-boot at lists.denx.de; Stephen Warren <[email protected]>; tomcwarren3959 at gmail.com
Subject: RE: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:18 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de; Stephen Warren <[email protected]>
Subject: Re: [PATCH 1/5] ARM: tegra: rework fdt_serial_tag_setup_one

External email: Use caution opening links or attachments

Quoted 8 lines · Stephen Warren
Quoted 6 lines · twarren at nvidia.com

From: Stephen Warren <[email protected]>

Reword fdt_serial_tag_setup_one() so that the types it uses aren't tied to CONFIG_SERIAL_TAG, and rename the function to better indicate its purpose. This will allow it to be re-used by future board info related code.

Quoted 7 lines
Quoted 3 lines
 arch/arm/mach-tegra/ft_board_info.c | 77
+++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/ft_board_info.h | 23 +++++++++++

I don't think this series was based on upstream, or there are missing patches in between upstream and this series; those files don't exist upstream.

Oh. This patch adds those files. But the commit description says it's reworking some existing logic. I guess the description is from some squashed patch, and doesn't describe what the patch actually does? Also, the new file isn't added to any Makefile, and no edits are made to any other file in order to call the newly added functionality. [Tom] Yeah, this got messed up when I squashed/edited the transition from nvtboot to cboot support files in arch/arm/mach-tegra. I'll have to revisit this, as the code isn't called anywhere currently in my upstream work, nor build by a Makefile.
[Tom] OK, so this work (adding board info (proc/pmu/display) is already done by CBoot on T210 before we get to U-Boot, so it's not needed. Mea culpa - lots of churn w/these patches, trying to get them squashed/optimized for upstreaming, and I mistakenly kept this one around from the nvtboot->U-Boot days. I'll drop it.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#6 lore raw

PATCH 2/5 t210: do not enable PLLE and UPHY PLL HW PWRSEQ

In reply to twarren at nvidia.com

From: JC Kuo <[email protected]>

This commit removes the programming sequence that enables PLLE and UPHY PLL hardware power sequencers. Per TRM, boot software should enable PLLE and UPHY PLLs in software controlled power-on state and should power down PLL before jumping into kernel or the next stage boot software.

Adds call to board_cleanup_before_linux to facilitate this.

---
 arch/arm/cpu/armv8/cpu.c                      |  5 ++
 arch/arm/include/asm/arch-tegra/xusb-padctl.h |  1 +
 arch/arm/mach-tegra/board2.c                  |  6 +++
 arch/arm/mach-tegra/tegra210/clock.c          | 19 --------
 arch/arm/mach-tegra/tegra210/xusb-padctl.c    | 68 +++++++++++++++++----------
 arch/arm/mach-tegra/xusb-padctl-dummy.c       |  4 ++
 6 files changed, 59 insertions(+), 44 deletions(-)
arch/arm/cpu/armv8/cpu.c +5 -0
index 2467e0b..3575203 100644
@@ -32,6 +32,8 @@ void sdelay(unsigned long loops)
 			  "b.ne 1b" : "=r" (loops) : "0"(loops) : "cc");
 }
 
+void __weak board_cleanup_before_linux(void){}
+
 int cleanup_before_linux(void)
 {
 	/*
@@ -40,6 +42,9 @@ int cleanup_before_linux(void)
 	 *
 	 * disable interrupt and turn off caches etc ...
 	 */
+
+	board_cleanup_before_linux();
+
 	disable_interrupts();
 
 	/*
arch/arm/include/asm/arch-tegra/xusb-padctl.h +1 -0
index deccdf4..7e14d81 100644
@@ -16,6 +16,7 @@ struct tegra_xusb_phy;
 struct tegra_xusb_phy *tegra_xusb_phy_get(unsigned int type);
 
 void tegra_xusb_padctl_init(void);
+void tegra_xusb_padctl_exit(void);
 int tegra_xusb_phy_prepare(struct tegra_xusb_phy *phy);
 int tegra_xusb_phy_enable(struct tegra_xusb_phy *phy);
 int tegra_xusb_phy_disable(struct tegra_xusb_phy *phy);
arch/arm/mach-tegra/board2.c +6 -0
index d3497a2..787ff97 100644
@@ -181,6 +181,12 @@ int board_init(void)
 	return nvidia_board_init();
 }
 
+void board_cleanup_before_linux(void)
+{
+	/* power down UPHY PLL */
+	tegra_xusb_padctl_exit();
+}
+
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 static void __gpio_early_init(void)
 {
arch/arm/mach-tegra/tegra210/clock.c +0 -19
index b240860..f1b25e2 100644
@@ -1235,25 +1235,6 @@ int tegra_plle_enable(void)
 	value &= ~PLLE_SS_CNTL_INTERP_RESET;
 	writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
 
-	/* 7. Enable HW power sequencer for PLLE */
-
-	value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
-	value &= ~PLLE_MISC_IDDQ_SWCTL;
-	writel(value, NV_PA_CLK_RST_BASE + PLLE_MISC);
-
-	value = readl(NV_PA_CLK_RST_BASE + PLLE_AUX);
-	value &= ~PLLE_AUX_SS_SWCTL;
-	value &= ~PLLE_AUX_ENABLE_SWCTL;
-	value |= PLLE_AUX_SS_SEQ_INCLUDE;
-	value |= PLLE_AUX_USE_LOCKDET;
-	writel(value, NV_PA_CLK_RST_BASE + PLLE_AUX);
-
-	/* 8. Wait 1 us */
-
-	udelay(1);
-	value |= PLLE_AUX_SEQ_ENABLE;
-	writel(value, NV_PA_CLK_RST_BASE + PLLE_AUX);
-
 	return 0;
 }
 
arch/arm/mach-tegra/tegra210/xusb-padctl.c +43 -25

83 lines not on this page · raw message

arch/arm/mach-tegra/xusb-padctl-dummy.c +4 -0
index 3ec27a2..f2d9030 100644
@@ -36,3 +36,7 @@ int __weak tegra_xusb_phy_unprepare(struct tegra_xusb_phy *phy)
 void __weak tegra_xusb_padctl_init(void)
 {
 }
+
+void __weak tegra_xusb_padctl_exit(void)
+{
+}
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#7 lore raw

PATCH 2/5 t210: do not enable PLLE and UPHY PLL HW PWRSEQ

Quoted 8 lines · twarren at nvidia.com

From: JC Kuo <[email protected]>

This commit removes the programming sequence that enables PLLE and UPHY PLL hardware power sequencers. Per TRM, boot software should enable PLLE and UPHY PLLs in software controlled power-on state and should power down PLL before jumping into kernel or the next stage boot software.

Adds call to board_cleanup_before_linux to facilitate this.

This directly contradicts what's in Tegra_X1_TRM_DP07225001_v1.3p.pdf, pages 1340/1341, which is what the code currently implements. Was a newer internal-only TRM published that changed the recommended programming flow?

author
#8 lore raw

PATCH 2/5 t210: do not enable PLLE and UPHY PLL HW PWRSEQ

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:30 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de; Jui Chang Kuo <[email protected]>
Subject: Re: [PATCH 2/5] t210: do not enable PLLE and UPHY PLL HW PWRSEQ

External email: Use caution opening links or attachments

Quoted 8 lines · twarren at nvidia.com

From: JC Kuo <[email protected]>

This commit removes the programming sequence that enables PLLE and UPHY PLL hardware power sequencers. Per TRM, boot software should enable PLLE and UPHY PLLs in software controlled power-on state and should power down PLL before jumping into kernel or the next stage boot software.

Adds call to board_cleanup_before_linux to facilitate this.

This directly contradicts what's in Tegra_X1_TRM_DP07225001_v1.3p.pdf,
pages 1340/1341, which is what the code currently implements. Was a newer internal-only TRM published that changed the recommended programming flow? [Tom] JC wrote this, I'll let him answer, but I'll check my TRM to see what the most recent version is. This code is exactly what we have in downstream T210 U-Boot.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#9 lore raw

PATCH 2/5 t210: do not enable PLLE and UPHY PLL HW PWRSEQ

Please refer to "Notes" section in p1337 of Tegra_X1_TRM_DP07225001_v1.3p.pdf. There are some implementation considerations for boot software.

Thanks,
JC

Quoted 18 lines · Tom Warren

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:30 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de; Jui Chang Kuo <[email protected]>
Subject: Re: [PATCH 2/5] t210: do not enable PLLE and UPHY PLL HW PWRSEQ

External email: Use caution opening links or attachments

Quoted 7 lines · twarren at nvidia.com

From: JC Kuo <[email protected]>

This commit removes the programming sequence that enables PLLE and UPHY PLL hardware power sequencers. Per TRM, boot software should enable PLLE and UPHY PLLs in software controlled power-on state and should power down PLL before jumping into kernel or the next stage boot software.

Quoted 6 lines
Quoted 1 line

Adds call to board_cleanup_before_linux to facilitate this.

This directly contradicts what's in Tegra_X1_TRM_DP07225001_v1.3p.pdf,
pages 1340/1341, which is what the code currently implements. Was a newer internal-only TRM published that changed the recommended programming flow? [Tom] JC wrote this, I'll let him answer, but I'll check my TRM to see what the most recent version is. This code is exactly what we have in downstream T210 U-Boot.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#10 lore raw

PATCH 2/5 t210: do not enable PLLE and UPHY PLL HW PWRSEQ

Quoted 2 lines · JC Kuo

Please refer to "Notes" section in p1337 of Tegra_X1_TRM_DP07225001_v1.3p.pdf. There are some implementation considerations for boot software.

OK, I assume you mean this note:

Boot loader should not enable hardware power sequencer. Boot loader should enable the required PLLs in software controlled state.

That's interesting, since I explicitly added the code to program PLLE in HW controlled mode after discussing with the relevant HW engineers the need to clean up the programming sequence in the following pages, and it was clearly communicated that this was in the context of a bootloader, and they pointed out that the bootloader needed to enable HW control but didn't. Sigh. I guess I should have read the sections prior to the programming sequence too.

So I guess this change is OK, and since we have it downstream it seems to operate OK in practice too.

Quoted 36 lines

Thanks,
JC

Quoted 18 lines · Tom Warren

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:30 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de; Jui Chang Kuo <[email protected]>
Subject: Re: [PATCH 2/5] t210: do not enable PLLE and UPHY PLL HW PWRSEQ

External email: Use caution opening links or attachments

Quoted 7 lines · twarren at nvidia.com

From: JC Kuo <[email protected]>

This commit removes the programming sequence that enables PLLE and UPHY PLL hardware power sequencers. Per TRM, boot software should enable PLLE and UPHY PLLs in software controlled power-on state and should power down PLL before jumping into kernel or the next stage boot software.

Quoted 6 lines
Quoted 1 line

Adds call to board_cleanup_before_linux to facilitate this.

This directly contradicts what's in Tegra_X1_TRM_DP07225001_v1.3p.pdf,
pages 1340/1341, which is what the code currently implements. Was a newer internal-only TRM published that changed the recommended programming flow? [Tom] JC wrote this, I'll let him answer, but I'll check my TRM to see what the most recent version is. This code is exactly what we have in downstream T210 U-Boot.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#11 lore raw

PATCH 3/5 ARM: tegra: p2771-0000: enable PIE relocation

In reply to twarren at nvidia.com

From: Vishruth <[email protected]>

U-Boot is configured to build as position independent executable. Enable relocation of RELA section required to work with different load addresses.

---
 configs/p2771-0000-000_defconfig | 1 +
 configs/p2771-0000-500_defconfig | 1 +
 2 files changed, 2 insertions(+)
configs/p2771-0000-000_defconfig +1 -0
index 06f12e2..e347a77 100644
@@ -36,3 +36,4 @@ CONFIG_TEGRA186_POWER_DOMAIN=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
+CONFIG_POSITION_INDEPENDENT=y
configs/p2771-0000-500_defconfig +1 -0
index 1a14a92..0803b26 100644
@@ -36,3 +36,4 @@ CONFIG_TEGRA186_POWER_DOMAIN=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
+CONFIG_POSITION_INDEPENDENT=y
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#13 lore raw

PATCH 4/5 fdt: Fix 'system' command

In reply to twarren at nvidia.com

From: Tom Warren <[email protected]>

'fdt systemsetup' wasn't working, due to the fact that the 'set' command was being parsed in do_fdt() by only testing for the leading 's' instead of "se", which kept the "sys" test further down from executing. Changed to test for "se" instead, now 'fdt systemsetup' works (to test the ft_system_setup proc w/o having to boot a kernel).

---
 cmd/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/fdt.c +1 -1
index 25a6ed4..36cc726 100644
@@ -286,7 +286,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	/*
 	 * Set the value of a property in the working_fdt.
 	 */
-	} else if (argv[1][0] == 's') {
+	} else if (strncmp(argv[1], "se", 2) == 0) {
 		char *pathp;		/* path */
 		char *prop;		/* property */
 		int  nodeoffset;	/* node offset from libfdt */
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#14 lore raw

PATCH 4/5 fdt: Fix 'system' command

Quoted 7 lines · twarren at nvidia.com

From: Tom Warren <[email protected]>

'fdt systemsetup' wasn't working, due to the fact that the 'set' command was being parsed in do_fdt() by only testing for the leading 's' instead of "se", which kept the "sys" test further down from executing. Changed to test for "se" instead, now 'fdt systemsetup' works (to test the ft_system_setup proc w/o having to boot a kernel).

(Although I wonder if this shouldn't just test the entire string to avoid any possible future ambiguity if more sub-commands are added later. Or doesn't U-Boot already have some sub-command table infra-structure this could use?)

author
#15 lore raw

PATCH 4/5 fdt: Fix 'system' command

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:33 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH 4/5] fdt: Fix 'system' command

External email: Use caution opening links or attachments

Quoted 7 lines · twarren at nvidia.com

From: Tom Warren <[email protected]>

'fdt systemsetup' wasn't working, due to the fact that the 'set' command was being parsed in do_fdt() by only testing for the leading 's' instead of "se", which kept the "sys" test further down from executing. Changed to test for "se" instead, now 'fdt systemsetup' works (to test the ft_system_setup proc w/o having to boot a kernel).

(Although I wonder if this shouldn't just test the entire string to avoid any possible future ambiguity if more sub-commands are added later. Or doesn't U-Boot already have some sub-command table infra-structure this could use?) [Tom] I usually take the path of least rework approach, so I just fixed the systemsetup command, which is what I was interested in. Let's see if any other Denxians chime in w/their opinion, and I can rework it if needed.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#16 lore raw

PATCH 5/5 ARM: Tegra: Use calc env var feature on all boards

In reply to twarren at nvidia.com

From: Tom Warren <[email protected]>

Large kernels (>32MB) can fail to boot because they overwrite the FDT address, corrupting the DTB. Stephen Warren had created a fix to dynamically adjust the fdt/ramdisk/pxefile/kernel addr vars at boot time for T186, which allows a large kernel to load and boot.

This is based on his commit, but applied to the tegraXXX-common.h headers so it's used on all T186 and T210 Jetson boards. Note that I've put the kernel 'size' param at 0x03000000, or 48MB, to leave room for kernel growth. Current L4T kernels are running at about 32MB.

---
 include/configs/p2771-0000.h      | 23 ++---------------------
 include/configs/tegra186-common.h | 22 ++++++++++++++++++++--
 include/configs/tegra210-common.h | 23 ++++++++++++++++++++---
 3 files changed, 42 insertions(+), 26 deletions(-)
include/configs/p2771-0000.h +2 -21
index 7c6d68a..90d764f 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Copyright (c) 2013-2016, NVIDIA CORPORATION.
+ * Copyright (c) 2013-2020, NVIDIA CORPORATION.
+ *
  */
 
 #ifndef _P2771_0000_H
@@ -17,26 +18,6 @@
 #define CONFIG_SYS_MMC_ENV_DEV		0
 #define CONFIG_SYS_MMC_ENV_PART		2
 
-#define BOARD_EXTRA_ENV_SETTINGS \
-	"calculated_vars=kernel_addr_r fdt_addr_r scriptaddr pxefile_addr_r " \
-		"ramdisk_addr_r\0" \
-	"kernel_addr_r_align=00200000\0" \
-	"kernel_addr_r_offset=00080000\0" \
-	"kernel_addr_r_size=02000000\0" \
-	"kernel_addr_r_aliases=loadaddr\0" \
-	"fdt_addr_r_align=00200000\0" \
-	"fdt_addr_r_offset=00000000\0" \
-	"fdt_addr_r_size=00200000\0" \
-	"scriptaddr_align=00200000\0" \
-	"scriptaddr_offset=00000000\0" \
-	"scriptaddr_size=00200000\0" \
-	"pxefile_addr_r_align=00200000\0" \
-	"pxefile_addr_r_offset=00000000\0" \
-	"pxefile_addr_r_size=00200000\0" \
-	"ramdisk_addr_r_align=00200000\0" \
-	"ramdisk_addr_r_offset=00000000\0" \
-	"ramdisk_addr_r_size=02000000\0"
-
 #include "tegra-common-post.h"
 
 /* Crystal is 38.4MHz. clk_m runs at half that rate */
include/configs/tegra186-common.h +20 -2
index b4936cc..e88e68d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Copyright 2013-2016, NVIDIA CORPORATION.
+ *  Copyright (c) 2013-2020, NVIDIA CORPORATION.
  */
 
 #ifndef _TEGRA186_COMMON_H_
@@ -50,6 +50,24 @@
 	"pxefile_addr_r=0x90100000\0" \
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"fdt_addr_r=0x82000000\0" \
-	"ramdisk_addr_r=0x82100000\0"
+	"ramdisk_addr_r=0x82100000\0" \
+	"calculated_vars=kernel_addr_r fdt_addr_r scriptaddr pxefile_addr_r " \
+		"ramdisk_addr_r\0" \
+	"kernel_addr_r_align=00200000\0" \
+	"kernel_addr_r_offset=00080000\0" \
+	"kernel_addr_r_size=03000000\0" \
+	"kernel_addr_r_aliases=loadaddr\0" \
+	"fdt_addr_r_align=00200000\0" \
+	"fdt_addr_r_offset=00000000\0" \
+	"fdt_addr_r_size=00200000\0" \
+	"scriptaddr_align=00200000\0" \
+	"scriptaddr_offset=00000000\0" \
+	"scriptaddr_size=00200000\0" \
+	"pxefile_addr_r_align=00200000\0" \
+	"pxefile_addr_r_offset=00000000\0" \
+	"pxefile_addr_r_size=00200000\0" \
+	"ramdisk_addr_r_align=00200000\0" \
+	"ramdisk_addr_r_offset=00000000\0" \
+	"ramdisk_addr_r_size=02000000\0"
 
 #endif
include/configs/tegra210-common.h +20 -3
index 1c53311..0d15b30 100644
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * (C) Copyright 2013-2015
- * NVIDIA Corporation <www.nvidia.com>
+ *  Copyright (c) 2013-2020, NVIDIA CORPORATION.
  */
 
 #ifndef _TEGRA210_COMMON_H_
@@ -47,7 +46,25 @@
 	"pxefile_addr_r=0x90100000\0" \
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"fdt_addr_r=0x82000000\0" \
-	"ramdisk_addr_r=0x82100000\0"
+	"ramdisk_addr_r=0x82100000\0" \
+	"calculated_vars=kernel_addr_r fdt_addr_r scriptaddr pxefile_addr_r " \
+		"ramdisk_addr_r\0" \
+	"kernel_addr_r_align=00200000\0" \
+	"kernel_addr_r_offset=00080000\0" \
+	"kernel_addr_r_size=03000000\0" \
+	"kernel_addr_r_aliases=loadaddr\0" \
+	"fdt_addr_r_align=00200000\0" \
+	"fdt_addr_r_offset=00000000\0" \
+	"fdt_addr_r_size=00200000\0" \
+	"scriptaddr_align=00200000\0" \
+	"scriptaddr_offset=00000000\0" \
+	"scriptaddr_size=00200000\0" \
+	"pxefile_addr_r_align=00200000\0" \
+	"pxefile_addr_r_offset=00000000\0" \
+	"pxefile_addr_r_size=00200000\0" \
+	"ramdisk_addr_r_align=00200000\0" \
+	"ramdisk_addr_r_offset=00000000\0" \
+	"ramdisk_addr_r_size=02000000\0"
 
 /* For USB EHCI controller */
 #define CONFIG_EHCI_IS_TDI
Signature · 9 lines
1.8.2.1.610.g562af5b


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
#17 lore raw

PATCH 5/5 ARM: Tegra: Use calc env var feature on all boards

Quoted 6 lines · twarren at nvidia.com

From: Tom Warren <[email protected]>

Large kernels (>32MB) can fail to boot because they overwrite the FDT address, corrupting the DTB. Stephen Warren had created a fix to dynamically adjust the fdt/ramdisk/pxefile/kernel addr vars at boot time for T186, which allows a large kernel to load and boot.

That was actually done to support holes in the RAM map; it's not actually required in order to support large kernels at all. We could just as easily directly modify the existing hard-coded load addresses.

Quoted 4 lines

This is based on his commit, but applied to the tegraXXX-common.h headers so it's used on all T186 and T210 Jetson boards. Note that I've put the kernel 'size' param at 0x03000000, or 48MB, to leave room for kernel growth. Current L4T kernels are running at about 32MB.

I had completely forgotten that we had the calculated env vars feature upstream already!

I thought we went with 96 or 128MB space for the kernel downstream, to make sure there'd "never" any future problem as the kernel grows?

But this patch seems OK for now I guess.

author
#18 lore raw

PATCH 5/5 ARM: Tegra: Use calc env var feature on all boards

-----Original Message-----
From: Stephen Warren <[email protected]>
Sent: Tuesday, March 17, 2020 10:38 AM
To: Tom Warren <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH 5/5] ARM: Tegra: Use calc env var feature on all boards

External email: Use caution opening links or attachments

Quoted 6 lines · twarren at nvidia.com

From: Tom Warren <[email protected]>

Large kernels (>32MB) can fail to boot because they overwrite the FDT address, corrupting the DTB. Stephen Warren had created a fix to dynamically adjust the fdt/ramdisk/pxefile/kernel addr vars at boot time for T186, which allows a large kernel to load and boot.

That was actually done to support holes in the RAM map; it's not actually required in order to support large kernels at all. We could just as easily directly modify the existing hard-coded load addresses.

Quoted 4 lines

This is based on his commit, but applied to the tegraXXX-common.h headers so it's used on all T186 and T210 Jetson boards. Note that I've put the kernel 'size' param at 0x03000000, or 48MB, to leave room for kernel growth. Current L4T kernels are running at about 32MB.

I had completely forgotten that we had the calculated env vars feature upstream already!

I thought we went with 96 or 128MB space for the kernel downstream, to make sure there'd "never" any future problem as the kernel grows?

But this patch seems OK for now I guess.
[Tom] Yes, we have a large (128MB) kernel size in downstream L4T U-Boot, but only because of the need to test GCOV kernels - I didn't think that excessive allocation was required upstream, so I backed it off to 48MB. As to your point about just fixing the hard-coding of the kernel/ramdisk/fdt_addr_r in T210, I can do that, but it seemed more elegant and future-proof to use the calc env vars code you'd added for T186, plus it brings the two builds in sync, using the same allocation strategy for these 'load' vars.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------