From: haojian.zhuang@linaro.org (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/6] clk: divider: add CLK_DIVIDER_HIWORD_MASK flag
Date: Tue, 4 Jun 2013 23:05:14 +0800 [thread overview]
Message-ID: <1370358317-12768-4-git-send-email-haojian.zhuang@linaro.org> (raw)
In-Reply-To: <1370358317-12768-1-git-send-email-haojian.zhuang@linaro.org>
In Hisilicon Hi3620 clock divider register, 16-bit HIWORD is mask field.
Support the HIWORD mask to reuse clock divider driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
drivers/clk/clk-divider.c | 6 ++++++
include/linux/clk-provider.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 6d96741..4c344b4 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -220,6 +220,12 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
val = readl(divider->reg);
val &= ~(div_mask(divider) << divider->shift);
val |= value << divider->shift;
+ if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
+ if (divider->width + divider->shift > 16)
+ pr_warn("divider value exceeds LOWORD field\n");
+ else
+ val |= div_mask(divider) << (divider->shift + 16);
+ }
writel(val, divider->reg);
if (divider->lock)
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 6ba32bc..dbb9bd9 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -257,6 +257,7 @@ struct clk_div_table {
* Some hardware implementations gracefully handle this case and allow a
* zero divisor by not modifying their input clock
* (divide by one / bypass).
+ * CLK_DIVIDER_HIWORD_MASK - register contains high 16-bit as mask field
*/
struct clk_divider {
struct clk_hw hw;
@@ -271,6 +272,7 @@ struct clk_divider {
#define CLK_DIVIDER_ONE_BASED BIT(0)
#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
+#define CLK_DIVIDER_HIWORD_MASK BIT(3)
extern const struct clk_ops clk_divider_ops;
struct clk *clk_register_divider(struct device *dev, const char *name,
--
1.8.1.2
next prev parent reply other threads:[~2013-06-04 15:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 15:05 [PATCH v2 0/6] support hi3xxx soc Haojian Zhuang
2013-06-04 15:05 ` [PATCH v2 1/6] ARM: debug: support debug ll on hisilicon soc Haojian Zhuang
2013-06-04 15:13 ` Arnd Bergmann
2013-06-04 15:05 ` [PATCH v2 2/6] clk: mux: add CLK_MUX_HIWORD_MASK Haojian Zhuang
2013-06-04 15:05 ` Haojian Zhuang [this message]
2013-06-07 9:15 ` [PATCH v2 3/6] clk: divider: add CLK_DIVIDER_HIWORD_MASK flag Linus Walleij
2013-06-07 9:30 ` Haojian Zhuang
2013-06-07 12:31 ` Heiko Stübner
2013-06-08 3:17 ` Haojian Zhuang
2013-06-08 9:20 ` Heiko Stübner
2013-06-04 15:05 ` [PATCH v2 4/6] clk: hi3xxx: add clock support Haojian Zhuang
2013-06-04 15:05 ` [PATCH v2 5/6] ARM: hi3xxx: add board support with device tree Haojian Zhuang
2013-06-04 15:16 ` Arnd Bergmann
2013-06-05 3:04 ` Haojian Zhuang
2013-06-07 10:54 ` Arnd Bergmann
2013-06-04 15:05 ` [PATCH v2 6/6] ARM: hi3xxx: enable hi4511 " Haojian Zhuang
2013-06-04 15:20 ` Arnd Bergmann
2013-06-04 15:31 ` Haojian Zhuang
2013-06-05 3:56 ` [PATCH v3 5/6] ARM: hi3xxx: add board support " Haojian Zhuang
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=1370358317-12768-4-git-send-email-haojian.zhuang@linaro.org \
--to=haojian.zhuang@linaro.org \
--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).