Skip to content

Commit 7757731

Browse files
oleremabelvesa
authored andcommitted
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
1 parent 8bb289b commit 7757731

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/clk/imx/clk.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ struct clk_hw *imx_obtain_fixed_clock_hw(
110110
return __clk_get_hw(clk);
111111
}
112112

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+
113127
struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name)
114128
{
115129
struct clk *clk;

drivers/clk/imx/clk.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ struct clk * imx_obtain_fixed_clock(
288288
struct clk_hw *imx_obtain_fixed_clock_hw(
289289
const char *name, unsigned long rate);
290290

291+
struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np,
292+
const char *name, unsigned long rate);
293+
291294
struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name);
292295

293296
struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,

0 commit comments

Comments
 (0)