Skip to content

Commit 84c2e17

Browse files
committed
Merge tag 'timers-core-2022-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer and timekeeping updates from Thomas Gleixner: "Core code: - Make the NOHZ handling of the timekeeping/tick core more robust to prevent a rare jiffies update stall. - Handle softirqs in the NOHZ/idle case correctly Drivers: - Add support for event stream scaling of the 1GHz counter on ARM(64) - Correct an error code check in the timer-of layer - The usual cleanups and improvements all over the place" * tag 'timers-core-2022-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) lib/irq_poll: Declare IRQ_POLL softirq vector as ksoftirqd-parking safe tick/rcu: Stop allowing RCU_SOFTIRQ in idle tick/rcu: Remove obsolete rcu_needs_cpu() parameters tick: Detect and fix jiffies update stall clocksource/drivers/timer-of: Check return value of of_iomap in timer_of_base_init() clocksource/drivers/timer-microchip-pit64b: Use 5MHz for clockevent clocksource/drivers/timer-microchip-pit64b: Use notrace clocksource/drivers/timer-microchip-pit64b: Remove mmio selection dt-bindings: timer: Tegra: Convert text bindings to yaml clocksource/drivers/imx-tpm: Move tpm_read_sched_clock() under CONFIG_ARM clocksource/drivers/arm_arch_timer: Use event stream scaling when available clocksource/drivers/exynos_mct: Increase the size of name array clocksource/drivers/exynos_mct: Bump up mct max irq number clocksource/drivers/exynos_mct: Remove mct interrupt index enum clocksource/drivers/exynos_mct: Handle DTS with higher number of interrupts clocksource/drivers/timer-ti-dm: Fix regression from errata i940 fix clocksource/drivers/imx-tpm: Exclude sched clock for ARM64 clocksource: Add a Kconfig option for WATCHDOG_MAX_SKEW clocksource/drivers/imx-tpm: Update name of clkevt clocksource/drivers/imx-tpm: Add CLOCK_EVT_FEAT_DYNIRQ ...
2 parents bba90e0 + b166e52 commit 84c2e17

23 files changed

+299
-157
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: "http://devicetree.org/schemas/timer/nvidia,tegra-timer.yaml#"
5+
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6+
7+
title: NVIDIA Tegra timer
8+
9+
maintainers:
10+
- Stephen Warren <swarren@nvidia.com>
11+
12+
allOf:
13+
- if:
14+
properties:
15+
compatible:
16+
contains:
17+
const: nvidia,tegra210-timer
18+
then:
19+
properties:
20+
interrupts:
21+
# Either a single combined interrupt or up to 14 individual interrupts
22+
minItems: 1
23+
maxItems: 14
24+
description: >
25+
A list of 14 interrupts; one per each timer channels 0 through 13
26+
27+
- if:
28+
properties:
29+
compatible:
30+
oneOf:
31+
- items:
32+
- enum:
33+
- nvidia,tegra114-timer
34+
- nvidia,tegra124-timer
35+
- nvidia,tegra132-timer
36+
- const: nvidia,tegra30-timer
37+
- items:
38+
- const: nvidia,tegra30-timer
39+
- const: nvidia,tegra20-timer
40+
then:
41+
properties:
42+
interrupts:
43+
# Either a single combined interrupt or up to 6 individual interrupts
44+
minItems: 1
45+
maxItems: 6
46+
description: >
47+
A list of 6 interrupts; one per each of timer channels 1 through 5,
48+
and one for the shared interrupt for the remaining channels.
49+
50+
- if:
51+
properties:
52+
compatible:
53+
const: nvidia,tegra20-timer
54+
then:
55+
properties:
56+
interrupts:
57+
# Either a single combined interrupt or up to 4 individual interrupts
58+
minItems: 1
59+
maxItems: 4
60+
description: |
61+
A list of 4 interrupts; one per timer channel.
62+
63+
properties:
64+
compatible:
65+
oneOf:
66+
- const: nvidia,tegra210-timer
67+
description: >
68+
The Tegra210 timer provides fourteen 29-bit timer counters and one 32-bit
69+
timestamp counter. The TMRs run at either a fixed 1 MHz clock rate derived
70+
from the oscillator clock (TMR0-TMR9) or directly at the oscillator clock
71+
(TMR10-TMR13). Each TMR can be programmed to generate one-shot, periodic,
72+
or watchdog interrupts.
73+
- items:
74+
- enum:
75+
- nvidia,tegra114-timer
76+
- nvidia,tegra124-timer
77+
- nvidia,tegra132-timer
78+
- const: nvidia,tegra30-timer
79+
- items:
80+
- const: nvidia,tegra30-timer
81+
- const: nvidia,tegra20-timer
82+
description: >
83+
The Tegra30 timer provides ten 29-bit timer channels, a single 32-bit free
84+
running counter, and 5 watchdog modules. The first two channels may also
85+
trigger a legacy watchdog reset.
86+
- const: nvidia,tegra20-timer
87+
description: >
88+
The Tegra20 timer provides four 29-bit timer channels and a single 32-bit free
89+
running counter. The first two channels may also trigger a watchdog reset.
90+
91+
reg:
92+
maxItems: 1
93+
94+
interrupts: true
95+
96+
clocks:
97+
maxItems: 1
98+
99+
clock-names:
100+
items:
101+
- const: timer
102+
103+
104+
required:
105+
- compatible
106+
- reg
107+
- interrupts
108+
- clocks
109+
110+
additionalProperties: false
111+
112+
examples:
113+
- |
114+
#include <dt-bindings/interrupt-controller/irq.h>
115+
timer@60005000 {
116+
compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer";
117+
reg = <0x60005000 0x400>;
118+
interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
119+
<0 1 IRQ_TYPE_LEVEL_HIGH>,
120+
<0 41 IRQ_TYPE_LEVEL_HIGH>,
121+
<0 42 IRQ_TYPE_LEVEL_HIGH>,
122+
<0 121 IRQ_TYPE_LEVEL_HIGH>,
123+
<0 122 IRQ_TYPE_LEVEL_HIGH>;
124+
clocks = <&tegra_car 214>;
125+
};
126+
- |
127+
#include <dt-bindings/clock/tegra210-car.h>
128+
#include <dt-bindings/interrupt-controller/arm-gic.h>
129+
#include <dt-bindings/interrupt-controller/irq.h>
130+
131+
timer@60005000 {
132+
compatible = "nvidia,tegra210-timer";
133+
reg = <0x60005000 0x400>;
134+
interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>,
135+
<GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
136+
<GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
137+
<GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
138+
<GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
139+
<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
140+
<GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>,
141+
<GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
142+
<GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>,
143+
<GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>,
144+
<GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>,
145+
<GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>,
146+
<GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>,
147+
<GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
148+
clocks = <&tegra_car TEGRA210_CLK_TIMER>;
149+
clock-names = "timer";
150+
};

Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

