Skip to content

Commit 6629c07

Browse files
committed
Merge tag 'timers-v5.17-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core
Pull clocksource/events updates from Daniel Lezcano: - Refactor resource allocation on the Exynos_mct driver without functional changes (Marek Szyprowski) - Add imx8ulp compatible string for NPX TPM driver (Jacky Bai) - Fix comma introduced by error by replacing it by the initial semicolon on the Exynos_mct (Will Deacon) - Add OSTM driver support on Renesas. The reset line must be deasserted before accessing the registers. This change depends on an external change resulting in a shared immutable branch 'reset/of-get-optional-exclusive' from git://git.pengutronix.de/pza/linux (Biju Das) - Make the OSTM Kconfig option visible to user in order to let him disable it when ARM architected timers is enabled (Biju Das) - Tag two variables on iMX sysctr _ro_afterinit (Peng Fan) - Set the cpumask to cpu_possible_mask in order to have full benefit of the DYNIRQ flag on iMX sysctr (Peng Fan) - Tag __maybe_unused a variable in the Pistachio timer driver in order to fix a warning reported by the kernel test robot (Drew Fustini) - Add MStar MSC313e timer support and the ssd20xd-based variant, as well as the DT bindings (Romain Perier) - Remove the incompatible compatible string for the rk3066 (Johan Jonker) - Fix dts_check warnings on the cadence ttc driver by adding the power domain bindings (Michal Simek) Link: https://lore.kernel.org/lkml/[email protected]
2 parents 2585cf9 + 7647204 commit 6629c07

File tree

14 files changed

+431
-32
lines changed

14 files changed

+431
-32
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ properties:
2525
clocks:
2626
maxItems: 1
2727

28+
power-domains:
29+
maxItems: 1
30+
2831
timer-width:
2932
$ref: "/schemas/types.yaml#/definitions/uint32"
3033
description: |
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/timer/mstar,msc313e-timer.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Mstar MSC313e Timer Device Tree Bindings
8+
9+
maintainers:
10+
- Daniel Palmer <[email protected]>
11+
- Romain Perier <[email protected]>
12+
13+
properties:
14+
compatible:
15+
enum:
16+
- mstar,msc313e-timer
17+
- sstar,ssd20xd-timer
18+
19+
reg:
20+
maxItems: 1
21+
22+
interrupts:
23+
maxItems: 1
24+
25+
clocks:
26+
maxItems: 1
27+
28+
required:
29+
- compatible
30+
- reg
31+
- interrupts
32+
- clocks
33+
34+
additionalProperties: false
35+
36+
examples:
37+
- |
38+
#include <dt-bindings/interrupt-controller/arm-gic.h>
39+
40+
timer@6040 {
41+
compatible = "mstar,msc313e-timer";
42+
reg = <0x6040 0x40>;
43+
clocks = <&xtal_div2>;
44+
interrupts-extended = <&intc_fiq GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
45+
};
46+
...

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ description: |
1919
2020
properties:
2121
compatible:
22-
const: fsl,imx7ulp-tpm
22+
oneOf:
23+
- const: fsl,imx7ulp-tpm
24+
- items:
25+
- const: fsl,imx8ulp-tpm
26+
- const: fsl,imx7ulp-tpm
2327

2428
reg:
2529
maxItems: 1

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ properties:
2121
compatible:
2222
items:
2323
- enum:
24-
- renesas,r7s72100-ostm # RZ/A1H
25-
- renesas,r7s9210-ostm # RZ/A2M
26-
- const: renesas,ostm # Generic
24+
- renesas,r7s72100-ostm # RZ/A1H
25+
- renesas,r7s9210-ostm # RZ/A2M
26+
- renesas,r9a07g044-ostm # RZ/G2{L,LC}
27+
- const: renesas,ostm # Generic
2728

2829
reg:
2930
maxItems: 1
@@ -37,13 +38,26 @@ properties:
3738
power-domains:
3839
maxItems: 1
3940

