Skip to contentSkip to conversation

mmc: avoid division by zero in meson_mmc_config_clock

PATCH New Heinrich Schuchardt 4 participants 7 messages Mar 17, 2018 – Apr 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

---
Resent due to missing cc u-boot at lists.denx.de.

---
 drivers/mmc/meson_gx_mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/meson_gx_mmc.c +3 -0
index a2cd5d3a44..454593eec4 100644
@@ -35,6 +35,9 @@ static void meson_mmc_config_clock(struct mmc *mmc)
 	uint32_t meson_mmc_clk = 0;
 	unsigned int clk, clk_src, clk_div;
 
+	if (!mmc->clock)
+		return;
+
 	/* 1GHz / CLK_MAX_DIV = 15,9 MHz */
 	if (mmc->clock > 16000000) {
 		clk = SD_EMMC_CLKSRC_DIV2;
Signature · 1 line
2.14.2
#1 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock

Quoted 5 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Thanks!

Works for me with odroid-c2 on u-boot 2018.03.

Without the patch, mmc access immediately hangs the board.

live well,
vagrant

Quoted 25 lines

---
Resent due to missing cc u-boot at lists.denx.de.

---
 drivers/mmc/meson_gx_mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/meson_gx_mmc.c +3 -0
index a2cd5d3a44..454593eec4 100644
@@ -35,6 +35,9 @@ static void meson_mmc_config_clock(struct mmc *mmc)
 	uint32_t meson_mmc_clk = 0;
 	unsigned int clk, clk_src, clk_div;
 
+	if (!mmc->clock)
+		return;
+
 	/* 1GHz / CLK_MAX_DIV = 15,9 MHz */
 	if (mmc->clock > 16000000) {
 		clk = SD_EMMC_CLKSRC_DIV2;
Signature · 1 line
2.14.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180317/7e04eb22/attachment.sig>

#2 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock

Quoted 36 lines · Vagrant Cascadian
Quoted 5 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Thanks!

Works for me with odroid-c2 on u-boot 2018.03.

Without the patch, mmc access immediately hangs the board.

live well,
vagrant

Quoted 17 lines

---
Resent due to missing cc u-boot at lists.denx.de.

---
 drivers/mmc/meson_gx_mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/meson_gx_mmc.c +0 -0
index a2cd5d3a44..454593eec4 100644
@@ -35,6 +35,9 @@ static void meson_mmc_config_clock(struct mmc *mmc)
 	uint32_t meson_mmc_clk = 0;
 	unsigned int clk, clk_src, clk_div;
 
Quoted 8 lines
Quoted 8 lines
drivers/mmc/meson_gx_mmc.c +3 -0
+	if (!mmc->clock)
+		return;
+
 	/* 1GHz / CLK_MAX_DIV = 15,9 MHz */
 	if (mmc->clock > 16000000) {
 		clk = SD_EMMC_CLKSRC_DIV2;
Signature · 1 line
2.14.2

Hello Jaehoon,

will you pick the patch?

Best regards

Heinrich

#3 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock - Please, consider for v2018.05-rc2

Quoted 48 lines · Heinrich Schuchardt
Quoted 36 lines · Vagrant Cascadian
Quoted 5 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Thanks!

Works for me with odroid-c2 on u-boot 2018.03.

Without the patch, mmc access immediately hangs the board.

live well,
vagrant

Quoted 17 lines

---
Resent due to missing cc u-boot at lists.denx.de.

---
 drivers/mmc/meson_gx_mmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/meson_gx_mmc.c +0 -0
index a2cd5d3a44..454593eec4 100644
@@ -35,6 +35,9 @@ static void meson_mmc_config_clock(struct mmc *mmc)
 	uint32_t meson_mmc_clk = 0;
 	unsigned int clk, clk_src, clk_div;
 
Quoted 8 lines
Quoted 8 lines
drivers/mmc/meson_gx_mmc.c +3 -0
+	if (!mmc->clock)
+		return;
+
 	/* 1GHz / CLK_MAX_DIV = 15,9 MHz */
 	if (mmc->clock > 16000000) {
 		clk = SD_EMMC_CLKSRC_DIV2;
Signature · 1 line
2.14.2

Hello Jaehoon,

Quoted 6 lines

will you pick the patch?

Best regards

Heinrich

Hello Jaehoon,

since v2018.03 the Odroid C2 cannot be booted with U-Boot. This patch fixes it and has been adopted by Debian:
https://packages.debian.org/de/buster/u-boot

Could you, please, consider it for v2018.05-rc2.

Best regards

Heinrich

#4 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock - Please, consider for v2018.05-rc2

Hi Jaehoon,

Quoted 25 lines · Heinrich Schuchardt
Quoted 24 lines · Heinrich Schuchardt
Quoted 23 lines · Vagrant Cascadian
Quoted 5 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Thanks!

Works for me with odroid-c2 on u-boot 2018.03.

Without the patch, mmc access immediately hangs the board.

live well,
vagrant

Quoted 4 lines

---

[...]

Quoted 18 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.14.2

Hello Jaehoon,

will you pick the patch?

Best regards

Heinrich

Hello Jaehoon,

since v2018.03 the Odroid C2 cannot be booted with U-Boot. This patch fixes it and has been adopted by Debian:
https://packages.debian.org/de/buster/u-boot

Quoted 6 lines

Could you, please, consider it for v2018.05-rc2.

Best regards

Heinrich

It also affects the other Amlogic platforms : P212, LibreTech-CC and Khadas-Vim, thus 2018.03 is broken for these platforms.

Thanks,
Neil

#5 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock - Please, consider for v2018.05-rc2

Hi All,

Sorry to top-post, but could this patch go into master for next release ?

Currently all the Amlogic boards are broken on master becaus eof this issue.

Thanks,
Neil

-------- Forwarded Message --------
Subject: Re: [U-Boot] [PATCH 1/1] mmc: avoid division by zero in meson_mmc_config_clock - Please, consider for v2018.05-rc2
Date: Wed, 11 Apr 2018 16:39:08 +0200
From: Neil Armstrong <[email protected]>
Organization: Baylibre
To: Heinrich Schuchardt <[email protected]>, Jaehoon Chung <[email protected]>
CC: Vagrant Cascadian <[email protected]>, u-boot at lists.denx.de, Tom Rini <[email protected]>, open list:ARM/Amlogic Meson... <[email protected]>

Hi Jaehoon,

Quoted 25 lines · Heinrich Schuchardt
Quoted 24 lines · Heinrich Schuchardt
Quoted 23 lines · Vagrant Cascadian
Quoted 5 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Thanks!

Works for me with odroid-c2 on u-boot 2018.03.

Without the patch, mmc access immediately hangs the board.

live well,
vagrant

Quoted 4 lines

---

[...]

Quoted 18 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.14.2

Hello Jaehoon,

will you pick the patch?

Best regards

Heinrich

Hello Jaehoon,

since v2018.03 the Odroid C2 cannot be booted with U-Boot. This patch fixes it and has been adopted by Debian:
https://packages.debian.org/de/buster/u-boot

Quoted 6 lines

Could you, please, consider it for v2018.05-rc2.

Best regards

Heinrich

It also affects the other Amlogic platforms : P212, LibreTech-CC and Khadas-Vim, thus 2018.03 is broken for these platforms.

Thanks,
Neil

Signature · 4 lines
Neil Armstrong
Embedded Linux Software Engineer
BayLibre - At the Heart of Embedded Linux
www.baylibre.com
#6 lore raw

PATCH 1/1 mmc: avoid division by zero in meson_mmc_config_clock

In reply to Heinrich Schuchardt
Quoted 10 lines · Heinrich Schuchardt

The Odroid C2 fails to read from mmc with U-Boot v2018.03. The change avoids a division by zero.

The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180423/a421ea3c/attachment.sig>