diff options
Diffstat (limited to 'test/dm/clk.c')
-rw-r--r-- | test/dm/clk.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/dm/clk.c b/test/dm/clk.c index 712a1e674a..d3649103ee 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -101,3 +101,40 @@ static int dm_test_clk(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_clk, DM_TESTF_SCAN_FDT); + +static int dm_test_clk_bulk(struct unit_test_state *uts) +{ + struct udevice *dev_clk, *dev_test; + + ut_assertok(uclass_get_device_by_name(UCLASS_CLK, "clk-sbox", + &dev_clk)); + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test", + &dev_test)); + ut_assertok(sandbox_clk_test_get_bulk(dev_test)); + + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_I2C)); + + /* Fixed clock does not support enable, thus should not fail */ + ut_assertok(sandbox_clk_test_enable_bulk(dev_test)); + ut_asserteq(1, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); + ut_asserteq(1, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_I2C)); + + /* Fixed clock does not support disable, thus should not fail */ + ut_assertok(sandbox_clk_test_disable_bulk(dev_test)); + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_I2C)); + + /* Fixed clock does not support enable, thus should not fail */ + ut_assertok(sandbox_clk_test_enable_bulk(dev_test)); + ut_asserteq(1, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); + ut_asserteq(1, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_I2C)); + + /* Fixed clock does not support disable, thus should not fail */ + ut_assertok(sandbox_clk_test_release_bulk(dev_test)); + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_SPI)); + ut_asserteq(0, sandbox_clk_query_enable(dev_clk, SANDBOX_CLK_ID_I2C)); + + return 0; +} +DM_TEST(dm_test_clk_bulk, DM_TESTF_SCAN_FDT); |