41+
resets:
42+
maxItems: 1
43+
4044
required:
4145
- compatible
4246
- reg
4347
- interrupts
4448
- clocks
4549
- power-domains
4650

51+
if:
52+
properties:
53+
compatible:
54+
contains:
55+
enum:
56+
- renesas,r9a07g044-ostm
57+
then:
58+
required:
59+
- resets
60+
4761
additionalProperties: false
4862

4963
examples:

Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ properties:
1818
- enum:
1919
- rockchip,rv1108-timer
2020
- rockchip,rk3036-timer
21-
- rockchip,rk3066-timer
2221
- rockchip,rk3188-timer
2322
- rockchip,rk3228-timer
2423
- rockchip,rk3229-timer

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,6 +2291,7 @@ F: Documentation/devicetree/bindings/gpio/mstar,msc313-gpio.yaml
22912291
F: arch/arm/boot/dts/mstar-*
22922292
F: arch/arm/mach-mstar/
22932293
F: drivers/clk/mstar/
2294+
F: drivers/clocksource/timer-msc313e.c
22942295
F: drivers/gpio/gpio-msc313.c
22952296
F: drivers/rtc/rtc-msc313.c
22962297
F: drivers/watchdog/msc313e_wdt.c

drivers/clocksource/Kconfig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ config SH_TIMER_MTU2
510510
This hardware comes with 16-bit timer registers.
511511

512512
config RENESAS_OSTM
513-
bool "Renesas OSTM timer driver" if COMPILE_TEST
513+
bool "Renesas OSTM timer driver"
514+
depends on ARCH_RENESAS || COMPILE_TEST
514515
select CLKSRC_MMIO
515516
select TIMER_OF
516517
help
@@ -671,6 +672,15 @@ config MILBEAUT_TIMER
671672
help
672673
Enables the support for Milbeaut timer driver.
673674

675+
config MSC313E_TIMER
676+
bool "MSC313E timer driver" if COMPILE_TEST
677+
select TIMER_OF
678+
select CLKSRC_MMIO
679+
help
680+
Enables support for the MStar MSC313E timer driver.
681+
This provides access to multiple interrupt generating
682+
programmable 32-bit free running incrementing counters.
683+
674684
config INGENIC_TIMER
675685
bool "Clocksource/timer using the TCU in Ingenic JZ SoCs"
676686
default MACH_INGENIC

drivers/clocksource/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ obj-$(CONFIG_CSKY_MP_TIMER) += timer-mp-csky.o
8888
obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o
8989
obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o
9090
obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o
91+
obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o

drivers/clocksource/exynos_mct.c

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ static int exynos4_mct_starting_cpu(unsigned int cpu)
467467
evt->tick_resume = set_state_shutdown;
468468
evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
469469
CLOCK_EVT_FEAT_PERCPU;
470-
evt->rating = MCT_CLKEVENTS_RATING,
470+
evt->rating = MCT_CLKEVENTS_RATING;
471471

472472
exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);
473473

@@ -504,11 +504,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu)
504504
return 0;
505505
}
506506

