[PATCH 1/3] clk: add dummy definitions for CLK_SET_RATE_GATE, CLK_SET_PARENT_GATE

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Feb 15 04:18:35 PST 2024


CLK_SET_RATE_GATE and CLK_SET_PARENT_GATE mean that the clk itself or
its parent, respectively, needs to be gated before attempting a set
rate.

If this is not the case, the operation would fail in Linux with -EBUSY.
The usual way this is ported to barebox is by just omitting the flag,
because a well-behaving driver shouldn't be gating clocks before setting
rate anyway. Embrace this guard rail free life by defining the macros as
zero.

If in future, we decide to add them, we can always redefine them and
implement appropriate behavior.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 Documentation/devel/porting.rst | 1 -
 include/linux/clk.h             | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devel/porting.rst b/Documentation/devel/porting.rst
index 4e14ace691df..6d6cf059fc97 100644
--- a/Documentation/devel/porting.rst
+++ b/Documentation/devel/porting.rst
@@ -391,7 +391,6 @@ Miscellaneous Linux porting advice:
   * ``jiffies``: use ``get_time_ns()``
   * ``time_before``: use ``!is_timeout()``
   * ``clk_hw_register_fixed_rate_with_accuracy``: use ``clk_hw_register_fixed_rate`` without accuracy
-  * ``CLK_SET_RATE_GATE`` can be ignored
   * ``clk_prepare``: is for the non-atomic code preparing for clk enablement. Merge it into ``clk_enable``
 
 ***************************
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1bdfb21d509e..d76f175bbd49 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -240,6 +240,11 @@ static inline void clk_put(struct clk *clk)
 #define CLK_GATE_SET_TO_DISABLE	(1 << 0)
 #define CLK_GATE_HIWORD_MASK	(1 << 1)
 
+/* Ignored sanity checking flags */
+#define CLK_SET_RATE_GATE	0 /* must be gated across rate change */
+#define CLK_SET_PARENT_GATE	0 /* must be gated across re-parent */
+
+
 /**
  * struct clk_ops -  Callback operations for hardware clocks; these are to
  * be provided by the clock implementation, and will be called by drivers
-- 
2.39.2




More information about the barebox mailing list