]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: meson: reset mmc clock on probe
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 5 Mar 2020 11:12:37 +0000 (12:12 +0100)
committerNeil Armstrong <narmstrong@baylibre.com>
Mon, 6 Apr 2020 07:56:35 +0000 (09:56 +0200)
On some SoCs, depending on the boot device, the MMC clock block may be
left in a weird state by the ROM code, in which no decent clock may be
provided. Reset the related register to make sure a sane MMC clock is
ready for the controller.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
drivers/clk/meson/axg.c
drivers/clk/meson/g12a.c
drivers/clk/meson/gxbb.c

index 7035b59a13794a51e64c9739fa860dbec84d72df..4b0028d04bf6c30692e926e6f7e9b08d098e0350 100644 (file)
@@ -291,6 +291,13 @@ static int meson_clk_probe(struct udevice *dev)
        if (IS_ERR(priv->map))
                return PTR_ERR(priv->map);
 
+       /*
+        * Depending on the boot src, the state of the MMC clock might
+        * be different. Reset it to make sure we won't get stuck
+        */
+       regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
+       regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
+
        debug("meson-clk-axg: probed\n");
 
        return 0;
index cada80e6b5fc0786b8ff3a3f2224c844a99f2651..c1976aa1efb15644f7611fa709c462e4b8c4b0ca 100644 (file)
@@ -978,6 +978,13 @@ static int meson_clk_probe(struct udevice *dev)
        if (IS_ERR(priv->map))
                return PTR_ERR(priv->map);
 
+       /*
+        * Depending on the boot src, the state of the MMC clock might
+        * be different. Reset it to make sure we won't get stuck
+        */
+       regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
+       regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
+
        debug("meson-clk-g12a: probed\n");
 
        return 0;
index e781e08d9d5d92d4ec3760fbfb1bf574dd102350..5ef4dd794d5210684d2ab89b5dfb7696783d6be2 100644 (file)
@@ -887,6 +887,13 @@ static int meson_clk_probe(struct udevice *dev)
        if (IS_ERR(priv->map))
                return PTR_ERR(priv->map);
 
+       /*
+        * Depending on the boot src, the state of the MMC clock might
+        * be different. Reset it to make sure we won't get stuck
+        */
+       regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
+       regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
+
        debug("meson-clk: probed\n");
 
        return 0;