]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: tq: common: add sysinfo setup helper
authorNora Schiffer <nora.schiffer@ew.tq-group.com>
Tue, 2 Jun 2026 11:57:52 +0000 (13:57 +0200)
committerFabio Estevam <festevam@gmail.com>
Fri, 5 Jun 2026 15:56:32 +0000 (12:56 -0300)
Add a setup helper based on the tq_eeprom sysinfo driver
and set up the U-Boot environment.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Feilke <alexander.feilke@ew.tq-group.com>
board/tq/common/Kconfig
board/tq/common/Makefile
board/tq/common/tq_sysinfo.c [new file with mode: 0644]
board/tq/common/tq_sysinfo.h [new file with mode: 0644]

index 2fe2ca3007289b64af3dc2a6a9c5d2461bfee798..567b6e2380a7f5323217469355192f7088e79fd4 100644 (file)
@@ -14,3 +14,8 @@ config TQ_COMMON_SDMMC
 
 config TQ_COMMON_SOM
        bool
+
+config TQ_COMMON_SYSINFO
+       bool
+       select SYSINFO
+       imply SYSINFO_TQ_EEPROM
index 4af9207da4abffeec7de98d46553c27574fe0475..6cb39a1925edcd5bde0fa72ea5133b03adf7e935 100644 (file)
@@ -8,3 +8,4 @@
 obj-$(CONFIG_TQ_COMMON_BB) += tq_bb.o
 obj-$(CONFIG_TQ_COMMON_SOM) += tq_som.o
 obj-$(CONFIG_TQ_COMMON_SDMMC) += tq_sdmmc.o
+obj-$(CONFIG_$(PHASE_)TQ_COMMON_SYSINFO) += tq_sysinfo.o
diff --git a/board/tq/common/tq_sysinfo.c b/board/tq/common/tq_sysinfo.c
new file mode 100644 (file)
index 0000000..8d21d1e
--- /dev/null
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Common sysinfo helpers for TQ-Systems SOMs
+ *
+ * Copyright (c) 2020-2026 TQ-Systems GmbH <u-boot@ew.tq-group.com>
+ * D-82229 Seefeld, Germany.
+ * Author: Nora Schiffer
+ */
+
+#include <env.h>
+#include <log.h>
+#include <sysinfo/tq_eeprom.h>
+
+#include "tq_sysinfo.h"
+
+#define MAX_NAME_LENGTH        80
+
+int tq_common_sysinfo_setup(void)
+{
+       struct udevice *sysinfo;
+       char buf[MAX_NAME_LENGTH];
+       int ret;
+
+       ret = sysinfo_get_and_detect(&sysinfo);
+       if (ret) {
+               log_debug("Failed to get sysinfo data: %d\n", ret);
+               return ret;
+       }
+
+       if (!sysinfo_get_str(sysinfo, SYSID_TQ_MODEL, sizeof(buf), buf))
+               env_set_runtime("boardtype", buf);
+
+       if (!sysinfo_get_str(sysinfo, SYSID_TQ_SERIAL, sizeof(buf), buf))
+               env_set_runtime("serial#", buf);
+
+       return 0;
+}
diff --git a/board/tq/common/tq_sysinfo.h b/board/tq/common/tq_sysinfo.h
new file mode 100644 (file)
index 0000000..d73b00e
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Common sysinfo helpers for TQ-Systems SOMs
+ *
+ * Copyright (c) 2025-2026 TQ-Systems GmbH <u-boot@ew.tq-group.com>
+ * D-82229 Seefeld, Germany.
+ * Author: Nora Schiffer
+ */
+
+#ifndef __TQ_SYSINFO_H
+#define __TQ_SYSINFO_H
+
+int tq_common_sysinfo_setup(void);
+
+#endif /* __TQ_SYSINFO_H */