All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes for Am65x controllers
@ 2020-01-08 14:32 Faiz Abbas
  2020-01-08 14:32 ` [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag Faiz Abbas
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Faiz Abbas @ 2020-01-08 14:32 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter, faiz_abbas

The following are some fixes for sdhci_am654 driver.

Patch 3 depends on patch 2.

v1 of patch 2 was posted:
https://patchwork.kernel.org/project/linux-mmc/list/?series=222279

Faiz Abbas (3):
  mmc: sdhci_am654: Remove Inverted Write Protect flag
  mmc: sdhci_am654: Reset Command and Data line after tuning
  mmc: sdhci_am654: Fix Command Queuing in AM65x

 drivers/mmc/host/sdhci_am654.c | 54 ++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 19 deletions(-)

-- 
2.19.2


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

* [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag
  2020-01-08 14:32 [PATCH 0/3] Fixes for Am65x controllers Faiz Abbas
@ 2020-01-08 14:32 ` Faiz Abbas
  2020-01-15 13:12   ` Adrian Hunter
  2020-01-08 14:33 ` [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning Faiz Abbas
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Faiz Abbas @ 2020-01-08 14:32 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter, faiz_abbas

The MMC/SD controllers on am65x and j721e don't in fact detect the write
protect line as inverted. No issues were detected because of this
because the sdwp line is not connected on any of the evms. Fix this by
removing the flag.

Fixes: 1accbced1c32 ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
Cc: stable@vger.kernel.org
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci_am654.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index b8e897e31e2e..2d38b1e12a7e 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -253,8 +253,7 @@ static struct sdhci_ops sdhci_am654_ops = {
 
 static const struct sdhci_pltfm_data sdhci_am654_pdata = {
 	.ops = &sdhci_am654_ops,
-	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
-		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
+	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
@@ -290,8 +289,7 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = {
 
 static const struct sdhci_pltfm_data sdhci_j721e_8bit_pdata = {
 	.ops = &sdhci_j721e_8bit_ops,
-	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
-		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
+	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
@@ -314,8 +312,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = {
 
 static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = {
 	.ops = &sdhci_j721e_4bit_ops,
-	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
-		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
+	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
-- 
2.19.2


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

* [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning
  2020-01-08 14:32 [PATCH 0/3] Fixes for Am65x controllers Faiz Abbas
  2020-01-08 14:32 ` [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag Faiz Abbas
@ 2020-01-08 14:33 ` Faiz Abbas
  2020-01-15 13:12   ` Adrian Hunter
  2020-01-08 14:33 ` [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x Faiz Abbas
  2020-01-16 14:39 ` [PATCH 0/3] Fixes for Am65x controllers Ulf Hansson
  3 siblings, 1 reply; 8+ messages in thread
From: Faiz Abbas @ 2020-01-08 14:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter, faiz_abbas

The tuning data is leftover in the buffer after tuning. This can cause
issues in future data commands, especially with CQHCI. Reset the command
and data lines after tuning to continue from a clean state.

Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci_am654.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 2d38b1e12a7e..59c0c41b3739 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -240,6 +240,22 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg)
 	writeb(val, host->ioaddr + reg);
 }
 
+static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
+{
+	struct sdhci_host *host = mmc_priv(mmc);
+	int err = sdhci_execute_tuning(mmc, opcode);
+
+	if (err)
+		return err;
+	/*
+	 * Tuning data remains in the buffer after tuning.
+	 * Do a command and data reset to get rid of it
+	 */
+	sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
+
+	return 0;
+}
+
 static struct sdhci_ops sdhci_am654_ops = {
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
 	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -546,6 +562,8 @@ static int sdhci_am654_probe(struct platform_device *pdev)
 		goto pm_runtime_put;
 	}
 
+	host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
+
 	ret = sdhci_am654_init(host);
 	if (ret)
 		goto pm_runtime_put;
-- 
2.19.2


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

* [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x
  2020-01-08 14:32 [PATCH 0/3] Fixes for Am65x controllers Faiz Abbas
  2020-01-08 14:32 ` [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag Faiz Abbas
  2020-01-08 14:33 ` [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning Faiz Abbas
@ 2020-01-08 14:33 ` Faiz Abbas
  2020-01-15 13:15   ` Adrian Hunter
  2020-01-16 14:39 ` [PATCH 0/3] Fixes for Am65x controllers Ulf Hansson
  3 siblings, 1 reply; 8+ messages in thread
From: Faiz Abbas @ 2020-01-08 14:33 UTC (permalink / raw)
  To: linux-kernel, linux-mmc; +Cc: ulf.hansson, adrian.hunter, faiz_abbas

Command Queuing was enabled completely for J721e controllers which lead
to partial enablement even for Am65x. Complete CQ implementation for
AM65x by adding the irq callback.

Fixes: f545702b74f9 ("mmc: sdhci_am654: Add Support for Command Queuing Engine to J721E")
Cc: stable@vger.kernel.org
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci_am654.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 59c0c41b3739..b8fe94fd9525 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -256,6 +256,19 @@ static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	return 0;
 }
 
+static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
+{
+	int cmd_error = 0;
+	int data_error = 0;
+
+	if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
+		return intmask;
+
+	cqhci_irq(host->mmc, intmask, cmd_error, data_error);
+
+	return 0;
+}
+
 static struct sdhci_ops sdhci_am654_ops = {
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
 	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -264,6 +277,7 @@ static struct sdhci_ops sdhci_am654_ops = {
 	.set_power = sdhci_am654_set_power,
 	.set_clock = sdhci_am654_set_clock,
 	.write_b = sdhci_am654_write_b,
+	.irq = sdhci_am654_cqhci_irq,
 	.reset = sdhci_reset,
 };
 
@@ -278,19 +292,6 @@ static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
 	.flags = IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT | DLL_PRESENT,
 };
 
-static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
-{
-	int cmd_error = 0;
-	int data_error = 0;
-
-	if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
-		return intmask;
-
-	cqhci_irq(host->mmc, intmask, cmd_error, data_error);
-
-	return 0;
-}
-
 static struct sdhci_ops sdhci_j721e_8bit_ops = {
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
 	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
-- 
2.19.2


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

* Re: [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag
  2020-01-08 14:32 ` [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag Faiz Abbas
@ 2020-01-15 13:12   ` Adrian Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Hunter @ 2020-01-15 13:12 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson

On 8/01/20 4:32 pm, Faiz Abbas wrote:
> The MMC/SD controllers on am65x and j721e don't in fact detect the write
> protect line as inverted. No issues were detected because of this
> because the sdwp line is not connected on any of the evms. Fix this by
> removing the flag.
> 
> Fixes: 1accbced1c32 ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
> Cc: stable@vger.kernel.org
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

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

> ---
>  drivers/mmc/host/sdhci_am654.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index b8e897e31e2e..2d38b1e12a7e 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -253,8 +253,7 @@ static struct sdhci_ops sdhci_am654_ops = {
>  
>  static const struct sdhci_pltfm_data sdhci_am654_pdata = {
>  	.ops = &sdhci_am654_ops,
> -	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
> -		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> +	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
>  	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
>  };
>  
> @@ -290,8 +289,7 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = {
>  
>  static const struct sdhci_pltfm_data sdhci_j721e_8bit_pdata = {
>  	.ops = &sdhci_j721e_8bit_ops,
> -	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
> -		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> +	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
>  	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
>  };
>  
> @@ -314,8 +312,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = {
>  
>  static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = {
>  	.ops = &sdhci_j721e_4bit_ops,
> -	.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
> -		  SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> +	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
>  	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
>  };
>  
> 


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

* Re: [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning
  2020-01-08 14:33 ` [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning Faiz Abbas
@ 2020-01-15 13:12   ` Adrian Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Hunter @ 2020-01-15 13:12 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson

On 8/01/20 4:33 pm, Faiz Abbas wrote:
> The tuning data is leftover in the buffer after tuning. This can cause
> issues in future data commands, especially with CQHCI. Reset the command
> and data lines after tuning to continue from a clean state.
> 
> Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

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

> ---
>  drivers/mmc/host/sdhci_am654.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 2d38b1e12a7e..59c0c41b3739 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -240,6 +240,22 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg)
>  	writeb(val, host->ioaddr + reg);
>  }
>  
> +static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
> +{
> +	struct sdhci_host *host = mmc_priv(mmc);
> +	int err = sdhci_execute_tuning(mmc, opcode);
> +
> +	if (err)
> +		return err;
> +	/*
> +	 * Tuning data remains in the buffer after tuning.
> +	 * Do a command and data reset to get rid of it
> +	 */
> +	sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
> +
> +	return 0;
> +}
> +
>  static struct sdhci_ops sdhci_am654_ops = {
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
> @@ -546,6 +562,8 @@ static int sdhci_am654_probe(struct platform_device *pdev)
>  		goto pm_runtime_put;
>  	}
>  
> +	host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
> +
>  	ret = sdhci_am654_init(host);
>  	if (ret)
>  		goto pm_runtime_put;
> 


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

* Re: [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x
  2020-01-08 14:33 ` [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x Faiz Abbas
@ 2020-01-15 13:15   ` Adrian Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Hunter @ 2020-01-15 13:15 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, linux-mmc; +Cc: ulf.hansson

On 8/01/20 4:33 pm, Faiz Abbas wrote:
> Command Queuing was enabled completely for J721e controllers which lead
> to partial enablement even for Am65x. Complete CQ implementation for
> AM65x by adding the irq callback.
> 
> Fixes: f545702b74f9 ("mmc: sdhci_am654: Add Support for Command Queuing Engine to J721E")
> Cc: stable@vger.kernel.org
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

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

> ---
>  drivers/mmc/host/sdhci_am654.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 59c0c41b3739..b8fe94fd9525 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -256,6 +256,19 @@ static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  	return 0;
>  }
>  
> +static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
> +{
> +	int cmd_error = 0;
> +	int data_error = 0;
> +
> +	if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
> +		return intmask;
> +
> +	cqhci_irq(host->mmc, intmask, cmd_error, data_error);
> +
> +	return 0;
> +}
> +
>  static struct sdhci_ops sdhci_am654_ops = {
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
> @@ -264,6 +277,7 @@ static struct sdhci_ops sdhci_am654_ops = {
>  	.set_power = sdhci_am654_set_power,
>  	.set_clock = sdhci_am654_set_clock,
>  	.write_b = sdhci_am654_write_b,
> +	.irq = sdhci_am654_cqhci_irq,
>  	.reset = sdhci_reset,
>  };
>  
> @@ -278,19 +292,6 @@ static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
>  	.flags = IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT | DLL_PRESENT,
>  };
>  
> -static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
> -{
> -	int cmd_error = 0;
> -	int data_error = 0;
> -
> -	if (!sdhci_cqe_irq(host, intmask, &cmd_error, &data_error))
> -		return intmask;
> -
> -	cqhci_irq(host->mmc, intmask, cmd_error, data_error);
> -
> -	return 0;
> -}
> -
>  static struct sdhci_ops sdhci_j721e_8bit_ops = {
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
> 


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

* Re: [PATCH 0/3] Fixes for Am65x controllers
  2020-01-08 14:32 [PATCH 0/3] Fixes for Am65x controllers Faiz Abbas
                   ` (2 preceding siblings ...)
  2020-01-08 14:33 ` [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x Faiz Abbas
@ 2020-01-16 14:39 ` Ulf Hansson
  3 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2020-01-16 14:39 UTC (permalink / raw)
  To: Faiz Abbas; +Cc: Linux Kernel Mailing List, linux-mmc, Adrian Hunter

On Wed, 8 Jan 2020 at 15:31, Faiz Abbas <faiz_abbas@ti.com> wrote:
>
> The following are some fixes for sdhci_am654 driver.
>
> Patch 3 depends on patch 2.
>
> v1 of patch 2 was posted:
> https://patchwork.kernel.org/project/linux-mmc/list/?series=222279
>
> Faiz Abbas (3):
>   mmc: sdhci_am654: Remove Inverted Write Protect flag
>   mmc: sdhci_am654: Reset Command and Data line after tuning
>   mmc: sdhci_am654: Fix Command Queuing in AM65x
>
>  drivers/mmc/host/sdhci_am654.c | 54 ++++++++++++++++++++++------------
>  1 file changed, 35 insertions(+), 19 deletions(-)
>
> --
> 2.19.2
>

Applied for fixes, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2020-01-16 14:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 14:32 [PATCH 0/3] Fixes for Am65x controllers Faiz Abbas
2020-01-08 14:32 ` [PATCH 1/3] mmc: sdhci_am654: Remove Inverted Write Protect flag Faiz Abbas
2020-01-15 13:12   ` Adrian Hunter
2020-01-08 14:33 ` [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning Faiz Abbas
2020-01-15 13:12   ` Adrian Hunter
2020-01-08 14:33 ` [PATCH 3/3] mmc: sdhci_am654: Fix Command Queuing in AM65x Faiz Abbas
2020-01-15 13:15   ` Adrian Hunter
2020-01-16 14:39 ` [PATCH 0/3] Fixes for Am65x controllers Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.