Skip to contentSkip to conversation

fsl_esdhc: Add Auto command 12 interrupt bit detecting

PATCH New Haijun Zhang 5 participants 10 messages Oct 12, 2013 – Jan 30, 2014 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
 drivers/mmc/fsl_esdhc.c | 10 +++++-----
 include/fsl_esdhc.h     |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +5 -5
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #endif
 
 	/* Wait for the command to complete */
-	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
 		;
 
 	irqstat = esdhc_read32(&regs->irqstat);
 
 	/* Reset CMD and DATA portions on error */
-	if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+	if (irqstat & CMD_ERR) {
 		esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
 			      SYSCTL_RSTC);
 		while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 		}
 	}
 
-	if (irqstat & CMD_ERR)
-		return COMM_ERR;
-
 	if (irqstat & IRQSTAT_CTOE)
 		return TIMEOUT;
 
+	if (irqstat & CMD_ERR)
+		return COMM_ERR;
+
 	/* Workaround for ESDHC errata ENGcm03648 */
 	if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
 		int timeout = 2500;
include/fsl_esdhc.h +2 -1
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
 #define IRQSTAT_TC		(0x00000002)
 #define IRQSTAT_CC		(0x00000001)
 
-#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+				IRQSTAT_CTOE | IRQSTAT_AC12E)
 #define DATA_ERR	(IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
 				IRQSTAT_DMAE)
 #define DATA_COMPLETE	(IRQSTAT_TC | IRQSTAT_DINT)
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Hi, all

Who can give some comments?

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 62 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
 drivers/mmc/fsl_esdhc.c | 10 +++++-----
 include/fsl_esdhc.h     |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +5 -5
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #endif
 
 	/* Wait for the command to complete */
-	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
 		;
 
 	irqstat = esdhc_read32(&regs->irqstat);
 
 	/* Reset CMD and DATA portions on error */
-	if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+	if (irqstat & CMD_ERR) {
 		esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
 			      SYSCTL_RSTC);
 		while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 		}
 	}
 
-	if (irqstat & CMD_ERR)
-		return COMM_ERR;
-
 	if (irqstat & IRQSTAT_CTOE)
 		return TIMEOUT;
 
+	if (irqstat & CMD_ERR)
+		return COMM_ERR;
+
 	/* Workaround for ESDHC errata ENGcm03648 */
 	if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
 		int timeout = 2500;
include/fsl_esdhc.h +2 -1
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
 #define IRQSTAT_TC		(0x00000002)
 #define IRQSTAT_CC		(0x00000001)
 
-#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+				IRQSTAT_CTOE | IRQSTAT_AC12E)
 #define DATA_ERR	(IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
 				IRQSTAT_DMAE)
 #define DATA_COMPLETE	(IRQSTAT_TC | IRQSTAT_DINT)
Signature · 2 lines
Thanks & Regards
Haijun.
#2 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these changes ?

Best regards,
Stefano Babic

Quoted 66 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 62 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
 drivers/mmc/fsl_esdhc.c | 10 +++++-----
 include/fsl_esdhc.h     |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +5 -5
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #endif
 
 	/* Wait for the command to complete */
-	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
 		;
 
 	irqstat = esdhc_read32(&regs->irqstat);
 
 	/* Reset CMD and DATA portions on error */
-	if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+	if (irqstat & CMD_ERR) {
 		esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
 			      SYSCTL_RSTC);
 		while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 		}
 	}
 
-	if (irqstat & CMD_ERR)
-		return COMM_ERR;
-
 	if (irqstat & IRQSTAT_CTOE)
 		return TIMEOUT;
 
+	if (irqstat & CMD_ERR)
+		return COMM_ERR;
+
 	/* Workaround for ESDHC errata ENGcm03648 */
 	if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
 		int timeout = 2500;
include/fsl_esdhc.h +2 -1
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
 #define IRQSTAT_TC		(0x00000002)
 #define IRQSTAT_CC		(0x00000001)
 
-#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+				IRQSTAT_CTOE | IRQSTAT_AC12E)
 #define DATA_ERR	(IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
 				IRQSTAT_DMAE)
 #define DATA_COMPLETE	(IRQSTAT_TC | IRQSTAT_DINT)
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Hi, Babic

Thanks.

This patch is test on PPC.

Regards,
Haijun

? 2013/10/21 17:19, Stefano Babic ??:

Quoted 80 lines

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these changes ?

Best regards,
Stefano Babic

Quoted 64 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 62 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
  drivers/mmc/fsl_esdhc.c | 10 +++++-----
  include/fsl_esdhc.h     |  3 ++-
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +5 -5
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
  #endif
 
  	/* Wait for the command to complete */
-	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+	while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
  		;
 
  	irqstat = esdhc_read32(&regs->irqstat);
 
  	/* Reset CMD and DATA portions on error */
-	if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+	if (irqstat & CMD_ERR) {
  		esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
  			      SYSCTL_RSTC);
  		while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
  		}
  	}
 
-	if (irqstat & CMD_ERR)
-		return COMM_ERR;
-
  	if (irqstat & IRQSTAT_CTOE)
  		return TIMEOUT;
 
