Skip to contentSkip to conversation

mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

PATCH Superseded [email protected] 2 participants 5 messages Aug 6, 2020 – Aug 11, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

From: Haibo Chen <[email protected]>

According to IC suggestion, everytime before sending the tuning command, need to reset the usdhc, so to reset the tuning circuit, to let every tuning command work well for the manual tuning method. For standard tuning method, IC already add the reset operation in the logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc-imx.c +1 -0
index a76b4513fbec..e4694eb1b914 100644
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
 
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);
 
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 17 lines · On 6/08/20 2:48 pm, [email protected] wrote:

From: Haibo Chen <[email protected]>

According to IC suggestion, everytime before sending the tuning command, need to reset the usdhc, so to reset the tuning circuit, to let every tuning command work well for the manual tuning method. For standard tuning method, IC already add the reset operation in the logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
index a76b4513fbec..e4694eb1b914 100644

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) · line 993

Quoted 4 lines
drivers/mmc/host/sdhci-esdhc-imx.c +1 -0
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
 
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);

Doesn't that reset all registers i.e. the entire ios state?

Quoted 4 lines
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
 
author maintainer
#2 lore raw
Quoted 32 lines

-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: 2020年8月6日 20:11
To: Bough Chen <[email protected]>; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

Quoted 20 lines · On 6/08/20 2:48 pm, [email protected] wrote:

From: Haibo Chen <[email protected]>

According to IC suggestion, everytime before sending the tuning command, need to reset the usdhc, so to reset the tuning circuit, to let every tuning command work well for the manual tuning method. For standard tuning method, IC already add the reset operation in the logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
index a76b4513fbec..e4694eb1b914 100644
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host
 *host, u32 val)
 
Quoted 6 lines

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) · line 993

Quoted 3 lines
drivers/mmc/host/sdhci-esdhc-imx.c +1 -0
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);

Doesn't that reset all registers i.e. the entire ios state?

Hi Adrian,
For i.MX usdhc, RESET_ALL operation do not impact any register value, it just reset the internal logic setting. I already verified that.
Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good enough to use this API directly. Any suggestion? At least, current patch can fix the manual tuning issue on imx7d/imx8qxp.

Quoted 4 lines
Quoted 4 lines
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
maintainer
#3 lore raw
Quoted 39 lines · Bough Chen
Quoted 32 lines

-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: 2020年8月6日 20:11
To: Bough Chen <[email protected]>; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

Quoted 20 lines · On 6/08/20 2:48 pm, [email protected] wrote:

From: Haibo Chen <[email protected]>

According to IC suggestion, everytime before sending the tuning command, need to reset the usdhc, so to reset the tuning circuit, to let every tuning command work well for the manual tuning method. For standard tuning method, IC already add the reset operation in the logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
index a76b4513fbec..e4694eb1b914 100644
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct sdhci_host
 *host, u32 val)
 
Quoted 6 lines

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) · line 993

Quoted 3 lines
drivers/mmc/host/sdhci-esdhc-imx.c +1 -0
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors */
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);

Doesn't that reset all registers i.e. the entire ios state?

Quoted 3 lines

Hi Adrian,
For i.MX usdhc, RESET_ALL operation do not impact any register value, it just reset the internal logic setting. I already verified that.
Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good enough to use this API directly. Any suggestion? At least, current patch can fix the manual tuning issue on imx7d/imx8qxp.

It might be safer to write SDHCI_RESET_ALL directly because, for your case, it does not have exactly the same semantics as sdhci_reset().

It is up to you, but either way, it would be worth adding a comment.

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
author maintainer
#4 lore raw
Quoted 56 lines

-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: 2020年8月10日 19:26
To: Bough Chen <[email protected]>; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

Quoted 32 lines · Bough Chen
Quoted 32 lines

-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: 2020年8月6日 20:11
To: Bough Chen <[email protected]>; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mmc: host: sdhci-esdhc-imx: reset usdhc before sending tuning command for manual tuning method

Quoted 20 lines · On 6/08/20 2:48 pm, [email protected] wrote:

From: Haibo Chen <[email protected]>

According to IC suggestion, everytime before sending the tuning command, need to reset the usdhc, so to reset the tuning circuit, to let every tuning command work well for the manual tuning method. For standard tuning method, IC already add the reset operation in the logic.

---
 drivers/mmc/host/sdhci-esdhc-imx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
index a76b4513fbec..e4694eb1b914 100644
@@ -990,6 +990,7 @@ static void esdhc_prepare_tuning(struct
 sdhci_host *host, u32 val)
 
Quoted 1 line
Quoted 1 line

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct · line 992

Quoted 1 line
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
 	/* FIXME: delay a bit for card to be ready for next tuning due to errors

*/

Quoted 8 lines
Quoted 5 lines

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) · line 993

Quoted 2 lines
drivers/mmc/host/sdhci-esdhc-imx.c +1 -0
 	mdelay(1);
+	sdhci_reset(host, SDHCI_RESET_ALL);

Doesn't that reset all registers i.e. the entire ios state?

Hi Adrian,
For i.MX usdhc, RESET_ALL operation do not impact any register value, it just

reset the internal logic setting. I already verified that.

Quoted 1 line

Here I just want to set the SDHCI_RESET_ALL bit, but I notice that the API

Quoted 9 lines

sdhci_reset() will also touch the host->clock, so I'm not sure whether it is good enough to use this API directly. Any suggestion? At least, current patch can fix the manual tuning issue on imx7d/imx8qxp.

It might be safer to write SDHCI_RESET_ALL directly because, for your case, it does not have exactly the same semantics as sdhci_reset().

It is up to you, but either way, it would be worth adding a comment.

Thanks Adrian, I will write this bit directly and add a comment in the next V2 patch.

Best Regards
Haibo Chen

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

drivers/mmc/host/sdhci-esdhc-imx.c static void esdhc_prepare_tuning(struct · line 996

Quoted 4 lines
drivers/mmc/host/sdhci-esdhc-imx.c +0 -0
 	reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
 	reg |= ESDHC_MIX_CTRL_EXE_TUNE |

ESDHC_MIX_CTRL_SMPCLK_SEL |

Quoted 2 lines
Quoted 1 line
Quoted 1 line