aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSvyatoslav Ryhel <clamor95@gmail.com>2023-10-03 09:36:45 +0300
committerTom Rini <trini@konsulko.com>2023-11-03 12:37:15 -0400
commit6bc34012942d3b9fa5831b0ee3486ca9b4225a7f (patch)
treeb1eecb3c028900f36776c6446e5991d9b9e40a16 /arch
parentf2cf7feb80889b6a777e470f6cc2ece4ac03374f (diff)
downloadu-boot-6bc34012942d3b9fa5831b0ee3486ca9b4225a7f.zip
u-boot-6bc34012942d3b9fa5831b0ee3486ca9b4225a7f.tar.gz
u-boot-6bc34012942d3b9fa5831b0ee3486ca9b4225a7f.tar.bz2
ARM: tegra: board2: add generic late init
Board specific late init allows vendors to set up different device or board specific env variables (like serial number, platform name). In case this information is missing, u-boot will lack info regards serial or platform. To avoid this prior nvidia_board_late_init internal generic function is called which fills required data. In this case platform name is obtained from get_chip and serialno is filled with SoC id. Though SoC id is not dedicated to be devices serial but it fits well in case of restriction of data about device and since SoC is basically a main chip of the device. Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS Transformers Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # Nvidia Tegratab Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/board2.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 981768b..cd40587 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -26,6 +26,10 @@
#include <asm/arch-tegra/gpu.h>
#include <asm/arch-tegra/usb.h>
#include <asm/arch-tegra/xusb-padctl.h>
+#ifndef CONFIG_TEGRA186
+#include <asm/arch-tegra/fuse.h>
+#include <asm/arch/gp_padctrl.h>
+#endif
#if IS_ENABLED(CONFIG_TEGRA_CLKRST)
#include <asm/arch/clock.h>
#endif
@@ -256,6 +260,37 @@ int board_early_init_f(void)
}
#endif /* EARLY_INIT */
+#ifndef CONFIG_TEGRA186
+static void nvidia_board_late_init_generic(void)
+{
+ char serialno_str[17];
+
+ /* Set chip id as serialno */
+ sprintf(serialno_str, "%016llx", tegra_chip_uid());
+ env_set("serial#", serialno_str);
+
+ switch (tegra_get_chip()) {
+ case CHIPID_TEGRA20:
+ env_set("platform", "tegra20");
+ break;
+ case CHIPID_TEGRA30:
+ env_set("platform", "tegra30");
+ break;
+ case CHIPID_TEGRA114:
+ env_set("platform", "tegra114");
+ break;
+ case CHIPID_TEGRA124:
+ env_set("platform", "tegra124");
+ break;
+ case CHIPID_TEGRA210:
+ env_set("platform", "tegra210");
+ break;
+ default:
+ return;
+ }
+}
+#endif
+
int board_late_init(void)
{
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
@@ -268,6 +303,14 @@ int board_late_init(void)
#endif
start_cpu_fan();
cboot_late_init();
+
+ /*
+ * Perform generic env setup in case
+ * vendor does not provide it.
+ */
+#ifndef CONFIG_TEGRA186
+ nvidia_board_late_init_generic();
+#endif
nvidia_board_late_init();
return 0;