linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Tuning Fixes for sdhci-omap
@ 2018-11-21 10:33 Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Faiz Abbas @ 2018-11-21 10:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon, adrian.hunter, faiz_abbas

The following patches fix tuning related errors in the
sdhci-omap driver.

v2:
Added Fixes and stable tags for patch 1.
Re-enable DCRC in patch 1 only if it was enabled before
Squashed patches 2 & 3

Faiz Abbas (3):
  mmc: sdhci-omap: Fix DCRC error handling during tuning
  mmc: sdhci-omap: Add platform specific reset callback
  mmc: sdhci-omap: Remove redundant structure assignments

 drivers/mmc/host/sdhci-omap.c | 36 ++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

-- 
2.19.1


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

* [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
@ 2018-11-21 10:33 ` Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 2/3] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Faiz Abbas @ 2018-11-21 10:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon, adrian.hunter, faiz_abbas

Commit 7d33c3581536 ("mmc: sdhci-omap: Workaround for Errata i802")
disabled DCRC interrupts during tuning. This write to the interrupt
enable register gets overwritten in sdhci_prepare_data() and the
interrupt is not in fact disabled. Fix this by disabling the interrupt
in the host->ier variable.

Fixes: 7d33c3581536 ("mmc: sdhci-omap: Workaround for Errata i802")
Cc: <stable@vger.kernel.org>
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 88347ce78f23..d264391616f9 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -288,9 +288,9 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	struct device *dev = omap_host->dev;
 	struct mmc_ios *ios = &mmc->ios;
 	u32 start_window = 0, max_window = 0;
+	bool dcrc_was_enabled = false;
 	u8 cur_match, prev_match = 0;
 	u32 length = 0, max_len = 0;
-	u32 ier = host->ier;
 	u32 phase_delay = 0;
 	int ret = 0;
 	u32 reg;
@@ -317,9 +317,10 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	 * during the tuning procedure. So disable it during the
 	 * tuning procedure.
 	 */
-	ier &= ~SDHCI_INT_DATA_CRC;
-	sdhci_writel(host, ier, SDHCI_INT_ENABLE);
-	sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
+	if (host->ier & SDHCI_INT_DATA_CRC) {
+		host->ier &= ~SDHCI_INT_DATA_CRC;
+		dcrc_was_enabled = true;
+	}
 
 	while (phase_delay <= MAX_PHASE_DELAY) {
 		sdhci_omap_set_dll(omap_host, phase_delay);
@@ -366,6 +367,9 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
 ret:
 	sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
+	/* Reenable forbidden interrupt */
+	if (dcrc_was_enabled)
+		host->ier |= SDHCI_INT_DATA_CRC;
 	sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
 	sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
 	return ret;
-- 
2.19.1


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

* [PATCH v2 2/3] mmc: sdhci-omap: Add platform specific reset callback
  2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
@ 2018-11-21 10:33 ` Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 3/3] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Faiz Abbas @ 2018-11-21 10:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon, adrian.hunter, faiz_abbas

The TRM (SPRUIC2C - January 2017 - Revised May 2018 [1]) forbids
assertion of data reset while tuning is happening. Implement a
platform specific callback that takes care of this condition.

[1] http://www.ti.com/lit/pdf/spruic2 Section 25.5.1.2.4

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index d264391616f9..4fad47926743 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -115,6 +115,7 @@ struct sdhci_omap_host {
 
 	struct pinctrl		*pinctrl;
 	struct pinctrl_state	**pinctrl_state;
+	bool			is_tuning;
 };
 
 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host);
@@ -322,6 +323,8 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		dcrc_was_enabled = true;
 	}
 
