From 853e98f560933e06124dc285e121f0b91c4bee79 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 15 Apr 2020 08:41:19 +0200 Subject: [PATCH] 5.5-stable patches added patches: mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch --- ...et-for-different-controller-versions.patch | 90 +++++++++++++++++++ queue-5.5/series | 1 + 2 files changed, 91 insertions(+) create mode 100644 queue-5.5/mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch diff --git a/queue-5.5/mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch b/queue-5.5/mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch new file mode 100644 index 00000000000..d21c6362ec0 --- /dev/null +++ b/queue-5.5/mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch @@ -0,0 +1,90 @@ +From 2aa3d826adb578b26629a79b775a552cfe3fedf7 Mon Sep 17 00:00:00 2001 +From: Yangbo Lu +Date: Wed, 8 Jan 2020 12:07:12 +0800 +Subject: mmc: sdhci-of-esdhc: fix esdhc_reset() for different controller versions + +From: Yangbo Lu + +commit 2aa3d826adb578b26629a79b775a552cfe3fedf7 upstream. + +This patch is to fix operating in esdhc_reset() for different +controller versions, and to add bus-width restoring after data +reset for eSDHC (verdor version <= 2.2). + +Also add annotation for understanding. + +Signed-off-by: Yangbo Lu +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/20200108040713.38888-1-yangbo.lu@nxp.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/sdhci-of-esdhc.c | 43 ++++++++++++++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 4 deletions(-) + +--- a/drivers/mmc/host/sdhci-of-esdhc.c ++++ b/drivers/mmc/host/sdhci-of-esdhc.c +@@ -758,23 +758,58 @@ static void esdhc_reset(struct sdhci_hos + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); +- u32 val; ++ u32 val, bus_width = 0; + ++ /* ++ * Add delay to make sure all the DMA transfers are finished ++ * for quirk. ++ */ + if (esdhc->quirk_delay_before_data_reset && + (mask & SDHCI_RESET_DATA) && + (host->flags & SDHCI_REQ_USE_DMA)) + mdelay(5); + ++ /* ++ * Save bus-width for eSDHC whose vendor version is 2.2 ++ * or lower for data reset. ++ */ ++ if ((mask & SDHCI_RESET_DATA) && ++ (esdhc->vendor_ver <= VENDOR_V_22)) { ++ val = sdhci_readl(host, ESDHC_PROCTL); ++ bus_width = val & ESDHC_CTRL_BUSWIDTH_MASK; ++ } ++ + sdhci_reset(host, mask); + +- sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); +- sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ /* ++ * Restore bus-width setting and interrupt registers for eSDHC ++ * whose vendor version is 2.2 or lower for data reset. ++ */ ++ if ((mask & SDHCI_RESET_DATA) && ++ (esdhc->vendor_ver <= VENDOR_V_22)) { ++ val = sdhci_readl(host, ESDHC_PROCTL); ++ val &= ~ESDHC_CTRL_BUSWIDTH_MASK; ++ val |= bus_width; ++ sdhci_writel(host, val, ESDHC_PROCTL); ++ ++ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); ++ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ } + +- if (mask & SDHCI_RESET_ALL) { ++ /* ++ * Some bits have to be cleaned manually for eSDHC whose spec ++ * version is higher than 3.0 for all reset. ++ */ ++ if ((mask & SDHCI_RESET_ALL) && ++ (esdhc->spec_ver >= SDHCI_SPEC_300)) { + val = sdhci_readl(host, ESDHC_TBCTL); + val &= ~ESDHC_TB_EN; + sdhci_writel(host, val, ESDHC_TBCTL); + ++ /* ++ * Initialize eSDHC_DLLCFG1[DLL_PD_PULSE_STRETCH_SEL] to ++ * 0 for quirk. ++ */ + if (esdhc->quirk_unreliable_pulse_detection) { + val = sdhci_readl(host, ESDHC_DLLCFG1); + val &= ~ESDHC_DLL_PD_PULSE_STRETCH_SEL; diff --git a/queue-5.5/series b/queue-5.5/series index ddaac75ac85..880b5b3a60d 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -171,3 +171,4 @@ remoteproc-fix-null-pointer-dereference-in-rproc_virtio_notify.patch crypto-rng-fix-a-refcounting-bug-in-crypto_rng_reset.patch crypto-mxs-dcp-fix-scatterlist-linearization-for-hash.patch io_uring-honor-original-task-rlimit_fsize.patch +mmc-sdhci-of-esdhc-fix-esdhc_reset-for-different-controller-versions.patch -- 2.47.3