]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: ccf: mux: fix access to the sandbox register
authorDario Binacchi <dariobin@libero.it>
Sat, 2 May 2020 15:58:33 +0000 (17:58 +0200)
committerLukasz Majewski <lukma@denx.de>
Mon, 24 Aug 2020 09:03:26 +0000 (11:03 +0200)
The tests developed for the mux clock are run on the sandbox. They don't
call the clk_mux_set_parent routine and therefore they do not detect
this error.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
drivers/clk/clk-mux.c

index 978f3a8a14f8bccfa85cc0186ab9bb9e8ba909f8..e10baaf83b4704e4a52004293c3847701ee819be 100644 (file)
@@ -131,12 +131,20 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent)
        if (mux->flags & CLK_MUX_HIWORD_MASK) {
                reg = mux->mask << (mux->shift + 16);
        } else {
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+               reg = mux->io_mux_val;
+#else
                reg = readl(mux->reg);
+#endif
                reg &= ~(mux->mask << mux->shift);
        }
        val = val << mux->shift;
        reg |= val;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+       mux->io_mux_val = reg;
+#else
        writel(reg, mux->reg);
+#endif
 
        return 0;
 }