Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1512454 > unrolled thread

Re: [PATCH] ARM: davinci: da850: Fix pwm name matching

Started bySekhar Nori <nsekhar@ti.com>
First post2016-10-31 11:20 +0100
Last post2016-11-03 05:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] ARM: davinci: da850: Fix pwm name matching Sekhar Nori <nsekhar@ti.com> - 2016-10-31 11:20 +0100
    Re: [PATCH] ARM: davinci: da850: Fix pwm name matching David Lechner <david@lechnology.com> - 2016-10-31 15:50 +0100
      Re: [PATCH] ARM: davinci: da850: Fix pwm name matching Sekhar Nori <nsekhar@ti.com> - 2016-11-01 11:40 +0100
        Re: [PATCH] ARM: davinci: da850: Fix pwm name matching David Lechner <david@lechnology.com> - 2016-11-03 05:30 +0100

#1512454 — Re: [PATCH] ARM: davinci: da850: Fix pwm name matching

FromSekhar Nori <nsekhar@ti.com>
Date2016-10-31 11:20 +0100
SubjectRe: [PATCH] ARM: davinci: da850: Fix pwm name matching
Message-ID<syhR7-110-17@gated-at.bofh.it>
On Tuesday 25 October 2016 11:24 PM, David Lechner wrote:
> This fixes pwm name matching for DA850 familiy devices. When using device
> tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact
> same name, which caused errors when trying to register the devices.
> 
> The names for clock matching in da850_clks[] also have to be updated to
> to exactly match in order for the clock lookup to work correctly.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
> 
> Tested working on LEGO MINDSTORMS EV3.
> 
> 
>  arch/arm/mach-davinci/da850.c    | 10 +++++++---
>  arch/arm/mach-davinci/da8xx-dt.c | 10 +++++-----
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index ed3d0e9..6b78a8f 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {
>  	CLK("vpif",		NULL,		&vpif_clk),
>  	CLK("ahci_da850",		NULL,		&sata_clk),
>  	CLK("davinci-rproc.0",	NULL,		&dsp_clk),
> -	CLK("ehrpwm",		"fck",		&ehrpwm_clk),
> -	CLK("ehrpwm",		"tbclk",	&ehrpwm_tbclk),
> -	CLK("ecap",		"fck",		&ecap_clk),
> +	CLK("ehrpwm.0",		"fck",		&ehrpwm_clk),
> +	CLK("ehrpwm.0",		"tbclk",	&ehrpwm_tbclk),
> +	CLK("ehrpwm.1",		"fck",		&ehrpwm_clk),
> +	CLK("ehrpwm.1",		"tbclk",	&ehrpwm_tbclk),
> +	CLK("ecap.0",		"fck",		&ecap_clk),
> +	CLK("ecap.1",		"fck",		&ecap_clk),
> +	CLK("ecap.2",		"fck",		&ecap_clk),

This has exposed a limitation of DaVinci clock framework. The struct clk
are stored as a linked list themselves. So a node repeating in the table
above will create a loop in the linked list. This is easily seen on the
LCDK board. davinci_clk_disable_unused() never returns. PWMs are unused
on that board.

There is no "simple" solution to this AFAICS. One solution is to
separate the iterator from the clock hardware structure and use struct
clk_hw available in struct clk_lookup.

Or move DaVinci to common clock framework. This is of course preferred
but much more involved as all 6 supported SoCs have to be moved together.

Thanks,
Sekhar

[toc] | [next] | [standalone]


#1512590

FromDavid Lechner <david@lechnology.com>
Date2016-10-31 15:50 +0100
Message-ID<sym4q-3HL-27@gated-at.bofh.it>
In reply to#1512454
On 10/31/2016 05:18 AM, Sekhar Nori wrote:
> On Tuesday 25 October 2016 11:24 PM, David Lechner wrote:
>> This fixes pwm name matching for DA850 familiy devices. When using device
>> tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact
>> same name, which caused errors when trying to register the devices.
>>
>> The names for clock matching in da850_clks[] also have to be updated to
>> to exactly match in order for the clock lookup to work correctly.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>
>> Tested working on LEGO MINDSTORMS EV3.
>>
>>
>>  arch/arm/mach-davinci/da850.c    | 10 +++++++---
>>  arch/arm/mach-davinci/da8xx-dt.c | 10 +++++-----
>>  2 files changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
>> index ed3d0e9..6b78a8f 100644
>> --- a/arch/arm/mach-davinci/da850.c
>> +++ b/arch/arm/mach-davinci/da850.c
>> @@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {
>>  	CLK("vpif",		NULL,		&vpif_clk),
>>  	CLK("ahci_da850",		NULL,		&sata_clk),
>>  	CLK("davinci-rproc.0",	NULL,		&dsp_clk),
>> -	CLK("ehrpwm",		"fck",		&ehrpwm_clk),
>> -	CLK("ehrpwm",		"tbclk",	&ehrpwm_tbclk),
>> -	CLK("ecap",		"fck",		&ecap_clk),
>> +	CLK("ehrpwm.0",		"fck",		&ehrpwm_clk),
>> +	CLK("ehrpwm.0",		"tbclk",	&ehrpwm_tbclk),
>> +	CLK("ehrpwm.1",		"fck",		&ehrpwm_clk),
>> +	CLK("ehrpwm.1",		"tbclk",	&ehrpwm_tbclk),
>> +	CLK("ecap.0",		"fck",		&ecap_clk),
>> +	CLK("ecap.1",		"fck",		&ecap_clk),
>> +	CLK("ecap.2",		"fck",		&ecap_clk),
>
> This has exposed a limitation of DaVinci clock framework. The struct clk
> are stored as a linked list themselves. So a node repeating in the table
> above will create a loop in the linked list. This is easily seen on the
> LCDK board. davinci_clk_disable_unused() never returns. PWMs are unused
> on that board.
>
> There is no "simple" solution to this AFAICS. One solution is to
> separate the iterator from the clock hardware structure and use struct
> clk_hw available in struct clk_lookup.
>
> Or move DaVinci to common clock framework. This is of course preferred
> but much more involved as all 6 supported SoCs have to be moved together.
>
> Thanks,
> Sekhar
>
>

The simple solution for now could be to make child clocks for each of 
these that simply enable the parent clock. e.g. ehrpwm0_clk and 
ehpwm1_clk are children of ehrpwm_clk, etc.

Looking at da830.c, it looks like the solution was to make multiple 
clocks that use the same LPSC, but this does not seem right to me.

[toc] | [prev] | [next] | [standalone]


#1513206

FromSekhar Nori <nsekhar@ti.com>
Date2016-11-01 11:40 +0100
Message-ID<syEE2-7uL-21@gated-at.bofh.it>
In reply to#1512590
On Monday 31 October 2016 08:18 PM, David Lechner wrote:
> On 10/31/2016 05:18 AM, Sekhar Nori wrote:
>> On Tuesday 25 October 2016 11:24 PM, David Lechner wrote:
>>> This fixes pwm name matching for DA850 familiy devices. When using
>>> device
>>> tree, the da850_auxdata_lookup[] table caused pwm devices to have the
>>> exact
>>> same name, which caused errors when trying to register the devices.
>>>
>>> The names for clock matching in da850_clks[] also have to be updated to
>>> to exactly match in order for the clock lookup to work correctly.
>>>
>>> Signed-off-by: David Lechner <david@lechnology.com>
>>> ---
>>>
>>> Tested working on LEGO MINDSTORMS EV3.
>>>
>>>
>>>  arch/arm/mach-davinci/da850.c    | 10 +++++++---
>>>  arch/arm/mach-davinci/da8xx-dt.c | 10 +++++-----
>>>  2 files changed, 12 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-davinci/da850.c
>>> b/arch/arm/mach-davinci/da850.c
>>> index ed3d0e9..6b78a8f 100644
>>> --- a/arch/arm/mach-davinci/da850.c
>>> +++ b/arch/arm/mach-davinci/da850.c
>>> @@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {
>>>      CLK("vpif",        NULL,        &vpif_clk),
>>>      CLK("ahci_da850",        NULL,        &sata_clk),
>>>      CLK("davinci-rproc.0",    NULL,        &dsp_clk),
>>> -    CLK("ehrpwm",        "fck",        &ehrpwm_clk),
>>> -    CLK("ehrpwm",        "tbclk",    &ehrpwm_tbclk),
>>> -    CLK("ecap",        "fck",        &ecap_clk),
>>> +    CLK("ehrpwm.0",        "fck",        &ehrpwm_clk),
>>> +    CLK("ehrpwm.0",        "tbclk",    &ehrpwm_tbclk),
>>> +    CLK("ehrpwm.1",        "fck",        &ehrpwm_clk),
>>> +    CLK("ehrpwm.1",        "tbclk",    &ehrpwm_tbclk),
>>> +    CLK("ecap.0",        "fck",        &ecap_clk),
>>> +    CLK("ecap.1",        "fck",        &ecap_clk),
>>> +    CLK("ecap.2",        "fck",        &ecap_clk),
>>
>> This has exposed a limitation of DaVinci clock framework. The struct clk
>> are stored as a linked list themselves. So a node repeating in the table
>> above will create a loop in the linked list. This is easily seen on the
>> LCDK board. davinci_clk_disable_unused() never returns. PWMs are unused
>> on that board.
>>
>> There is no "simple" solution to this AFAICS. One solution is to
>> separate the iterator from the clock hardware structure and use struct
>> clk_hw available in struct clk_lookup.
>>
>> Or move DaVinci to common clock framework. This is of course preferred
>> but much more involved as all 6 supported SoCs have to be moved together.
>>
>> Thanks,
>> Sekhar
>>
>>
> 
> The simple solution for now could be to make child clocks for each of
> these that simply enable the parent clock. e.g. ehrpwm0_clk and
> ehpwm1_clk are children of ehrpwm_clk, etc.

That sounds good. I saw the v2 patch you sent and it looks good. I
noticed that aemif clock is repeated in da850.c too. That needs fixing.

> Looking at da830.c, it looks like the solution was to make multiple
> clocks that use the same LPSC, but this does not seem right to me.

The PWM clock definitions there are definitely wrong. It should be
fixed. Looks like its been like that forever.

Thanks,
Sekhar

[toc] | [prev] | [next] | [standalone]


#1514276

FromDavid Lechner <david@lechnology.com>
Date2016-11-03 05:30 +0100
Message-ID<szhP3-7mu-1@gated-at.bofh.it>
In reply to#1513206
On 11/01/2016 05:31 AM, Sekhar Nori wrote:
> On Monday 31 October 2016 08:18 PM, David Lechner wrote:
>> On 10/31/2016 05:18 AM, Sekhar Nori wrote:
>>> On Tuesday 25 October 2016 11:24 PM, David Lechner wrote:
>>>> This fixes pwm name matching for DA850 familiy devices. When using
>>>> device
>>>> tree, the da850_auxdata_lookup[] table caused pwm devices to have the
>>>> exact
>>>> same name, which caused errors when trying to register the devices.
>>>>
>>>> The names for clock matching in da850_clks[] also have to be updated to
>>>> to exactly match in order for the clock lookup to work correctly.
>>>>
>>>> Signed-off-by: David Lechner <david@lechnology.com>
>>>> ---
>>>>
>>>> Tested working on LEGO MINDSTORMS EV3.
>>>>
>>>>
>>>>  arch/arm/mach-davinci/da850.c    | 10 +++++++---
>>>>  arch/arm/mach-davinci/da8xx-dt.c | 10 +++++-----
>>>>  2 files changed, 12 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-davinci/da850.c
>>>> b/arch/arm/mach-davinci/da850.c
>>>> index ed3d0e9..6b78a8f 100644
>>>> --- a/arch/arm/mach-davinci/da850.c
>>>> +++ b/arch/arm/mach-davinci/da850.c
>>>> @@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {
>>>>      CLK("vpif",        NULL,        &vpif_clk),
>>>>      CLK("ahci_da850",        NULL,        &sata_clk),
>>>>      CLK("davinci-rproc.0",    NULL,        &dsp_clk),
>>>> -    CLK("ehrpwm",        "fck",        &ehrpwm_clk),
>>>> -    CLK("ehrpwm",        "tbclk",    &ehrpwm_tbclk),
>>>> -    CLK("ecap",        "fck",        &ecap_clk),
>>>> +    CLK("ehrpwm.0",        "fck",        &ehrpwm_clk),
>>>> +    CLK("ehrpwm.0",        "tbclk",    &ehrpwm_tbclk),
>>>> +    CLK("ehrpwm.1",        "fck",        &ehrpwm_clk),
>>>> +    CLK("ehrpwm.1",        "tbclk",    &ehrpwm_tbclk),
>>>> +    CLK("ecap.0",        "fck",        &ecap_clk),
>>>> +    CLK("ecap.1",        "fck",        &ecap_clk),
>>>> +    CLK("ecap.2",        "fck",        &ecap_clk),
>>>
>>> This has exposed a limitation of DaVinci clock framework. The struct clk
>>> are stored as a linked list themselves. So a node repeating in the table
>>> above will create a loop in the linked list. This is easily seen on the
>>> LCDK board. davinci_clk_disable_unused() never returns. PWMs are unused
>>> on that board.
>>>
>>> There is no "simple" solution to this AFAICS. One solution is to
>>> separate the iterator from the clock hardware structure and use struct
>>> clk_hw available in struct clk_lookup.
>>>
>>> Or move DaVinci to common clock framework. This is of course preferred
>>> but much more involved as all 6 supported SoCs have to be moved together.
>>>
>>> Thanks,
>>> Sekhar
>>>
>>>
>>
>> The simple solution for now could be to make child clocks for each of
>> these that simply enable the parent clock. e.g. ehrpwm0_clk and
>> ehpwm1_clk are children of ehrpwm_clk, etc.
>
> That sounds good. I saw the v2 patch you sent and it looks good. I
> noticed that aemif clock is repeated in da850.c too. That needs fixing.

Same with emac clock.

>> Looking at da830.c, it looks like the solution was to make multiple
>> clocks that use the same LPSC, but this does not seem right to me.
>
> The PWM clock definitions there are definitely wrong. It should be
> fixed. Looks like its been like that forever.
>
> Thanks,
> Sekhar
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web