diff options
author | Fabrice Gasnier <fabrice.gasnier@st.com> | 2018-07-24 16:31:28 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-08-03 19:53:10 -0400 |
commit | 1fe243a1e42fe99da0fa45c8c727f9c3d599c6c9 (patch) | |
tree | eeaf0f029ccf5cc128a91ff889914ad6136b0f2a /drivers/clk/clk_sandbox_test.c | |
parent | 14aa210c1d4fb272ba2583b70f13505d3533015a (diff) |
clk: add clk_valid()
Add clk_valid() to check for optional clocks are valid.
Call clk_valid() in test/dm/clk.c and add relevant test routine to
sandbox clk tests.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/clk/clk_sandbox_test.c')
-rw-r--r-- | drivers/clk/clk_sandbox_test.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c index 8cd4abb84f..e8465dbfad 100644 --- a/drivers/clk/clk_sandbox_test.c +++ b/drivers/clk/clk_sandbox_test.c @@ -116,6 +116,19 @@ int sandbox_clk_test_release_bulk(struct udevice *dev) return clk_release_bulk(&sbct->bulk); } +int sandbox_clk_test_valid(struct udevice *dev) +{ + struct sandbox_clk_test *sbct = dev_get_priv(dev); + int i; + + for (i = 0; i < SANDBOX_CLK_TEST_ID_COUNT; i++) { + if (!clk_valid(&sbct->clks[i])) + return -EINVAL; + } + + return 0; +} + static const struct udevice_id sandbox_clk_test_ids[] = { { .compatible = "sandbox,clk-test" }, { } |