mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers
Adrian Hunter
maintainerPATCH 1/1 mmc: sdhci-pci: Fix eMMC driver strength for BYT-based controllers
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.
--- drivers/mmc/host/sdhci-pci-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +3 -0
@@ -597,6 +597,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; }
Signature · 1 line
2.17.1
Quoted 8 lines · Adrian Hunter
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.
Quoted 7 lines
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 <[email protected]>Fixes 51ced59cc02e ("mmc: sdhci-pci: Use ACPI DSM to get driver strength for some Intel devices")
Applied for fixes, thanks!
Kind regards
Uffe
Quoted 21 lines
--- drivers/mmc/host/sdhci-pci-core.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mmc/host/sdhci-pci-core.c +3
-1@@ -597,6 +597,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; } --2.17.1