linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver
@ 2020-11-16  8:32 Manish Narani
  2020-11-16  8:32 ` [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values Manish Narani
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Manish Narani @ 2020-11-16  8:32 UTC (permalink / raw)
  To: michal.simek, adrian.hunter, ulf.hansson
  Cc: linux-arm-kernel, linux-mmc, linux-kernel, git, Manish Narani

This patch set consists a couple of minor bug fixes for SDHCI Arasan
driver. The fixes are for tap delay programming where in some cases
tuning is failing for some of the SD cards.

Changes in v2:
	- Fixed the eemi_ops call issue by replacing to an API call
	  directly
	- Merged https://lore.kernel.org/patchwork/patch/1336342/
	  with this series of patches

Manish Narani (3):
  mmc: sdhci-of-arasan: Allow configuring zero tap values
  mmc: sdhci-of-arasan: Use Mask writes for Tap delays
  mmc: sdhci-of-arasan: Issue DLL reset explicitly

 drivers/mmc/host/sdhci-of-arasan.c | 51 +++++++++++-------------------
 1 file changed, 19 insertions(+), 32 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values
  2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
@ 2020-11-16  8:32 ` Manish Narani
  2020-11-16  8:32 ` [PATCH v2 2/3] mmc: sdhci-of-arasan: Use Mask writes for Tap delays Manish Narani
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Narani @ 2020-11-16  8:32 UTC (permalink / raw)
  To: michal.simek, adrian.hunter, ulf.hansson
  Cc: linux-arm-kernel, linux-mmc, linux-kernel, git, Manish Narani,
	Sai Krishna Potthuri

Allow configuring the Output and Input tap values with zero to avoid
failures in some cases (one of them is SD boot mode) where the output
and input tap values may be already set to non-zero.

Fixes: a5c8b2ae2e51 ("mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup")
Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 40 ++++++------------------------
 1 file changed, 8 insertions(+), 32 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 829ccef87426..100621e55427 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -600,14 +600,8 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
 	u8 tap_delay, tap_max = 0;
 	int ret;
 
-	/*
-	 * This is applicable for SDHCI_SPEC_300 and above
-	 * ZynqMP does not set phase for <=25MHz clock.
-	 * If degrees is zero, no need to do anything.
-	 */
-	if (host->version < SDHCI_SPEC_300 ||
-	    host->timing == MMC_TIMING_LEGACY ||
-	    host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
+	/* This is applicable for SDHCI_SPEC_300 and above */
+	if (host->version < SDHCI_SPEC_300)
 		return 0;
 
 	switch (host->timing) {
@@ -668,14 +662,8 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees)
 	u8 tap_delay, tap_max = 0;
 	int ret;
 
-	/*
-	 * This is applicable for SDHCI_SPEC_300 and above
-	 * ZynqMP does not set phase for <=25MHz clock.
-	 * If degrees is zero, no need to do anything.
-	 */
-	if (host->version < SDHCI_SPEC_300 ||
-	    host->timing == MMC_TIMING_LEGACY ||
-	    host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
+	/* This is applicable for SDHCI_SPEC_300 and above */
+	if (host->version < SDHCI_SPEC_300)
 		return 0;
 
 	switch (host->timing) {
@@ -733,14 +721,8 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
 	struct sdhci_host *host = sdhci_arasan->host;
 	u8 tap_delay, tap_max = 0;
 
-	/*
-	 * This is applicable for SDHCI_SPEC_300 and above
-	 * Versal does not set phase for <=25MHz clock.
-	 * If degrees is zero, no need to do anything.
-	 */
-	if (host->version < SDHCI_SPEC_300 ||
-	    host->timing == MMC_TIMING_LEGACY ||
-	    host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
+	/* This is applicable for SDHCI_SPEC_300 and above */
+	if (host->version < SDHCI_SPEC_300)
 		return 0;
 
 	switch (host->timing) {
@@ -804,14 +786,8 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees)
 	struct sdhci_host *host = sdhci_arasan->host;
 	u8 tap_delay, tap_max = 0;
 
-	/*
-	 * This is applicable for SDHCI_SPEC_300 and above
-	 * Versal does not set phase for <=25MHz clock.
-	 * If degrees is zero, no need to do anything.
-	 */
-	if (host->version < SDHCI_SPEC_300 ||
-	    host->timing == MMC_TIMING_LEGACY ||
-	    host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
+	/* This is applicable for SDHCI_SPEC_300 and above */
+	if (host->version < SDHCI_SPEC_300)
 		return 0;
 
 	switch (host->timing) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] mmc: sdhci-of-arasan: Use Mask writes for Tap delays
  2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
  2020-11-16  8:32 ` [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values Manish Narani
@ 2020-11-16  8:32 ` Manish Narani
  2020-11-16  8:32 ` [PATCH v2 3/3] mmc: sdhci-of-arasan: Issue DLL reset explicitly Manish Narani
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Narani @ 2020-11-16  8:32 UTC (permalink / raw)
  To: michal.simek, adrian.hunter, ulf.hansson
  Cc: linux-arm-kernel, linux-mmc, linux-kernel, git, Manish Narani,
	Sai Krishna Potthuri

Mask the ITAP and OTAP delay bits before updating with the new
tap value for Versal platform.

Fixes: 1a470721c8f5 ("sdhci: arasan: Add support for Versal Tap Delays")
Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 100621e55427..3ec5ecad637c 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -30,7 +30,10 @@
 #define SDHCI_ARASAN_VENDOR_REGISTER	0x78
 
 #define SDHCI_ARASAN_ITAPDLY_REGISTER	0xF0F8
+#define SDHCI_ARASAN_ITAPDLY_SEL_MASK	0xFF
+
 #define SDHCI_ARASAN_OTAPDLY_REGISTER	0xF0FC
+#define SDHCI_ARASAN_OTAPDLY_SEL_MASK	0x3F
 
 #define SDHCI_ARASAN_CQE_BASE_ADDR	0x200
 #define VENDOR_ENHANCED_STROBE		BIT(0)
@@ -755,6 +758,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
 		regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER);
 		regval |= SDHCI_OTAPDLY_ENABLE;
 		sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
