Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: imx: add imx_obtain_fixed_of_clock()

Add imx_obtain_fixed_of_clock() to optionally add clock not configured in
the devicetree.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230131084642.709385-15-o.rempel@pengutronix.de

authored by

Oleksij Rempel and committed by
Abel Vesa
77577310 8bb289bb

+17
+14
drivers/clk/imx/clk.c
··· 110 110 return __clk_get_hw(clk); 111 111 } 112 112 113 + struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, 114 + const char *name, unsigned long rate) 115 + { 116 + struct clk *clk = of_clk_get_by_name(np, name); 117 + struct clk_hw *hw; 118 + 119 + if (IS_ERR(clk)) 120 + hw = imx_obtain_fixed_clock_hw(name, rate); 121 + else 122 + hw = __clk_get_hw(clk); 123 + 124 + return hw; 125 + } 126 + 113 127 struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) 114 128 { 115 129 struct clk *clk;
+3
drivers/clk/imx/clk.h
··· 288 288 struct clk_hw *imx_obtain_fixed_clock_hw( 289 289 const char *name, unsigned long rate); 290 290 291 + struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, 292 + const char *name, unsigned long rate); 293 + 291 294 struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name); 292 295 293 296 struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,