Skip to content

Commit 228ad72

Browse files
committed
Merge tag 'timers-v6.13-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core
Pull clocksource/event updates from Daniel Lezcano: - Remove unused dw_apb_clockevent_[pause|resume|stop] functions as they are unused since 2021 (David Alan Gilbert) - Make the sp804 driver user selectable as they may be unused on some platforms (Mark Brown) - Don't fail if the ti-dm does not describe an interrupt in the DT as this could be a normal situation if the PWM is used (Judith Mendez) - Always use cluster 0 counter as a clocksource on a multi-cluster system to prevent problems related to the time shifting between clusters if multiple per cluster clocksource is used (Paul Burton) - Move the RaLink system tick counter from the arch directory to the clocksource directory (Sergio Paracuellos) - Convert the owl-timer bindings into yaml schema (Ivaylo Ivanov) - Fix child node refcount handling on the TI DM by relying on the __free annotation to automatically release the refcount on the node (Javier Carrasco) - Remove pointless cast in the GPX driver as PTR_ERR already does that (Tang Bin) - Use of_property_present() for non-boolean properties where it is possible in the different drivers (Rob Herring) Link: https://lore.kernel.org/lkml/8d402321-96f1-47f7-9347-a850350d60de@linaro.org
2 parents 3c2fb01 + 08b97fb commit 228ad72

File tree

15 files changed

+174
-90
lines changed

15 files changed

+174
-90
lines changed

Documentation/devicetree/bindings/timer/actions,owl-timer.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/timer/actions,owl-timer.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Actions Semi Owl timer
8+
9+
maintainers:
10+
- Andreas Färber <afaerber@suse.de>
11+
12+
description:
13+
Actions Semi Owl SoCs provide 32bit and 2Hz timers.
14+
The 32bit timers support dynamic irq, as well as one-shot mode.
15+
16+
properties:
17+
compatible:
18+
enum:
19+
- actions,s500-timer
20+
- actions,s700-timer
21+
- actions,s900-timer
22+
23+
clocks:
24+
maxItems: 1
25+
26+
interrupts:
27+
minItems: 1
28+
maxItems: 6
29+
30+
interrupt-names:
31+
minItems: 1
32+
maxItems: 6
33+
items:
34+
enum:
35+
- 2hz0
36+
- 2hz1
37+
- timer0
38+
- timer1
39+
- timer2
40+
- timer3
41+
42+
reg:
43+
maxItems: 1
44+
45+
required:
46+
- compatible
47+
- clocks
48+
- interrupts
49+
- interrupt-names
50+
- reg
51+
52+
allOf:
53+
- if:
54+
properties:
55+
compatible:
56+
contains:
57+
enum:
58+
- actions,s500-timer
59+
then:
60+
properties:
61+
interrupts:
62+
minItems: 4
63+
maxItems: 4
64+
interrupt-names:
65+
items:
66+
- const: 2hz0
67+
- const: 2hz1
68+
- const: timer0
69+
- const: timer1
70+
71+
- if:
72+
properties:
73+
compatible:
74+
contains:
75+
enum:
76+
- actions,s700-timer
77+
- actions,s900-timer
78+
then:
79+
properties:
80+
interrupts:
81+
minItems: 1
82+
maxItems: 1
83+
interrupt-names:
84+
items:
85+
- const: timer1
86+
87+
additionalProperties: false
88+
89+
examples:
90+
- |
91+
#include <dt-bindings/interrupt-controller/arm-gic.h>
92+
#include <dt-bindings/interrupt-controller/irq.h>
93+
soc {
94+
#address-cells = <1>;
95+
#size-cells = <1>;
96+
timer@b0168000 {
97+
compatible = "actions,s500-timer";
98+
reg = <0xb0168000 0x100>;
99+
clocks = <&hosc>;
100+
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
101+
<GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
102+
<GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
103+
<GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
104+
interrupt-names = "2hz0", "2hz1", "timer0", "timer1";
105+
};
106+
};
107+
...

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ F: Documentation/devicetree/bindings/mmc/owl-mmc.yaml
20042004
F: Documentation/devicetree/bindings/net/actions,owl-emac.yaml
20052005
F: Documentation/devicetree/bindings/pinctrl/actions,*
20062006
F: Documentation/devicetree/bindings/power/actions,owl-sps.txt
2007-
F: Documentation/devicetree/bindings/timer/actions,owl-timer.txt
2007+
F: Documentation/devicetree/bindings/timer/actions,owl-timer.yaml
20082008
F: arch/arm/boot/dts/actions/
20092009
F: arch/arm/mach-actions/
20102010
F: arch/arm64/boot/dts/actions/

arch/mips/ralink/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
if RALINK
33

4-
config CLKEVT_RT3352
5-
bool
6-
depends on SOC_RT305X || SOC_MT7620
7-
default y
8-
select TIMER_OF
9-
select CLKSRC_MMIO
10-
114
config RALINK_ILL_ACC
125
bool
136
depends on SOC_RT305X

arch/mips/ralink/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ ifndef CONFIG_MIPS_GIC
1010
obj-y += clk.o timer.o
1111
endif
1212

13-
obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
14-
1513
obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o
1614

1715
obj-$(CONFIG_IRQ_INTC) += irq.o

drivers/clocksource/Kconfig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ config ARM_GT_INITIAL_PRESCALER_VAL
400400
This affects CPU_FREQ max delta from the initial frequency.
401401