+	if (irqstat & CMD_ERR)
+		return COMM_ERR;
+
  	/* Workaround for ESDHC errata ENGcm03648 */
  	if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
  		int timeout = 2500;
include/fsl_esdhc.h +2 -1
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
  #define IRQSTAT_TC		(0x00000002)
  #define IRQSTAT_CC		(0x00000001)
 
-#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR		(IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+				IRQSTAT_CTOE | IRQSTAT_AC12E)
  #define DATA_ERR	(IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
  				IRQSTAT_DMAE)
  #define DATA_COMPLETE	(IRQSTAT_TC | IRQSTAT_DINT)
Signature · 2 lines
Thanks & Regards
Haijun.
#4 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Hi, Antonious

How about this patch?
Could you give some advice?

? 2013/10/21 17:23, Zhang Haijun ??:

Quoted 90 lines

Hi, Babic

Thanks.

This patch is test on PPC.

Regards,
Haijun

? 2013/10/21 17:19, Stefano Babic ??:

Quoted 77 lines

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these changes ?

Best regards,
Stefano Babic

Quoted 61 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 59 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
  drivers/mmc/fsl_esdhc.c | 10 +++++-----
  include/fsl_esdhc.h     |  3 ++-
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +4 -4
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct 
 mmc_cmd *cmd, struct mmc_data *data)
  #endif
        /* Wait for the command to complete */
-    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | 
 IRQSTAT_CTOE)))
+    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
          ;
        irqstat = esdhc_read32(&regs->irqstat);
        /* Reset CMD and DATA portions on error */
-    if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+    if (irqstat & CMD_ERR) {
          esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
                    SYSCTL_RSTC);
          while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct 
 mmc_cmd *cmd, struct mmc_data *data)
          }
      }
  -    if (irqstat & CMD_ERR)
-        return COMM_ERR;
-
      if (irqstat & IRQSTAT_CTOE)
          return TIMEOUT;
  +    if (irqstat & CMD_ERR)
+        return COMM_ERR;
+
      /* Workaround for ESDHC errata ENGcm03648 */
      if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
          int timeout = 2500;
include/fsl_esdhc.h +2 -0
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
  #define IRQSTAT_TC        (0x00000002)
  #define IRQSTAT_CC        (0x00000001)
  -#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+                IRQSTAT_CTOE | IRQSTAT_AC12E)
  #define DATA_ERR    (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
                  IRQSTAT_DMAE)
  #define DATA_COMPLETE    (IRQSTAT_TC | IRQSTAT_DINT)
Signature · 2 lines
Thanks & Regards
Haijun.
#5 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Hi Zhang,

I'll take a look at it over the weekend.

Regards

-- Pantelis

Quoted 100 lines · Zhang Haijun

Hi, Antonious

How about this patch?
Could you give some advice?

? 2013/10/21 17:23, Zhang Haijun ??:

Quoted 87 lines

Hi, Babic

Thanks.

This patch is test on PPC.

Regards,
Haijun

? 2013/10/21 17:19, Stefano Babic ??:

Quoted 74 lines

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these changes ?

Best regards,
Stefano Babic

Quoted 58 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 56 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
 drivers/mmc/fsl_esdhc.c | 10 +++++-----
 include/fsl_esdhc.h     |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +4 -4
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #endif
       /* Wait for the command to complete */
-    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
         ;
       irqstat = esdhc_read32(&regs->irqstat);
       /* Reset CMD and DATA portions on error */
-    if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+    if (irqstat & CMD_ERR) {
         esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
                   SYSCTL_RSTC);
         while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
         }
     }
 -    if (irqstat & CMD_ERR)
-        return COMM_ERR;
-
     if (irqstat & IRQSTAT_CTOE)
         return TIMEOUT;
 +    if (irqstat & CMD_ERR)
+        return COMM_ERR;
+
     /* Workaround for ESDHC errata ENGcm03648 */
     if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
         int timeout = 2500;
include/fsl_esdhc.h +2 -0
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
 #define IRQSTAT_TC        (0x00000002)
 #define IRQSTAT_CC        (0x00000001)
 -#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+                IRQSTAT_CTOE | IRQSTAT_AC12E)
 #define DATA_ERR    (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
                 IRQSTAT_DMAE)
 #define DATA_COMPLETE    (IRQSTAT_TC | IRQSTAT_DINT)
Signature · 2 lines
Thanks & Regards
Haijun.
#6 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

:-)

Thanks.

? 2013/11/1 15:45, Pantelis Antoniou ??:

Quoted 106 lines

Hi Zhang,

I'll take a look at it over the weekend.

Regards

-- Pantelis

Quoted 95 lines · Zhang Haijun

Hi, Antonious

How about this patch?
Could you give some advice?

? 2013/10/21 17:23, Zhang Haijun ??:

Quoted 84 lines

Hi, Babic

Thanks.

This patch is test on PPC.

Regards,
Haijun

? 2013/10/21 17:19, Stefano Babic ??:

Quoted 72 lines

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these changes ?

