summaryrefslogtreecommitdiffstats
path: root/drivers/clk/imx/clk.h
diff options
context:
space:
mode:
authorJacky Bai <ping.bai@nxp.com>2023-03-31 08:38:11 +0200
committerAbel Vesa <abel.vesa@linaro.org>2023-04-09 16:12:49 +0200
commit335aee51ffc72149ddf99755ba629f981f20e6b6 (patch)
tree7333dac2839cff06b9a1275bf6b2d06954bdf7d2 /drivers/clk/imx/clk.h
parentclk: imx: imx8ulp: Fix XBAR_DIVBUS and AD_SLOW clock parents (diff)
downloadlinux-335aee51ffc72149ddf99755ba629f981f20e6b6.tar.xz
linux-335aee51ffc72149ddf99755ba629f981f20e6b6.zip
clk: imx: imx8ulp: Add divider closest support to get more accurate clock rate
If a divider's parent clock has fractional part, it will hard to round out a more accurate clock rate for this divider, add the 'CLK_DIVIDER_ROUND_CLOSEST' flags for such divider to get a more accurate clock rate. Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Jacky Bai <ping.bai@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Link: https://lore.kernel.org/r/20230331063814.2462059-3-peng.fan@oss.nxp.com Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Diffstat (limited to 'drivers/clk/imx/clk.h')
-rw-r--r--drivers/clk/imx/clk.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index c8db0c8d4c5d..1031468701d7 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -353,6 +353,15 @@ static inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name,
CLK_SET_RATE_PARENT, mult, div);
}
+static inline struct clk_hw *imx_clk_hw_divider_closest(const char *name,
+ const char *parent,
+ void __iomem *reg, u8 shift,
+ u8 width)
+{
+ return clk_hw_register_divider(NULL, name, parent, 0,
+ reg, shift, width, CLK_DIVIDER_ROUND_CLOSEST, &imx_ccm_lock);
+}
+
static inline struct clk_hw *__imx_clk_hw_divider(const char *name,
const char *parent,
void __iomem *reg, u8 shift,