All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] mmc: core: Preparations to support SD UHS-II cards
@ 2021-02-25 17:03 Ulf Hansson
  2021-02-25 17:03 ` [PATCH 1/4] mmc: core: Cleanup printing of speed mode at card insertion Ulf Hansson
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Ulf Hansson @ 2021-02-25 17:03 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson, Adrian Hunter
  Cc: AKASHI Takahiro, Ben Chuang, greg.tu, Renius Chen,
	Masami Hiramatsu, Takao Orito, linux-kernel

A series [1] that has been collaborative worked upon by Takahiro Akashi
(Linaro) and Ben Chuang (Genesys Logic) is targeting to add SD UHS-II support
to the mmc subsystem.

Throughout the reviews, we realized that the changes affecting the mmc core to
support the UHS-II interface/protocol might not be entirely straightforward to
implement. Especially, I expressed some concerns about the code that manages
power on/off, initialization and power management of a SD UHS-II card.

Therefore, I have posted this small series to try to help to put some of the
foundation in the mmc core in place. Hopefully this can provide some guidance
and an overall structure, of how I think the code could evolve.

More details are available in the commit messages and through comments in the
code, for each path.

Kind regards
Uffe

[1]
https://lkml.org/lkml/2020/11/5/1472


Ulf Hansson (4):
  mmc: core: Cleanup printing of speed mode at card insertion
  mmc: core: Prepare to support SD UHS-II cards
  mmc: core: Announce successful insertion of an SD UHS-II card
  mmc: core: Extend support for mmc regulators with a vqmmc2

 drivers/mmc/core/Makefile    |   2 +-
 drivers/mmc/core/bus.c       |  38 +++--
 drivers/mmc/core/core.c      |  17 ++-
 drivers/mmc/core/core.h      |   1 +
 drivers/mmc/core/host.h      |   5 +
 drivers/mmc/core/regulator.c |  34 +++++
 drivers/mmc/core/sd_uhs2.c   | 289 +++++++++++++++++++++++++++++++++++
 include/linux/mmc/card.h     |   6 +
 include/linux/mmc/host.h     |  30 ++++
 9 files changed, 404 insertions(+), 18 deletions(-)
 create mode 100644 drivers/mmc/core/sd_uhs2.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
@ 2021-06-24 16:30 Al Cooper
       [not found] ` <CAG0XXUGrmHY_2koaFTkUH8kozZ8B5Z_eafJMm+92-NP4oSE7yA@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Al Cooper @ 2021-06-24 16:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Al Cooper, Adrian Hunter, linux-mmc, Ulf Hansson

When an eMMC device is being run in HS400 mode, any access to the
RPMB device will cause the error message "mmc1: Invalid UHS-I mode
selected". This happens as a result of tuning being disabled before
RPMB access and then re-enabled after the RPMB access is complete.
When tuning is re-enabled, the system has to switch from HS400
to HS200 to do the tuning and then back to HS400. As part of
sequence to switch from HS400 to HS200 the system is temporarily
put into HS mode. When switching to HS mode, sdhci_get_preset_value()
is called and does not have support for HS mode and prints the warning
message and returns the preset for SDR12. The fix is to add support
for MMC and SD HS modes to sdhci_get_preset_value().

This can be reproduced on any system running eMMC in HS400 mode
(not HS400ES) by using the "mmc" utility to run the following
command: "mmc rpmb read-counter /dev/mmcblk0rpmb".

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 drivers/mmc/host/sdhci.c | 4 ++++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index bf238ade1602..6b39126fbf06 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
 	u16 preset = 0;
 
 	switch (host->timing) {
+	case MMC_TIMING_MMC_HS:
+	case MMC_TIMING_SD_HS:
+		preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
+		break;
 	case MMC_TIMING_UHS_SDR12:
 		preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
 		break;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0770c036e2ff..960fed78529e 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -253,6 +253,7 @@
 
 /* 60-FB reserved */
 
+#define SDHCI_PRESET_FOR_HIGH_SPEED	0x64
 #define SDHCI_PRESET_FOR_SDR12 0x66
 #define SDHCI_PRESET_FOR_SDR25 0x68
 #define SDHCI_PRESET_FOR_SDR50 0x6A

base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-07-02  8:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25 17:03 [PATCH 0/4] mmc: core: Preparations to support SD UHS-II cards Ulf Hansson
2021-02-25 17:03 ` [PATCH 1/4] mmc: core: Cleanup printing of speed mode at card insertion Ulf Hansson
2021-02-25 17:03 ` [PATCH 2/4] mmc: core: Prepare to support SD UHS-II cards Ulf Hansson
2021-07-02  8:00   ` Jason Lai
2021-07-02  8:31   ` Ulf Hansson
2021-02-25 17:03 ` [PATCH 3/4] mmc: core: Announce successful insertion of an SD UHS-II card Ulf Hansson
2021-02-25 17:03 ` [PATCH 4/4] mmc: core: Extend support for mmc regulators with a vqmmc2 Ulf Hansson
2021-03-31  9:57 ` [PATCH 0/4] mmc: core: Preparations to support SD UHS-II cards Ulf Hansson
2021-03-31 10:26   ` ReniusChen[陳建宏]
2021-03-31 10:31     ` Ulf Hansson
2021-06-24 16:30 [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode Al Cooper
     [not found] ` <CAG0XXUGrmHY_2koaFTkUH8kozZ8B5Z_eafJMm+92-NP4oSE7yA@mail.gmail.com>
     [not found]   ` <CAG0XXUH6zVaHGatn6rjMMOzEkkwSdFBseGyGSik8a6cQLJvX2Q@mail.gmail.com>
2021-06-28  2:08     ` [PATCH 2/4] mmc: core: Prepare to support SD UHS-II cards Lai Jason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.