Skip to contentSkip to conversation

[U-Boot] [PATCH v1 0/2]

PATCH New Jean-Jacques Hiblot 5 participants 11 messages Feb 9, 2018 – Feb 19, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

cover [U-Boot] [PATCH v1 0/2]

This series is about fixing 2 issues:
- SD breakage with QEmu / vexpress-a15
- incorrect version identification for MMC above version 4.41 (included)

Thanks to Jonathan Gray and eil Eilmsteiner Heribert for reporting them.

Jean-Jacques Hiblot (2):
mmc: Fix bug in sd_set_card_speed()
mmc: fix bug in mmc_startup_v4()

 drivers/mmc/mmc.c | 3 ++-
 include/mmc.h     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 mmc: Fix bug in sd_set_card_speed()

After settings the speed of the sd with the switch command, a check is done to make sure that the new speed has been set. The current check has a masking error: speed are encoded on 4 bits only.
Fix it by masking the upper bits.

This fixes a problem seen with QEmu emulating a vexpress-a15.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 255310a..31614dd 100644
@@ -1333,7 +1333,7 @@ static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode)
 	if (err)
 		return err;
 
-	if ((__be32_to_cpu(switch_status[4]) >> 24) != speed)
+	if (((__be32_to_cpu(switch_status[4]) >> 24) & 0xF) != speed)
 		return -ENOTSUPP;
 
 	return 0;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/2 mmc: Fix bug in sd_set_card_speed()

Quoted 9 lines · Jean-Jacques Hiblot

After settings the speed of the sd with the switch command, a check is done to make sure that the new speed has been set. The current check has a masking error: speed are encoded on 4 bits only.
Fix it by masking the upper bits.

This fixes a problem seen with QEmu emulating a vexpress-a15.

With this change the emulated mmc controller can be accessed again here.

Quoted 22 lines

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 255310a..31614dd 100644
@@ -1333,7 +1333,7 @@ static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode)
 	if (err)
 		return err;
 
-	if ((__be32_to_cpu(switch_status[4]) >> 24) != speed)
+	if (((__be32_to_cpu(switch_status[4]) >> 24) & 0xF) != speed)
 		return -ENOTSUPP;
 
 	return 0;
Signature · 1 line
1.9.1
#3 lore raw

PATCH 1/2 mmc: Fix bug in sd_set_card_speed()

Quoted 6 lines · Jonathan Gray
Quoted 5 lines · Jean-Jacques Hiblot

After settings the speed of the sd with the switch command, a check is done to make sure that the new speed has been set. The current check has a masking error: speed are encoded on 4 bits only.
Fix it by masking the upper bits.

Quoted 8 lines
Quoted 4 lines

This fixes a problem seen with QEmu emulating a vexpress-a15.

With this change the emulated mmc controller can be accessed again here.

Thanks for testing. I will pick this. When i apply to u-boot-mmc, i will notice.

Best Regards,
Jaehoon Chung

Quoted 26 lines
Quoted 23 lines

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 255310a..31614dd 100644
@@ -1333,7 +1333,7 @@ static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode)
 	if (err)
 		return err;
 
-	if ((__be32_to_cpu(switch_status[4]) >> 24) != speed)
+	if (((__be32_to_cpu(switch_status[4]) >> 24) & 0xF) != speed)
 		return -ENOTSUPP;
 
 	return 0;
Signature · 1 line
1.9.1
#4 lore raw

PATCH 1/2 mmc: Fix bug in sd_set_card_speed()

In reply to Jean-Jacques Hiblot
Quoted 9 lines · Jean-Jacques Hiblot

After settings the speed of the sd with the switch command, a check is done to make sure that the new speed has been set. The current check has a masking error: speed are encoded on 4 bits only.
Fix it by masking the upper bits.

This fixes a problem seen with QEmu emulating a vexpress-a15.

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 20 lines

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 255310a..31614dd 100644
@@ -1333,7 +1333,7 @@ static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode)
 	if (err)
 		return err;
 
-	if ((__be32_to_cpu(switch_status[4]) >> 24) != speed)
+	if (((__be32_to_cpu(switch_status[4]) >> 24) & 0xF) != speed)
 		return -ENOTSUPP;
 
 	return 0;
#5 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

In reply to Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
 		MMC_VERSION_4_1,
 		MMC_VERSION_4_2,
 		MMC_VERSION_4_3,
+		MMC_VERSION_4_4,
 		MMC_VERSION_4_41,
 		MMC_VERSION_4_5,
 		MMC_VERSION_5_0,
include/mmc.h +1 -0
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1		MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2		MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3		MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4		MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41	MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5		MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0		MAKE_MMC_VERSION(5, 0, 0)
Signature · 1 line
1.9.1
#6 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

Quoted 1 line · Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version

U-Boot

Quoted 6 lines

numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

Quoted 9 lines

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
Quoted 27 lines
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
                MMC_VERSION_4_1,
                MMC_VERSION_4_2,
                MMC_VERSION_4_3,
+               MMC_VERSION_4_4,
                MMC_VERSION_4_41,
                MMC_VERSION_4_5,
                MMC_VERSION_5_0,
include/mmc.h +1 -1
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1                MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2                MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3                MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4                MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41       MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5                MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0                MAKE_MMC_VERSION(5, 0, 0)
--

1.9.1

#7 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

In reply to Jean-Jacques Hiblot
Quoted 43 lines · Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
                MMC_VERSION_4_1,
                MMC_VERSION_4_2,
                MMC_VERSION_4_3,
+               MMC_VERSION_4_4,
                MMC_VERSION_4_41,
                MMC_VERSION_4_5,
                MMC_VERSION_5_0,
include/mmc.h +1 -1
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1                MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2                MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3                MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4                MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41       MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5                MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0                MAKE_MMC_VERSION(5, 0, 0)
--

1.9.1

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

This patch fixes eMMC on AM57x EVM / X15 boards, which was broken in 58a6fb7b0496 ("mmc: reworked version lookup in mmc_startup_v4") commit.

Thanks.

#8 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

Hi Tom,

Can we merge this fix, please? We are having troubles with X15 board in Linaro lab due to this bug... Would be great to have this patch in v2018.03. I know, relying on master branch is not good, but it is what it is, I'll talk with guys if we can change the policy.

Thanks!

Quoted 56 lines · Sam Protsenko
Quoted 43 lines · Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
                MMC_VERSION_4_1,
                MMC_VERSION_4_2,
                MMC_VERSION_4_3,
+               MMC_VERSION_4_4,
                MMC_VERSION_4_41,
                MMC_VERSION_4_5,
                MMC_VERSION_5_0,
include/mmc.h +1 -1
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1                MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2                MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3                MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4                MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41       MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5                MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0                MAKE_MMC_VERSION(5, 0, 0)
--

1.9.1

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

This patch fixes eMMC on AM57x EVM / X15 boards, which was broken in 58a6fb7b0496 ("mmc: reworked version lookup in mmc_startup_v4") commit.

Thanks.

#9 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

Quoted 6 lines · Sam Protsenko

Hi Tom,

Can we merge this fix, please? We are having troubles with X15 board in Linaro lab due to this bug... Would be great to have this patch in v2018.03. I know, relying on master branch is not good, but it is what it is, I'll talk with guys if we can change the policy.

i will send the PR with this patch on today.

Quoted 63 lines

Thanks!

Quoted 56 lines · Sam Protsenko
Quoted 43 lines · Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
                MMC_VERSION_4_1,
                MMC_VERSION_4_2,
                MMC_VERSION_4_3,
+               MMC_VERSION_4_4,
                MMC_VERSION_4_41,
                MMC_VERSION_4_5,
                MMC_VERSION_5_0,
include/mmc.h +1 -1
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1                MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2                MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3                MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4                MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41       MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5                MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0                MAKE_MMC_VERSION(5, 0, 0)
--

1.9.1

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

This patch fixes eMMC on AM57x EVM / X15 boards, which was broken in 58a6fb7b0496 ("mmc: reworked version lookup in mmc_startup_v4") commit.

Thanks.

#10 lore raw

PATCH 2/2 mmc: fix bug in mmc_startup_v4()

In reply to Jean-Jacques Hiblot
Quoted 9 lines · Jean-Jacques Hiblot

The correspondence between mmc versions as used in u-boot and the version numbers reported in register EXT_CSD_REV is wrong for versions above and including MMC_VERSION_4_41. All those versions were shifted by one:
real 4.5 hardware appeared to be MMC_VERSION_5_0.

Fix this by adding the missing version in the correspondence table.

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 32 lines

---

 drivers/mmc/mmc.c | 1 +
 include/mmc.h     | 1 +
 2 files changed, 2 insertions(+)
drivers/mmc/mmc.c +1 -0
index 31614dd..99e2a75 100644
@@ -1950,6 +1950,7 @@ static int mmc_startup_v4(struct mmc *mmc)
 		MMC_VERSION_4_1,
 		MMC_VERSION_4_2,
 		MMC_VERSION_4_3,
+		MMC_VERSION_4_4,
 		MMC_VERSION_4_41,
 		MMC_VERSION_4_5,
 		MMC_VERSION_5_0,
include/mmc.h +1 -0
index a46eaed..86f885b 100644
@@ -54,6 +54,7 @@
 #define MMC_VERSION_4_1		MAKE_MMC_VERSION(4, 1, 0)
 #define MMC_VERSION_4_2		MAKE_MMC_VERSION(4, 2, 0)
 #define MMC_VERSION_4_3		MAKE_MMC_VERSION(4, 3, 0)
+#define MMC_VERSION_4_4		MAKE_MMC_VERSION(4, 4, 0)
 #define MMC_VERSION_4_41	MAKE_MMC_VERSION(4, 4, 1)
 #define MMC_VERSION_4_5		MAKE_MMC_VERSION(4, 5, 0)
 #define MMC_VERSION_5_0		MAKE_MMC_VERSION(5, 0, 0)