Skip to content

Commit 86c54c8

Browse files
committed
Merge tag 'timers-v6.9-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core
Pull clocksource/event driver updates from Daniel Lezcano: - Fix -Wunused-but-set-variable warning for the iMX GPT timer (Daniel Lezcano) - Add Pixel6 compatible string for Exynos 4210 MCT timer (Peter Griffin) - Fix all kernel-doc warnings and misuse of comment format (Randy Dunlap) - Document in the DT bindings the interrupt used for input capture interrupt and udpate the example to match the reality (Geert Uytterhoeven) - Document RZ/Five SoC DT bindings (Lad Prabhakar) - Add DT bindings support for the i.MX95, reorganize the driver to move globale variables to a timer private structure and introduce the i.MX95 timer support (Peng Fan) - Fix prescalar value to conform to the ARM global timer documentation. Fix data types and comparison, guard the divide by zero code section and use the available macros for bit manipulation (Martin Blumenstingl) - Add Ralink SoCs system tick counter (Sergio Paracuellos) - Add support for cadence TTC PWM (Mubin Sayyed) - Clear timer interrupt on timer initialization to prevent the interrupt to fire during setup (Ley Foon Tan) Link: https://lore.kernel.org/r/5552010a-1ce2-46a1-a740-a69f2e9a2cf2@linaro.org
2 parents 8ca1836 + 8248ca3 commit 86c54c8

File tree

12 files changed

+191
-59
lines changed

12 files changed

+191
-59
lines changed

Documentation/devicetree/bindings/timer/cdns,ttc.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,23 @@ properties:
3232
description: |
3333
Bit width of the timer, necessary if not 16.
3434
35+
"#pwm-cells":
36+
const: 3
37+
3538
required:
3639
- compatible
3740
- reg
38-
- interrupts
3941
- clocks
4042

43+
allOf:
44+
- if:
45+
not:
46+
required:
47+
- "#pwm-cells"
48+
then:
49+
required:
50+
- interrupts
51+
4152
additionalProperties: false
4253

4354
examples:
@@ -50,3 +61,12 @@ examples:
5061
clocks = <&cpu_clk 3>;
5162
timer-width = <32>;
5263
};
64+
65+
- |
66+
pwm: pwm@f8002000 {
67+
compatible = "cdns,ttc";
68+
reg = <0xf8002000 0x1000>;
69+
clocks = <&cpu_clk 3>;
70+
timer-width = <32>;
71+
#pwm-cells = <3>;
72+
};

Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ description: |
1818
1919
properties:
2020
compatible:
21-
const: nxp,sysctr-timer
21+
enum:
22+
- nxp,imx95-sysctr-timer
23+
- nxp,sysctr-timer
2224

2325
reg:
2426
maxItems: 1
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/timer/ralink,cevt-systick.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: System tick counter present in Ralink family SoCs
8+
9+
maintainers:
10+
- Sergio Paracuellos <sergio.paracuellos@gmail.com>
11+
12+
properties:
13+
compatible:
14+
const: ralink,cevt-systick
15+
16+
reg:
17+
maxItems: 1
18+
19+
interrupts:
20+
maxItems: 1
21+
22+
required:
23+
- compatible
24+
- reg
25+
- interrupts
26+
27+
additionalProperties: false
28+
29+
examples:
30+
- |
31+
systick@d00 {
32+
compatible = "ralink,cevt-systick";
33+
reg = <0xd00 0x10>;
34+
35+
interrupt-parent = <&cpuintc>;
36+
interrupts = <7>;
37+
};
38+
...

Documentation/devicetree/bindings/timer/renesas,ostm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ properties:
2323
- enum:
2424
- renesas,r7s72100-ostm # RZ/A1H
2525
- renesas,r7s9210-ostm # RZ/A2M
26-
- renesas,r9a07g043-ostm # RZ/G2UL
26+
- renesas,r9a07g043-ostm # RZ/G2UL and RZ/Five
2727
- renesas,r9a07g044-ostm # RZ/G2{L,LC}
2828
- renesas,r9a07g054-ostm # RZ/V2L
2929
- const: renesas,ostm # Generic

Documentation/devicetree/bindings/timer/renesas,tmu.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,19 @@ properties:
4646

4747
interrupts:
4848
minItems: 2
49-
maxItems: 3
49+
items:
50+
- description: Underflow interrupt, channel 0
51+
- description: Underflow interrupt, channel 1
52+
- description: Underflow interrupt, channel 2
53+
- description: Input capture interrupt, channel 2
54+
55+
interrupt-names:
56+
minItems: 2
57+
items:
58+
- const: tuni0
59+
- const: tuni1
60+
- const: tuni2
61+
- const: ticpi2
5062

5163
clocks:
5264
maxItems: 1
@@ -100,7 +112,9 @@ examples:
100112
reg = <0xffd80000 0x30>;
101113
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
102114
<GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
103-
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
115+
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
116+
<GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
117+
interrupt-names = "tuni0", "tuni1", "tuni2", "ticpi2";
104118
clocks = <&mstp0_clks R8A7779_CLK_TMU0>;
105119
clock-names = "fck";
106120
power-domains = <&sysc R8A7779_PD_ALWAYS_ON>;

Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ properties:
2626
- items:
2727
- enum:
2828
- axis,artpec8-mct
29+
- google,gs101-mct
2930
- samsung,exynos3250-mct
3031
- samsung,exynos5250-mct
3132
- samsung,exynos5260-mct
@@ -127,6 +128,7 @@ allOf:
127128
contains:
128129
enum:
129130
- axis,artpec8-mct
131+
- google,gs101-mct
130132
- samsung,exynos5260-mct
131133
- samsung,exynos5420-mct
132134
- samsung,exynos5433-mct

