diff options
author | Peng Fan <peng.fan@nxp.com> | 2019-08-21 13:35:19 +0000 |
---|---|---|
committer | Lukasz Majewski <lukma@denx.de> | 2019-08-22 00:10:09 +0200 |
commit | c66f4f5e3018e7df5249ae7e100ad85d9d2cb33f (patch) | |
tree | 7b7471bea3ac18089f6929be697fc6ea76ae270d /test | |
parent | aeeb2e6d9c67273da5d91f7567657447878eb493 (diff) | |
download | u-boot-c66f4f5e3018e7df5249ae7e100ad85d9d2cb33f.tar.gz |
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 'test')
-rw-r--r-- | test/dm/clk_ccf.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index bbc4b500e8..ae3a4d8a76 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -64,6 +64,34 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) rate = clk_get_rate(clk); ut_asserteq(rate, 60000000); +#if CONFIG_IS_ENABLED(CLK_CCF) + /* Test clk tree enable/disable */ + ret = clk_get_by_id(SANDBOX_CLK_I2C_ROOT, &clk); + ut_assertok(ret); + ut_asserteq_str("i2c_root", clk->dev->name); + + ret = clk_enable(clk); + ut_assertok(ret); + + ret = sandbox_clk_enable_count(clk); + ut_asserteq(ret, 1); + + ret = clk_get_by_id(SANDBOX_CLK_I2C, &pclk); + ut_assertok(ret); + + ret = sandbox_clk_enable_count(pclk); + ut_asserteq(ret, 1); + + ret = clk_disable(clk); + ut_assertok(ret); + + ret = sandbox_clk_enable_count(clk); + ut_asserteq(ret, 0); + + ret = sandbox_clk_enable_count(pclk); + ut_asserteq(ret, 0); +#endif + return 1; } |