Skip to contentSkip to conversation

mmc: sdhci-msm: Don't enable PWRSAVE_DLL for certain sdhc hosts

PATCH Superseded Veerabhadrarao Badiganti 4 participants 5 messages Feb 7, 2020 – Feb 18, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci-msm: Don't enable PWRSAVE_DLL for certain sdhc hosts

From: Ritesh Harjani <[email protected]>

SDHC core with new 14lpp and later tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement:
When MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming.

Adding support for this requirement.

---
 drivers/mmc/host/sdhci-msm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +15 -3
index c3a160c..f27f891 100644
@@ -977,9 +977,21 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
 		goto out;
 	}
 
-	config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3);
-	config |= CORE_PWRSAVE_DLL;
-	writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec3);
+	/*
+	 * Set CORE_PWRSAVE_DLL bit in CORE_VENDOR_SPEC3.
+	 * When MCLK is gated OFF, it is not gated for less than 0.5us
+	 * and MCLK must be switched on for at-least 1us before DATA
+	 * starts coming. Controllers with 14lpp and later tech DLL cannot
+	 * guarantee above requirement. So PWRSAVE_DLL should not be
+	 * turned on for host controllers using this DLL.
+	 */
+	if (msm_host->use_14lpp_dll_reset) {
+		config = readl_relaxed(host->ioaddr +
+				msm_offset->core_vendor_spec3);
+		config |= CORE_PWRSAVE_DLL;
+		writel_relaxed(config, host->ioaddr +
+				msm_offset->core_vendor_spec3);
+	}
 
 	/*
 	 * Drain writebuffer to ensure above DLL calibration
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
#1 lore raw

PATCH v2 1/1 mmc: sdhci-msm: Don't enable PWRSAVE_DLL for certain sdhc hosts

From: Ritesh Harjani <[email protected]>

SDHC core with new 14lpp and later tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement:
When MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming.

Adding support for this requirement.

--

Changes since V1:
Condition was not correct in V1, which is corrected in V2

--

---
 drivers/mmc/host/sdhci-msm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +15 -3
index c3a160c..aa5b610 100644
@@ -977,9 +977,21 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
 		goto out;
 	}
 
-	config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3);
-	config |= CORE_PWRSAVE_DLL;
-	writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec3);
+	/*
+	 * Set CORE_PWRSAVE_DLL bit in CORE_VENDOR_SPEC3.
+	 * When MCLK is gated OFF, it is not gated for less than 0.5us
+	 * and MCLK must be switched on for at-least 1us before DATA
+	 * starts coming. Controllers with 14lpp and later tech DLL cannot
+	 * guarantee above requirement. So PWRSAVE_DLL should not be
+	 * turned on for host controllers using this DLL.
+	 */
+	if (!msm_host->use_14lpp_dll_reset) {
+		config = readl_relaxed(host->ioaddr +
+				msm_offset->core_vendor_spec3);
+		config |= CORE_PWRSAVE_DLL;
+		writel_relaxed(config, host->ioaddr +
+				msm_offset->core_vendor_spec3);
+	}
 
 	/*
 	 * Drain writebuffer to ensure above DLL calibration
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Reviewed-by on v2 1/1
#2 lore raw
Quoted 8 lines · Veerabhadrarao Badiganti

From: Ritesh Harjani <[email protected]>

SDHC core with new 14lpp and later tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement:
When MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming.

Quoted 5 lines

Adding support for this requirement.

--

Quoted 39 lines

Changes since V1:
Condition was not correct in V1, which is corrected in V2

--

---
 drivers/mmc/host/sdhci-msm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +15 -3
index c3a160c..aa5b610 100644
@@ -977,9 +977,21 @@ static int
 sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
 		goto out;
 	}
 
-	config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3);
-	config |= CORE_PWRSAVE_DLL;
-	writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec3);
+	/*
+	 * Set CORE_PWRSAVE_DLL bit in CORE_VENDOR_SPEC3.
+	 * When MCLK is gated OFF, it is not gated for less than 0.5us
+	 * and MCLK must be switched on for at-least 1us before DATA
+	 * starts coming. Controllers with 14lpp and later tech DLL cannot
+	 * guarantee above requirement. So PWRSAVE_DLL should not be
+	 * turned on for host controllers using this DLL.
+	 */
+	if (!msm_host->use_14lpp_dll_reset) {
+		config = readl_relaxed(host->ioaddr +
+				msm_offset->core_vendor_spec3);
+		config |= CORE_PWRSAVE_DLL;
+		writel_relaxed(config, host->ioaddr +
+				msm_offset->core_vendor_spec3);
+	}
 
 	/*

* Drain writebuffer to ensure above DLL calibration

maintainer Acked-by on v2 1/1
#3 lore raw
In reply to Veerabhadrarao Badiganti
Quoted 8 lines · Veerabhadrarao Badiganti

From: Ritesh Harjani <[email protected]>

SDHC core with new 14lpp and later tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement:
When MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming.

Quoted 4 lines

Adding support for this requirement.

Quoted 40 lines

--

Changes since V1:
Condition was not correct in V1, which is corrected in V2

--

---
 drivers/mmc/host/sdhci-msm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +15 -3
index c3a160c..aa5b610 100644
@@ -977,9 +977,21 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
 		goto out;
 	}
 
-	config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3);
-	config |= CORE_PWRSAVE_DLL;
-	writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec3);
+	/*
+	 * Set CORE_PWRSAVE_DLL bit in CORE_VENDOR_SPEC3.
+	 * When MCLK is gated OFF, it is not gated for less than 0.5us
+	 * and MCLK must be switched on for at-least 1us before DATA
+	 * starts coming. Controllers with 14lpp and later tech DLL cannot
+	 * guarantee above requirement. So PWRSAVE_DLL should not be
+	 * turned on for host controllers using this DLL.
+	 */
+	if (!msm_host->use_14lpp_dll_reset) {
+		config = readl_relaxed(host->ioaddr +
+				msm_offset->core_vendor_spec3);
+		config |= CORE_PWRSAVE_DLL;
+		writel_relaxed(config, host->ioaddr +
+				msm_offset->core_vendor_spec3);
+	}
 
 	/*
 	 * Drain writebuffer to ensure above DLL calibration
#4 lore raw
In reply to Veerabhadrarao Badiganti
Quoted 9 lines · Veerabhadrarao Badiganti

From: Ritesh Harjani <[email protected]>

SDHC core with new 14lpp and later tech DLL should not enable PWRSAVE_DLL since such controller's internal gating cannot meet following MCLK requirement:
When MCLK is gated OFF, it is not gated for less than 0.5us and MCLK must be switched on for at-least 1us before DATA starts coming.

Quoted 4 lines

Adding support for this requirement.

Applied for next, thanks!

Kind regards
Uffe

Quoted 41 lines

--

Changes since V1:
Condition was not correct in V1, which is corrected in V2

--

---
 drivers/mmc/host/sdhci-msm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-msm.c +15 -4
index c3a160c..aa5b610 100644
@@ -977,9 +977,21 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
                goto out;
        }
 
-       config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3);
-       config |= CORE_PWRSAVE_DLL;
-       writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec3);
+       /*
+        * Set CORE_PWRSAVE_DLL bit in CORE_VENDOR_SPEC3.
+        * When MCLK is gated OFF, it is not gated for less than 0.5us
+        * and MCLK must be switched on for at-least 1us before DATA
+        * starts coming. Controllers with 14lpp and later tech DLL cannot
+        * guarantee above requirement. So PWRSAVE_DLL should not be
+        * turned on for host controllers using this DLL.
+        */
+       if (!msm_host->use_14lpp_dll_reset) {
+               config = readl_relaxed(host->ioaddr +
+                               msm_offset->core_vendor_spec3);
+               config |= CORE_PWRSAVE_DLL;
+               writel_relaxed(config, host->ioaddr +
+                               msm_offset->core_vendor_spec3);
+       }
 
        /*
         * Drain writebuffer to ensure above DLL calibration
--

Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project