+	omap_host->is_tuning = true;
+
 	while (phase_delay <= MAX_PHASE_DELAY) {
 		sdhci_omap_set_dll(omap_host, phase_delay);
 
@@ -359,9 +362,12 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	phase_delay = max_window + 4 * (max_len >> 1);
 	sdhci_omap_set_dll(omap_host, phase_delay);
 
+	omap_host->is_tuning = false;
+
 	goto ret;
 
 tuning_error:
+	omap_host->is_tuning = false;
 	dev_err(dev, "Tuning failed\n");
 	sdhci_omap_disable_tuning(omap_host);
 
@@ -687,6 +693,18 @@ static void sdhci_omap_set_uhs_signaling(struct sdhci_host *host,
 	sdhci_omap_start_clock(omap_host);
 }
 
+void sdhci_omap_reset(struct sdhci_host *host, u8 mask)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
+
+	/* Don't reset data lines during tuning operation */
+	if (omap_host->is_tuning)
+		mask &= ~SDHCI_RESET_DATA;
+
+	sdhci_reset(host, mask);
+}
+
 static struct sdhci_ops sdhci_omap_ops = {
 	.set_clock = sdhci_omap_set_clock,
 	.set_power = sdhci_omap_set_power,
@@ -695,7 +713,7 @@ static struct sdhci_ops sdhci_omap_ops = {
 	.get_min_clock = sdhci_omap_get_min_clock,
 	.set_bus_width = sdhci_omap_set_bus_width,
 	.platform_send_init_74_clocks = sdhci_omap_init_74_clocks,
-	.reset = sdhci_reset,
+	.reset = sdhci_omap_reset,
 	.set_uhs_signaling = sdhci_omap_set_uhs_signaling,
 };
 
-- 
2.19.1


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

* [PATCH v2 3/3] mmc: sdhci-omap: Remove redundant structure assignments
  2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
  2018-11-21 10:33 ` [PATCH v2 2/3] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
@ 2018-11-21 10:33 ` Faiz Abbas
  2018-11-21 11:23 ` [PATCH v2 0/3] Tuning Fixes for sdhci-omap Adrian Hunter
  2018-12-05 14:23 ` Ulf Hansson
  4 siblings, 0 replies; 7+ messages in thread
From: Faiz Abbas @ 2018-11-21 10:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon, adrian.hunter, faiz_abbas

The sdhci_execute_tuning() function has assignment of
private pointers multiple times. Remove the redundant assignment.

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 4fad47926743..f588ab679cb0 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -296,10 +296,6 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	int ret = 0;
 	u32 reg;
 
-	pltfm_host = sdhci_priv(host);
-	omap_host = sdhci_pltfm_priv(pltfm_host);
-	dev = omap_host->dev;
-
 	/* clock tuning is not needed for upto 52MHz */
 	if (ios->clock <= 52000000)
 		return 0;
-- 
2.19.1


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

* Re: [PATCH v2 0/3] Tuning Fixes for sdhci-omap
  2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
                   ` (2 preceding siblings ...)
  2018-11-21 10:33 ` [PATCH v2 3/3] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
@ 2018-11-21 11:23 ` Adrian Hunter
  2018-12-04  8:27   ` Faiz Abbas
  2018-12-05 14:23 ` Ulf Hansson
  4 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2018-11-21 11:23 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon

On 21/11/18 12:33 PM, Faiz Abbas wrote:
> The following patches fix tuning related errors in the
> sdhci-omap driver.
> 
> v2:
> Added Fixes and stable tags for patch 1.
> Re-enable DCRC in patch 1 only if it was enabled before
> Squashed patches 2 & 3
> 
> Faiz Abbas (3):
>   mmc: sdhci-omap: Fix DCRC error handling during tuning
>   mmc: sdhci-omap: Add platform specific reset callback
>   mmc: sdhci-omap: Remove redundant structure assignments
> 
>  drivers/mmc/host/sdhci-omap.c | 36 ++++++++++++++++++++++++++---------
>  1 file changed, 27 insertions(+), 9 deletions(-)
> 

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

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

* Re: [PATCH v2 0/3] Tuning Fixes for sdhci-omap
  2018-11-21 11:23 ` [PATCH v2 0/3] Tuning Fixes for sdhci-omap Adrian Hunter
@ 2018-12-04  8:27   ` Faiz Abbas
  0 siblings, 0 replies; 7+ messages in thread
From: Faiz Abbas @ 2018-12-04  8:27 UTC (permalink / raw)
  To: Adrian Hunter, linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon

Hi,

On 21/11/18 4:53 PM, Adrian Hunter wrote:
> On 21/11/18 12:33 PM, Faiz Abbas wrote:
>> The following patches fix tuning related errors in the
>> sdhci-omap driver.
>>
>> v2:
>> Added Fixes and stable tags for patch 1.
>> Re-enable DCRC in patch 1 only if it was enabled before
>> Squashed patches 2 & 3
>>
>> Faiz Abbas (3):
>>   mmc: sdhci-omap: Fix DCRC error handling during tuning
>>   mmc: sdhci-omap: Add platform specific reset callback
>>   mmc: sdhci-omap: Remove redundant structure assignments
>>
>>  drivers/mmc/host/sdhci-omap.c | 36 ++++++++++++++++++++++++++---------
>>  1 file changed, 27 insertions(+), 9 deletions(-)
>>
> 
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Gentle ping.

Thanks,
Faiz


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

* Re: [PATCH v2 0/3] Tuning Fixes for sdhci-omap
  2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
                   ` (3 preceding siblings ...)
  2018-11-21 11:23 ` [PATCH v2 0/3] Tuning Fixes for sdhci-omap Adrian Hunter
@ 2018-12-05 14:23 ` Ulf Hansson
  4 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2018-12-05 14:23 UTC (permalink / raw)
  To: Faiz Abbas; +Cc: Linux Kernel Mailing List, linux-mmc, Kishon, Adrian Hunter

On Wed, 21 Nov 2018 at 11:31, Faiz Abbas <faiz_abbas@ti.com> wrote:
>
> The following patches fix tuning related errors in the
> sdhci-omap driver.
>
> v2:
> Added Fixes and stable tags for patch 1.
> Re-enable DCRC in patch 1 only if it was enabled before
> Squashed patches 2 & 3
>
> Faiz Abbas (3):
>   mmc: sdhci-omap: Fix DCRC error handling during tuning
>   mmc: sdhci-omap: Add platform specific reset callback
>   mmc: sdhci-omap: Remove redundant structure assignments
>
>  drivers/mmc/host/sdhci-omap.c | 36 ++++++++++++++++++++++++++---------
>  1 file changed, 27 insertions(+), 9 deletions(-)
>
> --
> 2.19.1
>

Sorry for the delay!

Picked patch 1/3 for fixes, patch 2/3 and 3/3 for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2018-12-05 14:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 10:33 [PATCH v2 0/3] Tuning Fixes for sdhci-omap Faiz Abbas
2018-11-21 10:33 ` [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
2018-11-21 10:33 ` [PATCH v2 2/3] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
2018-11-21 10:33 ` [PATCH v2 3/3] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
2018-11-21 11:23 ` [PATCH v2 0/3] Tuning Fixes for sdhci-omap Adrian Hunter
2018-12-04  8:27   ` Faiz Abbas
2018-12-05 14:23 ` 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).