linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Tuning Fixes for sdhci-omap
@ 2018-11-19 11:16 Faiz Abbas
  2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Faiz Abbas @ 2018-11-19 11:16 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.

Faiz Abbas (4):
  mmc: sdhci-omap: Fix DCRC error handling during tuning
  mmc: sdhci-omap: Add variable to indicate host is tuning
  mmc: sdhci-omap: Add platform specific reset callback
  mmc: sdhci-omap: Remove redundant structure assignments

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

-- 
2.19.1


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

* [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-19 11:16 [PATCH 0/4] Tuning Fixes for sdhci-omap Faiz Abbas
@ 2018-11-19 11:16 ` Faiz Abbas
  2018-11-19 13:18   ` Ulf Hansson
  2018-11-20  4:53   ` Kishon Vijay Abraham I
  2018-11-19 11:16 ` [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning Faiz Abbas
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Faiz Abbas @ 2018-11-19 11:16 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.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 88347ce78f23..87138067e334 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -290,7 +290,6 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	u32 start_window = 0, max_window = 0;
 	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 +316,7 @@ 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);
+	host->ier &= ~SDHCI_INT_DATA_CRC;
 
 	while (phase_delay <= MAX_PHASE_DELAY) {
 		sdhci_omap_set_dll(omap_host, phase_delay);
@@ -366,6 +363,8 @@ 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 */
+	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] 13+ messages in thread

* [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning
  2018-11-19 11:16 [PATCH 0/4] Tuning Fixes for sdhci-omap Faiz Abbas
  2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
@ 2018-11-19 11:16 ` Faiz Abbas
  2018-11-19 13:18   ` Ulf Hansson
  2018-11-19 11:16 ` [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
  2018-11-19 11:16 ` [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
  3 siblings, 1 reply; 13+ messages in thread
From: Faiz Abbas @ 2018-11-19 11:16 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, kishon, adrian.hunter, faiz_abbas

Add a variable in sdhc_omap_host to indicate whether a tuning
operation is ongoing.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 87138067e334..cfffcf58be3f 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);
@@ -318,6 +319,8 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	 */
 	host->ier &= ~SDHCI_INT_DATA_CRC;
 
+	omap_host->is_tuning = true;
+
 	while (phase_delay <= MAX_PHASE_DELAY) {
 		sdhci_omap_set_dll(omap_host, phase_delay);
 
@@ -355,9 +358,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);
 
-- 
2.19.1


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

* [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback
  2018-11-19 11:16 [PATCH 0/4] Tuning Fixes for sdhci-omap Faiz Abbas
  2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
  2018-11-19 11:16 ` [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning Faiz Abbas
@ 2018-11-19 11:16 ` Faiz Abbas
  2018-11-20  5:00   ` Kishon Vijay Abraham I
  2018-11-19 11:16 ` [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
  3 siblings, 1 reply; 13+ messages in thread
From: Faiz Abbas @ 2018-11-19 11:16 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

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-omap.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index cfffcf58be3f..bf268b38ddc8 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -688,6 +688,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,
@@ -696,7 +708,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] 13+ messages in thread

* [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments
  2018-11-19 11:16 [PATCH 0/4] Tuning Fixes for sdhci-omap Faiz Abbas
                   ` (2 preceding siblings ...)
  2018-11-19 11:16 ` [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
@ 2018-11-19 11:16 ` Faiz Abbas
  2018-11-20  5:01   ` Kishon Vijay Abraham I
  3 siblings, 1 reply; 13+ messages in thread
From: Faiz Abbas @ 2018-11-19 11:16 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.

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 bf268b38ddc8..b3cb39d0db6f 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -295,10 +295,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] 13+ messages in thread

* Re: [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
@ 2018-11-19 13:18   ` Ulf Hansson
  2018-11-20  7:28     ` Faiz Abbas
  2018-11-20  4:53   ` Kishon Vijay Abraham I
  1 sibling, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2018-11-19 13:18 UTC (permalink / raw)
  To: Faiz Abbas; +Cc: Linux Kernel Mailing List, linux-mmc, Kishon, Adrian Hunter

On 19 November 2018 at 12:16, Faiz Abbas <faiz_abbas@ti.com> wrote:
> 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.
>
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Should we have fixes/stable tag?

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-omap.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> index 88347ce78f23..87138067e334 100644
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -290,7 +290,6 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
>         u32 start_window = 0, max_window = 0;
>         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 +316,7 @@ 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);
> +       host->ier &= ~SDHCI_INT_DATA_CRC;
>
>         while (phase_delay <= MAX_PHASE_DELAY) {
>                 sdhci_omap_set_dll(omap_host, phase_delay);
> @@ -366,6 +363,8 @@ 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 */
> +       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	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning
  2018-11-19 11:16 ` [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning Faiz Abbas
@ 2018-11-19 13:18   ` Ulf Hansson
  2018-11-20 12:58     ` Faiz Abbas
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2018-11-19 13:18 UTC (permalink / raw)
  To: Faiz Abbas; +Cc: Linux Kernel Mailing List, linux-mmc, Kishon, Adrian Hunter

On 19 November 2018 at 12:16, Faiz Abbas <faiz_abbas@ti.com> wrote:
> Add a variable in sdhc_omap_host to indicate whether a tuning
> operation is ongoing.
>
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Please squash this into patch3 as it seems a bit silly to keep this a
separate change.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-omap.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> index 87138067e334..cfffcf58be3f 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);
> @@ -318,6 +319,8 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
>          */
>         host->ier &= ~SDHCI_INT_DATA_CRC;
>
> +       omap_host->is_tuning = true;
> +
>         while (phase_delay <= MAX_PHASE_DELAY) {
>                 sdhci_omap_set_dll(omap_host, phase_delay);
>
> @@ -355,9 +358,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);
>
> --
> 2.19.1
>

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

* Re: [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
  2018-11-19 13:18   ` Ulf Hansson
@ 2018-11-20  4:53   ` Kishon Vijay Abraham I
  2018-11-21  9:39     ` Faiz Abbas
  1 sibling, 1 reply; 13+ messages in thread
From: Kishon Vijay Abraham I @ 2018-11-20  4:53 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter

Hi,

On 19/11/18 4:46 PM, Faiz Abbas wrote:
> 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.
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> ---
>   drivers/mmc/host/sdhci-omap.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> index 88347ce78f23..87138067e334 100644
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -290,7 +290,6 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
>   	u32 start_window = 0, max_window = 0;
>   	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 +316,7 @@ 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);
> +	host->ier &= ~SDHCI_INT_DATA_CRC;
>   
>   	while (phase_delay <= MAX_PHASE_DELAY) {
>   		sdhci_omap_set_dll(omap_host, phase_delay);
> @@ -366,6 +363,8 @@ 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 */
> +	host->ier |= SDHCI_INT_DATA_CRC;

It's better to have a backup of host->ier and restore the value here (in 
case DATA_CRC is disabled for other cases).

Thanks
Kishon

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

* Re: [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback
  2018-11-19 11:16 ` [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
@ 2018-11-20  5:00   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 13+ messages in thread
From: Kishon Vijay Abraham I @ 2018-11-20  5:00 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter



On 19/11/18 4:46 PM, Faiz Abbas wrote:
> 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
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Once patch 2 is merged with this patch, you can add
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>   drivers/mmc/host/sdhci-omap.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> index cfffcf58be3f..bf268b38ddc8 100644
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -688,6 +688,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,
> @@ -696,7 +708,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,
>   };
>   
> 

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

* Re: [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments
  2018-11-19 11:16 ` [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
@ 2018-11-20  5:01   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 13+ messages in thread
From: Kishon Vijay Abraham I @ 2018-11-20  5:01 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter



On 19/11/18 4:46 PM, Faiz Abbas wrote:
> The sdhci_execute_tuning() function has assignment of
> private pointers multiple times. Remove the redundant assignment.
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Acked-by: Kishon Vijay Abraham I <kishon@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 bf268b38ddc8..b3cb39d0db6f 100644
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -295,10 +295,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;
> 

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

* Re: [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-19 13:18   ` Ulf Hansson
@ 2018-11-20  7:28     ` Faiz Abbas
  0 siblings, 0 replies; 13+ messages in thread
From: Faiz Abbas @ 2018-11-20  7:28 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Linux Kernel Mailing List, linux-mmc, Kishon, Adrian Hunter

Hi Uffe

On 19/11/18 6:48 PM, Ulf Hansson wrote:
> On 19 November 2018 at 12:16, Faiz Abbas <faiz_abbas@ti.com> wrote:
>> 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.
>>
>> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> 
> Should we have fixes/stable tag?
> 

Ok. Will add that.

Thanks,
Faiz

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

* Re: [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning
  2018-11-19 13:18   ` Ulf Hansson
@ 2018-11-20 12:58     ` Faiz Abbas
  0 siblings, 0 replies; 13+ messages in thread
From: Faiz Abbas @ 2018-11-20 12:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Linux Kernel Mailing List, linux-mmc, Kishon, Adrian Hunter

Hi Uffe,

On 19/11/18 6:48 PM, Ulf Hansson wrote:
> On 19 November 2018 at 12:16, Faiz Abbas <faiz_abbas@ti.com> wrote:
>> Add a variable in sdhc_omap_host to indicate whether a tuning
>> operation is ongoing.
>>
>> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> 
> Please squash this into patch3 as it seems a bit silly to keep this a
> separate change.
> 

Ok. Squashing 2 and 3.

Thanks,
Faiz

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

* Re: [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning
  2018-11-20  4:53   ` Kishon Vijay Abraham I
@ 2018-11-21  9:39     ` Faiz Abbas
  0 siblings, 0 replies; 13+ messages in thread
From: Faiz Abbas @ 2018-11-21  9:39 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, linux-kernel, linux-mmc
  Cc: ulf.hansson, adrian.hunter

Hi Kishon,

On 20/11/18 10:23 AM, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On 19/11/18 4:46 PM, Faiz Abbas wrote:
>> 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.
>>
>> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
>> ---
>>   drivers/mmc/host/sdhci-omap.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-omap.c
>> b/drivers/mmc/host/sdhci-omap.c
>> index 88347ce78f23..87138067e334 100644
>> --- a/drivers/mmc/host/sdhci-omap.c
>> +++ b/drivers/mmc/host/sdhci-omap.c
>> @@ -290,7 +290,6 @@ static int sdhci_omap_execute_tuning(struct
>> mmc_host *mmc, u32 opcode)
>>       u32 start_window = 0, max_window = 0;
>>       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 +316,7 @@ 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);
>> +    host->ier &= ~SDHCI_INT_DATA_CRC;
>>         while (phase_delay <= MAX_PHASE_DELAY) {
>>           sdhci_omap_set_dll(omap_host, phase_delay);
>> @@ -366,6 +363,8 @@ 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 */
>> +    host->ier |= SDHCI_INT_DATA_CRC;
> 
> It's better to have a backup of host->ier and restore the value here (in
> case DATA_CRC is disabled for other cases).
> 

host->ier is modified everywhere during an mmc request. I would not
expect it to hold its value after so many tuning commands. I can add a
bool to check of DCRC was enabled before and only then re-enable it.

Thanks,
Faiz

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

end of thread, other threads:[~2018-11-21  9:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 11:16 [PATCH 0/4] Tuning Fixes for sdhci-omap Faiz Abbas
2018-11-19 11:16 ` [PATCH 1/4] mmc: sdhci-omap: Fix DCRC error handling during tuning Faiz Abbas
2018-11-19 13:18   ` Ulf Hansson
2018-11-20  7:28     ` Faiz Abbas
2018-11-20  4:53   ` Kishon Vijay Abraham I
2018-11-21  9:39     ` Faiz Abbas
2018-11-19 11:16 ` [PATCH 2/4] mmc: sdhci-omap: Add variable to indicate host is tuning Faiz Abbas
2018-11-19 13:18   ` Ulf Hansson
2018-11-20 12:58     ` Faiz Abbas
2018-11-19 11:16 ` [PATCH 3/4] mmc: sdhci-omap: Add platform specific reset callback Faiz Abbas
2018-11-20  5:00   ` Kishon Vijay Abraham I
2018-11-19 11:16 ` [PATCH 4/4] mmc: sdhci-omap: Remove redundant structure assignments Faiz Abbas
2018-11-20  5:01   ` Kishon Vijay Abraham I

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