+		regval &= ~SDHCI_ARASAN_OTAPDLY_SEL_MASK;
 		regval |= tap_delay;
 		sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
 	}
@@ -822,6 +826,7 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees)
 		sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
 		regval |= SDHCI_ITAPDLY_ENABLE;
 		sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
+		regval &= ~SDHCI_ARASAN_ITAPDLY_SEL_MASK;
 		regval |= tap_delay;
 		sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
 		regval &= ~SDHCI_ITAPDLY_CHGWIN;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] mmc: sdhci-of-arasan: Issue DLL reset explicitly
  2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
  2020-11-16  8:32 ` [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values Manish Narani
  2020-11-16  8:32 ` [PATCH v2 2/3] mmc: sdhci-of-arasan: Use Mask writes for Tap delays Manish Narani
@ 2020-11-16  8:32 ` Manish Narani
  2020-11-16 15:04 ` [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Michal Simek
  2020-11-17 11:50 ` Ulf Hansson
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Narani @ 2020-11-16  8:32 UTC (permalink / raw)
  To: michal.simek, adrian.hunter, ulf.hansson
  Cc: linux-arm-kernel, linux-mmc, linux-kernel, git, Manish Narani,
	Sai Krishna Potthuri

In the current implementation DLL reset will be issued for
each ITAP and OTAP setting inside ATF, this is creating issues
in some scenarios and this sequence is not inline with the TRM.
To fix the issue, DLL reset should be removed from the ATF and
host driver will request it explicitly.
This patch update host driver to explicitly request for DLL reset
before ITAP (assert DLL) and after OTAP (release DLL) settings.

Fixes: a5c8b2ae2e51 ("mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup")
Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 3ec5ecad637c..d25a4b50c2f3 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -635,6 +635,9 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
 	if (ret)
 		pr_err("Error setting Output Tap Delay\n");
 
+	/* Release DLL Reset */
+	zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_RELEASE);
+
 	return ret;
 }
 
@@ -669,6 +672,9 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees)
 	if (host->version < SDHCI_SPEC_300)
 		return 0;
 
+	/* Assert DLL Reset */
+	zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_ASSERT);
+
 	switch (host->timing) {
 	case MMC_TIMING_MMC_HS:
 	case MMC_TIMING_SD_HS:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver
  2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
                   ` (2 preceding siblings ...)
  2020-11-16  8:32 ` [PATCH v2 3/3] mmc: sdhci-of-arasan: Issue DLL reset explicitly Manish Narani
@ 2020-11-16 15:04 ` Michal Simek
  2020-11-17 11:50 ` Ulf Hansson
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-11-16 15:04 UTC (permalink / raw)
  To: Manish Narani, michal.simek, adrian.hunter, ulf.hansson
  Cc: linux-arm-kernel, linux-mmc, linux-kernel, git



On 16. 11. 20 9:32, Manish Narani wrote:
> This patch set consists a couple of minor bug fixes for SDHCI Arasan
> driver. The fixes are for tap delay programming where in some cases
> tuning is failing for some of the SD cards.
> 
> Changes in v2:
> 	- Fixed the eemi_ops call issue by replacing to an API call
> 	  directly
> 	- Merged https://lore.kernel.org/patchwork/patch/1336342/
> 	  with this series of patches
> 
> Manish Narani (3):
>   mmc: sdhci-of-arasan: Allow configuring zero tap values
>   mmc: sdhci-of-arasan: Use Mask writes for Tap delays
>   mmc: sdhci-of-arasan: Issue DLL reset explicitly
> 
>  drivers/mmc/host/sdhci-of-arasan.c | 51 +++++++++++-------------------
>  1 file changed, 19 insertions(+), 32 deletions(-)
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver
  2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
                   ` (3 preceding siblings ...)
  2020-11-16 15:04 ` [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Michal Simek
@ 2020-11-17 11:50 ` Ulf Hansson
  4 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2020-11-17 11:50 UTC (permalink / raw)
  To: Manish Narani
  Cc: Michal Simek, Adrian Hunter, Linux ARM, linux-mmc,
	Linux Kernel Mailing List, git

On Mon, 16 Nov 2020 at 09:33, Manish Narani <manish.narani@xilinx.com> wrote:
>
> This patch set consists a couple of minor bug fixes for SDHCI Arasan
> driver. The fixes are for tap delay programming where in some cases
> tuning is failing for some of the SD cards.
>
> Changes in v2:
>         - Fixed the eemi_ops call issue by replacing to an API call
>           directly
>         - Merged https://lore.kernel.org/patchwork/patch/1336342/
>           with this series of patches
>
> Manish Narani (3):
>   mmc: sdhci-of-arasan: Allow configuring zero tap values
>   mmc: sdhci-of-arasan: Use Mask writes for Tap delays
>   mmc: sdhci-of-arasan: Issue DLL reset explicitly
>
>  drivers/mmc/host/sdhci-of-arasan.c | 51 +++++++++++-------------------
>  1 file changed, 19 insertions(+), 32 deletions(-)
>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-17 11:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  8:32 [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Manish Narani
2020-11-16  8:32 ` [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values Manish Narani
2020-11-16  8:32 ` [PATCH v2 2/3] mmc: sdhci-of-arasan: Use Mask writes for Tap delays Manish Narani
2020-11-16  8:32 ` [PATCH v2 3/3] mmc: sdhci-of-arasan: Issue DLL reset explicitly Manish Narani
2020-11-16 15:04 ` [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver Michal Simek
2020-11-17 11:50 ` Ulf Hansson

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).