* [PATCH 0/2] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers
@ 2018-02-14 13:57 Adrian Hunter
2018-02-14 13:57 ` [PATCH 1/2] " Adrian Hunter
2018-02-14 13:57 ` [PATCH 2/2] mmc: sdhci-pci: Get rid of glk_cqe_enable() Adrian Hunter
0 siblings, 2 replies; 3+ messages in thread
From: Adrian Hunter @ 2018-02-14 13:57 UTC (permalink / raw)
To: Ulf Hansson, Rafael J. Wysocki; +Cc: Linux PM, linux-mmc, Haridhar Kalvala
Hi
Here is a small fix (cc stable) and a subsequent tidy-up.
Adrian Hunter (2):
mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers
mmc: sdhci-pci: Get rid of glk_cqe_enable()
drivers/mmc/host/sdhci-pci-core.c | 55 +++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 23 deletions(-)
Regards
Adrian
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers
2018-02-14 13:57 [PATCH 0/2] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Adrian Hunter
@ 2018-02-14 13:57 ` Adrian Hunter
2018-02-14 13:57 ` [PATCH 2/2] mmc: sdhci-pci: Get rid of glk_cqe_enable() Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2018-02-14 13:57 UTC (permalink / raw)
To: Ulf Hansson, Rafael J. Wysocki; +Cc: Linux PM, linux-mmc, Haridhar Kalvala
Tuning can leave the IP in an active state (Buffer Read Enable bit set)
which prevents the entry to low power states (i.e. S0i3). Data reset will
clear it.
Generally tuning is followed by a data transfer which will anyway sort out
the state, so it is rare that S0i3 is actually prevented.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
---
drivers/mmc/host/sdhci-pci-core.c | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 5296b749d661..ba725580e944 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -661,9 +661,36 @@ static void byt_read_dsm(struct sdhci_pci_slot *slot)
slot->chip->rpm_retune = intel_host->d3_retune;
}
-static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
+static int intel_execute_tuning(struct mmc_host *mmc, u32 opcode)
+{
+ int err = sdhci_execute_tuning(mmc, opcode);
+ struct sdhci_host *host = mmc_priv(mmc);
+
+ if (err)
+ return err;
+
+ /*
+ * Tuning can leave the IP in an active state (Buffer Read Enable bit
+ * set) which prevents the entry to low power states (i.e. S0i3). Data
+ * reset will clear it.
+ */
+ sdhci_reset(host, SDHCI_RESET_DATA);
+
+ return 0;
+}
+
+static void byt_probe_slot(struct sdhci_pci_slot *slot)
{
+ struct mmc_host_ops *ops = &slot->host->mmc_host_ops;
+
byt_read_dsm(slot);
+
+ ops->execute_tuning = intel_execute_tuning;
+}
+
+static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
+{
+ byt_probe_slot(slot);
slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
MMC_CAP_CMD_DURING_TFR |
@@ -786,7 +813,7 @@ static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
{
int err;
- byt_read_dsm(slot);
+ byt_probe_slot(slot);
err = ni_set_max_freq(slot);
if (err)
@@ -799,7 +826,7 @@ static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
{
- byt_read_dsm(slot);
+ byt_probe_slot(slot);
slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE |
MMC_CAP_WAIT_WHILE_BUSY;
return 0;
@@ -807,7 +834,7 @@ static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
{
- byt_read_dsm(slot);
+ byt_probe_slot(slot);
slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY |
MMC_CAP_AGGRESSIVE_PM | MMC_CAP_CD_WAKE;
slot->cd_idx = 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] mmc: sdhci-pci: Get rid of glk_cqe_enable()
2018-02-14 13:57 [PATCH 0/2] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Adrian Hunter
2018-02-14 13:57 ` [PATCH 1/2] " Adrian Hunter
@ 2018-02-14 13:57 ` Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2018-02-14 13:57 UTC (permalink / raw)
To: Ulf Hansson, Rafael J. Wysocki; +Cc: Linux PM, linux-mmc, Haridhar Kalvala
Now that tuning no longer leaves the Buffer Read Enable bit set (refer
intel_execute_tuning()), glk_cqe_enable() is no longer needed. Get rid of
it.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci-core.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index ba725580e944..bd6ee968bcd9 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -719,26 +719,8 @@ static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
return ret;
}
-static void glk_cqe_enable(struct mmc_host *mmc)
-{
- struct sdhci_host *host = mmc_priv(mmc);
- u32 reg;
-
- /*
- * CQE gets stuck if it sees Buffer Read Enable bit set, which can be
- * the case after tuning, so ensure the buffer is drained.
- */
- reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
- while (reg & SDHCI_DATA_AVAILABLE) {
- sdhci_readl(host, SDHCI_BUFFER);
- reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
- }
-
- sdhci_cqe_enable(mmc);
-}
-
static const struct cqhci_host_ops glk_cqhci_ops = {
- .enable = glk_cqe_enable,
+ .enable = sdhci_cqe_enable,
.disable = sdhci_cqe_disable,
.dumpregs = sdhci_pci_dumpregs,
};
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-14 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 13:57 [PATCH 0/2] mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers Adrian Hunter
2018-02-14 13:57 ` [PATCH 1/2] " Adrian Hunter
2018-02-14 13:57 ` [PATCH 2/2] mmc: sdhci-pci: Get rid of glk_cqe_enable() Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).