]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mmc: core: Fix host controller programming for fixed driver type
authorKamal Dasu <kamal.dasu@broadcom.com>
Thu, 23 Apr 2026 19:18:55 +0000 (15:18 -0400)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 11 May 2026 14:45:48 +0000 (16:45 +0200)
When using the fixed-emmc-driver-type device tree property, the MMC core
correctly selects the driver strength for the card but fails to program
the host controller accordingly. This causes a mismatch where the card
uses the specified driver type while the host controller defaults to
Type B (since ios->drv_type remains zero).

Split the driver type programming logic to handle both fixed and dynamic
driver type selection paths. For fixed driver types, program the host
controller with the selected drive_strength value. For dynamic selection,
use the existing drv_type as before.

This ensures both the eMMC device and host controller use matching driver
strengths, preventing potential signal integrity issues.

Fixes: 6186d06c519e ("mmc: parse new binding for eMMC fixed driver type")
Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/mmc.c

index 8846550a8892a55545c97458e3909173b44c2a01..05444ecf3909f811e9faef819860aed33c85a81a 100644 (file)
@@ -1371,7 +1371,9 @@ static void mmc_select_driver_type(struct mmc_card *card)
 
        card->drive_strength = drive_strength;
 
-       if (drv_type)
+       if (fixed_drv_type >= 0 && drive_strength)
+               mmc_set_driver_type(card->host, drive_strength);
+       else if (drv_type)
                mmc_set_driver_type(card->host, drv_type);
 }