* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
@ 2013-08-01 6:18 Boris BREZILLON
2013-08-12 13:52 ` Nicolas Ferre
0 siblings, 1 reply; 6+ messages in thread
From: Boris BREZILLON @ 2013-08-01 6:18 UTC (permalink / raw)
To: linux-arm-kernel
The AT91 PMC (Power Management Controller) provides an USB clock used by
USB Full Speed host (ohci) and USB Full Speed device (udc).
The usb drivers (ohci and udc) must configure this clock to 48Mhz.
This configuration was formely done in mach-at91/clock.c, but this
implementation will be removed when moving to common clk framework.
This patch adds support for usb clock retrieval and configuration, and is
backward compatible with the current at91 clk implementation (if usb clk
is not found, it does not configure/enable it).
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/usb/gadget/at91_udc.c | 17 ++++++++++++++++-
drivers/usb/gadget/at91_udc.h | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index fce8e4e..ae06585 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -870,6 +870,11 @@ static void clk_on(struct at91_udc *udc)
if (udc->clocked)
return;
udc->clocked = 1;
+
+ if (!IS_ERR(udc->uclk)) {
+ clk_set_rate(udc->uclk, 48000000);
+ clk_prepare_enable(udc->uclk);
+ }
clk_prepare_enable(udc->iclk);
clk_prepare_enable(udc->fclk);
}
@@ -882,6 +887,8 @@ static void clk_off(struct at91_udc *udc)
udc->gadget.speed = USB_SPEED_UNKNOWN;
clk_disable_unprepare(udc->fclk);
clk_disable_unprepare(udc->iclk);
+ if (!IS_ERR(udc->uclk))
+ clk_disable_unprepare(udc->uclk);
}
/*
@@ -1774,10 +1781,10 @@ static int at91udc_probe(struct platform_device *pdev)
/* get interface and function clocks */
udc->iclk = clk_get(dev, "udc_clk");
udc->fclk = clk_get(dev, "udpck");
+ udc->uclk = clk_get(dev, "usb_clk");
if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
DBG("clocks missing\n");
retval = -ENODEV;
- /* NOTE: we "know" here that refcounts on these are NOPs */
goto fail1;
}
@@ -1851,6 +1858,12 @@ fail3:
fail2:
free_irq(udc->udp_irq, udc);
fail1:
+ if (!IS_ERR(udc->uclk))
+ clk_put(udc->uclk);
+ if (!IS_ERR(udc->fclk))
+ clk_put(udc->fclk);
+ if (!IS_ERR(udc->iclk))
+ clk_put(udc->iclk);
iounmap(udc->udp_baseaddr);
fail0a:
if (cpu_is_at91rm9200())
@@ -1894,6 +1907,8 @@ static int __exit at91udc_remove(struct platform_device *pdev)
clk_put(udc->iclk);
clk_put(udc->fclk);
+ if (!IS_ERR(udc->uclk))
+ clk_put(udc->uclk);
return 0;
}
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h
index e647d1c..0175246 100644
--- a/drivers/usb/gadget/at91_udc.h
+++ b/drivers/usb/gadget/at91_udc.h
@@ -126,7 +126,7 @@ struct at91_udc {
unsigned active_suspend:1;
u8 addr;
struct at91_udc_data board;
- struct clk *iclk, *fclk;
+ struct clk *iclk, *fclk, *uclk;
struct platform_device *pdev;
struct proc_dir_entry *pde;
void __iomem *udp_baseaddr;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
2013-08-01 6:18 [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework Boris BREZILLON
@ 2013-08-12 13:52 ` Nicolas Ferre
2013-08-12 18:08 ` Felipe Balbi
2013-08-12 20:42 ` boris brezillon
0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Ferre @ 2013-08-12 13:52 UTC (permalink / raw)
To: linux-arm-kernel
On 01/08/2013 08:18, Boris BREZILLON :
> The AT91 PMC (Power Management Controller) provides an USB clock used by
> USB Full Speed host (ohci) and USB Full Speed device (udc).
> The usb drivers (ohci and udc) must configure this clock to 48Mhz.
> This configuration was formely done in mach-at91/clock.c, but this
> implementation will be removed when moving to common clk framework.
>
> This patch adds support for usb clock retrieval and configuration, and is
> backward compatible with the current at91 clk implementation (if usb clk
> is not found, it does not configure/enable it).
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/usb/gadget/at91_udc.c | 17 ++++++++++++++++-
> drivers/usb/gadget/at91_udc.h | 2 +-
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
> index fce8e4e..ae06585 100644
> --- a/drivers/usb/gadget/at91_udc.c
> +++ b/drivers/usb/gadget/at91_udc.c
> @@ -870,6 +870,11 @@ static void clk_on(struct at91_udc *udc)
> if (udc->clocked)
> return;
> udc->clocked = 1;
> +
> + if (!IS_ERR(udc->uclk)) {
> + clk_set_rate(udc->uclk, 48000000);
> + clk_prepare_enable(udc->uclk);
> + }
> clk_prepare_enable(udc->iclk);
> clk_prepare_enable(udc->fclk);
> }
> @@ -882,6 +887,8 @@ static void clk_off(struct at91_udc *udc)
> udc->gadget.speed = USB_SPEED_UNKNOWN;
> clk_disable_unprepare(udc->fclk);
> clk_disable_unprepare(udc->iclk);
> + if (!IS_ERR(udc->uclk))
> + clk_disable_unprepare(udc->uclk);
> }
>
> /*
> @@ -1774,10 +1781,10 @@ static int at91udc_probe(struct platform_device *pdev)
> /* get interface and function clocks */
> udc->iclk = clk_get(dev, "udc_clk");
> udc->fclk = clk_get(dev, "udpck");
> + udc->uclk = clk_get(dev, "usb_clk");
> if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
> DBG("clocks missing\n");
> retval = -ENODEV;
> - /* NOTE: we "know" here that refcounts on these are NOPs */
> goto fail1;
> }
>
> @@ -1851,6 +1858,12 @@ fail3:
> fail2:
> free_irq(udc->udp_irq, udc);
> fail1:
> + if (!IS_ERR(udc->uclk))
> + clk_put(udc->uclk);
> + if (!IS_ERR(udc->fclk))
> + clk_put(udc->fclk);
> + if (!IS_ERR(udc->iclk))
> + clk_put(udc->iclk);
> iounmap(udc->udp_baseaddr);
> fail0a:
> if (cpu_is_at91rm9200())
> @@ -1894,6 +1907,8 @@ static int __exit at91udc_remove(struct platform_device *pdev)
>
> clk_put(udc->iclk);
> clk_put(udc->fclk);
> + if (!IS_ERR(udc->uclk))
> + clk_put(udc->uclk);
>
> return 0;
> }
> diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h
> index e647d1c..0175246 100644
> --- a/drivers/usb/gadget/at91_udc.h
> +++ b/drivers/usb/gadget/at91_udc.h
> @@ -126,7 +126,7 @@ struct at91_udc {
> unsigned active_suspend:1;
> u8 addr;
> struct at91_udc_data board;
> - struct clk *iclk, *fclk;
> + struct clk *iclk, *fclk, *uclk;
> struct platform_device *pdev;
> struct proc_dir_entry *pde;
> void __iomem *udp_baseaddr;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
2013-08-12 13:52 ` Nicolas Ferre
@ 2013-08-12 18:08 ` Felipe Balbi
2013-08-12 20:46 ` boris brezillon
2013-08-12 20:42 ` boris brezillon
1 sibling, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2013-08-12 18:08 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 12, 2013 at 03:52:01PM +0200, Nicolas Ferre wrote:
> On 01/08/2013 08:18, Boris BREZILLON :
> >The AT91 PMC (Power Management Controller) provides an USB clock used by
> >USB Full Speed host (ohci) and USB Full Speed device (udc).
> >The usb drivers (ohci and udc) must configure this clock to 48Mhz.
> >This configuration was formely done in mach-at91/clock.c, but this
> >implementation will be removed when moving to common clk framework.
> >
> >This patch adds support for usb clock retrieval and configuration, and is
> >backward compatible with the current at91 clk implementation (if usb clk
> >is not found, it does not configure/enable it).
> >
> >Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
I don't have the original, where is it ? Was it not Cced to linux-usb ?
Can someone resend with Nicolas' Acked-by in place ?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130812/5aa45466/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
2013-08-12 13:52 ` Nicolas Ferre
2013-08-12 18:08 ` Felipe Balbi
@ 2013-08-12 20:42 ` boris brezillon
2013-08-13 7:06 ` Nicolas Ferre
1 sibling, 1 reply; 6+ messages in thread
From: boris brezillon @ 2013-08-12 20:42 UTC (permalink / raw)
To: linux-arm-kernel
Hello Nicolas,
On 12/08/2013 15:52, Nicolas Ferre wrote:
> On 01/08/2013 08:18, Boris BREZILLON :
>> The AT91 PMC (Power Management Controller) provides an USB clock used by
>> USB Full Speed host (ohci) and USB Full Speed device (udc).
>> The usb drivers (ohci and udc) must configure this clock to 48Mhz.
>> This configuration was formely done in mach-at91/clock.c, but this
>> implementation will be removed when moving to common clk framework.
>>
>> This patch adds support for usb clock retrieval and configuration,
>> and is
>> backward compatible with the current at91 clk implementation (if usb clk
>> is not found, it does not configure/enable it).
>>
>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
Is there a reason you acked this version but not the 3rd one
(https://lkml.org/lkml/2013/8/2/102).
>> ---
>> drivers/usb/gadget/at91_udc.c | 17 ++++++++++++++++-
>> drivers/usb/gadget/at91_udc.h | 2 +-
>> 2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/at91_udc.c
>> b/drivers/usb/gadget/at91_udc.c
>> index fce8e4e..ae06585 100644
>> --- a/drivers/usb/gadget/at91_udc.c
>> +++ b/drivers/usb/gadget/at91_udc.c
>> @@ -870,6 +870,11 @@ static void clk_on(struct at91_udc *udc)
>> if (udc->clocked)
>> return;
>> udc->clocked = 1;
>> +
>> + if (!IS_ERR(udc->uclk)) {
>> + clk_set_rate(udc->uclk, 48000000);
>> + clk_prepare_enable(udc->uclk);
>> + }
>> clk_prepare_enable(udc->iclk);
>> clk_prepare_enable(udc->fclk);
>> }
>> @@ -882,6 +887,8 @@ static void clk_off(struct at91_udc *udc)
>> udc->gadget.speed = USB_SPEED_UNKNOWN;
>> clk_disable_unprepare(udc->fclk);
>> clk_disable_unprepare(udc->iclk);
>> + if (!IS_ERR(udc->uclk))
>> + clk_disable_unprepare(udc->uclk);
>> }
>>
>> /*
>> @@ -1774,10 +1781,10 @@ static int at91udc_probe(struct
>> platform_device *pdev)
>> /* get interface and function clocks */
>> udc->iclk = clk_get(dev, "udc_clk");
>> udc->fclk = clk_get(dev, "udpck");
>> + udc->uclk = clk_get(dev, "usb_clk");
>> if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
>> DBG("clocks missing\n");
>> retval = -ENODEV;
>> - /* NOTE: we "know" here that refcounts on these are NOPs */
>> goto fail1;
>> }
>>
>> @@ -1851,6 +1858,12 @@ fail3:
>> fail2:
>> free_irq(udc->udp_irq, udc);
>> fail1:
>> + if (!IS_ERR(udc->uclk))
>> + clk_put(udc->uclk);
>> + if (!IS_ERR(udc->fclk))
>> + clk_put(udc->fclk);
>> + if (!IS_ERR(udc->iclk))
>> + clk_put(udc->iclk);
>> iounmap(udc->udp_baseaddr);
>> fail0a:
>> if (cpu_is_at91rm9200())
>> @@ -1894,6 +1907,8 @@ static int __exit at91udc_remove(struct
>> platform_device *pdev)
>>
>> clk_put(udc->iclk);
>> clk_put(udc->fclk);
>> + if (!IS_ERR(udc->uclk))
>> + clk_put(udc->uclk);
>>
>> return 0;
>> }
>> diff --git a/drivers/usb/gadget/at91_udc.h
>> b/drivers/usb/gadget/at91_udc.h
>> index e647d1c..0175246 100644
>> --- a/drivers/usb/gadget/at91_udc.h
>> +++ b/drivers/usb/gadget/at91_udc.h
>> @@ -126,7 +126,7 @@ struct at91_udc {
>> unsigned active_suspend:1;
>> u8 addr;
>> struct at91_udc_data board;
>> - struct clk *iclk, *fclk;
>> + struct clk *iclk, *fclk, *uclk;
>> struct platform_device *pdev;
>> struct proc_dir_entry *pde;
>> void __iomem *udp_baseaddr;
>>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
2013-08-12 18:08 ` Felipe Balbi
@ 2013-08-12 20:46 ` boris brezillon
0 siblings, 0 replies; 6+ messages in thread
From: boris brezillon @ 2013-08-12 20:46 UTC (permalink / raw)
To: linux-arm-kernel
Hello Felipe
On 12/08/2013 20:08, Felipe Balbi wrote:
> On Mon, Aug 12, 2013 at 03:52:01PM +0200, Nicolas Ferre wrote:
>> On 01/08/2013 08:18, Boris BREZILLON :
>>> The AT91 PMC (Power Management Controller) provides an USB clock used by
>>> USB Full Speed host (ohci) and USB Full Speed device (udc).
>>> The usb drivers (ohci and udc) must configure this clock to 48Mhz.
>>> This configuration was formely done in mach-at91/clock.c, but this
>>> implementation will be removed when moving to common clk framework.
>>>
>>> This patch adds support for usb clock retrieval and configuration, and is
>>> backward compatible with the current at91 clk implementation (if usb clk
>>> is not found, it does not configure/enable it).
>>>
>>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> I don't have the original, where is it ? Was it not Cced to linux-usb ?
> Can someone resend with Nicolas' Acked-by in place ?
>
This mail was sent to linux-usb at vger.kernel.org and to you (balbi at ti.com).
It may have been filtered.
Anyway, you asked me to rework the 2nd version (which I did).
I think it's better to review the 3rd one
(https://lkml.org/lkml/2013/8/2/102).
Best Regards,
Boris
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework
2013-08-12 20:42 ` boris brezillon
@ 2013-08-13 7:06 ` Nicolas Ferre
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2013-08-13 7:06 UTC (permalink / raw)
To: linux-arm-kernel
On 12/08/2013 22:42, boris brezillon :
> Hello Nicolas,
>
> On 12/08/2013 15:52, Nicolas Ferre wrote:
>> On 01/08/2013 08:18, Boris BREZILLON :
>>> The AT91 PMC (Power Management Controller) provides an USB clock used by
>>> USB Full Speed host (ohci) and USB Full Speed device (udc).
>>> The usb drivers (ohci and udc) must configure this clock to 48Mhz.
>>> This configuration was formely done in mach-at91/clock.c, but this
>>> implementation will be removed when moving to common clk framework.
>>>
>>> This patch adds support for usb clock retrieval and configuration,
>>> and is
>>> backward compatible with the current at91 clk implementation (if usb clk
>>> is not found, it does not configure/enable it).
>>>
>>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
> Is there a reason you acked this version but not the 3rd one
> (https://lkml.org/lkml/2013/8/2/102).
No, only flow of emails while getting back online ;-)
Bye,
>>> ---
>>> drivers/usb/gadget/at91_udc.c | 17 ++++++++++++++++-
>>> drivers/usb/gadget/at91_udc.h | 2 +-
>>> 2 files changed, 17 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/gadget/at91_udc.c
>>> b/drivers/usb/gadget/at91_udc.c
>>> index fce8e4e..ae06585 100644
>>> --- a/drivers/usb/gadget/at91_udc.c
>>> +++ b/drivers/usb/gadget/at91_udc.c
>>> @@ -870,6 +870,11 @@ static void clk_on(struct at91_udc *udc)
>>> if (udc->clocked)
>>> return;
>>> udc->clocked = 1;
>>> +
>>> + if (!IS_ERR(udc->uclk)) {
>>> + clk_set_rate(udc->uclk, 48000000);
>>> + clk_prepare_enable(udc->uclk);
>>> + }
>>> clk_prepare_enable(udc->iclk);
>>> clk_prepare_enable(udc->fclk);
>>> }
>>> @@ -882,6 +887,8 @@ static void clk_off(struct at91_udc *udc)
>>> udc->gadget.speed = USB_SPEED_UNKNOWN;
>>> clk_disable_unprepare(udc->fclk);
>>> clk_disable_unprepare(udc->iclk);
>>> + if (!IS_ERR(udc->uclk))
>>> + clk_disable_unprepare(udc->uclk);
>>> }
>>>
>>> /*
>>> @@ -1774,10 +1781,10 @@ static int at91udc_probe(struct
>>> platform_device *pdev)
>>> /* get interface and function clocks */
>>> udc->iclk = clk_get(dev, "udc_clk");
>>> udc->fclk = clk_get(dev, "udpck");
>>> + udc->uclk = clk_get(dev, "usb_clk");
>>> if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
>>> DBG("clocks missing\n");
>>> retval = -ENODEV;
>>> - /* NOTE: we "know" here that refcounts on these are NOPs */
>>> goto fail1;
>>> }
>>>
>>> @@ -1851,6 +1858,12 @@ fail3:
>>> fail2:
>>> free_irq(udc->udp_irq, udc);
>>> fail1:
>>> + if (!IS_ERR(udc->uclk))
>>> + clk_put(udc->uclk);
>>> + if (!IS_ERR(udc->fclk))
>>> + clk_put(udc->fclk);
>>> + if (!IS_ERR(udc->iclk))
>>> + clk_put(udc->iclk);
>>> iounmap(udc->udp_baseaddr);
>>> fail0a:
>>> if (cpu_is_at91rm9200())
>>> @@ -1894,6 +1907,8 @@ static int __exit at91udc_remove(struct
>>> platform_device *pdev)
>>>
>>> clk_put(udc->iclk);
>>> clk_put(udc->fclk);
>>> + if (!IS_ERR(udc->uclk))
>>> + clk_put(udc->uclk);
>>>
>>> return 0;
>>> }
>>> diff --git a/drivers/usb/gadget/at91_udc.h
>>> b/drivers/usb/gadget/at91_udc.h
>>> index e647d1c..0175246 100644
>>> --- a/drivers/usb/gadget/at91_udc.h
>>> +++ b/drivers/usb/gadget/at91_udc.h
>>> @@ -126,7 +126,7 @@ struct at91_udc {
>>> unsigned active_suspend:1;
>>> u8 addr;
>>> struct at91_udc_data board;
>>> - struct clk *iclk, *fclk;
>>> + struct clk *iclk, *fclk, *uclk;
>>> struct platform_device *pdev;
>>> struct proc_dir_entry *pde;
>>> void __iomem *udp_baseaddr;
>>>
>>
>>
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-13 7:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 6:18 [PATCH] usb: gadget: at91_udc: add usb_clk for transition to common clk framework Boris BREZILLON
2013-08-12 13:52 ` Nicolas Ferre
2013-08-12 18:08 ` Felipe Balbi
2013-08-12 20:46 ` boris brezillon
2013-08-12 20:42 ` boris brezillon
2013-08-13 7:06 ` Nicolas Ferre
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).