summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2020-04-22 14:16:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-06 08:15:06 +0200
commitd8f7e15a65ddb8e6bba1fdebac3d86c2c2d89dc1 (patch)
tree34e43b793780fd3308f291f85eef0010ce157eec
parenteed4792f96575b91fabf9da3dab6e5bf894238d0 (diff)
downloadlinux-stable-d8f7e15a65ddb8e6bba1fdebac3d86c2c2d89dc1.tar.gz
linux-stable-d8f7e15a65ddb8e6bba1fdebac3d86c2c2d89dc1.tar.bz2
linux-stable-d8f7e15a65ddb8e6bba1fdebac3d86c2c2d89dc1.zip
mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers
commit 1a8eb6b373c2af6533c13d1ea11f504e5010ed9a upstream. BIOS writers have begun the practice of setting 40 ohm eMMC driver strength even though the eMMC may not support it, on the assumption that the kernel will validate the value against the eMMC (Extended CSD DRIVER_STRENGTH [offset 197]) and revert to the default 50 ohm value if 40 ohm is invalid. This is done to avoid changing the value for different boards. Putting aside the merits of this approach, it is clear the eMMC's mask of supported driver strengths is more reliable than the value provided by BIOS. Add validation accordingly. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Fixes: 51ced59cc02e ("mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200422111629.4899-1-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mmc/host/sdhci-pci-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 5091e2c1c0e5..9b66e8b374ed 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -601,6 +601,9 @@ static int intel_select_drive_strength(struct mmc_card *card,
struct sdhci_pci_slot *slot = sdhci_priv(host);
struct intel_host *intel_host = sdhci_pci_priv(slot);
+ if (!(mmc_driver_type_mask(intel_host->drv_strength) & card_drv))
+ return 0;
+
return intel_host->drv_strength;
}