Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457788 > unrolled thread
| Started by | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| First post | 2016-08-08 15:40 +0200 |
| Last post | 2016-08-08 15:40 +0200 |
| Articles | 5 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/4] clocksource: timer-atmel-pit: driver fix and cleanups Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 15:40 +0200
[PATCH v2 2/4] clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 15:40 +0200
[PATCH v2 3/4] clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 15:40 +0200
[PATCH v2 4/4] clocksource: timer-atmel-pit: simplify IRQ handler Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 15:40 +0200
[PATCH v2 1/4] clocksource: timer-atmel-pit: enable mck Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 15:40 +0200
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 15:40 +0200 |
| Subject | [PATCH v2 0/4] clocksource: timer-atmel-pit: driver fix and cleanups |
| Message-ID | <s3SWB-1Y6-3@gated-at.bofh.it> |
Hi, The first patch in the series is a fix that will be needed starting v4.9. The remaining patches are cleanups. Changes in v2: - Rebased on v4.8-rc1 - Collected acks Alexandre Belloni (4): clocksource: timer-atmel-pit: enable mck 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 | 78 +++++++++++++---------------------- 1 file changed, 29 insertions(+), 49 deletions(-) -- 2.8.1
[toc] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 15:40 +0200 |
| Subject | [PATCH v2 2/4] clocksource: timer-atmel-pit: drop at91sam926x_pit_common_init |
| Message-ID | <s3SWB-1Y6-5@gated-at.bofh.it> |
| In reply to | #1457788 |
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 | 64 ++++++++++++++---------------------
1 file changed, 26 insertions(+), 38 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index db839fc99a8e..6767768a7849 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -177,11 +177,36 @@ 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;
+ struct pit_data *data;
+
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ panic(pr_fmt("Unable to allocate memory\n"));
+
+ data->base = of_iomap(node, 0);
+ if (!data->base)
+ panic(pr_fmt("Could not map PIT address\n"));
+
+ 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))
+ panic(pr_fmt("Unable to get mck clk\n"));
+
+ if (clk_prepare_enable(data->mck))
+ panic(pr_fmt("Unable to enable mck\n"));
+
+ /* Get the interrupts property */
+ data->irq = irq_of_parse_and_map(node, 0);
+ if (!data->irq)
+ panic(pr_fmt("Unable to get IRQ from DT\n"));
/*
* Use our actual MCK to figure out how many MCK/16 ticks per
@@ -236,42 +261,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;
-
- 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);
- }
-
- if (clk_prepare_enable(data->mck))
- panic(pr_fmt("Unable to enable mck\n"));
-
- /* 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.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 15:40 +0200 |
| Subject | [PATCH v2 3/4] clocksource: timer-atmel-pit: remove uselesss WARN_ON_ONCE |
| Message-ID | <s3SWB-1Y6-11@gated-at.bofh.it> |
| In reply to | #1457788 |
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 6767768a7849..af657fdce665 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.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 15:40 +0200 |
| Subject | [PATCH v2 4/4] clocksource: timer-atmel-pit: simplify IRQ handler |
| Message-ID | <s3SWB-1Y6-21@gated-at.bofh.it> |
| In reply to | #1457788 |
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 af657fdce665..c5f3291328bd 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.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 15:40 +0200 |
| Subject | [PATCH v2 1/4] clocksource: timer-atmel-pit: enable mck |
| Message-ID | <s3SWC-1Y6-41@gated-at.bofh.it> |
| In reply to | #1457788 |
mck is needed to get the PIT working. Explicitly prepare_enable it instead
of assuming it is enabled.
This solves an issue where the system is freezing when the ETM/ETB drivers
are enabled.
Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/clocksource/timer-atmel-pit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 1ffac0cb0cb7..db839fc99a8e 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -261,6 +261,9 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
return PTR_ERR(data->mck);
}
+ if (clk_prepare_enable(data->mck))
+ panic(pr_fmt("Unable to enable mck\n"));
+
/* Get the interrupts property */
data->irq = irq_of_parse_and_map(node, 0);
if (!data->irq) {
--
2.8.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web