mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable
Date: Thu, 11 May 2023 10:58:03 +0200	[thread overview]
Message-ID: <20230511085803.335993-4-rhi@pengutronix.de> (raw)
In-Reply-To: <20230511085803.335993-1-rhi@pengutronix.de>

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@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




  parent reply	other threads:[~2023-05-11  8:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
2023-05-11  8:58 ` [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK Roland Hieber
2023-05-11  8:58 ` [RFT][PATCH 2/3] ARM: i.MX: TQMa6x: migrate flash partitions to device tree Roland Hieber
2023-05-11  8:58 ` Roland Hieber [this message]
2023-05-12 11:27 ` [RFT][PATCH 0/3] TQMa6x cleanup Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230511085803.335993-4-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox