From: Ulrich Hecht <ulrich.hecht@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH 1/4] clk: shmobile: div6: support selectable-input clocks
Date: Tue, 22 Apr 2014 13:19:09 +0000 [thread overview]
Message-ID: <1398172752-30567-2-git-send-email-ulrich.hecht+renesas@gmail.com> (raw)
From: Ulrich Hecht <ulrich.hecht@gmail.com>
Adds support for DIV6 clocks with selectable parents as found in the r8a7740
and other SoCs.
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
.../bindings/clock/renesas,cpg-div6-clocks.txt | 8 ++++++++
drivers/clk/shmobile/clk-div6.c | 19 ++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
index 952e373..f8302f5 100644
--- a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
+++ b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
@@ -7,6 +7,7 @@ to 64.
Required Properties:
- compatible: Must be one of the following
+ - "renesas,r8a7740-div6-clock" for R8A7740 DIV6 clocks
- "renesas,r8a7790-div6-clock" for R8A7790 (R-Car H2) DIV6 clocks
- "renesas,r8a7791-div6-clock" for R8A7791 (R-Car M2) DIV6 clocks
- "renesas,cpg-div6-clock" for generic DIV6 clocks
@@ -15,6 +16,13 @@ Required Properties:
- #clock-cells: Must be 0
- clock-output-names: The name of the clock as a free-form string
+Optional Properties:
+
+ - renesas,src-shift: Bit position of the input clock selector (default:
+ fixed input clock)
+ - renesas,src-width: Bit width of the input clock selector (default: fixed
+ input clock)
+
Example
-------
diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c
index f065f69..5be8161 100644
--- a/drivers/clk/shmobile/clk-div6.c
+++ b/drivers/clk/shmobile/clk-div6.c
@@ -121,6 +121,7 @@ static void __init cpg_div6_clock_init(struct device_node *np)
const char *name;
struct clk *clk;
int ret;
+ u32 src_shift, src_width;
clock = kzalloc(sizeof(*clock), GFP_KERNEL);
if (!clock) {
@@ -150,7 +151,23 @@ static void __init cpg_div6_clock_init(struct device_node *np)
goto error;
}
- parent_name = of_clk_get_parent_name(np, 0);
+ if (!of_property_read_u32(np, "renesas,src-shift", &src_shift)) {
+ if (!of_property_read_u32(np, "renesas,src-width",
+ &src_width)) {
+ unsigned int parent_idx + (clk_readl(clock->reg) >> src_shift) &
+ (BIT(src_width) - 1);
+ parent_name = of_clk_get_parent_name(np, parent_idx);
+ }
+ else {
+ pr_err("%s: renesas,src-shift without renesas,"
+ "src-width in %s\n", __func__, np->name);
+ goto error;
+ }
+ }
+ else
+ parent_name = of_clk_get_parent_name(np, 0);
+
if (parent_name = NULL) {
pr_err("%s: failed to get %s DIV6 clock parent name\n",
__func__, np->name);
--
1.8.4.5
next reply other threads:[~2014-04-22 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 13:19 Ulrich Hecht [this message]
2014-04-30 23:55 ` [PATCH 1/4] clk: shmobile: div6: support selectable-input clocks Laurent Pinchart
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=1398172752-30567-2-git-send-email-ulrich.hecht+renesas@gmail.com \
--to=ulrich.hecht@gmail.com \
--cc=linux-sh@vger.kernel.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).