From: Inochi Amaoto <inochiama@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>,
Karol Gugala <kgugala@antmicro.com>,
Mateusz Holenko <mholenko@antmicro.com>,
Gabriel Somlo <gsomlo@gmail.com>, Joel Stanley <joel@jms.id.au>,
Maciej Dudek <mdudek@internships.antmicro.com>,
Paul Mackerras <paulus@ozlabs.org>
Cc: Inochi Amaoto <inochiama@gmail.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Yixun Lan <dlan@gentoo.org>, Longbin Li <looong.bin@gmail.com>
Subject: [PATCH v5 0/2] mmc: litex_mmc: Set mandatory idle clocks before CMD0
Date: Thu, 21 May 2026 15:21:19 +0800 [thread overview]
Message-ID: <20260521072122.1601215-1-inochiama@gmail.com> (raw)
The litex_mmc driver assumes the card is already probed in the BIOS
and skip the phy initialization. This will cause the command fail
like the following when the old card is unplugged and then insert
a new card:
[ 62.923593] litex-mmc f0004000.mmc: Command (cmd 8) error, status -110
[ 62.949717] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
[ 62.976606] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
[ 63.002516] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
[ 63.028442] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
Firstly, fix the clock divider calculation so we can get the right
clock frequency, then add required clock settings and initialization
for the CMD 0, so it can probe the new card.
Test Results:
Rocket:
# dmesg | grep mmc
[ 0.109176] litex-mmc 12003000.mmc: LiteX MMC controller initialized.
[ 0.256926] mmc0: new SDHC card at address aaaa
[ 0.257058] mmcblk0: mmc0:aaaa WC32G 29.7 GiB
Note: it seems like the rocket give a wrong DMA result when the target
address is in main memory.
See issue: https://github.com/enjoy-digital/litex/issues/2464
VexiiRiscv:
# dmesg | grep mmc
[ 2.368365] litex-mmc f0004000.mmc: LiteX MMC controller initialized.
[ 2.576993] mmc0: new SDHC card at address aaaa
[ 2.588966] mmcblk0: mmc0:aaaa WC32G 29.7 GiB
[ 2.620197] mmcblk0: p1
Changed from v4:
- https://lore.kernel.org/linux-mmc/20260517015323.264179-1-inochiama@gmail.com/
1. Add a new patch for fixing clock divider calculation
2. Move everything in the set_ios() callback.
Changed from v3:
- https://lore.kernel.org/linux-mmc/20260426112016.1370929-1-inochiama@gmail.com/
1. Remove patch 1: mmc: litex_mmc: Move litex_mmc_setclk() to bottom for reuse
2. Use set_ios() callback to apply the clock change.
Changed from v2:
- https://lore.kernel.org/linux-mmc/20260424013615.470325-1-inochiama@gmail.com/
1. Remove the added function forward reference and add a new patch
for moving litex_mmc_setclk() function
Change from v1:
- https://lore.kernel.org/linux-mmc/20260421025052.755471-1-inochiama@gmail.com/
1. use fsleep to replace udelay
Inochi Amaoto (2):
mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation
mmc: litex_mmc: Set mandatory idle clocks before CMD0
drivers/mmc/host/litex_mmc.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
--
2.54.0
next reply other threads:[~2026-05-21 7:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 7:21 Inochi Amaoto [this message]
2026-05-21 7:21 ` [PATCH v5 1/2] mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation Inochi Amaoto
2026-05-21 7:21 ` [PATCH v5 2/2] mmc: litex_mmc: Set mandatory idle clocks before CMD0 Inochi Amaoto
2026-05-21 14:39 ` [PATCH v5 0/2] " Gabriel L. Somlo
2026-05-29 14:45 ` Ulf Hansson
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=20260521072122.1601215-1-inochiama@gmail.com \
--to=inochiama@gmail.com \
--cc=dlan@gentoo.org \
--cc=gsomlo@gmail.com \
--cc=joel@jms.id.au \
--cc=kgugala@antmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=looong.bin@gmail.com \
--cc=mdudek@internships.antmicro.com \
--cc=mholenko@antmicro.com \
--cc=paulus@ozlabs.org \
--cc=ulfh@kernel.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
all inboxes | Powered by JetHome®