* [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe
@ 2014-05-08 10:06 David Jander
2014-05-22 13:32 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: David Jander @ 2014-05-08 10:06 UTC (permalink / raw)
To: linux-arm-kernel
tc_mode() can be called from interrupt context and thus must not call
clk_*prepare*() functions.
Signed-off-by: David Jander <david@protonic.nl>
---
drivers/clocksource/tcb_clksrc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 00fdd11..a8d7ea1 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
|| tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
__raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
__raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
- clk_disable_unprepare(tcd->clk);
+ clk_disable(tcd->clk);
}
switch (m) {
@@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
* of oneshot, we get lower overhead and improved accuracy.
*/
case CLOCK_EVT_MODE_PERIODIC:
- clk_prepare_enable(tcd->clk);
+ clk_enable(tcd->clk);
/* slow clock, count up to RC, then irq and restart */
__raw_writel(timer_clock
@@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
break;
case CLOCK_EVT_MODE_ONESHOT:
- clk_prepare_enable(tcd->clk);
+ clk_enable(tcd->clk);
/* slow clock, count up to RC, then irq and stop */
__raw_writel(timer_clock | ATMEL_TC_CPCSTOP
@@ -194,7 +194,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
ret = clk_prepare_enable(t2_clk);
if (ret)
return ret;
- clk_disable_unprepare(t2_clk);
+ clk_disable(t2_clk);
clkevt.regs = tc->regs;
clkevt.clk = t2_clk;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe
2014-05-08 10:06 [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe David Jander
@ 2014-05-22 13:32 ` Alexandre Belloni
2014-05-22 16:33 ` Nicolas Ferre
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2014-05-22 13:32 UTC (permalink / raw)
To: linux-arm-kernel
On 08/05/2014 at 12:06:25 +0200, David Jander wrote :
> tc_mode() can be called from interrupt context and thus must not call
> clk_*prepare*() functions.
>
> Signed-off-by: David Jander <david@protonic.nl>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/clocksource/tcb_clksrc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
> index 00fdd11..a8d7ea1 100644
> --- a/drivers/clocksource/tcb_clksrc.c
> +++ b/drivers/clocksource/tcb_clksrc.c
> @@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
> __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
> __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
> - clk_disable_unprepare(tcd->clk);
> + clk_disable(tcd->clk);
> }
>
> switch (m) {
> @@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> * of oneshot, we get lower overhead and improved accuracy.
> */
> case CLOCK_EVT_MODE_PERIODIC:
> - clk_prepare_enable(tcd->clk);
> + clk_enable(tcd->clk);
>
> /* slow clock, count up to RC, then irq and restart */
> __raw_writel(timer_clock
> @@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
> break;
>
> case CLOCK_EVT_MODE_ONESHOT:
> - clk_prepare_enable(tcd->clk);
> + clk_enable(tcd->clk);
>
> /* slow clock, count up to RC, then irq and stop */
> __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
> @@ -194,7 +194,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
> ret = clk_prepare_enable(t2_clk);
> if (ret)
> return ret;
> - clk_disable_unprepare(t2_clk);
> + clk_disable(t2_clk);
>
> clkevt.regs = tc->regs;
> clkevt.clk = t2_clk;
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe
2014-05-22 13:32 ` Alexandre Belloni
@ 2014-05-22 16:33 ` Nicolas Ferre
2014-05-22 16:56 ` Daniel Lezcano
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2014-05-22 16:33 UTC (permalink / raw)
To: linux-arm-kernel
On 22/05/2014 15:32, Alexandre Belloni :
> On 08/05/2014 at 12:06:25 +0200, David Jander wrote :
>> tc_mode() can be called from interrupt context and thus must not call
>> clk_*prepare*() functions.
>>
>> Signed-off-by: David Jander <david@protonic.nl>
>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Ok, indeed. We keep the clocks prepared for the system lifetime.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Daniel, can you please take this fix (do you want me to re-send it)?
Bye,
>> ---
>> drivers/clocksource/tcb_clksrc.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
>> index 00fdd11..a8d7ea1 100644
>> --- a/drivers/clocksource/tcb_clksrc.c
>> +++ b/drivers/clocksource/tcb_clksrc.c
>> @@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>> || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
>> __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
>> __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
>> - clk_disable_unprepare(tcd->clk);
>> + clk_disable(tcd->clk);
>> }
>>
>> switch (m) {
>> @@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>> * of oneshot, we get lower overhead and improved accuracy.
>> */
>> case CLOCK_EVT_MODE_PERIODIC:
>> - clk_prepare_enable(tcd->clk);
>> + clk_enable(tcd->clk);
>>
>> /* slow clock, count up to RC, then irq and restart */
>> __raw_writel(timer_clock
>> @@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>> break;
>>
>> case CLOCK_EVT_MODE_ONESHOT:
>> - clk_prepare_enable(tcd->clk);
>> + clk_enable(tcd->clk);
>>
>> /* slow clock, count up to RC, then irq and stop */
>> __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
>> @@ -194,7 +194,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
>> ret = clk_prepare_enable(t2_clk);
>> if (ret)
>> return ret;
>> - clk_disable_unprepare(t2_clk);
>> + clk_disable(t2_clk);
>>
>> clkevt.regs = tc->regs;
>> clkevt.clk = t2_clk;
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe
2014-05-22 16:33 ` Nicolas Ferre
@ 2014-05-22 16:56 ` Daniel Lezcano
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2014-05-22 16:56 UTC (permalink / raw)
To: linux-arm-kernel
On 05/22/2014 06:33 PM, Nicolas Ferre wrote:
> On 22/05/2014 15:32, Alexandre Belloni :
>> On 08/05/2014 at 12:06:25 +0200, David Jander wrote :
>>> tc_mode() can be called from interrupt context and thus must not call
>>> clk_*prepare*() functions.
>>>
>>> Signed-off-by: David Jander <david@protonic.nl>
>>
>> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>
> Ok, indeed. We keep the clocks prepared for the system lifetime.
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> Daniel, can you please take this fix (do you want me to re-send it)?
It is ok, I applied it as a 3.15 fix.
Thanks
-- Daniel
>>> ---
>>> drivers/clocksource/tcb_clksrc.c | 8 ++++----
>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
>>> index 00fdd11..a8d7ea1 100644
>>> --- a/drivers/clocksource/tcb_clksrc.c
>>> +++ b/drivers/clocksource/tcb_clksrc.c
>>> @@ -100,7 +100,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>>> || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
>>> __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
>>> __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
>>> - clk_disable_unprepare(tcd->clk);
>>> + clk_disable(tcd->clk);
>>> }
>>>
>>> switch (m) {
>>> @@ -109,7 +109,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>>> * of oneshot, we get lower overhead and improved accuracy.
>>> */
>>> case CLOCK_EVT_MODE_PERIODIC:
>>> - clk_prepare_enable(tcd->clk);
>>> + clk_enable(tcd->clk);
>>>
>>> /* slow clock, count up to RC, then irq and restart */
>>> __raw_writel(timer_clock
>>> @@ -126,7 +126,7 @@ static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
>>> break;
>>>
>>> case CLOCK_EVT_MODE_ONESHOT:
>>> - clk_prepare_enable(tcd->clk);
>>> + clk_enable(tcd->clk);
>>>
>>> /* slow clock, count up to RC, then irq and stop */
>>> __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
>>> @@ -194,7 +194,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
>>> ret = clk_prepare_enable(t2_clk);
>>> if (ret)
>>> return ret;
>>> - clk_disable_unprepare(t2_clk);
>>> + clk_disable(t2_clk);
>>>
>>> clkevt.regs = tc->regs;
>>> clkevt.clk = t2_clk;
>>> --
>>> 1.9.1
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
>
>
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-22 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 10:06 [PATCH] ARM AT91: clocksource tcb_clksrc.c: make tc_mode interrupt safe David Jander
2014-05-22 13:32 ` Alexandre Belloni
2014-05-22 16:33 ` Nicolas Ferre
2014-05-22 16:56 ` Daniel Lezcano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.