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


Groups > linux.kernel > #1439170 > unrolled thread

[PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

Started byJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
First post2016-07-08 10:20 +0200
Last post2016-07-11 23:10 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> - 2016-07-08 10:20 +0200
    Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via  dt Michael Turquette <mturquette@baylibre.com> - 2016-07-08 19:20 +0200
      Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency  setting via dt Jorge Ramirez <jorge.ramirez-ortiz@linaro.org> - 2016-07-08 23:50 +0200
        Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via  dt Michael Turquette <mturquette@baylibre.com> - 2016-07-09 02:30 +0200
          Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency  setting via dt Stephen Boyd <sboyd@codeaurora.org> - 2016-07-09 02:50 +0200
            Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency  setting via dt Jorge Ramirez <jorge.ramirez-ortiz@linaro.org> - 2016-07-09 08:50 +0200
              Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency  setting via dt Stephen Boyd <sboyd@codeaurora.org> - 2016-07-11 23:10 +0200

#1439170 — [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Date2016-07-08 10:20 +0200
Subject[PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSzaW-29Y-11@gated-at.bofh.it>
Allow to specify the clock frequency for any given port via the
assigned-clock-rates device tree property.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 1b7331e..51867ab 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -55,6 +55,7 @@
 #include <linux/types.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/clk/clk-conf.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/sizes.h>
 #include <linux/io.h>
@@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
 	if (IS_ERR(uap->clk))
 		return PTR_ERR(uap->clk);
 
+	ret = of_clk_set_defaults(dev->dev.of_node, false);
+	if (ret < 0)
+		return ret;
+
 	uap->reg_offset = vendor->reg_offset;
 	uap->vendor = vendor;
 	uap->fifosize = vendor->get_fifosize(dev);
-- 
2.7.4

[toc] | [next] | [standalone]


#1439700 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromMichael Turquette <mturquette@baylibre.com>
Date2016-07-08 19:20 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSHBw-7JO-15@gated-at.bofh.it>
In reply to#1439170
Quoting Jorge Ramirez-Ortiz (2016-07-08 01:11:06)
> Allow to specify the clock frequency for any given port via the
> assigned-clock-rates device tree property.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  drivers/tty/serial/amba-pl011.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 1b7331e..51867ab 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -55,6 +55,7 @@
>  #include <linux/types.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> +#include <linux/clk/clk-conf.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/sizes.h>
>  #include <linux/io.h>
> @@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>         if (IS_ERR(uap->clk))
>                 return PTR_ERR(uap->clk);
>  
> +       ret = of_clk_set_defaults(dev->dev.of_node, false);

Change looks good to me, but with one question: should this change be
put into more generic code instead of in this specific driver? For
instance, we call of_clk_set_defaults from the following files:

drivers/base/platform.c
drivers/i2c/i2c-core.c
drivers/spi/spi.c

And Stephen posted a patch to do this for devices on the AMBA bus:

https://patchwork.kernel.org/patch/6501691/

Does Stephen's patch mean that you do not need patch #1? Stephen, any
update on what happened to this patch?

Thanks,
Mike

> +       if (ret < 0)
> +               return ret;
> +
>         uap->reg_offset = vendor->reg_offset;
>         uap->vendor = vendor;
>         uap->fifosize = vendor->get_fifosize(dev);
> -- 
> 2.7.4
> 

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


#1439809 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromJorge Ramirez <jorge.ramirez-ortiz@linaro.org>
Date2016-07-08 23:50 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSLON-23d-3@gated-at.bofh.it>
In reply to#1439700
On 07/08/2016 07:14 PM, Michael Turquette wrote:
> Quoting Jorge Ramirez-Ortiz (2016-07-08 01:11:06)
>> Allow to specify the clock frequency for any given port via the
>> assigned-clock-rates device tree property.
>>
>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>> Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>> ---
>>   drivers/tty/serial/amba-pl011.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>> index 1b7331e..51867ab 100644
>> --- a/drivers/tty/serial/amba-pl011.c
>> +++ b/drivers/tty/serial/amba-pl011.c
>> @@ -55,6 +55,7 @@
>>   #include <linux/types.h>
>>   #include <linux/of.h>
>>   #include <linux/of_device.h>
>> +#include <linux/clk/clk-conf.h>
>>   #include <linux/pinctrl/consumer.h>
>>   #include <linux/sizes.h>
>>   #include <linux/io.h>
>> @@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>>          if (IS_ERR(uap->clk))
>>                  return PTR_ERR(uap->clk);
>>   
>> +       ret = of_clk_set_defaults(dev->dev.of_node, false);
> Change looks good to me, but with one question: should this change be
> put into more generic code instead of in this specific driver? For
> instance, we call of_clk_set_defaults from the following files:
>
> drivers/base/platform.c
> drivers/i2c/i2c-core.c
> drivers/spi/spi.c
>
> And Stephen posted a patch to do this for devices on the AMBA bus:
>
> https://patchwork.kernel.org/patch/6501691/
>
> Does Stephen's patch mean that you do not need patch #1?

I did a quick test (replaced my changes with the patch above) and the 
console broke and the BT stack couldn't communicate to the device over 
the uart...I guess something else needs doing on top of Stephen's change.

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


#1439856 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromMichael Turquette <mturquette@baylibre.com>
Date2016-07-09 02:30 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSOjE-3KG-1@gated-at.bofh.it>
In reply to#1439809
Quoting Jorge Ramirez (2016-07-08 14:39:50)
> On 07/08/2016 07:14 PM, Michael Turquette wrote:
> > Quoting Jorge Ramirez-Ortiz (2016-07-08 01:11:06)
> >> Allow to specify the clock frequency for any given port via the
> >> assigned-clock-rates device tree property.
> >>
> >> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> >> Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> >> ---
> >>   drivers/tty/serial/amba-pl011.c | 5 +++++
> >>   1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> >> index 1b7331e..51867ab 100644
> >> --- a/drivers/tty/serial/amba-pl011.c
> >> +++ b/drivers/tty/serial/amba-pl011.c
> >> @@ -55,6 +55,7 @@
> >>   #include <linux/types.h>
> >>   #include <linux/of.h>
> >>   #include <linux/of_device.h>
> >> +#include <linux/clk/clk-conf.h>
> >>   #include <linux/pinctrl/consumer.h>
> >>   #include <linux/sizes.h>
> >>   #include <linux/io.h>
> >> @@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
> >>          if (IS_ERR(uap->clk))
> >>                  return PTR_ERR(uap->clk);
> >>   
> >> +       ret = of_clk_set_defaults(dev->dev.of_node, false);
> > Change looks good to me, but with one question: should this change be
> > put into more generic code instead of in this specific driver? For
> > instance, we call of_clk_set_defaults from the following files:
> >
> > drivers/base/platform.c
> > drivers/i2c/i2c-core.c
> > drivers/spi/spi.c
> >
> > And Stephen posted a patch to do this for devices on the AMBA bus:
> >
> > https://patchwork.kernel.org/patch/6501691/
> >
> > Does Stephen's patch mean that you do not need patch #1?
> 
> I did a quick test (replaced my changes with the patch above) and the 
> console broke and the BT stack couldn't communicate to the device over 
> the uart...I guess something else needs doing on top of Stephen's change.
> 

Let's give Stephen a chance to respond. If he doesn't soon then I'm OK
to merge your two patches.

Regards,
Mike

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


#1439860 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-07-09 02:50 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSOCZ-3U2-5@gated-at.bofh.it>
In reply to#1439856
On 07/08/2016 05:23 PM, Michael Turquette wrote:
> Quoting Jorge Ramirez (2016-07-08 14:39:50)
>> On 07/08/2016 07:14 PM, Michael Turquette wrote:
>>> Quoting Jorge Ramirez-Ortiz (2016-07-08 01:11:06)
>>>> Allow to specify the clock frequency for any given port via the
>>>> assigned-clock-rates device tree property.
>>>>
>>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>>>> Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>>>> ---
>>>>   drivers/tty/serial/amba-pl011.c | 5 +++++
>>>>   1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>>>> index 1b7331e..51867ab 100644
>>>> --- a/drivers/tty/serial/amba-pl011.c
>>>> +++ b/drivers/tty/serial/amba-pl011.c
>>>> @@ -55,6 +55,7 @@
>>>>   #include <linux/types.h>
>>>>   #include <linux/of.h>
>>>>   #include <linux/of_device.h>
>>>> +#include <linux/clk/clk-conf.h>
>>>>   #include <linux/pinctrl/consumer.h>
>>>>   #include <linux/sizes.h>
>>>>   #include <linux/io.h>
>>>> @@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>>>>          if (IS_ERR(uap->clk))
>>>>                  return PTR_ERR(uap->clk);
>>>>   
>>>> +       ret = of_clk_set_defaults(dev->dev.of_node, false);
>>> Change looks good to me, but with one question: should this change be
>>> put into more generic code instead of in this specific driver? For
>>> instance, we call of_clk_set_defaults from the following files:
>>>
>>> drivers/base/platform.c
>>> drivers/i2c/i2c-core.c
>>> drivers/spi/spi.c
>>>
>>> And Stephen posted a patch to do this for devices on the AMBA bus:
>>>
>>> https://patchwork.kernel.org/patch/6501691/
>>>
>>> Does Stephen's patch mean that you do not need patch #1?
>> I did a quick test (replaced my changes with the patch above) and the 
>> console broke and the BT stack couldn't communicate to the device over 
>> the uart...I guess something else needs doing on top of Stephen's change.
>>
> Let's give Stephen a chance to respond. If he doesn't soon then I'm OK
> to merge your two patches.
>


Yeah we need to restart that patch. It's been in my "pending" list for a
year now it seems.

Curious why it broke things, perhaps device probe is failing when it
didn't fail before?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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


#1439900 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromJorge Ramirez <jorge.ramirez-ortiz@linaro.org>
Date2016-07-09 08:50 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rSUfn-7IK-1@gated-at.bofh.it>
In reply to#1439860
On 07/09/2016 02:43 AM, Stephen Boyd wrote:
> On 07/08/2016 05:23 PM, Michael Turquette wrote:
>> Quoting Jorge Ramirez (2016-07-08 14:39:50)
>>> On 07/08/2016 07:14 PM, Michael Turquette wrote:
>>>> Quoting Jorge Ramirez-Ortiz (2016-07-08 01:11:06)
>>>>> Allow to specify the clock frequency for any given port via the
>>>>> assigned-clock-rates device tree property.
>>>>>
>>>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>>>>> Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>>>>> ---
>>>>>    drivers/tty/serial/amba-pl011.c | 5 +++++
>>>>>    1 file changed, 5 insertions(+)
>>>>>
>>>>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>>>>> index 1b7331e..51867ab 100644
>>>>> --- a/drivers/tty/serial/amba-pl011.c
>>>>> +++ b/drivers/tty/serial/amba-pl011.c
>>>>> @@ -55,6 +55,7 @@
>>>>>    #include <linux/types.h>
>>>>>    #include <linux/of.h>
>>>>>    #include <linux/of_device.h>
>>>>> +#include <linux/clk/clk-conf.h>
>>>>>    #include <linux/pinctrl/consumer.h>
>>>>>    #include <linux/sizes.h>
>>>>>    #include <linux/io.h>
>>>>> @@ -2472,6 +2473,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>>>>>           if (IS_ERR(uap->clk))
>>>>>                   return PTR_ERR(uap->clk);
>>>>>    
>>>>> +       ret = of_clk_set_defaults(dev->dev.of_node, false);
>>>> Change looks good to me, but with one question: should this change be
>>>> put into more generic code instead of in this specific driver? For
>>>> instance, we call of_clk_set_defaults from the following files:
>>>>
>>>> drivers/base/platform.c
>>>> drivers/i2c/i2c-core.c
>>>> drivers/spi/spi.c
>>>>
>>>> And Stephen posted a patch to do this for devices on the AMBA bus:
>>>>
>>>> https://patchwork.kernel.org/patch/6501691/
>>>>
>>>> Does Stephen's patch mean that you do not need patch #1?
>>> I did a quick test (replaced my changes with the patch above) and the
>>> console broke and the BT stack couldn't communicate to the device over
>>> the uart...I guess something else needs doing on top of Stephen's change.
>>>
>> Let's give Stephen a chance to respond. If he doesn't soon then I'm OK
>> to merge your two patches.
>>
>
> Yeah we need to restart that patch. It's been in my "pending" list for a
> year now it seems.
>
> Curious why it broke things, perhaps device probe is failing when it
> didn't fail before?
>

um, I retested again this morning and it is all good - I was also a bit 
surprised when things failed yesterday  (it seems one of the wires on my 
board was loose, sorry).

So AFAIC your patch addresses the issue in a much generic (better) way 
and there are no regressions on a HiKey board running a 4.4 kernel.

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


#1440909 — Re: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-07-11 23:10 +0200
SubjectRe: [PATCH 1/2] tty: amba-pl011: add support for clock frequency setting via dt
Message-ID<rTQCK-3Y9-25@gated-at.bofh.it>
In reply to#1439900
On 07/10, Jorge Ramirez Ortiz wrote:
> On 9 July 2016 at 08:42, Jorge Ramirez <jorge.ramirez-ortiz@linaro.org>
> > um, I retested again this morning and it is all good - I was also a bit
> > surprised when things failed yesterday  (it seems one of the wires on my
> > board was loose, sorry).
> >
> > So AFAIC your patch addresses the issue in a much generic (better) way and
> > there are no regressions on a HiKey board running a 4.4 kernel.
> >
> >
> >
> 
> Stephen, will you post your patch again? how do we progress the change set
> (ie your patch & the hikey device tree change)?

Yes I'll post it again today and put it in Russell's patch
tracker soon after that. I assume there isn't any concern with
the patch and it works for you so it would be good to have your
Tested-by too.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web