]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
clk: mux: Add support for read-only muxes.
authorTomasz Figa <tomasz.figa@gmail.com>
Mon, 22 Jul 2013 23:49:18 +0000 (01:49 +0200)
committerMike Turquette <mturquette@linaro.org>
Mon, 5 Aug 2013 18:56:46 +0000 (11:56 -0700)
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>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk-mux.c
include/linux/clk-provider.h

index 614444ca40cd638bbf3283c75b8ea7f80f7fdfe0..92f1a1be53196de97c08f9dd2438d2c3e792ee21 100644 (file)
@@ -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;
index 1ec14a73217654308fa20bd18e3ec913d668274f..9487b96939e850f59677b55230540b33a16b90d7 100644 (file)
@@ -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,