507-
static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base)
507+
static int __init exynos4_timer_resources(struct device_node *np)
508508
{
509-
int err, cpu;
510509
struct clk *mct_clk, *tick_clk;
511510

511+
reg_base = of_iomap(np, 0);
512+
if (!reg_base)
513+
panic("%s: unable to ioremap mct address space\n", __func__);
514+
512515
tick_clk = of_clk_get_by_name(np, "fin_pll");
513516
if (IS_ERR(tick_clk))
514517
panic("%s: unable to determine tick clock rate\n", __func__);
@@ -519,9 +522,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
519522
panic("%s: unable to retrieve mct clock instance\n", __func__);
520523
clk_prepare_enable(mct_clk);
521524

522-
reg_base = base;
523-
if (!reg_base)
524-
panic("%s: unable to ioremap mct address space\n", __func__);
525+
return 0;
526+
}
527+
528+
static int __init exynos4_timer_interrupts(struct device_node *np,
529+
unsigned int int_type)
530+
{
531+
int nr_irqs, i, err, cpu;
532+
533+
mct_int_type = int_type;
534+
535+
/* This driver uses only one global timer interrupt */
536+
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
537+
538+
/*
539+
* Find out the number of local irqs specified. The local
540+
* timer irqs are specified after the four global timer
541+
* irqs are specified.
542+
*/
543+
nr_irqs = of_irq_count(np);
544+
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
545+
mct_irqs[i] = irq_of_parse_and_map(np, i);
525546

526547
if (mct_int_type == MCT_INT_PPI) {
527548

@@ -581,24 +602,13 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
581602

582603
static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
583604
{
584-
u32 nr_irqs, i;
585605
int ret;
586606

587-
mct_int_type = int_type;
588-
589-
/* This driver uses only one global timer interrupt */
590-
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
591-
592-
/*
593-
* Find out the number of local irqs specified. The local
594-
* timer irqs are specified after the four global timer
595-
* irqs are specified.
596-
*/
597-
nr_irqs = of_irq_count(np);
598-
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
599-
mct_irqs[i] = irq_of_parse_and_map(np, i);
607+
ret = exynos4_timer_resources(np);
608+
if (ret)
609+
return ret;
600610

601-
ret = exynos4_timer_resources(np, of_iomap(np, 0));
611+
ret = exynos4_timer_interrupts(np, int_type);
602612
if (ret)
603613
return ret;
604614

drivers/clocksource/renesas-ostm.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <linux/clk.h>
1010
#include <linux/clockchips.h>
1111
#include <linux/interrupt.h>
12+
#include <linux/platform_device.h>
13+
#include <linux/reset.h>
1214
#include <linux/sched_clock.h>
1315
#include <linux/slab.h>
1416

@@ -159,13 +161,22 @@ static int __init ostm_init_clkevt(struct timer_of *to)
159161

160162
static int __init ostm_init(struct device_node *np)
161163
{
164+
struct reset_control *rstc;
162165
struct timer_of *to;
163166
int ret;
164167

165168
to = kzalloc(sizeof(*to), GFP_KERNEL);
166169
if (!to)
167170
return -ENOMEM;
168171

172+
rstc = of_reset_control_get_optional_exclusive(np, NULL);
173+
if (IS_ERR(rstc)) {
174+
ret = PTR_ERR(rstc);
175+
goto err_free;
176+
}
177+
178+
reset_control_deassert(rstc);
179+
169180
to->flags = TIMER_OF_BASE | TIMER_OF_CLOCK;
170181
if (system_clock) {
171182
/*
@@ -178,7 +189,7 @@ static int __init ostm_init(struct device_node *np)
178189

179190
ret = timer_of_init(np, to);
180191
if (ret)
181-
goto err_free;
192+
goto err_reset;
182193

183194
/*
184195
* First probed device will be used as system clocksource. Any
@@ -203,9 +214,35 @@ static int __init ostm_init(struct device_node *np)
203214

204215
err_cleanup:
205216
timer_of_cleanup(to);
217+
err_reset:
218+
reset_control_assert(rstc);
219+
reset_control_put(rstc);
206220
err_free:
207221
kfree(to);
208222
return ret;
209223
}
210224

211225
TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
226+
227+
#ifdef CONFIG_ARCH_R9A07G044
228+
static int __init ostm_probe(struct platform_device *pdev)
229+
{
230+
struct device *dev = &pdev->dev;
231+
232+
return ostm_init(dev->of_node);
233+
}
234+
235+
static const struct of_device_id ostm_of_table[] = {
236+
{ .compatible = "renesas,ostm", },
237+
{ /* sentinel */ }
238+
};
239+
240+
static struct platform_driver ostm_device_driver = {
241+
.driver = {
242+
.name = "renesas_ostm",
243+
.of_match_table = of_match_ptr(ostm_of_table),
244+
.suppress_bind_attrs = true,
245+
},
246+
};
247+
builtin_platform_driver_probe(ostm_device_driver, ostm_probe);
248+
#endif

0 commit comments

Comments
 (0)