linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/8] clk: mux: Add support for read-only muxes.
Date: Tue, 23 Jul 2013 01:49:18 +0200	[thread overview]
Message-ID: <1374536965-3545-2-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1374536965-3545-1-git-send-email-tomasz.figa@gmail.com>

Some platforms have read-only clock muxes that are preconfigured at
reset and cannot be changed at runtime. This patch extends mux clock
driver to allow handling such read-only muxes by adding new
CLK_MUX_READ_ONLY mux flag.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/clk/clk-mux.c        | 10 +++++++++-
 include/linux/clk-provider.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 614444c..92f1a1b 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -107,6 +107,11 @@ const struct clk_ops clk_mux_ops = {
 };
 EXPORT_SYMBOL_GPL(clk_mux_ops);
 
+const struct clk_ops clk_mux_ro_ops = {
+	.get_parent = clk_mux_get_parent,
+};
+EXPORT_SYMBOL_GPL(clk_mux_ro_ops);
+
 struct clk *clk_register_mux_table(struct device *dev, const char *name,
 		const char **parent_names, u8 num_parents, unsigned long flags,
 		void __iomem *reg, u8 shift, u32 mask,
@@ -133,7 +138,10 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,
 	}
 
 	init.name = name;
-	init.ops = &clk_mux_ops;
+	if (clk_mux_flags & CLK_MUX_READ_ONLY)
+		init.ops = &clk_mux_ro_ops;
+	else
+		init.ops = &clk_mux_ops;
 	init.flags = flags | CLK_IS_BASIC;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1ec14a7..9487b96 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -327,8 +327,10 @@ struct clk_mux {
 #define CLK_MUX_INDEX_ONE		BIT(0)
 #define CLK_MUX_INDEX_BIT		BIT(1)
 #define CLK_MUX_HIWORD_MASK		BIT(2)
+#define CLK_MUX_READ_ONLY	BIT(3) /* mux setting cannot be changed */
 
 extern const struct clk_ops clk_mux_ops;
+extern const struct clk_ops clk_mux_ro_ops;
 
 struct clk *clk_register_mux(struct device *dev, const char *name,
 		const char **parent_names, u8 num_parents, unsigned long flags,
-- 
1.8.3.2

  reply	other threads:[~2013-07-22 23:49 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 23:49 [PATCH v2 0/8] Common Clock Framework support for Samsung S3C64xx Tomasz Figa
2013-07-22 23:49 ` Tomasz Figa [this message]
2013-07-23 11:22   ` [PATCH v2 1/8] clk: mux: Add support for read-only muxes Sergei Shtylyov
2013-07-23 11:25     ` Tomasz Figa
2013-07-27 12:41   ` Tomasz Figa
2013-08-02 21:46     ` Mike Turquette
2013-07-22 23:49 ` [PATCH v2 2/8] clk: samsung: pll: Add support for PLL6552 and PLL6553 Tomasz Figa
2013-07-23 23:52   ` [PATCH v3 " Tomasz Figa
2013-07-28 12:30     ` Mark Brown
2013-07-28 12:38       ` Tomasz Figa
2013-08-02 22:53         ` Mike Turquette
2013-07-22 23:49 ` [PATCH v2 3/8] clk: samsung: Add clock driver for S3C64xx SoCs Tomasz Figa
2013-07-23 23:55   ` [PATCH v3 " Tomasz Figa
2013-07-22 23:49 ` [PATCH v2 4/8] ARM: SAMSUNG: Add soc_is_s3c6400/s3c6410 macros Tomasz Figa
2013-07-22 23:49 ` [PATCH v2 5/8] ARM: s3c64xx: dma: Use clk_prepare_enable/clk_disable_unprepare Tomasz Figa
2013-07-28 12:32   ` Mark Brown
2013-07-22 23:49 ` [PATCH v2 6/8] usb: host: ohci-s3c2410 " Tomasz Figa
2013-07-23  0:15   ` Fabio Estevam
2013-07-23  0:44     ` Tomasz Figa
2013-07-31 18:58   ` Tomasz Figa
2013-07-31 20:44     ` Alan Stern
2013-08-01  7:45       ` Greg KH
2013-07-22 23:49 ` [PATCH v2 7/8] ARM: s3c64xx: Migrate clock handling to Common Clock Framework Tomasz Figa
2013-07-22 23:49 ` [PATCH v2 8/8] ARM: s3c64xx: Remove old clock management code Tomasz Figa
2013-07-24 12:20 ` [PATCH v2 0/8] Common Clock Framework support for Samsung S3C64xx Kukjin Kim
2013-08-05 17:01 ` Kukjin Kim
2013-08-05 18:06   ` Mike Turquette
2013-08-05 18:13     ` Kukjin Kim
2013-08-05 19:02       ` Mike Turquette
2013-08-05 23:42         ` Tomasz Figa
2013-08-06 19:47           ` Mike Turquette
2013-08-06 22:06             ` Tomasz Figa
2013-08-06 22:11               ` Kukjin Kim
2013-08-06 22:13                 ` Tomasz Figa
2013-08-16 10:44     ` Tomasz Figa
2013-08-16 21:02       ` Mike Turquette
2013-08-16 21:15         ` Tomasz Figa
2013-08-17 10:30           ` Kukjin Kim
2013-08-20  0:22             ` Mike Turquette
2013-08-20  7:09               ` Kukjin Kim
2013-08-25 17:19                 ` Kukjin Kim
2013-08-21  0:33               ` [PATCH] clk: samsung: pll: Use new registration method for PLL6552 and PLL6553 Tomasz Figa
2013-08-27  1:14                 ` Mike Turquette
2013-08-27 17:16                   ` Kukjin Kim
2013-08-27 23:45                     ` Mike Turquette

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=1374536965-3545-2-git-send-email-tomasz.figa@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).