* [PATCH v4 0/3] clocksource: timer-atmel-pit: driver cleanups
@ 2016-09-09 11:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Boris Brezillon, Nicolas Ferre, linux-arm-kernel, linux-kernel,
Alexandre Belloni
Hi Daniel,
This is just the cleanup part of the previous seris as the fix has been applied.
It is rebased on top of v4.8-rc5 and should apply cleanly.
Alexandre Belloni (3):
clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init
clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE
clocksource: timer-atmel-pit: simplify IRQ handler
drivers/clocksource/timer-atmel-pit.c | 96 ++++++++++++++---------------------
1 file changed, 37 insertions(+), 59 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 0/3] clocksource: timer-atmel-pit: driver cleanups
@ 2016-09-09 11:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: linux-arm-kernel
Hi Daniel,
This is just the cleanup part of the previous seris as the fix has been applied.
It is rebased on top of v4.8-rc5 and should apply cleanly.
Alexandre Belloni (3):
clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init
clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE
clocksource: timer-atmel-pit: simplify IRQ handler
drivers/clocksource/timer-atmel-pit.c | 96 ++++++++++++++---------------------
1 file changed, 37 insertions(+), 59 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/3] clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init
2016-09-09 11:13 ` Alexandre Belloni
@ 2016-09-09 11:13 ` Alexandre Belloni
-1 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Boris Brezillon, Nicolas Ferre, linux-arm-kernel, linux-kernel,
Alexandre Belloni
Merge at91sam926x_pit_common_init in at91sam926x_pit_dt_init as this is the
only initialization method now.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 79 +++++++++++++++--------------------
1 file changed, 34 insertions(+), 45 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 7f0f5b26d8c5..da7e6d4eef4d 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -177,11 +177,41 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
/*
* Set up both clocksource and clockevent support.
*/
-static int __init at91sam926x_pit_common_init(struct pit_data *data)
+static int __init at91sam926x_pit_dt_init(struct device_node *node)
{
- unsigned long pit_rate;
- unsigned bits;
- int ret;
+ unsigned long pit_rate;
+ unsigned bits;
+ int ret;
+ struct pit_data *data;
+
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ data->base = of_iomap(node, 0);
+ if (!data->base) {
+ pr_err("Could not map PIT address\n");
+ return -ENXIO;
+ }
+
+ data->mck = of_clk_get(node, 0);
+ if (IS_ERR(data->mck)) {
+ pr_err("Unable to get mck clk\n");
+ return PTR_ERR(data->mck);
+ }
+
+ ret = clk_prepare_enable(data->mck);
+ if (ret) {
+ pr_err("Unable to enable mck\n");
+ return ret;
+ }
+
+ /* Get the interrupts property */
+ data->irq = irq_of_parse_and_map(node, 0);
+ if (!data->irq) {
+ pr_err("Unable to get IRQ from DT\n");
+ return -EINVAL;
+ }
/*
* Use our actual MCK to figure out how many MCK/16 ticks per
@@ -236,46 +266,5 @@ static int __init at91sam926x_pit_common_init(struct pit_data *data)
return 0;
}
-
-static int __init at91sam926x_pit_dt_init(struct device_node *node)
-{
- struct pit_data *data;
- int ret;
-
- data = kzalloc(sizeof(*data), GFP_KERNEL);
- if (!data)
- return -ENOMEM;
-
- data->base = of_iomap(node, 0);
- if (!data->base) {
- pr_err("Could not map PIT address\n");
- return -ENXIO;
- }
-
- data->mck = of_clk_get(node, 0);
- if (IS_ERR(data->mck))
- /* Fallback on clkdev for !CCF-based boards */
- data->mck = clk_get(NULL, "mck");
-
- if (IS_ERR(data->mck)) {
- pr_err("Unable to get mck clk\n");
- return PTR_ERR(data->mck);
- }
-
- ret = clk_prepare_enable(data->mck);
- if (ret) {
- pr_err("Unable to enable mck\n");
- return ret;
- }
-
- /* Get the interrupts property */
- data->irq = irq_of_parse_and_map(node, 0);
- if (!data->irq) {
- pr_err("Unable to get IRQ from DT\n");
- return -EINVAL;
- }
-
- return at91sam926x_pit_common_init(data);
-}
CLOCKSOURCE_OF_DECLARE(at91sam926x_pit, "atmel,at91sam9260-pit",
at91sam926x_pit_dt_init);
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 1/3] clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init
@ 2016-09-09 11:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: linux-arm-kernel
Merge at91sam926x_pit_common_init in at91sam926x_pit_dt_init as this is the
only initialization method now.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 79 +++++++++++++++--------------------
1 file changed, 34 insertions(+), 45 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 7f0f5b26d8c5..da7e6d4eef4d 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -177,11 +177,41 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
/*
* Set up both clocksource and clockevent support.
*/
-static int __init at91sam926x_pit_common_init(struct pit_data *data)
+static int __init at91sam926x_pit_dt_init(struct device_node *node)
{
- unsigned long pit_rate;
- unsigned bits;
- int ret;
+ unsigned long pit_rate;
+ unsigned bits;
+ int ret;
+ struct pit_data *data;
+
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ data->base = of_iomap(node, 0);
+ if (!data->base) {
+ pr_err("Could not map PIT address\n");
+ return -ENXIO;
+ }
+
+ data->mck = of_clk_get(node, 0);
+ if (IS_ERR(data->mck)) {
+ pr_err("Unable to get mck clk\n");
+ return PTR_ERR(data->mck);
+ }
+
+ ret = clk_prepare_enable(data->mck);
+ if (ret) {
+ pr_err("Unable to enable mck\n");
+ return ret;
+ }
+
+ /* Get the interrupts property */
+ data->irq = irq_of_parse_and_map(node, 0);
+ if (!data->irq) {
+ pr_err("Unable to get IRQ from DT\n");
+ return -EINVAL;
+ }
/*
* Use our actual MCK to figure out how many MCK/16 ticks per
@@ -236,46 +266,5 @@ static int __init at91sam926x_pit_common_init(struct pit_data *data)
return 0;
}
-
-static int __init at91sam926x_pit_dt_init(struct device_node *node)
-{
- struct pit_data *data;
- int ret;
-
- data = kzalloc(sizeof(*data), GFP_KERNEL);
- if (!data)
- return -ENOMEM;
-
- data->base = of_iomap(node, 0);
- if (!data->base) {
- pr_err("Could not map PIT address\n");
- return -ENXIO;
- }
-
- data->mck = of_clk_get(node, 0);
- if (IS_ERR(data->mck))
- /* Fallback on clkdev for !CCF-based boards */
- data->mck = clk_get(NULL, "mck");
-
- if (IS_ERR(data->mck)) {
- pr_err("Unable to get mck clk\n");
- return PTR_ERR(data->mck);
- }
-
- ret = clk_prepare_enable(data->mck);
- if (ret) {
- pr_err("Unable to enable mck\n");
- return ret;
- }
-
- /* Get the interrupts property */
- data->irq = irq_of_parse_and_map(node, 0);
- if (!data->irq) {
- pr_err("Unable to get IRQ from DT\n");
- return -EINVAL;
- }
-
- return at91sam926x_pit_common_init(data);
-}
CLOCKSOURCE_OF_DECLARE(at91sam926x_pit, "atmel,at91sam9260-pit",
at91sam926x_pit_dt_init);
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/3] clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE
2016-09-09 11:13 ` Alexandre Belloni
@ 2016-09-09 11:13 ` Alexandre Belloni
-1 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Boris Brezillon, Nicolas Ferre, linux-arm-kernel, linux-kernel,
Alexandre Belloni
IRQ handlers are running with IRQ disabled for a while, remove wrong
comment and useless test.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index da7e6d4eef4d..91cf04704ed1 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -149,12 +149,6 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
{
struct pit_data *data = dev_id;
- /*
- * irqs should be disabled here, but as the irq is shared they are only
- * guaranteed to be off if the timer irq is registered first.
- */
- WARN_ON_ONCE(!irqs_disabled());
-
/* The PIT interrupt may be disabled, and is shared */
if (clockevent_state_periodic(&data->clkevt) &&
(pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/3] clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE
@ 2016-09-09 11:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: linux-arm-kernel
IRQ handlers are running with IRQ disabled for a while, remove wrong
comment and useless test.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index da7e6d4eef4d..91cf04704ed1 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -149,12 +149,6 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
{
struct pit_data *data = dev_id;
- /*
- * irqs should be disabled here, but as the irq is shared they are only
- * guaranteed to be off if the timer irq is registered first.
- */
- WARN_ON_ONCE(!irqs_disabled());
-
/* The PIT interrupt may be disabled, and is shared */
if (clockevent_state_periodic(&data->clkevt) &&
(pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 3/3] clocksource: timer-atmel-pit: simplify IRQ handler
2016-09-09 11:13 ` Alexandre Belloni
@ 2016-09-09 11:13 ` Alexandre Belloni
-1 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Boris Brezillon, Nicolas Ferre, linux-arm-kernel, linux-kernel,
Alexandre Belloni
Because the PIT is also a proper clocksource, the timekeeping code is
already able to handle lost ticks.
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 91cf04704ed1..6555821bbdae 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -152,15 +152,10 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
/* The PIT interrupt may be disabled, and is shared */
if (clockevent_state_periodic(&data->clkevt) &&
(pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
- unsigned nr_ticks;
-
/* Get number of ticks performed before irq, and ack it */
- nr_ticks = PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
- do {
- data->cnt += data->cycle;
- data->clkevt.event_handler(&data->clkevt);
- nr_ticks--;
- } while (nr_ticks);
+ data->cnt += data->cycle * PIT_PICNT(pit_read(data->base,
+ AT91_PIT_PIVR));
+ data->clkevt.event_handler(&data->clkevt);
return IRQ_HANDLED;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 3/3] clocksource: timer-atmel-pit: simplify IRQ handler
@ 2016-09-09 11:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2016-09-09 11:13 UTC (permalink / raw)
To: linux-arm-kernel
Because the PIT is also a proper clocksource, the timekeeping code is
already able to handle lost ticks.
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 91cf04704ed1..6555821bbdae 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -152,15 +152,10 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
/* The PIT interrupt may be disabled, and is shared */
if (clockevent_state_periodic(&data->clkevt) &&
(pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
- unsigned nr_ticks;
-
/* Get number of ticks performed before irq, and ack it */
- nr_ticks = PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
- do {
- data->cnt += data->cycle;
- data->clkevt.event_handler(&data->clkevt);
- nr_ticks--;
- } while (nr_ticks);
+ data->cnt += data->cycle * PIT_PICNT(pit_read(data->base,
+ AT91_PIT_PIVR));
+ data->clkevt.event_handler(&data->clkevt);
return IRQ_HANDLED;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 0/3] clocksource: timer-atmel-pit: driver cleanups
2016-09-09 11:13 ` Alexandre Belloni
` (3 preceding siblings ...)
(?)
@ 2016-09-09 12:29 ` Daniel Lezcano
-1 siblings, 0 replies; 9+ messages in thread
From: Daniel Lezcano @ 2016-09-09 12:29 UTC (permalink / raw)
To: linux-arm-kernel
On 09/09/2016 13:13, Alexandre Belloni wrote:
> Hi Daniel,
>
> This is just the cleanup part of the previous seris as the fix has been applied.
>
> It is rebased on top of v4.8-rc5 and should apply cleanly.
>
> Alexandre Belloni (3):
> clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init
> clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE
> clocksource: timer-atmel-pit: simplify IRQ handler
>
> drivers/clocksource/timer-atmel-pit.c | 96 ++++++++++++++---------------------
> 1 file changed, 37 insertions(+), 59 deletions(-)
Ok, I have applied the series.
Thanks.
-- Daniel
--
<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] 9+ messages in thread
end of thread, other threads:[~2016-09-09 12:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09 11:13 [PATCH v4 0/3] clocksource: timer-atmel-pit: driver cleanups Alexandre Belloni
2016-09-09 11:13 ` Alexandre Belloni
2016-09-09 11:13 ` [PATCH v4 1/3] clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init Alexandre Belloni
2016-09-09 11:13 ` Alexandre Belloni
2016-09-09 11:13 ` [PATCH v4 2/3] clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE Alexandre Belloni
2016-09-09 11:13 ` Alexandre Belloni
2016-09-09 11:13 ` [PATCH v4 3/3] clocksource: timer-atmel-pit: simplify IRQ handler Alexandre Belloni
2016-09-09 11:13 ` Alexandre Belloni
2016-09-09 12:29 ` [PATCH v4 0/3] clocksource: timer-atmel-pit: driver cleanups 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.