mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Don't program invalid host driver type for fixed eMMC type
@ 2026-09-26 12:29 Ian Ray
  2026-09-29 13:06 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Ray @ 2026-09-26 12:29 UTC (permalink / raw)
  To: Ulf Hansson, Shawn Lin, Kamal Dasu
  Cc: Ian Ray, stable, linux-mmc, linux-kernel

The host controller driver type value used by the MMC core [1] _mostly_
overlaps with the eMMC device I/O driver strength value [2] as shown in
the table below; however, there is _no_ host mapping for eMMC value 4.

  host value/type   | eMMC value | nominal impedance | strength
  ------------------+------------+-------------------+---------
  0 / Type B        | 0          | 50 Ohm            | x1
  1 / Type A        | 1          | 33 Ohm            | x1.5
  2 / Type C        | 2          | 66 Ohm            | x0.75
  3 / Type D        | 3          | 100 Ohm           | x0.5
  (none)            | 4          | 40 Ohm            | x1.2

[1] MMC_SET_DRIVER_TYPE_* in include/linux/mmc/host.h

[2] 'fixed-emmc-driver-type', see JESD84-B51 Table 206 and
    Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml

Since commit 5a52c5701a67 ("mmc: core: Fix host controller programming
for fixed driver type"), the selected eMMC driver strength is passed
directly to mmc_set_driver_type().  For a fixed eMMC driver type of 4
this reaches sdhci_set_ios(), which only knows types 0..3 and therefore
complains on every ios update:

  mmc2: invalid driver type, default to driver type B

The mmc card itself is still programmed correctly (the HS_TIMING driver
strength field is set from card->drive_strength independently), so this
is a spurious, repeated warning for a valid, documented configuration.

Change to only program the host when the eMMC driver type value maps to
a valid host driver type.

Tested on i.MX8MP (usdhc3, eMMC in HS400) with
`fixed-emmc-driver-type = <4>`: the warning is no longer logged and the
HS_TIMING register contains 0x43 as expected.

Fixes: 5a52c5701a67 ("mmc: core: Fix host controller programming for fixed driver type")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
---
 drivers/mmc/core/mmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 05444ecf3909..ff5d4b805998 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1371,9 +1371,11 @@ static void mmc_select_driver_type(struct mmc_card *card)
 
 	card->drive_strength = drive_strength;
 
-	if (fixed_drv_type >= 0 && drive_strength)
-		mmc_set_driver_type(card->host, drive_strength);
-	else if (drv_type)
+	if (fixed_drv_type >= 0 && drive_strength) {
+		/* eMMC driver types >= 4 have no host controller equivalent. */
+		if (drive_strength <= MMC_SET_DRIVER_TYPE_D)
+			mmc_set_driver_type(card->host, drive_strength);
+	} else if (drv_type)
 		mmc_set_driver_type(card->host, drv_type);
 }
 
-- 
2.49.0


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

end of thread, other threads:[~2026-10-01 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-26 12:29 [PATCH] mmc: core: Don't program invalid host driver type for fixed eMMC type Ian Ray
2026-09-29 13:06 ` Ulf Hansson
2026-09-30 19:00   ` Adrian Hunter
2026-10-01 15:39     ` Ian Ray

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®