clk: imx: clk-pll14xx: Switch to clk_hw based API
authorPeng Fan <peng.fan@nxp.com>
Thu, 12 Dec 2019 02:58:42 +0000 (02:58 +0000)
committerShawn Guo <shawnguo@kernel.org>
Mon, 23 Dec 2019 03:50:30 +0000 (11:50 +0800)
Switch the imx_clk_pll14xx function to clk_hw based API, rename
accordingly and add a macro for clk based legacy. This allows us to
move closer to a clear split between consumer and provider clk APIs.

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
drivers/clk/imx/clk-pll14xx.c
drivers/clk/imx/clk.h

index a6d31a7..968dd02 100644 (file)
@@ -376,13 +376,14 @@ static const struct clk_ops clk_pll1443x_ops = {
        .set_rate       = clk_pll1443x_set_rate,
 };
 
-struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
-                           void __iomem *base,
-                           const struct imx_pll14xx_clk *pll_clk)
+struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name,
+                                 void __iomem *base,
+                                 const struct imx_pll14xx_clk *pll_clk)
 {
        struct clk_pll14xx *pll;
-       struct clk *clk;
+       struct clk_hw *hw;
        struct clk_init_data init;
+       int ret;
        u32 val;
 
        pll = kzalloc(sizeof(*pll), GFP_KERNEL);
@@ -419,12 +420,15 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
        val &= ~BYPASS_MASK;
        writel_relaxed(val, pll->base + GNRL_CTL);
 
-       clk = clk_register(NULL, &pll->hw);
-       if (IS_ERR(clk)) {
-               pr_err("%s: failed to register pll %s %lu\n",
-                       __func__, name, PTR_ERR(clk));
+       hw = &pll->hw;
+
+       ret = clk_hw_register(NULL, hw);
+       if (ret) {
+               pr_err("%s: failed to register pll %s %d\n",
+                       __func__, name, ret);
                kfree(pll);
+               return ERR_PTR(ret);
        }
 
-       return clk;
+       return hw;
 }
index afc7947..caee661 100644 (file)
@@ -127,6 +127,13 @@ extern struct imx_pll14xx_clk imx_1443x_dram_pll;
 struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
                 void __iomem *base, const struct imx_pll14xx_clk *pll_clk);
 
+#define imx_clk_pll14xx(name, parent_name, base, pll_clk) \
+       to_clk(imx_clk_hw_pll14xx(name, parent_name, base, pll_clk))
+
+struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name,
+                                 void __iomem *base,
+                                 const struct imx_pll14xx_clk *pll_clk);
+
 struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name,
                const char *parent, void __iomem *base);