mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/3] clk: add dummy definitions for CLK_SET_RATE_GATE, CLK_SET_PARENT_GATE
Date: Thu, 15 Feb 2024 13:18:35 +0100	[thread overview]
Message-ID: <20240215121837.251013-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240215121837.251013-1-a.fatoum@pengutronix.de>

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@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




  reply	other threads:[~2024-02-15 12:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 12:18 [PATCH 0/3] clk: at91: sync drivers with Linux Ahmad Fatoum
2024-02-15 12:18 ` Ahmad Fatoum [this message]
2024-02-15 12:18 ` [PATCH 2/3] clk: define empty stub for clk_hw_unregister Ahmad Fatoum
2024-02-15 12:18 ` [PATCH 3/3] clk: at91: sync drivers with Linux Ahmad Fatoum
2024-02-16 12:11 ` [PATCH 0/3] " Sascha Hauer

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=20240215121837.251013-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox