Skip to contentSkip to conversation

mmc: fsl_esdhc: fix mmc read/write error on T4080

PATCH Superseded Yangbo Lu 4 participants 8 messages Jan 7, 2016 – Jan 21, 2016 MMC, SD and SDIO

lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +1 -1
index c5054d6..16fb01a 100644
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
 	defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) || \
-	defined(CONFIG_PPC_T4160)
+	defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
 	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
 		xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 15 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data) · line 113

Quoted 8 lines
drivers/mmc/fsl_esdhc.c +1 -1
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) || \
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Andy

#2 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 38 lines · Andy Fleming
Quoted 15 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data) · line 113

Quoted 8 lines
drivers/mmc/fsl_esdhc.c +1 -1
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) || \
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 7 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Yangbo,

I agree with Andy on this. Please make the suggested change.

York

#3 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 46 lines · york sun
Quoted 38 lines · Andy Fleming
Quoted 15 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data) · line 113

Quoted 8 lines
drivers/mmc/fsl_esdhc.c +1 -1
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) || \
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 6 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Quoted 3 lines

Yangbo,

I agree with Andy on this. Please make the suggested change.

... as some sort of Kconfig entry that's ideally selected rather than prmopted for when applicable. Like it would be done in the kernel :)

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160114/e072a0a4/attachment.sig>
author
#4 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 58 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Friday, January 15, 2016 2:09 AM
To: york sun
Cc: Andy Fleming; Yangbo Lu; U-Boot list
Subject: Re: [U-Boot] [v2] mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 19 lines · york sun
Quoted 18 lines · Andy Fleming
Quoted 17 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd,
 struct mmc_data *data)
 
Quoted 2 lines
Quoted 2 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, · line 110

Quoted 2 lines
drivers/mmc/fsl_esdhc.c +0 -0
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) ||

\

Quoted 27 lines
Quoted 18 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)

Quoted 4 lines
drivers/mmc/fsl_esdhc.c +1 -1
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;  #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 6 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Yangbo,

Quoted 7 lines
Quoted 1 line

I agree with Andy on this. Please make the suggested change.

... as some sort of Kconfig entry that's ideally selected rather than prmopted for when applicable. Like it would be done in the kernel :)

--
Tom

[Lu Yangbo-B47093] Thank you so much for your suggestion. I would prepare a v3 patchset.
:)

author
#5 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

In reply to Tom Rini
Quoted 58 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Friday, January 15, 2016 2:09 AM
To: york sun
Cc: Andy Fleming; Yangbo Lu; U-Boot list
Subject: Re: [U-Boot] [v2] mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 19 lines · york sun
Quoted 18 lines · Andy Fleming
Quoted 17 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd,
 struct mmc_data *data)
 
Quoted 2 lines
Quoted 2 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, · line 110

Quoted 2 lines
drivers/mmc/fsl_esdhc.c +0 -0
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) ||

\

Quoted 27 lines
Quoted 18 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)

Quoted 4 lines
drivers/mmc/fsl_esdhc.c +1 -1
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;  #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 6 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Yangbo,

Quoted 7 lines
Quoted 1 line

I agree with Andy on this. Please make the suggested change.

... as some sort of Kconfig entry that's ideally selected rather than prmopted for when applicable. Like it would be done in the kernel :)

--
Tom

[Lu Yangbo-B47093] Hi Tom, I want to reconfirm whether your suggestion is same with Andy and York's. Could I define it in include/configs/xxxx.h? Or use Kconfig?

Thanks.

#6 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 60 lines · Yangbo Lu
Quoted 60 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Friday, January 15, 2016 2:09 AM
To: york sun
Cc: Andy Fleming; Yangbo Lu; U-Boot list
Subject: Re: [U-Boot] [v2] mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 19 lines · york sun
Quoted 18 lines · Andy Fleming
Quoted 17 lines · Yangbo Lu

Fill the right command type when using CMD12 to stop data transfer.

---
Changes for v2:
- Removed fix for T4160 because other patch had done that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd,
 struct mmc_data *data)
 
Quoted 2 lines
Quoted 2 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, · line 110

Quoted 2 lines
drivers/mmc/fsl_esdhc.c +0 -0
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LAYERSCAPE) ||

\

Quoted 28 lines
Quoted 18 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)

Quoted 4 lines
drivers/mmc/fsl_esdhc.c +1 -1
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;  #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 6 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that seems like a poor use of your time. :)

Yangbo,

I agree with Andy on this. Please make the suggested change.

Quoted 7 lines
Quoted 5 lines

... as some sort of Kconfig entry that's ideally selected rather than prmopted for when applicable. Like it would be done in the kernel :)

--
Tom

[Lu Yangbo-B47093] Hi Tom, I want to reconfirm whether your suggestion is same with Andy and York's. Could I define it in include/configs/xxxx.h? Or use Kconfig?

I'm agreeing with what Andy/York say and noting that the right way to fix this is not to add something to include/configs/ but to use Kconfig and have the platforms select the symbol (rather than prompt for it), similar to how flags like this would work in the Linux kernel.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160119/ddbcfadd/attachment.sig>
author
#7 lore raw

PATCH v2 1/1 mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 85 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Tuesday, January 19, 2016 11:59 PM
To: Yangbo Lu
Cc: york sun; Andy Fleming; U-Boot list
Subject: Re: [U-Boot] [v2] mmc: fsl_esdhc: fix mmc read/write error on T4080

Quoted 12 lines · Yangbo Lu
Quoted 12 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Friday, January 15, 2016 2:09 AM
To: york sun
Cc: Andy Fleming; Yangbo Lu; U-Boot list
Subject: Re: [U-Boot] [v2] mmc: fsl_esdhc: fix mmc read/write error on
T4080

Quoted 2 lines · york sun
Quoted 1 line · Andy Fleming

On Thu, Jan 7, 2016 at 2:50 AM, Yangbo Lu <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Fill the right command type when using CMD12 to stop data

transfer.

Quoted 39 lines
Quoted 39 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

---
Changes for v2:
- Removed fix for T4160 because other patch had done
that

---
 drivers/mmc/fsl_esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/fsl_esdhc.c +0 -0
index c5054d6..16fb01a 100644
@@ -107,7 +107,7 @@ static uint esdhc_xfertyp(struct mmc_cmd
 *cmd, struct mmc_data *data)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/mmc/fsl_esdhc.c +0 -0
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
        defined(CONFIG_LS102XA) ||

defined(CONFIG_FSL_LAYERSCAPE) ||

\

Quoted 18 lines
Quoted 18 lines

drivers/mmc/fsl_esdhc.c static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)

Quoted 4 lines
drivers/mmc/fsl_esdhc.c +1 -1
-       defined(CONFIG_PPC_T4160)
+       defined(CONFIG_PPC_T4160) || defined(CONFIG_PPC_T4080)
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
                xfertyp |= XFERTYP_CMDTYP_ABORT;  #endif

These sorts of chip-specific #ifdefs are very hard to maintain. It would be far better if there were a single define, like:

#ifdef CONFIG_FSL_ESDHC_USES_ABORT_TO_STOP

And then define that on any system that needs this code. With the current version, I have no idea why this code is needed. I have guesses, but in order to be sure, I'd have to check several reference manuals. With my suggestion, it is obvious to everyone why this code is here, and it gives a hint to those who are adding support to new chips.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Now, I'm not saying you should use my suggestion precisely. Perhaps every version of the esdhc after some point uses this mechanism. Then you could use that information. And perhaps my naming doesn't reflect what is happening. My point is, you're going to have to do this again when you release LS232XB, and that

seems like a poor use of your time.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

:)

Yangbo,

I agree with Andy on this. Please make the suggested change.

Quoted 7 lines
Quoted 6 lines

... as some sort of Kconfig entry that's ideally selected rather than prmopted for when applicable. Like it would be done in the kernel :)

--
Tom

[Lu Yangbo-B47093] Hi Tom, I want to reconfirm whether your suggestion

is same with Andy and York's.

Quoted 1 line

Could I define it in include/configs/xxxx.h? Or use Kconfig?

Quoted 7 lines

I'm agreeing with what Andy/York say and noting that the right way to fix this is not to add something to include/configs/ but to use Kconfig and have the platforms select the symbol (rather than prompt for it), similar to how flags like this would work in the Linux kernel.

--
Tom

[Lu Yangbo-B47093] Thank you. But I just find I need to remove all the #ifdef rather than add one. Because the MMC_CMD_STOP_TRANSMISSION command must be set a XFERTYP_CMDTYP_ABORT command type according to SD spec.

A new version patch would be sent later.

Best regards,
Yangbo Lu