2020-11-16 08:36:10

by Manish Narani

[permalink] [raw]
Subject: [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver

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


2020-11-16 08:36:37

by Manish Narani

[permalink] [raw]
Subject: [PATCH v2 3/3] mmc: sdhci-of-arasan: Issue DLL reset explicitly

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 <[email protected]>
Signed-off-by: Manish Narani <[email protected]>
---
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

2020-11-16 08:36:59

by Manish Narani

[permalink] [raw]
Subject: [PATCH v2 1/3] mmc: sdhci-of-arasan: Allow configuring zero tap values

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 <[email protected]>
Signed-off-by: Manish Narani <[email protected]>
---
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

2020-11-16 15:07:22

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver



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 <[email protected]>

Thanks,
Michal

2020-11-16 19:30:44

by Manish Narani

[permalink] [raw]
Subject: [PATCH v2 2/3] mmc: sdhci-of-arasan: Use Mask writes for Tap delays

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 <[email protected]>
Signed-off-by: Manish Narani <[email protected]>
Acked-by: Michal Simek <[email protected]>
---
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

2020-11-17 11:55:39

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Bug Fixes to Tap Delay code in SDHCI Arasan driver

On Mon, 16 Nov 2020 at 09:33, Manish Narani <[email protected]> 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