[PATCH 1/4] board: fsl: lx2160ardb: add api for obtaining board revision

Ioana Ciornei ioana.ciornei at nxp.com
Wed Apr 21 12:36:52 CEST 2021


From: Florin Chiculita <florinlaurentiu.chiculita at nxp.com>

Add new API for obtaining board revision and trigger the i2c node
fixup with this new API.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita at nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei at nxp.com>
---
 board/freescale/lx2160a/lx2160a.c | 13 ++++++++++---
 board/freescale/lx2160a/lx2160a.h |  4 ++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c
index 8f75b48f956b..97e0021b0c53 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -564,6 +564,15 @@ int config_board_mux(void)
 }
 #endif
 
+#if CONFIG_IS_ENABLED(TARGET_LX2160ARDB)
+u8 get_board_rev(void)
+{
+	u8 board_rev = (QIXIS_READ(arch) & 0xf) - 1 + 'A';
+
+	return board_rev;
+}
+#endif
+
 unsigned long get_board_sys_clk(void)
 {
 #if defined(CONFIG_TARGET_LX2160AQDS) || defined(CONFIG_TARGET_LX2162AQDS)
@@ -847,7 +856,6 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	u64 mc_memory_base = 0;
 	u64 mc_memory_size = 0;
 	u16 total_memory_banks;
-	u8 board_rev;
 
 	ft_cpu_setup(blob, bd);
 
@@ -903,8 +911,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 	fdt_fixup_icid(blob);
 
 if (IS_ENABLED(CONFIG_TARGET_LX2160ARDB)) {
-	board_rev = (QIXIS_READ(arch) & 0xf) - 1 + 'A';
-	if (board_rev == 'C')
+	if (get_board_rev() == 'C')
 		fdt_fixup_i2c_thermal_node(blob);
 	}
 
diff --git a/board/freescale/lx2160a/lx2160a.h b/board/freescale/lx2160a/lx2160a.h
index 52b020765dc6..26a94e4c176a 100644
--- a/board/freescale/lx2160a/lx2160a.h
+++ b/board/freescale/lx2160a/lx2160a.h
@@ -58,4 +58,8 @@
 #endif
 #endif
 
+#if CONFIG_IS_ENABLED(TARGET_LX2160ARDB)
+u8 get_board_rev(void);
+#endif
+
 #endif /* __LX2160_H */
-- 
2.17.1



More information about the U-Boot mailing list