drivers/clocksource/arm_global_timer.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/init.h>
1111
#include <linux/interrupt.h>
12+
#include <linux/bitfield.h>
1213
#include <linux/clocksource.h>
1314
#include <linux/clockchips.h>
1415
#include <linux/cpu.h>
@@ -31,10 +32,7 @@
3132
#define GT_CONTROL_COMP_ENABLE BIT(1) /* banked */
3233
#define GT_CONTROL_IRQ_ENABLE BIT(2) /* banked */
3334
#define GT_CONTROL_AUTO_INC BIT(3) /* banked */
34-
#define GT_CONTROL_PRESCALER_SHIFT 8
35-
#define GT_CONTROL_PRESCALER_MAX 0xF
36-
#define GT_CONTROL_PRESCALER_MASK (GT_CONTROL_PRESCALER_MAX << \
37-
GT_CONTROL_PRESCALER_SHIFT)
35+
#define GT_CONTROL_PRESCALER_MASK GENMASK(15, 8)
3836

3937
#define GT_INT_STATUS 0x0c
4038
#define GT_INT_STATUS_EVENT_FLAG BIT(0)
@@ -52,7 +50,8 @@
5250
*/
5351
static void __iomem *gt_base;
5452
static struct notifier_block gt_clk_rate_change_nb;
55-
static u32 gt_psv_new, gt_psv_bck, gt_target_rate;
53+
static u32 gt_psv_new, gt_psv_bck;
54+
static unsigned long gt_target_rate;
5655
static int gt_ppi;
5756
static struct clock_event_device __percpu *gt_evt;
5857

@@ -88,7 +87,7 @@ static u64 gt_counter_read(void)
8887
return _gt_counter_read();
8988
}
9089

91-
/**
90+
/*
9291
* To ensure that updates to comparator value register do not set the
9392
* Interrupt Status Register proceed as follows:
9493
* 1. Clear the Comp Enable bit in the Timer Control Register.
@@ -247,7 +246,7 @@ static void gt_write_presc(u32 psv)
247246

248247
reg = readl(gt_base + GT_CONTROL);
249248
reg &= ~GT_CONTROL_PRESCALER_MASK;
250-
reg |= psv << GT_CONTROL_PRESCALER_SHIFT;
249+
reg |= FIELD_PREP(GT_CONTROL_PRESCALER_MASK, psv);
251250
writel(reg, gt_base + GT_CONTROL);
252251
}
253252

@@ -256,8 +255,7 @@ static u32 gt_read_presc(void)
256255
u32 reg;
257256

258257
reg = readl(gt_base + GT_CONTROL);
259-
reg &= GT_CONTROL_PRESCALER_MASK;
260-
return reg >> GT_CONTROL_PRESCALER_SHIFT;
258+
return FIELD_GET(GT_CONTROL_PRESCALER_MASK, reg);
261259
}
262260

263261
static void __init gt_delay_timer_init(void)
@@ -272,9 +270,9 @@ static int __init gt_clocksource_init(void)
272270
writel(0, gt_base + GT_COUNTER0);
273271
writel(0, gt_base + GT_COUNTER1);
274272
/* set prescaler and enable timer on all the cores */
275-
writel(((CONFIG_ARM_GT_INITIAL_PRESCALER_VAL - 1) <<
276-
GT_CONTROL_PRESCALER_SHIFT)
277-
| GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
273+
writel(FIELD_PREP(GT_CONTROL_PRESCALER_MASK,
274+
CONFIG_ARM_GT_INITIAL_PRESCALER_VAL - 1) |
275+
GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
278276

279277
#ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
280278
sched_clock_register(gt_sched_clock_read, 64, gt_target_rate);
@@ -290,18 +288,17 @@ static int gt_clk_rate_change_cb(struct notifier_block *nb,
290288
switch (event) {
291289
case PRE_RATE_CHANGE:
292290
{
293-
int psv;
294-
295-
psv = DIV_ROUND_CLOSEST(ndata->new_rate,
296-
gt_target_rate);
291+
unsigned long psv;
297292

298-
if (abs(gt_target_rate - (ndata->new_rate / psv)) > MAX_F_ERR)
293+
psv = DIV_ROUND_CLOSEST(ndata->new_rate, gt_target_rate);
294+
if (!psv ||
295+
abs(gt_target_rate - (ndata->new_rate / psv)) > MAX_F_ERR)
299296
return NOTIFY_BAD;
300297

301298
psv--;
302299

303300
/* prescaler within legal range? */
304-
if (psv < 0 || psv > GT_CONTROL_PRESCALER_MAX)
301+
if (!FIELD_FIT(GT_CONTROL_PRESCALER_MASK, psv))
305302
return NOTIFY_BAD;
306303

307304
/*
@@ -411,7 +408,7 @@ static int __init global_timer_of_register(struct device_node *np)
411408
err = gt_clocksource_init();
412409
if (err)
413410
goto out_irq;
414-
411+
415412
err = cpuhp_setup_state(CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
416413
"clockevents/arm/global_timer:starting",
417414
gt_starting_cpu, gt_dying_cpu);

drivers/clocksource/timer-imx-gpt.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,8 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
258258
{
259259
struct clock_event_device *ced = dev_id;
260260
struct imx_timer *imxtm = to_imx_timer(ced);
261-
uint32_t tstat;
262261

263-
tstat = readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);
262+
readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat);
264263

265264
imxtm->gpt->gpt_irq_acknowledge(imxtm);
266265

0 commit comments

Comments
 (0)