summaryrefslogtreecommitdiff
path: root/drivers/clk/clk_sandbox_ccf.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2019-08-21 13:35:19 +0000
committerLukasz Majewski <lukma@denx.de>2019-08-22 00:10:09 +0200
commitc66f4f5e3018e7df5249ae7e100ad85d9d2cb33f (patch)
tree7b7471bea3ac18089f6929be697fc6ea76ae270d /drivers/clk/clk_sandbox_ccf.c
parentaeeb2e6d9c67273da5d91f7567657447878eb493 (diff)
sandbox: clk: add clk enable/disable test code
Since we added clk enable_count and prograte clk child enabling operation to clk parent, so add a new function sandbox_clk_enable_count to get enable_count for test usage. And add test code to get the enable_count after we enable/disable the device clk. Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/clk/clk_sandbox_ccf.c')
-rw-r--r--drivers/clk/clk_sandbox_ccf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/clk_sandbox_ccf.c
index e126f18d8e..9fa27229e1 100644
--- a/drivers/clk/clk_sandbox_ccf.c
+++ b/drivers/clk/clk_sandbox_ccf.c
@@ -25,6 +25,18 @@ struct clk_pllv3 {
u32 div_shift;
};
+int sandbox_clk_enable_count(struct clk *clk)
+{
+ struct clk *clkp = NULL;
+ int ret;
+
+ ret = clk_get_by_id(clk->id, &clkp);
+ if (ret)
+ return 0;
+
+ return clkp->enable_count;
+}
+
static ulong clk_pllv3_get_rate(struct clk *clk)
{
unsigned long parent_rate = clk_get_parent_rate(clk);
@@ -254,6 +266,9 @@ static int sandbox_clk_ccf_probe(struct udevice *dev)
sandbox_clk_composite("i2c", i2c_sels, ARRAY_SIZE(i2c_sels),
&reg, 0));
+ clk_dm(SANDBOX_CLK_I2C_ROOT,
+ sandbox_clk_gate2("i2c_root", "i2c", base + 0x7c, 0));
+
return 0;
}