sunxi-mmc: use new mode on both controllers on A64
authorVasily Khoruzhick <anarsoul@gmail.com>
Sat, 10 Nov 2018 04:41:46 +0000 (20:41 -0800)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 22 Nov 2018 07:50:16 +0000 (13:20 +0530)
Using new mode improves stability of eMMC and SD cards. Without
it SPL fails to load u-boot from SD on Pinebook.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # Amarula A64-Relic
Reviewed-by: Jagan Teki <jagan@openedev.com>
arch/arm/mach-sunxi/Kconfig
drivers/mmc/sunxi_mmc.c

index 66fff6c6d3c177ea5de3851407438b3b5ae81788..3c54f5106ddb49ea5dda0f5418a9cc00348e5fe5 100644 (file)
@@ -282,6 +282,7 @@ config MACH_SUN50I
        select SUN6I_PRCM
        select SUNXI_DE2
        select SUNXI_GEN_SUN6I
+       select MMC_SUNXI_HAS_NEW_MODE
        select SUPPORT_SPL
        select SUNXI_DRAM_DW
        select SUNXI_DRAM_DW_32BIT
index e50b2c3343195847b2d800228cc6d808c97c801b..9bf040cb40871fdc3e730549dd5396f9c192d8e0 100644 (file)
@@ -98,12 +98,16 @@ static int mmc_resource_init(int sdc_no)
 static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
 {
        unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly;
-       bool new_mode = false;
+       bool new_mode = true;
        bool calibrate = false;
        u32 val = 0;
 
-       if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
-               new_mode = true;
+       if (!IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE))
+               new_mode = false;
+
+       /* A83T support new mode only on eMMC */
+       if (IS_ENABLED(CONFIG_MACH_SUN8I_A83T) && priv->mmc_no != 2)
+               new_mode = false;
 
 #if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6)
        calibrate = true;