All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: NXP Linux Team <linux-imx@nxp.com>,
	linux-clk@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Abel Vesa <abel.vesa@nxp.com>
Subject: [PATCH 6/8] clk: imx: Rework all clk_hw_register_divider wrappers
Date: Mon, 13 Sep 2021 11:24:48 +0300	[thread overview]
Message-ID: <1631521490-17171-7-git-send-email-abel.vesa@nxp.com> (raw)
In-Reply-To: <1631521490-17171-1-git-send-email-abel.vesa@nxp.com>

Instead of having multiple inline functions that were calling
clk_hw_register_divider, implement a generic low-level
__imx_clk_hw_divider and implement the rest as macros that
pass on as arguments whatever is needed in each case.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/clk/imx/clk.h | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index a94170c5c83e..224a22065064 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -175,6 +175,16 @@ extern struct imx_pll14xx_clk imx_1443x_dram_pll;
 #define imx_clk_hw_mux2_flags(name, reg, shift, width, parents, num_parents, flags) \
 	__imx_clk_hw_mux(name, reg, shift, width, parents, num_parents, flags | CLK_OPS_PARENT_ENABLE, 0)
 
+#define imx_clk_hw_divider(name, parent, reg, shift, width) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, CLK_SET_RATE_PARENT)
+
+#define imx_clk_hw_divider2(name, parent, reg, shift, width) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, \
+				CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE)
+
+#define imx_clk_hw_divider_flags(name, parent, reg, shift, width, flags) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, flags)
+
 struct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,
 				const char *parent_name, void __iomem *base,
 				const struct imx_pll14xx_clk *pll_clk);
@@ -303,16 +313,7 @@ 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(const char *name,
-						const char *parent,
-						void __iomem *reg, u8 shift,
-						u8 width)
-{
-	return clk_hw_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
-				       reg, shift, width, 0, &imx_ccm_lock);
-}
-
-static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
+static inline struct clk_hw *__imx_clk_hw_divider(const char *name,
 						   const char *parent,
 						   void __iomem *reg, u8 shift,
 						   u8 width, unsigned long flags)
@@ -321,14 +322,6 @@ static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
 				       reg, shift, width, 0, &imx_ccm_lock);
 }
 
-static inline struct clk_hw *imx_clk_hw_divider2(const char *name, const char *parent,
-		void __iomem *reg, u8 shift, u8 width)
-{
-	return clk_hw_register_divider(NULL, name, parent,
-			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
-			reg, shift, width, 0, &imx_ccm_lock);
-}
-
 static inline struct clk_hw *__imx_clk_hw_gate(const char *name, const char *parent,
 						void __iomem *reg, u8 shift,
 						unsigned long flags,
-- 
2.31.1


WARNING: multiple messages have this Message-ID (diff)
From: Abel Vesa <abel.vesa@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: NXP Linux Team <linux-imx@nxp.com>,
	linux-clk@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Abel Vesa <abel.vesa@nxp.com>
Subject: [PATCH 6/8] clk: imx: Rework all clk_hw_register_divider wrappers
Date: Mon, 13 Sep 2021 11:24:48 +0300	[thread overview]
Message-ID: <1631521490-17171-7-git-send-email-abel.vesa@nxp.com> (raw)
In-Reply-To: <1631521490-17171-1-git-send-email-abel.vesa@nxp.com>

Instead of having multiple inline functions that were calling
clk_hw_register_divider, implement a generic low-level
__imx_clk_hw_divider and implement the rest as macros that
pass on as arguments whatever is needed in each case.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/clk/imx/clk.h | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index a94170c5c83e..224a22065064 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -175,6 +175,16 @@ extern struct imx_pll14xx_clk imx_1443x_dram_pll;
 #define imx_clk_hw_mux2_flags(name, reg, shift, width, parents, num_parents, flags) \
 	__imx_clk_hw_mux(name, reg, shift, width, parents, num_parents, flags | CLK_OPS_PARENT_ENABLE, 0)
 
+#define imx_clk_hw_divider(name, parent, reg, shift, width) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, CLK_SET_RATE_PARENT)
+
+#define imx_clk_hw_divider2(name, parent, reg, shift, width) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, \
+				CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE)
+
+#define imx_clk_hw_divider_flags(name, parent, reg, shift, width, flags) \
+	__imx_clk_hw_divider(name, parent, reg, shift, width, flags)
+
 struct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,
 				const char *parent_name, void __iomem *base,
 				const struct imx_pll14xx_clk *pll_clk);
@@ -303,16 +313,7 @@ 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(const char *name,
-						const char *parent,
-						void __iomem *reg, u8 shift,
-						u8 width)
-{
-	return clk_hw_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
-				       reg, shift, width, 0, &imx_ccm_lock);
-}
-
-static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
+static inline struct clk_hw *__imx_clk_hw_divider(const char *name,
 						   const char *parent,
 						   void __iomem *reg, u8 shift,
 						   u8 width, unsigned long flags)
@@ -321,14 +322,6 @@ static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
 				       reg, shift, width, 0, &imx_ccm_lock);
 }
 
-static inline struct clk_hw *imx_clk_hw_divider2(const char *name, const char *parent,
-		void __iomem *reg, u8 shift, u8 width)
-{
-	return clk_hw_register_divider(NULL, name, parent,
-			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
-			reg, shift, width, 0, &imx_ccm_lock);
-}
-
 static inline struct clk_hw *__imx_clk_hw_gate(const char *name, const char *parent,
 						void __iomem *reg, u8 shift,
 						unsigned long flags,
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-09-13  8:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  8:24 [PATCH 0/8] imx: clk: Rework all the wrappers Abel Vesa
2021-09-13  8:24 ` Abel Vesa
2021-09-13  8:24 ` [PATCH 1/8] clk: imx: Remove unused helpers Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 2/8] clk: imx: Make mux/mux2 clk based helpers use clk_hw based ones Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 3/8] clk: imx: Rework all clk_hw_register_gate wrappers Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 4/8] clk: imx: Rework all clk_hw_register_gate2 wrappers Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 5/8] clk: imx: Rework all clk_hw_register_mux wrappers Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` Abel Vesa [this message]
2021-09-13  8:24   ` [PATCH 6/8] clk: imx: Rework all clk_hw_register_divider wrappers Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 7/8] clk: imx: Rework all imx_clk_hw_composite wrappers Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-13  8:24 ` [PATCH 8/8] clk: imx: Rework imx_clk_hw_pll14xx wrapper Abel Vesa
2021-09-13  8:24   ` Abel Vesa
2021-09-15  1:02   ` Stephen Boyd
2021-09-15  1:02     ` Stephen Boyd
2021-09-15  9:57 ` [PATCH 0/8] imx: clk: Rework all the wrappers Abel Vesa
2021-09-15  9:57   ` Abel Vesa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1631521490-17171-7-git-send-email-abel.vesa@nxp.com \
    --to=abel.vesa@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.