From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mgr@pengutronix.de, ore@pengutronix.de,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/3] ARM: at91: xload-mmc: add prominent note about PBL MMC limitation
Date: Wed, 2 Jun 2021 12:25:24 +0200 [thread overview]
Message-ID: <20210602102524.20034-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210602102524.20034-1-a.fatoum@pengutronix.de>
The PBL driver has an assumption about only being used with
high capacity cards. When using a default capacity card, the sama5d3
MCI controller hang when doing unaligned accesses.
This heuristic could add some support default capacity card support
without risking unaligned accesses:
at91_mci_set_highcapacity(false);
sector0 = read_sector(0);
if (!is_mbr(sector0, &fatsect)
abort();
fatsector1 = read_sector(fatsect);
at91_mci_set_highcapacity(false);
if (is_fat(fatsect))
goto default_cap;
else
goto high_cap;
This, of course, fails if fatsect * 512 on a high capacity card
happens to have a FAT signature. As it's unclear whether supporting
<= 2 GiB is worth the effort, hardcode it in xload-mmc.c and add
a note about the limitation to conserve future debugging effort.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-at91/xload-mmc.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/xload-mmc.c b/arch/arm/mach-at91/xload-mmc.c
index 1b641f3a47ac..89766cf6b910 100644
--- a/arch/arm/mach-at91/xload-mmc.c
+++ b/arch/arm/mach-at91/xload-mmc.c
@@ -76,8 +76,18 @@ void __noreturn sama5d2_sdhci_start_image(u32 r4)
if (ret)
goto out_panic;
- /* TODO: eMMC boot partition handling: they are not FAT-formatted */
+ /*
+ * There seems to be no definitive way to find out whether we are
+ * connected to a default or high capacity card without resetting
+ * the card. The PBL driver assumes however that the card is already
+ * in transfer mode. For now assume all cards to be high capacity.
+ * If support for cards smaller or equal to 2GiB becomes relevant,
+ * this assumption can be revisited.
+ */
+ pr_debug("Assuming high capacity card\n");
+ at91_sdhci_set_highcapacity(&bio, true);
+ /* TODO: eMMC boot partition handling: they are not FAT-formatted */
at91_fat_start_image(&bio, buf, SZ_16M, r4);
out_panic:
@@ -128,6 +138,18 @@ void __noreturn sama5d3_atmci_start_image(u32 boot_src, unsigned int clock,
if (ret)
goto out_panic;
+ /*
+ * There seems to be no definitive way to find out whether we are
+ * connected to a default or high capacity card without resetting
+ * the card. The PBL driver assumes however that the card is already
+ * in transfer mode. For now assume all cards to be high capacity.
+ * If support for cards smaller or equal to 2GiB becomes relevant,
+ * this assumption can be revisited.
+ */
+ pr_debug("Assuming high capacity card\n");
+ at91_mci_set_highcapacity(&bio, true);
+
+ /* TODO: eMMC boot partition handling: they are not FAT-formatted */
at91_fat_start_image(&bio, buf, SZ_16M, boot_src);
out_panic:
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-06-02 10:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 10:25 [PATCH 1/3] ARM: at91: microchip-ksz9477-evb: support PBL console Ahmad Fatoum
2021-06-02 10:25 ` [PATCH 2/3] ARM: at91: mmc-xload: allow overriding card capacity Ahmad Fatoum
2021-06-02 10:30 ` Ahmad Fatoum
2021-06-03 5:34 ` Alexander Dahl
2021-06-03 6:28 ` Ahmad Fatoum
2021-06-03 6:53 ` Alexander Dahl
2021-06-03 7:01 ` Ahmad Fatoum
2021-06-02 10:25 ` Ahmad Fatoum [this message]
2021-06-02 10:29 ` [PATCH 1/3] ARM: at91: microchip-ksz9477-evb: support PBL console Ahmad Fatoum
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=20210602102524.20034-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mgr@pengutronix.de \
--cc=ore@pengutronix.de \
/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