Documentation/devicetree/bindings/timer/nvidia,tegra210-timer.txt

Lines changed: 0 additions & 36 deletions
This file was deleted.

Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.

arch/arm/boot/dts/dra7-l4.dtsi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,8 +3482,7 @@
34823482
ti,timer-pwm;
34833483
};
34843484
};
3485-
3486-
target-module@2c000 { /* 0x4882c000, ap 17 02.0 */
3485+
timer15_target: target-module@2c000 { /* 0x4882c000, ap 17 02.0 */
34873486
compatible = "ti,sysc-omap4-timer", "ti,sysc";
34883487
reg = <0x2c000 0x4>,
34893488
<0x2c010 0x4>;
@@ -3511,7 +3510,7 @@
35113510
};
35123511
};
35133512

3514-
target-module@2e000 { /* 0x4882e000, ap 19 14.0 */
3513+
timer16_target: target-module@2e000 { /* 0x4882e000, ap 19 14.0 */
35153514
compatible = "ti,sysc-omap4-timer", "ti,sysc";
35163515
reg = <0x2e000 0x4>,
35173516
<0x2e010 0x4>;

arch/arm/boot/dts/dra7.dtsi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,20 +1339,20 @@
13391339
};
13401340

13411341
/* Local timers, see ARM architected timer wrap erratum i940 */
1342-
&timer3_target {
1342+
&timer15_target {
13431343
ti,no-reset-on-init;
13441344
ti,no-idle;
13451345
timer@0 {
1346-
assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER3_CLKCTRL 24>;
1346+
assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>;
13471347
assigned-clock-parents = <&timer_sys_clk_div>;
13481348
};
13491349
};
13501350

1351-
&timer4_target {
1351+
&timer16_target {
13521352
ti,no-reset-on-init;
13531353
ti,no-idle;
13541354
timer@0 {
1355-
assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER4_CLKCTRL 24>;
1355+
assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>;
13561356
assigned-clock-parents = <&timer_sys_clk_div>;
13571357
};
13581358
};

drivers/clocksource/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,6 @@ config INGENIC_OST
713713
config MICROCHIP_PIT64B
714714
bool "Microchip PIT64B support"
715715
depends on OF || COMPILE_TEST
716-
select CLKSRC_MMIO
717716
select TIMER_OF
718717
help
719718
This option enables Microchip PIT64B timer for Atmel

drivers/clocksource/arm_arch_timer.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,19 @@ static void __arch_timer_setup(unsigned type,
880880
clockevents_config_and_register(clk, arch_timer_rate, 0xf, max_delta);
881881
}
882882

883-
static void arch_timer_evtstrm_enable(int divider)
883+
static void arch_timer_evtstrm_enable(unsigned int divider)
884884
{
885885
u32 cntkctl = arch_timer_get_cntkctl();
886886

887+
#ifdef CONFIG_ARM64
888+
/* ECV is likely to require a large divider. Use the EVNTIS flag. */
889+
if (cpus_have_const_cap(ARM64_HAS_ECV) && divider > 15) {
890+
cntkctl |= ARCH_TIMER_EVT_INTERVAL_SCALE;
891+
divider -= 8;
892+
}
893+
#endif
894+
895+
divider = min(divider, 15U);
887896
cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
888897
/* Set the divider and enable virtual event stream */
889898
cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
@@ -912,7 +921,7 @@ static void arch_timer_configure_evtstream(void)
912921
lsb++;
913922

914923
/* enable event stream */
915-
arch_timer_evtstrm_enable(max(0, min(lsb, 15)));
924+
arch_timer_evtstrm_enable(max(0, lsb));
916925
}
917926

918927
static void arch_counter_set_user_access(void)

drivers/clocksource/exynos_mct.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,18 @@
6060
#define MCT_CLKEVENTS_RATING 350
6161
#endif
6262

63+
/* There are four Global timers starting with 0 offset */
64+
#define MCT_G0_IRQ 0
65+
/* Local timers count starts after global timer count */
66+
#define MCT_L0_IRQ 4
67+
/* Max number of IRQ as per DT binding document */
68+
#define MCT_NR_IRQS 20
69+
6370
enum {
6471
MCT_INT_SPI,
6572
MCT_INT_PPI
6673
};
6774

68-
enum {
69-
MCT_G0_IRQ,
70-
MCT_G1_IRQ,
71-
MCT_G2_IRQ,
72-
MCT_G3_IRQ,
73-
MCT_L0_IRQ,
74-
MCT_L1_IRQ,
75-
MCT_L2_IRQ,
76-
MCT_L3_IRQ,
77-
MCT_L4_IRQ,
78-
MCT_L5_IRQ,
79-
MCT_L6_IRQ,
80-
MCT_L7_IRQ,
81-
MCT_NR_IRQS,
82-
};
83-
8475
static void __iomem *reg_base;
8576
static unsigned long clk_rate;
8677
static unsigned int mct_int_type;
@@ -89,7 +80,11 @@ static int mct_irqs[MCT_NR_IRQS];
8980
struct mct_clock_event_device {
9081
struct clock_event_device evt;
9182
unsigned long base;
92-
char name[10];
83+
/**
84+
* The length of the name must be adjusted if number of
85+
* local timer interrupts grow over two digits
86+
*/
87+
char name[11];
9388
};
9489

9590
static void exynos4_mct_write(unsigned int value, unsigned long offset)
@@ -541,6 +536,11 @@ static int __init exynos4_timer_interrupts(struct device_node *np,
541536
* irqs are specified.
542537
*/
543538
nr_irqs = of_irq_count(np);
539+
if (nr_irqs > ARRAY_SIZE(mct_irqs)) {
540+
pr_err("exynos-mct: too many (%d) interrupts configured in DT\n",
541+
nr_irqs);
542+
nr_irqs = ARRAY_SIZE(mct_irqs);
543+
}
544544
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
545545
mct_irqs[i] = irq_of_parse_and_map(np, i);
546546

@@ -553,11 +553,14 @@ static int __init exynos4_timer_interrupts(struct device_node *np,
553553
mct_irqs[MCT_L0_IRQ], err);
554554
} else {
555555
for_each_possible_cpu(cpu) {
556-
int mct_irq = mct_irqs[MCT_L0_IRQ + cpu];
556+
int mct_irq;
557557
struct mct_clock_event_device *pcpu_mevt =
558558
per_cpu_ptr(&percpu_mct_tick, cpu);
559559

560560
pcpu_mevt->evt.irq = -1;
561+
if (MCT_L0_IRQ + cpu >= ARRAY_SIZE(mct_irqs))
562+
break;
563+
mct_irq = mct_irqs[MCT_L0_IRQ + cpu];
561564

562565
irq_set_status_flags(mct_irq, IRQ_NOAUTOEN);
563566
if (request_irq(mct_irq,

0 commit comments

Comments
 (0)