402402
config ARM_TIMER_SP804
403-
bool "Support for Dual Timer SP804 module" if COMPILE_TEST
403+
bool "Support for Dual Timer SP804 module"
404+
depends on ARM || ARM64 || COMPILE_TEST
404405
depends on GENERIC_SCHED_CLOCK && HAVE_CLK
405406
select CLKSRC_MMIO
406407
select TIMER_OF if OF
@@ -753,4 +754,13 @@ config EP93XX_TIMER
753754
Enables support for the Cirrus Logic timer block
754755
EP93XX.
755756

757+
config RALINK_TIMER
758+
bool "Ralink System Tick Counter"
759+
depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST
760+
select CLKSRC_MMIO
761+
select TIMER_OF
762+
help
763+
Enables support for system tick counter present on
764+
Ralink SoCs RT3352 and MT7620.
765+
756766
endmenu

drivers/clocksource/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,4 @@ obj-$(CONFIG_GOLDFISH_TIMER) += timer-goldfish.o
9191
obj-$(CONFIG_GXP_TIMER) += timer-gxp.o
9292
obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o
9393
obj-$(CONFIG_EP93XX_TIMER) += timer-ep93xx.o
94+
obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o

drivers/clocksource/arm_arch_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ static int __init arch_timer_of_init(struct device_node *np)
14281428

14291429
arch_timers_present |= ARCH_TIMER_TYPE_CP15;
14301430

1431-
has_names = of_property_read_bool(np, "interrupt-names");
1431+
has_names = of_property_present(np, "interrupt-names");
14321432

14331433
for (i = ARCH_TIMER_PHYS_SECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++) {
14341434
if (has_names)

drivers/clocksource/dw_apb_timer.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,6 @@ static inline void apbt_writel_relaxed(struct dw_apb_timer *timer, u32 val,
6868
writel_relaxed(val, timer->base + offs);
6969
}
7070

71-
static void apbt_disable_int(struct dw_apb_timer *timer)
72-
{
73-
u32 ctrl = apbt_readl(timer, APBTMR_N_CONTROL);
74-
75-
ctrl |= APBTMR_CONTROL_INT;
76-
apbt_writel(timer, ctrl, APBTMR_N_CONTROL);
77-
}
78-
79-
/**
80-
* dw_apb_clockevent_pause() - stop the clock_event_device from running
81-
*
82-
* @dw_ced: The APB clock to stop generating events.
83-
*/
84-
void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced)
85-
{
86-
disable_irq(dw_ced->timer.irq);
87-
apbt_disable_int(&dw_ced->timer);
88-
}
89-
9071
static void apbt_eoi(struct dw_apb_timer *timer)
9172
{
9273
apbt_readl_relaxed(timer, APBTMR_N_EOI);
@@ -284,26 +265,6 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
284265
return dw_ced;
285266
}
286267

287-
/**
288-
* dw_apb_clockevent_resume() - resume a clock that has been paused.
289-
*
290-
* @dw_ced: The APB clock to resume.
291-
*/
292-
void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced)
293-
{
294-
enable_irq(dw_ced->timer.irq);
295-
}
296-
297-
/**
298-
* dw_apb_clockevent_stop() - stop the clock_event_device and release the IRQ.
299-
*
300-
* @dw_ced: The APB clock to stop generating the events.
301-
*/
302-
void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced)
303-
{
304-
free_irq(dw_ced->timer.irq, &dw_ced->ced);
305-
}
306-
307268
/**
308269
* dw_apb_clockevent_register() - register the clock with the generic layer
309270
*

drivers/clocksource/mips-gic-timer.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,37 @@ static u64 gic_hpt_read(struct clocksource *cs)
166166
return gic_read_count();
167167
}
168168

169+
static u64 gic_hpt_read_multicluster(struct clocksource *cs)
170+
{
171+
unsigned int hi, hi2, lo;
172+
u64 count;
173+
174+
mips_cm_lock_other(0, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);
175+
176+
if (mips_cm_is64) {
177+
count = read_gic_redir_counter();
178+
goto out;
179+
}
180+
181+
hi = read_gic_redir_counter_32h();
182+
while (true) {
183+
lo = read_gic_redir_counter_32l();
184+
185+
/* If hi didn't change then lo didn't wrap & we're done */
186+
hi2 = read_gic_redir_counter_32h();
187+
if (hi2 == hi)
188+
break;
189+
190+
/* Otherwise, repeat with the latest hi value */
191+
hi = hi2;
192+
}
193+
194+
count = (((u64)hi) << 32) + lo;
195+
out:
196+
mips_cm_unlock_other();
197+
return count;
198+
}
199+
169200
static struct clocksource gic_clocksource = {
170201
.name = "GIC",
171202
.read = gic_hpt_read,
@@ -203,6 +234,11 @@ static int __init __gic_clocksource_init(void)
203234
gic_clocksource.rating = 200;
204235
gic_clocksource.rating += clamp(gic_frequency / 10000000, 0, 99);
205236

237+
if (mips_cps_multicluster_cpus()) {
238+
gic_clocksource.read = &gic_hpt_read_multicluster;
239+
gic_clocksource.vdso_clock_mode = VDSO_CLOCKMODE_NONE;
240+
}
241+
206242
ret = clocksource_register_hz(&gic_clocksource, gic_frequency);
207243
if (ret < 0)
208244
pr_warn("Unable to register clocksource\n");
@@ -261,7 +297,8 @@ static int __init gic_clocksource_of_init(struct device_node *node)
261297
* stable CPU frequency or on the platforms with CM3 and CPU frequency
262298
* change performed by the CPC core clocks divider.
263299
*/
264-
if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) {
300+
if ((mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) &&
301+
!mips_cps_multicluster_cpus()) {
265302
sched_clock_register(mips_cm_is64 ?
266303
gic_read_count_64 : gic_read_count_2x32,
267304
gic_count_width, gic_frequency);

0 commit comments

Comments
 (0)