diff options
author | Neil Armstrong <narmstrong@baylibre.com> | 2018-04-03 11:44:19 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-04-10 15:18:56 -0400 |
commit | 65388d0dc5a36fc86718ffcdf08ac5671ae27b5d (patch) | |
tree | 750fd5330e3e2b18b9b21054953de28053130da8 /test/dm | |
parent | a855be87da49ba750e83ecc526235fe33099f76e (diff) |
clk: add sandbox test for bulk API
This patch adds the bulk clock API tests for the sandbox test suite.
It's very similar to the main test but only uses the _bulk() API and
checks if the clocks are correctly enabled/disabled.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-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); |