[PATCH 08/13] board/tq: Add common baseboard API
Max Merchel
Max.Merchel at ew.tq-group.com
Thu Mar 12 10:57:04 CET 2026
From: Markus Niebel <Markus.Niebel at ew.tq-group.com>
TQMa6 and other SOM from TQ-Systems GmbH need a base board. Therefore
functionality of U-Boot board callbacks may be distributed between SOM
and base board implementation.
To prevent code duplication and boilerplate implement a baseboard specific
API for TQ boards with weak defaults that can be filled out for baseboard
implementations as needed.
Signed-off-by: Markus Niebel <Markus.Niebel at ew.tq-group.com>
Signed-off-by: Max Merchel <Max.Merchel at ew.tq-group.com>
---
board/tq/common/Kconfig | 10 ++++++
board/tq/common/Makefile | 8 +++++
board/tq/common/tq_bb.c | 78 ++++++++++++++++++++++++++++++++++++++++
board/tq/common/tq_bb.h | 39 ++++++++++++++++++++
4 files changed, 135 insertions(+)
create mode 100644 board/tq/common/Kconfig
create mode 100644 board/tq/common/Makefile
create mode 100644 board/tq/common/tq_bb.c
create mode 100644 board/tq/common/tq_bb.h
diff --git a/board/tq/common/Kconfig b/board/tq/common/Kconfig
new file mode 100644
index 00000000000..a4a1d17bb9c
--- /dev/null
+++ b/board/tq/common/Kconfig
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (c) 2023-2026 TQ-Systems GmbH <u-boot at ew.tq-group.com>,
+# D-82229 Seefeld, Germany.
+# Author: Markus Niebel, Max Merchel
+#
+
+config TQ_COMMON_BB
+ bool
+ default y
diff --git a/board/tq/common/Makefile b/board/tq/common/Makefile
new file mode 100644
index 00000000000..b643321fcb0
--- /dev/null
+++ b/board/tq/common/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (c) 2016-2026 TQ-Systems GmbH <u-boot at ew.tq-group.com>,
+# D-82229 Seefeld, Germany.
+# Author: Markus Niebel
+#
+
+obj-$(CONFIG_TQ_COMMON_BB) += tq_bb.o
diff --git a/board/tq/common/tq_bb.c b/board/tq/common/tq_bb.c
new file mode 100644
index 00000000000..40cff6ab178
--- /dev/null
+++ b/board/tq/common/tq_bb.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2022-2026 TQ-Systems GmbH <u-boot at ew.tq-group.com>,
+ * D-82229 Seefeld, Germany.
+ * Author: Markus Niebel
+ */
+
+#include <linux/types.h>
+
+#include "tq_bb.h"
+
+int __weak tq_bb_board_mmc_getwp(struct mmc *mmc)
+{
+ return 0;
+}
+
+int __weak tq_bb_board_mmc_getcd(struct mmc *mmc)
+{
+ return 0;
+}
+
+int __weak tq_bb_board_mmc_init(struct bd_info *bis)
+{
+ return 0;
+}
+
+int __weak tq_bb_board_early_init_f(void)
+{
+ return 0;
+}
+
+int __weak tq_bb_board_init(void)
+{
+ return 0;
+}
+
+int __weak tq_bb_board_late_init(void)
+{
+ return 0;
+}
+
+int __weak tq_bb_checkboard(void)
+{
+ return 0;
+}
+
+void __weak tq_bb_board_quiesce_devices(void)
+{
+ ;
+}
+
+const char * __weak tq_bb_get_boardname(void)
+{
+ return "INVALID";
+}
+
+#if IS_ENABLED(CONFIG_SPL_BUILD)
+void __weak tq_bb_board_init_f(ulong dummy)
+{
+ ;
+}
+
+void __weak tq_bb_spl_board_init(void)
+{
+ ;
+}
+#endif /* IS_ENABLED(CONFIG_SPL_BUILD) */
+
+/*
+ * Device Tree Support
+ */
+#if IS_ENABLED(CONFIG_OF_BOARD_SETUP) && IS_ENABLED(CONFIG_OF_LIBFDT)
+int __weak tq_bb_ft_board_setup(void *blob, struct bd_info *bis)
+{
+ return 0;
+}
+
+#endif /* IS_ENABLED(CONFIG_OF_BOARD_SETUP) && IS_ENABLED(CONFIG_OF_LIBFDT) */
diff --git a/board/tq/common/tq_bb.h b/board/tq/common/tq_bb.h
new file mode 100644
index 00000000000..5b1b3f62a8c
--- /dev/null
+++ b/board/tq/common/tq_bb.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2013-2026 TQ-Systems GmbH <u-boot at ew.tq-group.com>,
+ * D-82229 Seefeld, Germany.
+ * Author: Markus Niebel
+ */
+
+#ifndef __TQ_BB_H
+#define __TQ_BB_H
+
+struct mmc;
+struct bd_info;
+struct node_info;
+
+int tq_bb_board_mmc_getwp(struct mmc *mmc);
+int tq_bb_board_mmc_getcd(struct mmc *mmc);
+int tq_bb_board_mmc_init(struct bd_info *bis);
+
+int tq_bb_board_early_init_f(void);
+int tq_bb_board_init(void);
+int tq_bb_board_late_init(void);
+int tq_bb_checkboard(void);
+void tq_bb_board_quiesce_devices(void);
+
+const char *tq_bb_get_boardname(void);
+
+#if IS_ENABLED(CONFIG_SPL_BUILD)
+void tq_bb_board_init_f(ulong dummy);
+void tq_bb_spl_board_init(void);
+#endif
+
+/*
+ * Device Tree Support
+ */
+#if IS_ENABLED(CONFIG_OF_BOARD_SETUP) && IS_ENABLED(CONFIG_OF_LIBFDT)
+int tq_bb_ft_board_setup(void *blob, struct bd_info *bis);
+#endif /* IS_ENABLED(CONFIG_OF_BOARD_SETUP) && IS_ENABLED(CONFIG_OF_LIBFDT) */
+
+#endif /* __TQ_BB_H */
--
2.43.0
More information about the U-Boot
mailing list