* [PATCH 1/3] clk: add clock-indices support
@ 2014-02-13 18:02 Ben Dooks
2014-02-13 18:08 ` Sergei Shtylyov
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Ben Dooks @ 2014-02-13 18:02 UTC (permalink / raw)
To: linux-sh
Add a property called clock-indices to allow clock-output-names
to be used where the index used to lookup a clock is not a 1:1
mapping to the array position in the clock-output-names
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
.../devicetree/bindings/clock/clock-bindings.txt | 17 +++++++++++++++++
drivers/clk/clk.c | 20 +++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/clock/clock-bindings.txt b/Documentation/devicetree/bindings/clock/clock-bindings.txt
index 7c52c29..700e7aa 100644
--- a/Documentation/devicetree/bindings/clock/clock-bindings.txt
+++ b/Documentation/devicetree/bindings/clock/clock-bindings.txt
@@ -44,6 +44,23 @@ For example:
clocks by index. The names should reflect the clock output signal
names for the device.
+clock-indices: If the identifyng number for the clocks in the node
+ is not linear from zero, then the this mapping allows
+ the mapping of identifiers into the clock-output-names
+ array.
+
+For example, if we have two clocks <&oscillator 1> and <&oscillator 3>:
+
+ oscillator {
+ compatible = "myclocktype";
+ #clock-cells = <1>;
+ clock-indices = <1>, <3>;
+ clock-output-names = "clka", "clkb";
+ }
+
+ This ensures we do not have any empty nodes in clock-output-names
+
+
=Clock consumers=
Required properties:
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 5517944..18633c9 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2505,8 +2505,12 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
const char *of_clk_get_parent_name(struct device_node *np, int index)
{
struct of_phandle_args clkspec;
+ struct property *prop;
const char *clk_name;
+ const __be32 *vp;
+ u32 pv;
int rc;
+ int count;
if (index < 0)
return NULL;
@@ -2516,8 +2520,22 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
if (rc)
return NULL;
+ index = clkspec.args_count ? clkspec.args[0] : 0;
+ count = 0;
+
+ /* if there is an indices property, use it to transfer the index
+ * specified into an array offset for the clock-output-names property.
+ */
+ of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
+ if (index = pv) {
+ index = count;
+ break;
+ }
+ count++;
+ }
+
if (of_property_read_string_index(clkspec.np, "clock-output-names",
- clkspec.args_count ? clkspec.args[0] : 0,
+ index,
&clk_name) < 0)
clk_name = clkspec.np->name;
--
1.8.5.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
@ 2014-02-13 18:08 ` Sergei Shtylyov
2014-02-13 18:08 ` Ben Dooks
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sergei Shtylyov @ 2014-02-13 18:08 UTC (permalink / raw)
To: linux-sh
Hello.
On 02/13/2014 09:02 PM, Ben Dooks wrote:
> Add a property called clock-indices to allow clock-output-names
> to be used where the index used to lookup a clock is not a 1:1
> mapping to the array position in the clock-output-names
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> .../devicetree/bindings/clock/clock-bindings.txt | 17 +++++++++++++++++
> drivers/clk/clk.c | 20 +++++++++++++++++++-
> 2 files changed, 36 insertions(+), 1 deletion(-)
> diff --git a/Documentation/devicetree/bindings/clock/clock-bindings.txt b/Documentation/devicetree/bindings/clock/clock-bindings.txt
> index 7c52c29..700e7aa 100644
> --- a/Documentation/devicetree/bindings/clock/clock-bindings.txt
> +++ b/Documentation/devicetree/bindings/clock/clock-bindings.txt
> @@ -44,6 +44,23 @@ For example:
> clocks by index. The names should reflect the clock output signal
> names for the device.
>
> +clock-indices: If the identifyng number for the clocks in the node
> + is not linear from zero, then the this mapping allows
> + the mapping of identifiers into the clock-output-names
> + array.
> +
> +For example, if we have two clocks <&oscillator 1> and <&oscillator 3>:
> +
> + oscillator {
> + compatible = "myclocktype";
> + #clock-cells = <1>;
> + clock-indices = <1>, <3>;
> + clock-output-names = "clka", "clkb";
> + }
> +
> + This ensures we do not have any empty nodes in clock-output-names
You mean empty strings?
WBR, Sergei
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
2014-02-13 18:08 ` Sergei Shtylyov
@ 2014-02-13 18:08 ` Ben Dooks
2014-02-23 21:00 ` Mike Turquette
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2014-02-13 18:08 UTC (permalink / raw)
To: linux-sh
On 13/02/14 19:08, Sergei Shtylyov wrote:
> Hello.
>
> On 02/13/2014 09:02 PM, Ben Dooks wrote:
>
>> Add a property called clock-indices to allow clock-output-names
>> to be used where the index used to lookup a clock is not a 1:1
>> mapping to the array position in the clock-output-names
>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>> ---
>> .../devicetree/bindings/clock/clock-bindings.txt | 17
>> +++++++++++++++++
>> drivers/clk/clk.c | 20
>> +++++++++++++++++++-
>> 2 files changed, 36 insertions(+), 1 deletion(-)
>
>> diff --git
>> a/Documentation/devicetree/bindings/clock/clock-bindings.txt
>> b/Documentation/devicetree/bindings/clock/clock-bindings.txt
>> index 7c52c29..700e7aa 100644
>> --- a/Documentation/devicetree/bindings/clock/clock-bindings.txt
>> +++ b/Documentation/devicetree/bindings/clock/clock-bindings.txt
>> @@ -44,6 +44,23 @@ For example:
>> clocks by index. The names should reflect the clock output signal
>> names for the device.
>>
>> +clock-indices: If the identifyng number for the clocks in the node
>> + is not linear from zero, then the this mapping allows
>> + the mapping of identifiers into the clock-output-names
>> + array.
>> +
>> +For example, if we have two clocks <&oscillator 1> and <&oscillator 3>:
>> +
>> + oscillator {
>> + compatible = "myclocktype";
>> + #clock-cells = <1>;
>> + clock-indices = <1>, <3>;
>> + clock-output-names = "clka", "clkb";
>> + }
>> +
>> + This ensures we do not have any empty nodes in clock-output-names
>
> You mean empty strings?
Yes, thanks. Empty strings.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
2014-02-13 18:08 ` Sergei Shtylyov
2014-02-13 18:08 ` Ben Dooks
@ 2014-02-23 21:00 ` Mike Turquette
2014-02-23 22:40 ` Laurent Pinchart
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Mike Turquette @ 2014-02-23 21:00 UTC (permalink / raw)
To: linux-sh
Quoting Ben Dooks (2014-02-13 10:02:49)
> Add a property called clock-indices to allow clock-output-names
> to be used where the index used to lookup a clock is not a 1:1
> mapping to the array position in the clock-output-names
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Ben & Laurent,
The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
cleanly for me.
Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
I'll leave it up to you guys to figure out the backwards compatibility
issue with Ben's patch #3.
Regards,
Mike
> ---
> .../devicetree/bindings/clock/clock-bindings.txt | 17 +++++++++++++++++
> drivers/clk/clk.c | 20 +++++++++++++++++++-
> 2 files changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/clock/clock-bindings.txt b/Documentation/devicetree/bindings/clock/clock-bindings.txt
> index 7c52c29..700e7aa 100644
> --- a/Documentation/devicetree/bindings/clock/clock-bindings.txt
> +++ b/Documentation/devicetree/bindings/clock/clock-bindings.txt
> @@ -44,6 +44,23 @@ For example:
> clocks by index. The names should reflect the clock output signal
> names for the device.
>
> +clock-indices: If the identifyng number for the clocks in the node
> + is not linear from zero, then the this mapping allows
> + the mapping of identifiers into the clock-output-names
> + array.
> +
> +For example, if we have two clocks <&oscillator 1> and <&oscillator 3>:
> +
> + oscillator {
> + compatible = "myclocktype";
> + #clock-cells = <1>;
> + clock-indices = <1>, <3>;
> + clock-output-names = "clka", "clkb";
> + }
> +
> + This ensures we do not have any empty nodes in clock-output-names
> +
> +
> =Clock consumers=
>
> Required properties:
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 5517944..18633c9 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2505,8 +2505,12 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
> const char *of_clk_get_parent_name(struct device_node *np, int index)
> {
> struct of_phandle_args clkspec;
> + struct property *prop;
> const char *clk_name;
> + const __be32 *vp;
> + u32 pv;
> int rc;
> + int count;
>
> if (index < 0)
> return NULL;
> @@ -2516,8 +2520,22 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
> if (rc)
> return NULL;
>
> + index = clkspec.args_count ? clkspec.args[0] : 0;
> + count = 0;
> +
> + /* if there is an indices property, use it to transfer the index
> + * specified into an array offset for the clock-output-names property.
> + */
> + of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
> + if (index = pv) {
> + index = count;
> + break;
> + }
> + count++;
> + }
> +
> if (of_property_read_string_index(clkspec.np, "clock-output-names",
> - clkspec.args_count ? clkspec.args[0] : 0,
> + index,
> &clk_name) < 0)
> clk_name = clkspec.np->name;
>
> --
> 1.8.5.3
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (2 preceding siblings ...)
2014-02-23 21:00 ` Mike Turquette
@ 2014-02-23 22:40 ` Laurent Pinchart
2014-02-24 0:29 ` Laurent Pinchart
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2014-02-23 22:40 UTC (permalink / raw)
To: linux-sh
Hi Mike,
On Sunday 23 February 2014 13:00:24 Mike Turquette wrote:
> Quoting Ben Dooks (2014-02-13 10:02:49)
>
> > Add a property called clock-indices to allow clock-output-names
> > to be used where the index used to lookup a clock is not a 1:1
> > mapping to the array position in the clock-output-names
> >
> > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>
> Ben & Laurent,
>
> The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
> clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
> cleanly for me.
>
> Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
Sure. I've pushed my pending patches to
git://linuxtv.org/pinchartl/fbdev.git clocks/next/drivers
Ben, could you please rebase your patch on top of it and repost ? I'll then
send a pull request to Mike.
> I'll leave it up to you guys to figure out the backwards compatibility issue
> with Ben's patch #3.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (3 preceding siblings ...)
2014-02-23 22:40 ` Laurent Pinchart
@ 2014-02-24 0:29 ` Laurent Pinchart
2014-03-02 22:28 ` Ben Dooks
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2014-02-24 0:29 UTC (permalink / raw)
To: linux-sh
On Sunday 23 February 2014 15:46:04 Mike Turquette wrote:
> Quoting Laurent Pinchart (2014-02-23 14:40:46)
> > On Sunday 23 February 2014 13:00:24 Mike Turquette wrote:
> > > Quoting Ben Dooks (2014-02-13 10:02:49)
> > >
> > > > Add a property called clock-indices to allow clock-output-names
> > > > to be used where the index used to lookup a clock is not a 1:1
> > > > mapping to the array position in the clock-output-names
> > > >
> > > > Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> > >
> > > Ben & Laurent,
> > >
> > > The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
> > > clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
> > > cleanly for me.
> > >
> > > Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
> >
> > Sure. I've pushed my pending patches to
> >
> > git://linuxtv.org/pinchartl/fbdev.git clocks/next/drivers
> >
> > Ben, could you please rebase your patch on top of it and repost ? I'll
> > then send a pull request to Mike.
>
> FYI, I've just pushed a new clk-next branch based on -rc3 out to my
> linaro remote. You don't need to rebase but it's there if you want to
> put your stuff on top of the latest.
Thanks. Rebased and pushed.
> > > I'll leave it up to you guys to figure out the backwards compatibility
> > > issue with Ben's patch #3.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (4 preceding siblings ...)
2014-02-24 0:29 ` Laurent Pinchart
@ 2014-03-02 22:28 ` Ben Dooks
2014-03-02 22:37 ` Laurent Pinchart
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2014-03-02 22:28 UTC (permalink / raw)
To: linux-sh
On 23/02/14 21:00, Mike Turquette wrote:
> Quoting Ben Dooks (2014-02-13 10:02:49)
>> Add a property called clock-indices to allow clock-output-names
>> to be used where the index used to lookup a clock is not a 1:1
>> mapping to the array position in the clock-output-names
>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>
> Ben & Laurent,
>
> The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
> clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
> cleanly for me.
>
> Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
> I'll leave it up to you guys to figure out the backwards compatibility
> issue with Ben's patch #3.
Thanks, I've only just found this in my mailbox.
Is there still any actions I need to take?
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (5 preceding siblings ...)
2014-03-02 22:28 ` Ben Dooks
@ 2014-03-02 22:37 ` Laurent Pinchart
2014-03-02 22:52 ` Ben Dooks
2014-03-06 19:05 ` Ben Dooks
8 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2014-03-02 22:37 UTC (permalink / raw)
To: linux-sh
Hi Ben,
On Sunday 02 March 2014 22:28:09 Ben Dooks wrote:
> On 23/02/14 21:00, Mike Turquette wrote:
> > Quoting Ben Dooks (2014-02-13 10:02:49)
> >
> >> Add a property called clock-indices to allow clock-output-names
> >> to be used where the index used to lookup a clock is not a 1:1
> >> mapping to the array position in the clock-output-names
> >>
> >> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> >
> > Ben & Laurent,
> >
> > The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
> > clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
> > cleanly for me.
> >
> > Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
> > I'll leave it up to you guys to figure out the backwards compatibility
> > issue with Ben's patch #3.
>
> Thanks, I've only just found this in my mailbox.
> Is there still any actions I need to take?
I've sent a pull request for my patches only. Could you please rebase yours ?
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (6 preceding siblings ...)
2014-03-02 22:37 ` Laurent Pinchart
@ 2014-03-02 22:52 ` Ben Dooks
2014-03-06 19:05 ` Ben Dooks
8 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2014-03-02 22:52 UTC (permalink / raw)
To: linux-sh
On 02/03/14 22:37, Laurent Pinchart wrote:
> Hi Ben,
>
> On Sunday 02 March 2014 22:28:09 Ben Dooks wrote:
>> On 23/02/14 21:00, Mike Turquette wrote:
>>> Quoting Ben Dooks (2014-02-13 10:02:49)
>>>
>>>> Add a property called clock-indices to allow clock-output-names
>>>> to be used where the index used to lookup a clock is not a 1:1
>>>> mapping to the array position in the clock-output-names
>>>>
>>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>>>
>>> Ben & Laurent,
>>>
>>> The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
>>> clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
>>> cleanly for me.
>>>
>>> Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
>>> I'll leave it up to you guys to figure out the backwards compatibility
>>> issue with Ben's patch #3.
>>
>> Thanks, I've only just found this in my mailbox.
>> Is there still any actions I need to take?
>
> I've sent a pull request for my patches only. Could you please rebase yours ?
Ok, will go and see if I can find it.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] clk: add clock-indices support
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
` (7 preceding siblings ...)
2014-03-02 22:52 ` Ben Dooks
@ 2014-03-06 19:05 ` Ben Dooks
8 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2014-03-06 19:05 UTC (permalink / raw)
To: linux-sh
On 23/02/14 23:46, Mike Turquette wrote:
> Quoting Laurent Pinchart (2014-02-23 14:40:46)
>> Hi Mike,
>>
>> On Sunday 23 February 2014 13:00:24 Mike Turquette wrote:
>>> Quoting Ben Dooks (2014-02-13 10:02:49)
>>>
>>>> Add a property called clock-indices to allow clock-output-names
>>>> to be used where the index used to lookup a clock is not a 1:1
>>>> mapping to the array position in the clock-output-names
>>>>
>>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>>>
>>> Ben & Laurent,
>>>
>>> The clock-indices stuff looks sane to me. I've taken Ben's patch #1 into
>>> clk-next. It seems patch #3 might be dropped and patch #2 didn't apply
>>> cleanly for me.
>>>
>>> Can Laurent's patches and Ben's #2 be rebased and sent together as a PR?
>>
>> Sure. I've pushed my pending patches to
>>
>> git://linuxtv.org/pinchartl/fbdev.git clocks/next/drivers
>>
>> Ben, could you please rebase your patch on top of it and repost ? I'll then
>> send a pull request to Mike.
>
> FYI, I've just pushed a new clk-next branch based on -rc3 out to my
> linaro remote. You don't need to rebase but it's there if you want to
> put your stuff on top of the latest.
Thanks. Will look at re-doing the reneasas clock driver as soon as
we can get some discussion on the best way to deal with the merging.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-03-06 19:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-13 18:02 [PATCH 1/3] clk: add clock-indices support Ben Dooks
2014-02-13 18:08 ` Sergei Shtylyov
2014-02-13 18:08 ` Ben Dooks
2014-02-23 21:00 ` Mike Turquette
2014-02-23 22:40 ` Laurent Pinchart
2014-02-24 0:29 ` Laurent Pinchart
2014-03-02 22:28 ` Ben Dooks
2014-03-02 22:37 ` Laurent Pinchart
2014-03-02 22:52 ` Ben Dooks
2014-03-06 19:05 ` Ben Dooks
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).