[U-Boot,2/3] sunxi-mmc: don't double clock for new mode unconditionally

Message ID 20181107035758.11029-3-anarsoul@gmail.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series
  • sunxi-mmc: enable new clock mode on A64
Related show

Commit Message

Vasily Khoruzhick Nov. 7, 2018, 3:57 a.m.
Comment in Linux driver says that clock needs to be doubled only
if we use DDR modes, moreover divider has to be set accordingly.

U-boot driver doesn't declare support for any DDR modes and doesn't
set divider, so it doubles clock unconditionally when new mode
is used.

Some cards can't handle that and as result SPL fails to load u-boot.

Fixes: de9b1771c3b ("mmc: sunxi: Support new mode")
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Zhaofeng Li <hello@zhaofeng.li>
---
 drivers/mmc/sunxi_mmc.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Chen-Yu Tsai Nov. 7, 2018, 4:15 a.m. | #1
On Wed, Nov 7, 2018 at 11:59 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>
> Comment in Linux driver says that clock needs to be doubled only
> if we use DDR modes, moreover divider has to be set accordingly.
>
> U-boot driver doesn't declare support for any DDR modes and doesn't
> set divider, so it doubles clock unconditionally when new mode

doesn't set the card clock divider, so the card is running at the module
clock's rate. This would be a bit clearer.

ChenYu

> is used.
>
> Some cards can't handle that and as result SPL fails to load u-boot.

Patch

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index b3526f5e3f..e50b2c3343 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -109,13 +109,6 @@  static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
 	calibrate = true;
 #endif
 
-	/*
-	 * The MMC clock has an extra /2 post-divider when operating in the new
-	 * mode.
-	 */
-	if (new_mode)
-		hz = hz * 2;
-
 	if (hz <= 24000000) {
 		pll = CCM_MMC_CTRL_OSCM24;
 		pll_hz = 24000000;