From: Tero Kristo <t-kristo@ti.com>
To: linux-omap@vger.kernel.org, paul@pwsan.com, tony@atomide.com,
nm@ti.com, rnayak@ti.com, bcousson@baylibre.com,
mturquette@linaro.org
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: [PATCHv12 04/49] clk: mux: add support for registering mux clock from descriptor
Date: Fri, 20 Dec 2013 18:34:22 +0200 [thread overview]
Message-ID: <1387557274-22583-4-git-send-email-t-kristo@ti.com> (raw)
In-Reply-To: <1387557274-22583-1-git-send-email-t-kristo@ti.com>
New clk_register_desc() call can be used to register this clock type now.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
drivers/clk/clk-mux.c | 37 +++++++++++++++++++++++++++++++++++++
include/linux/clk-provider.h | 20 ++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 4f96ff3..2cbed08 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -27,8 +27,12 @@
* parent - parent is adjustable through clk_set_parent
*/
+/* resolve struct clk_mux from inner struct clk_hw member */
#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
+/* resolve struct clk_mux_desc from inner struct clk_desc member */
+#define to_hw_desc(_desc) container_of(_desc, struct clk_mux_desc, desc)
+
static u8 clk_mux_get_parent(struct clk_hw *hw)
{
struct clk_mux *mux = to_clk_mux(hw);
@@ -177,3 +181,36 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
NULL, lock);
}
EXPORT_SYMBOL_GPL(clk_register_mux);
+
+struct clk_hw *clk_register_mux_desc(struct device *dev, struct clk_desc *desc)
+{
+ struct clk_mux *mux;
+ struct clk_mux_desc *hw_desc;
+
+ hw_desc = to_hw_desc(desc);
+
+ /* allocate mux clock */
+ mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+ if (!mux)
+ return ERR_PTR(-ENOMEM);
+
+ /* populate struct clk_mux assignments */
+ mux->reg = hw_desc->reg;
+ mux->table = hw_desc->table;
+ mux->mask = hw_desc->mask;
+ mux->shift = hw_desc->shift;
+ mux->flags = hw_desc->flags;
+ mux->lock = hw_desc->lock;
+
+ if (!desc->ops) {
+ if (mux->flags & CLK_MUX_READ_ONLY)
+ desc->ops = &clk_mux_ro_ops;
+ else
+ desc->ops = &clk_mux_ops;
+ }
+
+ desc->flags |= CLK_IS_BASIC;
+
+ return &mux->hw;
+}
+EXPORT_SYMBOL_GPL(clk_register_mux_desc);
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index bf89ab4..ea5281c 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -391,6 +391,25 @@ struct clk_mux {
spinlock_t *lock;
};
+/**
+ * struct clk_mux_desc - init descriptor for multiplexer clock
+ * @desc: handle between common and hardware-specific interfaces
+ * @reg: register controlling multiplexer
+ * @shift: shift to multiplexer bit field
+ * @width: width of multiplexer bit field
+ * @flags: hardware-specific flags
+ * @lock: register lock
+ */
+struct clk_mux_desc {
+ struct clk_desc desc;
+ void __iomem *reg;
+ u32 *table;
+ u32 mask;
+ u8 shift;
+ u8 flags;
+ spinlock_t *lock;
+};
+
#define CLK_MUX_INDEX_ONE BIT(0)
#define CLK_MUX_INDEX_BIT BIT(1)
#define CLK_MUX_HIWORD_MASK BIT(2)
@@ -399,6 +418,7 @@ struct clk_mux {
extern const struct clk_ops clk_mux_ops;
extern const struct clk_ops clk_mux_ro_ops;
+struct clk_hw *clk_register_mux_desc(struct device *dev, struct clk_desc *desc);
struct clk *clk_register_mux(struct device *dev, const char *name,
const char **parent_names, u8 num_parents, unsigned long flags,
void __iomem *reg, u8 shift, u8 width,
--
1.7.9.5
next prev parent reply other threads:[~2013-12-20 16:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 16:34 [PATCHv12 00/49] ARM: TI SoC clock DT conversion Tero Kristo
2013-12-20 16:34 ` [PATCHv12 01/49] clk: add support for registering clocks from description Tero Kristo
2013-12-20 16:34 ` [PATCHv12 03/49] clk: divider: add support for registering divider clock from descriptor Tero Kristo
2013-12-20 16:34 ` Tero Kristo [this message]
2013-12-20 16:34 ` [PATCHv12 05/49] clk: gate: add support for registering gate " Tero Kristo
2013-12-20 16:34 ` [PATCHv12 06/49] clk: add support for low level register ops Tero Kristo
2013-12-20 16:34 ` [PATCHv12 07/49] clk: divider: add support for low level ops Tero Kristo
2013-12-20 16:34 ` [PATCHv12 08/49] clk: gate: " Tero Kristo
2013-12-20 16:34 ` [PATCHv12 09/49] clk: mux: " Tero Kristo
2013-12-20 16:34 ` [PATCHv12 12/49] CLK: TI: Add DPLL clock support Tero Kristo
2013-12-20 16:34 ` [PATCHv12 17/49] CLK: TI: add support for gate clock Tero Kristo
[not found] ` <1387557274-22583-1-git-send-email-t-kristo-l0cyMroinI0@public.gmane.org>
2013-12-20 16:34 ` [PATCHv12 11/49] CLK: ti: add init support for clock IP blocks Tero Kristo
2013-12-20 16:34 ` [PATCHv12 14/49] clk: ti: add composite clock support Tero Kristo
2013-12-20 16:34 ` [PATCHv12 18/49] CLK: TI: add support for clockdomain binding Tero Kristo
2013-12-20 16:34 ` [PATCHv12 23/49] CLK: TI: DRA7: Add APLL support Tero Kristo
2013-12-20 16:34 ` [PATCHv12 43/49] ARM: OMAP2+: PRM: add support for initializing PRCM clock modules from DT Tero Kristo
2013-12-20 18:37 ` [PATCHv12 00/49] ARM: TI SoC clock DT conversion Tony Lindgren
2013-12-20 20:06 ` Felipe Balbi
2013-12-20 20:10 ` Sebastian Reichel
2014-01-07 3:21 ` Nishanth Menon
2014-01-07 16:36 ` Nishanth Menon
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=1387557274-22583-4-git-send-email-t-kristo@ti.com \
--to=t-kristo@ti.com \
--cc=bcousson@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
--cc=rnayak@ti.com \
--cc=tony@atomide.com \
/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).