mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/3] ARM: rpi: look for env in mmc0 as well
Date: Thu, 14 Dec 2023 16:18:05 +0100	[thread overview]
Message-ID: <20231214151805.1657124-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20231214151805.1657124-1-a.fatoum@pengutronix.de>

Raspberry Pi Compute Module 4S device tree has a DT alias for the eMMC,
which makes it mmc0. Use that as a fallback, so environment and /boot
mount is correct there as well.

There is no upstream device tree for this S-variant yet, but it's already
bootable when barebox is passed the device tree by the VideoCore.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index f3a28e87c6f0..abee5ffcdbee 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -188,14 +188,20 @@ mem_initcall(rpi_mem_init);
 static int rpi_env_init(void)
 {
 	struct stat s;
-	const char *diskdev = "/dev/disk0.0";
+	const char *diskdev;
 	int ret;
 
 	device_detect_by_name("mci0");
 
+	diskdev = "/dev/disk0.0";
 	ret = stat(diskdev, &s);
 	if (ret) {
-		printf("no %s. using default env\n", diskdev);
+		device_detect_by_name("mmc0");
+		diskdev = "/dev/mmc0.0";
+		ret = stat(diskdev, &s);
+	}
+	if (ret) {
+		printf("no /dev/disk0.0 or /dev/mmc0.0. using default env\n");
 		return 0;
 	}
 
-- 
2.39.2




  parent reply	other threads:[~2023-12-14 15:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 15:18 [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Ahmad Fatoum
2023-12-14 15:18 ` [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400 Ahmad Fatoum
2023-12-14 15:18 ` Ahmad Fatoum [this message]
2023-12-15 11:06 ` [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi 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=20231214151805.1657124-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@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