]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: gate: support sandbox
authorPeng Fan <peng.fan@nxp.com>
Wed, 31 Jul 2019 07:01:57 +0000 (07:01 +0000)
committerLukasz Majewski <lukma@denx.de>
Wed, 31 Jul 2019 07:20:51 +0000 (09:20 +0200)
Introduce io_gate_val for sandbox clk gate test usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/clk/clk-gate.c
include/linux/clk-provider.h

index a3a1fdd3b2fe67157a20f6f9df03210029f6eab6..70b879455452c3ec447794bd1fb3cecf897b5d02 100644 (file)
@@ -55,7 +55,11 @@ static void clk_gate_endisable(struct clk *clk, int enable)
                if (set)
                        reg |= BIT(gate->bit_idx);
        } else {
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+               reg = gate->io_gate_val;
+#else
                reg = readl(gate->reg);
+#endif
 
                if (set)
                        reg |= BIT(gate->bit_idx);
@@ -86,7 +90,11 @@ int clk_gate_is_enabled(struct clk *clk)
                        dev_get_clk_ptr(clk->dev) : clk);
        u32 reg;
 
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+       reg = gate->io_gate_val;
+#else
        reg = readl(gate->reg);
+#endif
 
        /* if a set bit disables this clk, flip it before masking */
        if (gate->flags & CLK_GATE_SET_TO_DISABLE)
@@ -128,6 +136,9 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
        gate->reg = reg;
        gate->bit_idx = bit_idx;
        gate->flags = clk_gate_flags;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+       gate->io_gate_val = *(u32 *)reg;
+#endif
 
        clk = &gate->clk;
 
index b9547736ee20414edd716391690c763de2a6d4fd..02ff1a311aca58a0988ecb1af449ed5e5b12261b 100644 (file)
@@ -75,6 +75,9 @@ struct clk_gate {
        void __iomem    *reg;
        u8              bit_idx;
        u8              flags;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+       u32             io_gate_val;
+#endif
 };
 
 #define to_clk_gate(_clk) container_of(_clk, struct clk_gate, clk)