Skip to contentSkip to conversation

mmc: sdhci: only invoke clock re-tuning for adtc type commands

PATCH In review Franky Lin 2 participants 7 messages Jan 7, 2014 – Mar 26, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Franky Lin

author
#1 lore raw

PATCH 1/1 mmc: sdhci: only invoke clock re-tuning for adtc type commands

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

---
 drivers/mmc/host/sdhci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		 * tuning procedure before sending command.
 		 */
 		if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+		    mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {
 			if (mmc->card) {
 				/* eMMC uses cmd21 but sd and sdio use cmd19 */
 				tuning_opcode =
Signature · 1 line
1.7.9.5
author
#2 lore raw

Hi Chris,

Quoted 10 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

---

Is this still in your queue? Any remarks on it?

Thanks,
Franky

Quoted 18 lines
  drivers/mmc/host/sdhci.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
  		 * tuning procedure before sending command.
  		 */
  		if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+		    mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {
  			if (mmc->card) {
  				/* eMMC uses cmd21 but sd and sdio use cmd19 */
  				tuning_opcode =
author
#3 lore raw
Quoted 11 lines · Franky Lin

Hi Chris,

Quoted 8 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

Quoted 8 lines
Quoted 2 lines

---

Is this still in your queue? Any remarks on it?

Thanks,
Franky

Ping?

Quoted 24 lines
Quoted 17 lines
  drivers/mmc/host/sdhci.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc,
 struct mmc_request *mrq)
           * tuning procedure before sending command.
           */
          if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-            !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+            !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+            mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {
              if (mmc->card) {
                  /* eMMC uses cmd21 but sd and sdio use cmd19 */
Quoted 2 lines

tuning_opcode =

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#4 lore raw

Hi Chris and Ulf,

Quoted 15 lines · Franky Lin
Quoted 14 lines · Franky Lin

Hi Chris,

Quoted 10 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

---

Quoted 7 lines
Quoted 5 lines

Is this still in your queue? Any remarks on it?

Thanks,
Franky

Ping?

Need to try my luck again. :) Could you please share your thought about this patch?

Thanks,
Franky

Quoted 32 lines
Quoted 19 lines
Quoted 19 lines
  drivers/mmc/host/sdhci.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc,
 struct mmc_request *mrq)
           * tuning procedure before sending command.
           */
          if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-            !(present_state & (SDHCI_DOING_WRITE |
 SDHCI_DOING_READ))) {
+            !(present_state & (SDHCI_DOING_WRITE |

SDHCI_DOING_READ)) &&

+            mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {
              if (mmc->card) {
Quoted 8 lines
Quoted 3 lines
                  /* eMMC uses cmd21 but sd and sdio use cmd19 */
                  tuning_opcode =

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Franky Lin
Quoted 9 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

Hi Franky,

Sorry for the delay.

Quoted 9 lines
---
 drivers/mmc/host/sdhci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +0 -0
index cc00bed..f301cd6 100644

drivers/mmc/host/sdhci.c static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) · line 1393

Quoted 6 lines
drivers/mmc/host/sdhci.c +2 -1
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                 * tuning procedure before sending command.
                 */
                if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+                   mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {

I don't have the in-depth knowledge about the sdhci; Still, to me it seems like checking for MMC_CMD_ADTC, is that not just the same a checking if there are a READ/WRITE?

Another note, we really should be working on moving the periodic "re-tuning trigger" mechanism into the mmc core layer, so all host driver's could benefit from this. Do you want to help out fixing this?

Kind regards
Ulf Hansson

Quoted 10 lines
drivers/mmc/host/sdhci.c +0 -1
                        if (mmc->card) {
                                /* eMMC uses cmd21 but sd and sdio use cmd19 */
                                tuning_opcode =
--

1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#6 lore raw

Hi Ulf,

Quoted 19 lines · Ulf Hansson
Quoted 9 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

Hi Franky,

Sorry for the delay.

Quoted 4 lines
---
  drivers/mmc/host/sdhci.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/mmc/host/sdhci.c static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) · line 1393

Quoted 11 lines
drivers/mmc/host/sdhci.c +2 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                  * tuning procedure before sending command.
                  */
                 if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+                   mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {

I don't have the in-depth knowledge about the sdhci; Still, to me it seems like checking for MMC_CMD_ADTC, is that not just the same a checking if there are a READ/WRITE?

non-adtc commands like CMD17/CMD24/CMD52 do not use the data lines. Tuning is only necessary for adtc commands as CMD18/CMD25/CMD53 which involve data lines.

Quoted 3 lines

Another note, we really should be working on moving the periodic "re-tuning trigger" mechanism into the mmc core layer, so all host driver's could benefit from this. Do you want to help out fixing this?

I thought about this before but hesitated because of non-sdhci drivers. I have seen some of them don't have standardized implementation(well if they do they would have used sdhci anyway).

Thanks,
Franky

Quoted 18 lines

Kind regards
Ulf Hansson

Quoted 10 lines
drivers/mmc/host/sdhci.c +0 -1
                         if (mmc->card) {
                                 /* eMMC uses cmd21 but sd and sdio use cmd19 */
                                 tuning_opcode =
--

1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#7 lore raw
Quoted 41 lines · Franky Lin

Hi Ulf,

Quoted 29 lines · Ulf Hansson
Quoted 9 lines · Franky Lin

For high clock frequency modes, ie. SDR104 and possibly SDR50, the data window on the CMD and DAT lines needs to be tuned. Once tuned to a sample clock rate, a re-tuning might required because of drifted signal on different lines. This re-tuning is needed and only necessary for commands using the DAT lines, ie. adtc type commands. This patch is an optimization by adding the condition of the requested command being adtc type in order to execute the re-tuning procedure.

Hi Franky,

Sorry for the delay.

Quoted 14 lines
---
  drivers/mmc/host/sdhci.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +0 -1
index cc00bed..f301cd6 100644
@@ -1389,7 +1389,8 @@ static void sdhci_request(struct mmc_host 
 *mmc, struct mmc_request *mrq)
                  * tuning procedure before sending command.
                  */
                 if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-                   !(present_state & (SDHCI_DOING_WRITE | 
Quoted 8 lines
Quoted 4 lines
drivers/mmc/host/sdhci.c +1 -0
 SDHCI_DOING_READ))) {
+                   !(present_state & (SDHCI_DOING_WRITE | 

SDHCI_DOING_READ)) &&
+ mmc_cmd_type(mrq->cmd) == MMC_CMD_ADTC) {

I don't have the in-depth knowledge about the sdhci; Still, to me it seems like checking for MMC_CMD_ADTC, is that not just the same a checking if there are a READ/WRITE?

Quoted 8 lines

non-adtc commands like CMD17/CMD24/CMD52 do not use the data lines. Tuning is only necessary for adtc commands as CMD18/CMD25/CMD53 which involve data lines.

Quoted 3 lines

Another note, we really should be working on moving the periodic "re-tuning trigger" mechanism into the mmc core layer, so all host driver's could benefit from this. Do you want to help out fixing this?

I thought about this before but hesitated because of non-sdhci drivers. I have seen some of them don't have standardized implementation(well if they do they would have used sdhci anyway).

Ping?