Skip to content

mmc: litex_mmc: Set mandatory idle clocks before CMD0

Inochi Amaoto linux-mmc lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 2 repliesIn review
  2. v41 patch 7 repliesSuperseded
  3. v32 patches 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v21 patch2 repliesSuperseded
v11 patch2 repliesSuperseded

Changes in v5 from the cover letter

- https://lore.kernel.org/linux-mmc/[email protected]/
1. Add a new patch for fixing clock divider calculation
2. Move everything in the set_ios() callback.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculationdrivers/mmc/host/litex_mmc.c+3 -30 replies
2/2mmc: litex_mmc: Set mandatory idle clocks before CMD0drivers/mmc/host/litex_mmc.c+14 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGabriel Somlo
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/2] mmc: litex_mmc: Set mandatory idle clocks before CMD0

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/[email protected]/
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/[email protected]/
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/[email protected]/
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/[email protected]/
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