[PATCH v2 04/16] clk: k210: Remove k210_register_pll

Sean Anderson seanga2 at gmail.com
Mon Oct 12 20:13:33 CEST 2020


This simplifies the PLL creation process, since we don't have to pass all
the parameters individually.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

Changes in v2:
- New

 drivers/clk/kendryte/clk.c | 20 ++++++--------------
 drivers/clk/kendryte/pll.c | 21 ---------------------
 include/kendryte/pll.h     |  4 ----
 3 files changed, 6 insertions(+), 39 deletions(-)

diff --git a/drivers/clk/kendryte/clk.c b/drivers/clk/kendryte/clk.c
index e657efc572..88a997e80b 100644
--- a/drivers/clk/kendryte/clk.c
+++ b/drivers/clk/kendryte/clk.c
@@ -511,23 +511,15 @@ static int k210_clk_probe(struct udevice *dev)
 	aclk_sels[0] = in0;
 	pll2_sels[0] = in0;
 
-	{
-		const struct k210_pll_params *params = &k210_plls[0];
-
+	pll = k210_create_pll(&k210_plls[0], base);
+	if (pll)
 		clk_dm(K210_CLK_PLL0,
-		       k210_register_pll("pll0", in0, base + params->off,
-					 base + params->lock_off, params->shift,
-					 params->width));
-	}
-
-	{
-		const struct k210_pll_params *params = &k210_plls[1];
+		       k210_register_pll_struct("pll0", in0, pll));
 
+	pll = k210_create_pll(&k210_plls[1], base);
+	if (pll)
 		clk_dm(K210_CLK_PLL1,
-		       k210_register_pll("pll1", in0, base + params->off,
-					 base + params->lock_off, params->shift,
-					 params->width));
-	}
+		       k210_register_pll_struct("pll1", in0, pll));
 
 	/* PLL2 is muxed, so set up a composite clock */
 	mux = k210_create_mux(&k210_muxes[MUXIFY(K210_CLK_PLL2)], base);
diff --git a/drivers/clk/kendryte/pll.c b/drivers/clk/kendryte/pll.c
index d46fd0ebbf..184f37aaf2 100644
--- a/drivers/clk/kendryte/pll.c
+++ b/drivers/clk/kendryte/pll.c
@@ -578,27 +578,6 @@ struct clk *k210_register_pll_struct(const char *name, const char *parent_name,
 	return clk;
 }
 
-struct clk *k210_register_pll(const char *name, const char *parent_name,
-			      void __iomem *reg, void __iomem *lock, u8 shift,
-			      u8 width)
-{
-	struct clk *clk;
-	struct k210_pll *pll;
-
-	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll)
-		return ERR_PTR(-ENOMEM);
-	pll->reg = reg;
-	pll->lock = lock;
-	pll->shift = shift;
-	pll->width = width;
-
-	clk = k210_register_pll_struct(name, parent_name, pll);
-	if (IS_ERR(clk))
-		kfree(pll);
-	return clk;
-}
-
 U_BOOT_DRIVER(k210_pll) = {
 	.name	= CLK_K210_PLL,
 	.id	= UCLASS_CLK,
diff --git a/include/kendryte/pll.h b/include/kendryte/pll.h
index 55a40b9c97..95b8494f40 100644
--- a/include/kendryte/pll.h
+++ b/include/kendryte/pll.h
@@ -55,8 +55,4 @@ extern const struct clk_ops k210_pll_ops;
 
 struct clk *k210_register_pll_struct(const char *name, const char *parent_name,
 				     struct k210_pll *pll);
-struct clk *k210_register_pll(const char *name, const char *parent_name,
-			      void __iomem *reg, void __iomem *lock, u8 shift,
-			      u8 width);
-
 #endif /* K210_PLL_H */
-- 
2.28.0



More information about the U-Boot mailing list