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] mci: detect SD card v3
Date: Mon,  2 Mar 2026 17:37:42 +0100	[thread overview]
Message-ID: <20260302163748.577552-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260302163748.577552-1-a.fatoum@pengutronix.de>

We define the constant and the erase group determination code queries
the version, but we didn't actually set it anywhere.

The code determining the SD version was taken from U-Boot, so sync it to
add v3.0 support[1].

[1]: https://github.com/u-boot/u-boot/blob/v2026.04-rc3/drivers/mmc/mmc.c#L1430

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/mci-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 517e4de1c6b0..ef5c4c5d6a5d 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -977,6 +977,8 @@ static int sd_change_freq(struct mci *mci)
 		break;
 	case 2:
 		mci->version = SD_VERSION_2;
+		if ((mci->scr[0] >> 15) & 0x1)
+			mci->version = SD_VERSION_3;
 		break;
 	default:
 		mci->version = SD_VERSION_1_0;
-- 
2.47.3




  parent reply	other threads:[~2026-03-02 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 16:37 [PATCH 1/3] mci: add support for eMMC v5.1b Ahmad Fatoum
2026-03-02 16:37 ` [PATCH 2/3] mci: treat unknown MMC version as greater than known versions Ahmad Fatoum
2026-03-02 16:37 ` Ahmad Fatoum [this message]
2026-03-04  7:48 ` [PATCH 1/3] mci: add support for eMMC v5.1b 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=20260302163748.577552-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