Skip to contentSkip to conversation

mmc: execute tuning when device is not busy.

PATCH In review Yi Sun 2 participants 5 messages Aug 14, 2014 – Sep 24, 2014

Subsystems (2)
lore
Share & tools
lore

Yi Sun

author
#0 lore raw

PATCH v2 1/1 mmc: execute tuning when device is not busy.

We find tuning timeout because of the secure erase operation lasts too long so not to do tuning when device is busy.

---
 drivers/mmc/host/sdhci.c |    7 ++++---
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +4 -3
index 47055f3..6a584d7 100644
@@ -1355,11 +1355,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
 		/*
 		 * Check if the re-tuning timer has already expired and there
-		 * is no on-going data transfer. If so, we need to execute
-		 * tuning procedure before sending command.
+		 * is no on-going data transfer and DAT0 is not busy. If so,
+		 * we need to execute 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)) &&
+		    (present_state & SDHCI_DATA_0_LVL_MASK)) {
 			if (mmc->card) {
 				/* eMMC uses cmd21 but sd and sdio use cmd19 */
 				tuning_opcode =
drivers/mmc/host/sdhci.h +1 -0
index 4a5cd5e..0ae6b99d 100644
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT	0x00080000
 #define  SDHCI_DATA_LVL_MASK	0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT	20
+#define   SDHCI_DATA_0_LVL_MASK	0x00100000
 
 #define SDHCI_HOST_CONTROL	0x28
 #define  SDHCI_CTRL_LED		0x01
Signature · 1 line
1.7.9.5
author
#1 lore raw

Hi, Uffe,

Could you please review the patch? Thanks!

BRs,
Sun Yi

-----Original Message-----
From: Sun, Yi Y
Sent: Thursday, August 14, 2014 1:52 PM
To: [email protected]; [email protected]
Cc: Sun, Yi Y
Subject: [PATCH v2] mmc: execute tuning when device is not busy.

We find tuning timeout because of the secure erase operation lasts too long so not to do tuning when device is busy.

---
 drivers/mmc/host/sdhci.c |    7 ++++---
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +4 -3
@@ -1355,11 +1355,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
 		/*
 		 * Check if the re-tuning timer has already expired and there
-		 * is no on-going data transfer. If so, we need to execute
-		 * tuning procedure before sending command.
+		 * is no on-going data transfer and DAT0 is not busy. If so,
+		 * we need to execute 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)) &&
+		    (present_state & SDHCI_DATA_0_LVL_MASK)) {
 			if (mmc->card) {
 				/* eMMC uses cmd21 but sd and sdio use cmd19 */
 				tuning_opcode =
drivers/mmc/host/sdhci.h +1 -0
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT	0x00080000
 #define  SDHCI_DATA_LVL_MASK	0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT	20
+#define   SDHCI_DATA_0_LVL_MASK	0x00100000
 
 #define SDHCI_HOST_CONTROL	0x28
 #define  SDHCI_CTRL_LED		0x01

--
1.7.9.5

#2 lore raw
Quoted 6 lines · Yi Y

Hi, Uffe,

Could you please review the patch? Thanks!

BRs,
Sun Yi

Please don't top post.

I am not the only one to review sdhci patches. There are probably other better suited and I rely to get some input on this kind of patch.

Kind regards
Uffe

Quoted 53 lines

-----Original Message-----
From: Sun, Yi Y
Sent: Thursday, August 14, 2014 1:52 PM
To: [email protected]; [email protected]
Cc: Sun, Yi Y
Subject: [PATCH v2] mmc: execute tuning when device is not busy.

We find tuning timeout because of the secure erase operation lasts too long so not to do tuning when device is busy.

---
 drivers/mmc/host/sdhci.c |    7 ++++---
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +4 -3
@@ -1355,11 +1355,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
                /*
                 * Check if the re-tuning timer has already expired and there
-                * is no on-going data transfer. If so, we need to execute
-                * tuning procedure before sending command.
+                * is no on-going data transfer and DAT0 is not busy. If so,
+                * we need to execute 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)) &&
+                   (present_state & SDHCI_DATA_0_LVL_MASK)) {
                        if (mmc->card) {
                                /* eMMC uses cmd21 but sd and sdio use cmd19 */
                                tuning_opcode =
drivers/mmc/host/sdhci.h +1 -1
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT   0x00080000
 #define  SDHCI_DATA_LVL_MASK   0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT 20
+#define   SDHCI_DATA_0_LVL_MASK        0x00100000
 
 #define SDHCI_HOST_CONTROL     0x28
 #define  SDHCI_CTRL_LED                0x01
--

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
#3 lore raw
In reply to Yi Sun

Kind remind.

BRs,
Yi Sun

-----Original Message-----
From: Sun, Yi Y
Sent: Thursday, August 14, 2014 1:52 PM
To: [email protected]; [email protected]
Cc: Sun, Yi Y
Subject: [PATCH v2] mmc: execute tuning when device is not busy.

We find tuning timeout because of the secure erase operation lasts too long so not to do tuning when device is busy.

---
 drivers/mmc/host/sdhci.c |    7 ++++---
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +4 -3
@@ -1355,11 +1355,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
 		/*
 		 * Check if the re-tuning timer has already expired and there
-		 * is no on-going data transfer. If so, we need to execute
-		 * tuning procedure before sending command.
+		 * is no on-going data transfer and DAT0 is not busy. If so,
+		 * we need to execute 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)) &&
+		    (present_state & SDHCI_DATA_0_LVL_MASK)) {
 			if (mmc->card) {
 				/* eMMC uses cmd21 but sd and sdio use cmd19 */
 				tuning_opcode =
drivers/mmc/host/sdhci.h +1 -0
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT	0x00080000
 #define  SDHCI_DATA_LVL_MASK	0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT	20
+#define   SDHCI_DATA_0_LVL_MASK	0x00100000
 
 #define SDHCI_HOST_CONTROL	0x28
 #define  SDHCI_CTRL_LED		0x01

--
1.7.9.5

#4 lore raw
Quoted 12 lines · Yi Y

Kind remind.

BRs,
Yi Sun

-----Original Message-----
From: Sun, Yi Y
Sent: Thursday, August 14, 2014 1:52 PM
To: [email protected]; [email protected]
Cc: Sun, Yi Y
Subject: [PATCH v2] mmc: execute tuning when device is not busy.

Quoted 3 lines

We find tuning timeout because of the secure erase operation lasts too long so not to do tuning when device is busy.

So I have applied this for next.

Though the patch had checkpatch errors related to your email and author of the patch. I have fixed it according to what your sob tag stated.

Kind regards
Uffe

Quoted 38 lines
---
 drivers/mmc/host/sdhci.c |    7 ++++---
 drivers/mmc/host/sdhci.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +4 -3
@@ -1355,11 +1355,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
                /*
                 * Check if the re-tuning timer has already expired and there
-                * is no on-going data transfer. If so, we need to execute
-                * tuning procedure before sending command.
+                * is no on-going data transfer and DAT0 is not busy. If so,
+                * we need to execute 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)) &&
+                   (present_state & SDHCI_DATA_0_LVL_MASK)) {
                        if (mmc->card) {
                                /* eMMC uses cmd21 but sd and sdio use cmd19 */
                                tuning_opcode =
drivers/mmc/host/sdhci.h +1 -1
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT   0x00080000
 #define  SDHCI_DATA_LVL_MASK   0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT 20
+#define   SDHCI_DATA_0_LVL_MASK        0x00100000
 
 #define SDHCI_HOST_CONTROL     0x28
 #define  SDHCI_CTRL_LED                0x01
--

1.7.9.5