Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-08-12 17:52:55 +0200
committerTakashi Iwai <tiwai@suse.de>2019-08-12 17:52:55 +0200
commit9932dc54dfcfc7747229a954663d161de533f8ad (patch)
treea50bb76dba609f5e0459e4e37964ddd59b7cd127
parent505ecbc1e8b0dc4065483c4d340039e5327229df (diff)
mmc: sdhci-pci: Fix BYT OCP setting (bsc#1051510).
-rw-r--r--patches.drivers/mmc-sdhci-pci-Fix-BYT-OCP-setting.patch184
-rw-r--r--series.conf1
2 files changed, 185 insertions, 0 deletions
diff --git a/patches.drivers/mmc-sdhci-pci-Fix-BYT-OCP-setting.patch b/patches.drivers/mmc-sdhci-pci-Fix-BYT-OCP-setting.patch
new file mode 100644
index 0000000000..98108b47cc
--- /dev/null
+++ b/patches.drivers/mmc-sdhci-pci-Fix-BYT-OCP-setting.patch
@@ -0,0 +1,184 @@
+From 0a49a619e7e1aeb3f5f5511ca59314423c83dae2 Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Mon, 6 May 2019 11:38:53 +0300
+Subject: [PATCH] mmc: sdhci-pci: Fix BYT OCP setting
+Git-commit: 0a49a619e7e1aeb3f5f5511ca59314423c83dae2
+Patch-mainline: v5.2-rc1
+References: bsc#1051510
+
+Some time ago, a fix was done for the sdhci-acpi driver, refer
+commit 6e1c7d6103fe ("mmc: sdhci-acpi: Reduce Baytrail eMMC/SD/SDIO
+hangs"). The same issue was not expected to affect the sdhci-pci driver,
+but there have been reports to the contrary, so make the same hardware
+setting change.
+
+This patch applies to v5.0+ but before that backports will be required.
+
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/mmc/host/Kconfig | 1
+ drivers/mmc/host/sdhci-pci-core.c | 96 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 97 insertions(+)
+
+--- a/drivers/mmc/host/Kconfig
++++ b/drivers/mmc/host/Kconfig
+@@ -73,6 +73,7 @@ config MMC_SDHCI_PCI
+ tristate "SDHCI support on PCI bus"
+ depends on MMC_SDHCI && PCI
+ select MMC_CQHCI
++ select IOSF_MBI if X86
+ help
+ This selects the PCI Secure Digital Host Controller Interface.
+ Most controllers found today are PCI devices.
+--- a/drivers/mmc/host/sdhci-pci-core.c
++++ b/drivers/mmc/host/sdhci-pci-core.c
+@@ -30,6 +30,10 @@
+ #include <linux/mmc/sdhci-pci-data.h>
+ #include <linux/acpi.h>
+
++#ifdef CONFIG_X86
++#include <asm/iosf_mbi.h>
++#endif
++
+ #include "cqhci.h"
+
+ #include "sdhci.h"
+@@ -456,6 +460,50 @@ static const struct sdhci_pci_fixes sdhc
+ .probe_slot = pch_hc_probe_slot,
+ };
+
++#ifdef CONFIG_X86
++
++#define BYT_IOSF_SCCEP 0x63
++#define BYT_IOSF_OCP_NETCTRL0 0x1078
++#define BYT_IOSF_OCP_TIMEOUT_BASE GENMASK(10, 8)
++
++static void byt_ocp_setting(struct pci_dev *pdev)
++{
++ u32 val = 0;
++
++ if (pdev->device != PCI_DEVICE_ID_INTEL_BYT_EMMC &&
++ pdev->device != PCI_DEVICE_ID_INTEL_BYT_SDIO &&
++ pdev->device != PCI_DEVICE_ID_INTEL_BYT_SD &&
++ pdev->device != PCI_DEVICE_ID_INTEL_BYT_EMMC2)
++ return;
++
++ if (iosf_mbi_read(BYT_IOSF_SCCEP, MBI_CR_READ, BYT_IOSF_OCP_NETCTRL0,
++ &val)) {
++ dev_err(&pdev->dev, "%s read error\n", __func__);
++ return;
++ }
++
++ if (!(val & BYT_IOSF_OCP_TIMEOUT_BASE))
++ return;
++
++ val &= ~BYT_IOSF_OCP_TIMEOUT_BASE;
++
++ if (iosf_mbi_write(BYT_IOSF_SCCEP, MBI_CR_WRITE, BYT_IOSF_OCP_NETCTRL0,
++ val)) {
++ dev_err(&pdev->dev, "%s write error\n", __func__);
++ return;
++ }
++
++ dev_dbg(&pdev->dev, "%s completed\n", __func__);
++}
++
++#else
++
++static inline void byt_ocp_setting(struct pci_dev *pdev)
++{
++}
++
++#endif
++
+ enum {
+ INTEL_DSM_FNS = 0,
+ INTEL_DSM_V18_SWITCH = 3,
+@@ -696,6 +744,8 @@ static void byt_probe_slot(struct sdhci_
+
+ byt_read_dsm(slot);
+
++ byt_ocp_setting(slot->chip->pdev);
++
+ ops->execute_tuning = intel_execute_tuning;
+ }
+
+@@ -860,7 +910,35 @@ static int byt_sd_probe_slot(struct sdhc
+ return 0;
+ }
+
++#ifdef CONFIG_PM_SLEEP
++
++static int byt_resume(struct sdhci_pci_chip *chip)
++{
++ byt_ocp_setting(chip->pdev);
++
++ return sdhci_pci_resume_host(chip);
++}
++
++#endif
++
++#ifdef CONFIG_PM
++
++static int byt_runtime_resume(struct sdhci_pci_chip *chip)
++{
++ byt_ocp_setting(chip->pdev);
++
++ return sdhci_pci_runtime_resume_host(chip);
++}
++
++#endif
++
+ static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
++#ifdef CONFIG_PM_SLEEP
++ .resume = byt_resume,
++#endif
++#ifdef CONFIG_PM
++ .runtime_resume = byt_runtime_resume,
++#endif
+ .allow_runtime_pm = true,
+ .probe_slot = byt_emmc_probe_slot,
+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+@@ -892,6 +970,12 @@ static const struct sdhci_pci_fixes sdhc
+ };
+
+ static const struct sdhci_pci_fixes sdhci_ni_byt_sdio = {
++#ifdef CONFIG_PM_SLEEP
++ .resume = byt_resume,
++#endif
++#ifdef CONFIG_PM
++ .runtime_resume = byt_runtime_resume,
++#endif
+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+ .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON |
+ SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+@@ -902,6 +986,12 @@ static const struct sdhci_pci_fixes sdhc
+ };
+
+ static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
++#ifdef CONFIG_PM_SLEEP
++ .resume = byt_resume,
++#endif
++#ifdef CONFIG_PM
++ .runtime_resume = byt_runtime_resume,
++#endif
+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+ .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON |
+ SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+@@ -912,6 +1002,12 @@ static const struct sdhci_pci_fixes sdhc
+ };
+
+ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
++#ifdef CONFIG_PM_SLEEP
++ .resume = byt_resume,
++#endif
++#ifdef CONFIG_PM
++ .runtime_resume = byt_runtime_resume,
++#endif
+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+ .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
+ SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
diff --git a/series.conf b/series.conf
index f8239cdb33..1d2ff84d64 100644
--- a/series.conf
+++ b/series.conf
@@ -46781,6 +46781,7 @@
patches.drivers/mmc-core-Verify-SD-bus-width.patch
patches.drivers/mmc-mmci-Prevent-polling-for-busy-detection-in-IRQ-c.patch
patches.drivers/mmc-core-Fix-tag-set-memory-leak.patch
+ patches.drivers/mmc-sdhci-pci-Fix-BYT-OCP-setting.patch
patches.drivers/drivers-fix-a-typo-in-the-kernel-doc-for-devm_platfo.patch
patches.drivers/iio-common-ssp_sensors-Initialize-calculated_time-in.patch
patches.drivers/iio-hmc5843-fix-potential-NULL-pointer-dereferences.patch