[RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable

Roland Hieber rhi at pengutronix.de
Thu May 11 01:58:03 PDT 2023


The SPI flash and eMMC are hard-wired on the TQMa6x SoM, so this
function is not specific for the mba6x baseboard but can be used on
other boards with a TQMa6x SoM too.

tqma6x_enet_init is specific to the mba6x board, so rename it to reflect
that fact.

Signed-off-by: Roland Hieber <rhi at pengutronix.de>
---
 arch/arm/boards/tqma6x/board.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c
index ae339887568a..4bb7223a6e7a 100644
--- a/arch/arm/boards/tqma6x/board.c
+++ b/arch/arm/boards/tqma6x/board.c
@@ -53,7 +53,7 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
 	return 0;
 }
 
-static int tqma6x_enet_init(void)
+static int tq_mba6x_enet_init(void)
 {
 	if (!of_machine_is_compatible("tq,mba6x"))
 		return 0;
@@ -77,18 +77,25 @@ static int tqma6x_enet_init(void)
 
 	return 0;
 }
-fs_initcall(tqma6x_enet_init);
+fs_initcall(tq_mba6x_enet_init);
 
-static int tqma6x_env_init(void)
+static int tqma6x_init(void)
 {
-	if (!of_machine_is_compatible("tq,mba6x"))
-		return 0;
-
 	imx6_bbu_internal_spi_i2c_register_handler("spiflash", "/dev/m25p0.barebox",
 		BBU_HANDLER_FLAG_DEFAULT);
 	imx6_bbu_internal_mmcboot_register_handler("emmc", "mmc2", 0);
 
-	device_detect_by_name("mmc2");
+	device_detect_by_name("mmc2"); // eMMC
+
+	return 0;
+}
+
+static int tq_mba6x_env_init(void)
+{
+	if (!of_machine_is_compatible("tq,mba6x"))
+		return 0;
+
+	tqma6x_init();
 
 	default_environment_path_set("/dev/mmc2.boot1");
 
@@ -96,4 +103,4 @@ static int tqma6x_env_init(void)
 
 	return 0;
 }
-late_initcall(tqma6x_env_init);
+late_initcall(tq_mba6x_env_init);
-- 
2.39.2




More information about the barebox mailing list