Best regards,
Stefano Babic

Quoted 57 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 56 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
  drivers/mmc/fsl_esdhc.c | 10 +++++-----
  include/fsl_esdhc.h     |  3 ++-
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +4 -4
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
  #endif
        /* Wait for the command to complete */
-    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE)))
+    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
          ;
        irqstat = esdhc_read32(&regs->irqstat);
        /* Reset CMD and DATA portions on error */
-    if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+    if (irqstat & CMD_ERR) {
          esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
                    SYSCTL_RSTC);
          while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
          }
      }
  -    if (irqstat & CMD_ERR)
-        return COMM_ERR;
-
      if (irqstat & IRQSTAT_CTOE)
          return TIMEOUT;
  +    if (irqstat & CMD_ERR)
+        return COMM_ERR;
+
      /* Workaround for ESDHC errata ENGcm03648 */
      if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
          int timeout = 2500;
include/fsl_esdhc.h +2 -0
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
  #define IRQSTAT_TC        (0x00000002)
  #define IRQSTAT_CC        (0x00000001)
  -#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+                IRQSTAT_CTOE | IRQSTAT_AC12E)
  #define DATA_ERR    (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
                  IRQSTAT_DMAE)
  #define DATA_COMPLETE    (IRQSTAT_TC | IRQSTAT_DINT)
Signature · 2 lines
Thanks & Regards
Haijun.
Signature · 2 lines
Thanks & Regards
Haijun.
#7 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Quoted 13 lines · Zhang Haijun

:-)

Thanks.

? 2013/11/1 15:45, Pantelis Antoniou ??:

Quoted 8 lines

Hi Zhang,

I'll take a look at it over the weekend.

Regards

-- Pantelis

Where are we on this patch?

York

#8 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

Sorry, just had a baby and things are a bit busy.
It's not fallen into the bit-bucket if that's what you're worried about.

Regards

-- Pantelis

Quoted 19 lines · York Sun
Quoted 13 lines · Zhang Haijun

:-)

Thanks.

? 2013/11/1 15:45, Pantelis Antoniou ??:

Quoted 8 lines

Hi Zhang,

I'll take a look at it over the weekend.

Regards

-- Pantelis

Where are we on this patch?

York

#9 lore raw

PATCH 1/1 fsl_esdhc: Add Auto command 12 interrupt bit detecting

In reply to Zhang Haijun

Hi, Antonious

Expect your advice.

Best Regards,
-- Haijun

Quoted 99 lines · Zhang Haijun

Hi, Antonious

How about this patch?
Could you give some advice?

? 2013/10/21 17:23, Zhang Haijun ??:

Quoted 91 lines

Hi, Babic

Thanks.

This patch is test on PPC.

Regards,
Haijun

? 2013/10/21 17:19, Stefano Babic ??:

Quoted 78 lines

Hi,

Quoted 3 lines · Zhang Haijun

Hi, all

Who can give some comments?

I put Antonius in CC, he's the MMC custodian.

The driver is for both PPC and i.MX. On which platform do you test these
changes ?

Best regards,
Stefano Babic

Quoted 61 lines

? 2013/10/12 17:50, Haijun Zhang ??:

Quoted 59 lines

When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop.

---
  drivers/mmc/fsl_esdhc.c | 10 +++++-----
  include/fsl_esdhc.h     |  3 ++-
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/mmc/fsl_esdhc.c +4 -4
index dc1d002..5aa592b 100644
@@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct 
 mmc_cmd *cmd, struct mmc_data *data)
  #endif
        /* Wait for the command to complete */
-    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | 
 IRQSTAT_CTOE)))
+    while (!(esdhc_read32(&regs->irqstat) & (IRQSTAT_CC | CMD_ERR)))
          ;
        irqstat = esdhc_read32(&regs->irqstat);
        /* Reset CMD and DATA portions on error */
-    if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) {
+    if (irqstat & CMD_ERR) {
          esdhc_write32(&regs->sysctl, esdhc_read32(&regs->sysctl) |
                    SYSCTL_RSTC);
          while (esdhc_read32(&regs->sysctl) & SYSCTL_RSTC)
@@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct 
 mmc_cmd *cmd, struct mmc_data *data)
          }
      }
  -    if (irqstat & CMD_ERR)
-        return COMM_ERR;
-
      if (irqstat & IRQSTAT_CTOE)
          return TIMEOUT;
  +    if (irqstat & CMD_ERR)
+        return COMM_ERR;
+
      /* Workaround for ESDHC errata ENGcm03648 */
      if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
          int timeout = 2500;
include/fsl_esdhc.h +2 -0
index 67d6057..37dbe27 100644
@@ -62,7 +62,8 @@
  #define IRQSTAT_TC        (0x00000002)
  #define IRQSTAT_CC        (0x00000001)
  -#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)
+#define CMD_ERR        (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \
+                IRQSTAT_CTOE | IRQSTAT_AC12E)
  #define DATA_ERR    (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \
                  IRQSTAT_DMAE)
  #define DATA_COMPLETE    (IRQSTAT_TC | IRQSTAT_DINT)