mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 7/7] clk: move struct clk_composite definition to header
Date: Tue, 22 Apr 2025 09:56:37 +0200	[thread overview]
Message-ID: <20250422075637.220688-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250422075637.220688-1-a.fatoum@pengutronix.de>

From: Ahmad Fatoum <a.fatoum@barebox.org>

Linux defines struct clk_composite in a header, so clock drivers can
make direct use of it. Do the same for barebox.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/clk/clk-composite.c  | 12 +-----------
 include/linux/clk-provider.h | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index f69d90e72b4f..e8f1fa7a7250 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -8,19 +8,9 @@
 #include <common.h>
 #include <io.h>
 #include <malloc.h>
-#include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/err.h>
 
-struct clk_composite {
-	struct clk_hw	hw;
-
-	struct clk_hw	*mux_hw;
-	struct clk_hw	*rate_hw;
-	struct clk_hw	*gate_hw;
-};
-
-#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
-
 static int clk_composite_get_parent(struct clk_hw *hw)
 {
 	struct clk_composite *composite = to_clk_composite(hw);
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 602e772a54bb..07ccf1d67515 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -31,6 +31,24 @@ static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate,
 					    val);
 }
 
+/***
+ * struct clk_composite - aggregate clock of mux, divider and gate clocks
+ *
+ * @hw:		handle between common and hardware-specific interfaces
+ * @mux_hw:	handle between composite and hardware-specific mux clock
+ * @rate_hw:	handle between composite and hardware-specific rate clock
+ * @gate_hw:	handle between composite and hardware-specific gate clock
+ */
+struct clk_composite {
+	struct clk_hw	hw;
+
+	struct clk_hw	*mux_hw;
+	struct clk_hw	*rate_hw;
+	struct clk_hw	*gate_hw;
+};
+
+#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)
+
 /**
  * struct clk_rate_request - Structure encoding the clk constraints that
  * a clock user might require.
-- 
2.39.5




  parent reply	other threads:[~2025-04-22  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22  7:56 [PATCH 1/7] clk: add compatibility for prepare/unprepare/is_prepared Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 2/7] clk: mux: replace width member with mask as in Linux Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 3/7] clk: mux: fix mask/width confusion in clk_hw_register_mux Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 4/7] clk: gate: underscore-prefix barebox-specific parent member Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 5/7] clk: gate: add bit_idx member as in Linux Ahmad Fatoum
2025-04-22  7:56 ` [PATCH 6/7] clk: composite: change mux/rate/gate members to clk_hw Ahmad Fatoum
2025-04-22  7:56 ` Ahmad Fatoum [this message]
2025-04-22  9:18 ` [PATCH 1/7] clk: add compatibility for prepare/unprepare/is_prepared 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=20250422075637.220688-7-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