]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: test: clk: add the test for the ccf gated clock
authorDario Binacchi <dariobin@libero.it>
Mon, 13 Apr 2020 12:36:26 +0000 (14:36 +0200)
committerLukasz Majewski <lukma@denx.de>
Mon, 24 Aug 2020 09:03:26 +0000 (11:03 +0200)
Unlike the other clock types, in the case of the gated clock, a new
driver has been developed which does not use the registering routine
provided by the common clock framework.
The addition of the ecspi0 clock to sandbox therefore allows testing
the ccf gate clock.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/clk/clk_sandbox_ccf.c
include/sandbox-clk.h
test/dm/clk_ccf.c

index 0619d04f0ece2dd666e8afa71c38f83041e573aa..e90b860257f64df5d2f30d37b1d70dc69426b063 100644 (file)
@@ -250,6 +250,10 @@ static int sandbox_clk_ccf_probe(struct udevice *dev)
        clk_dm(SANDBOX_CLK_ECSPI_ROOT,
               sandbox_clk_divider("ecspi_root", "pll3_60m", &reg, 19, 6));
 
+       reg = 0;
+       clk_dm(SANDBOX_CLK_ECSPI0,
+              sandbox_clk_gate("ecspi0", "ecspi_root", &reg, 0, 0));
+
        clk_dm(SANDBOX_CLK_ECSPI1,
               sandbox_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0));
 
index 296cddfbb0ef7575a386e185c61e7af87df496a4..c2616c27a44ac9da73a5e071b22cc2a17d85dadc 100644 (file)
@@ -50,6 +50,14 @@ static inline struct clk *sandbox_clk_divider(const char *name,
                        reg, shift, width, 0);
 }
 
+static inline struct clk *sandbox_clk_gate(const char *name, const char *parent,
+                                          void __iomem *reg, u8 bit_idx,
+                                          u8 clk_gate_flags)
+{
+       return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT,
+                                reg, bit_idx, clk_gate_flags, NULL);
+}
+
 struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name,
                                       const char *parent_name,
                                       unsigned long flags,
index 050fa804533d0cead45119e2dbb2954adc60ebe3..960cb2db0d49f34ec871a2aacdbaa541b92f67e6 100644 (file)
@@ -39,6 +39,14 @@ static int dm_test_clk_ccf(struct unit_test_state *uts)
        rate = clk_get_parent_rate(clk);
        ut_asserteq(rate, 20000000);
 
+       /* test the gate of CCF */
+       ret = clk_get_by_id(SANDBOX_CLK_ECSPI0, &clk);
+       ut_assertok(ret);
+       ut_asserteq_str("ecspi0", clk->dev->name);
+
+       rate = clk_get_parent_rate(clk);
+       ut_asserteq(rate, 20000000);
+
        /* Test the mux of CCF */
        ret = clk_get_by_id(SANDBOX_CLK_USDHC1_SEL, &clk);
        ut_assertok(ret);