Skip to content

Commit 18a2078

Browse files
committed
Merge tag 'timers-v6.2-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core
Pull clockevent/source driver updates from Daniel Lezcano: - Add DT bindings for the Rockchip rk3128 timer (Johan Jonker) - Change the DT bindings for the npcm7xx timer in order to specify multiple clocks and enable the clock for the timer1 on WPCM450 (Jonathan Neuschäfer) - Fix the timer duration being too long the ARM architected timer in order to prevent an integer overflow leading to a negative value and an immediate interruption (Joe Korty) - Fix an unused pointer warning reported by lkp and some cleanups in the timer TI dm (Tony Lindgren) - Fix a missing call to clk_disable_unprepare() in the error path at init time on the timer TI dm (Yang Yingliang) - Use kstrtobool() instead of strtobool() in the ARM architected timer (Christophe JAILLET) - Add DT bindings for r8a779g0 on Renesas platform (Wolfram Sang) Link: https://lore.kernel.org/all/3c4c3bb2-b849-0c87-0948-8a36984bdde4@linaro.org
2 parents ebe1173 + 83571a4 commit 18a2078

9 files changed

Lines changed: 50 additions & 9 deletions

File tree

Documentation/devicetree/bindings/timer/nuvoton,npcm7xx-timer.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ properties:
2525
- description: The timer interrupt of timer 0
2626

2727
clocks:
28-
maxItems: 1
28+
items:
29+
- description: The reference clock for timer 0
30+
- description: The reference clock for timer 1
31+
- description: The reference clock for timer 2
32+
- description: The reference clock for timer 3
33+
- description: The reference clock for timer 4
34+
minItems: 1
2935

3036
required:
3137
- compatible

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ properties:
102102
- enum:
103103
- renesas,r8a779a0-cmt0 # 32-bit CMT0 on R-Car V3U
104104
- renesas,r8a779f0-cmt0 # 32-bit CMT0 on R-Car S4-8
105+
- renesas,r8a779g0-cmt0 # 32-bit CMT0 on R-Car V4H
105106
- const: renesas,rcar-gen4-cmt0 # 32-bit CMT0 on R-Car Gen4
106107

107108
- items:
108109
- enum:
109110
- renesas,r8a779a0-cmt1 # 48-bit CMT on R-Car V3U
110111
- renesas,r8a779f0-cmt1 # 48-bit CMT on R-Car S4-8
112+
- renesas,r8a779g0-cmt1 # 48-bit CMT on R-Car V4H
111113
- const: renesas,rcar-gen4-cmt1 # 48-bit CMT on R-Car Gen4
112114

113115
reg:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ properties:
3838
- renesas,tmu-r8a77995 # R-Car D3
3939
- renesas,tmu-r8a779a0 # R-Car V3U
4040
- renesas,tmu-r8a779f0 # R-Car S4-8
41+
- renesas,tmu-r8a779g0 # R-Car V4H
4142
- const: renesas,tmu
4243

4344
reg:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ properties:
1818
- enum:
1919
- rockchip,rv1108-timer
2020
- rockchip,rk3036-timer
21+
- rockchip,rk3128-timer
2122
- rockchip,rk3188-timer
2223
- rockchip,rk3228-timer
2324
- rockchip,rk3229-timer

drivers/clocksource/arm_arch_timer.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/clocksource.h>
1919
#include <linux/clocksource_ids.h>
2020
#include <linux/interrupt.h>
21+
#include <linux/kstrtox.h>
2122
#include <linux/of_irq.h>
2223
#include <linux/of_address.h>
2324
#include <linux/io.h>
@@ -97,7 +98,7 @@ static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EV
9798

9899
static int __init early_evtstrm_cfg(char *buf)
99100
{
100-
return strtobool(buf, &evtstrm_enable);
101+
return kstrtobool(buf, &evtstrm_enable);
101102
}
102103
early_param("clocksource.arm_arch_timer.evtstrm", early_evtstrm_cfg);
103104

@@ -806,15 +807,18 @@ static u64 __arch_timer_check_delta(void)
806807
/*
807808
* XGene-1 implements CVAL in terms of TVAL, meaning
808809
* that the maximum timer range is 32bit. Shame on them.
810+
*
811+
* Note that TVAL is signed, thus has only 31 of its
812+
* 32 bits to express magnitude.
809813
*/
810814
MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
811815
APM_CPU_PART_POTENZA)),
812816
{},
813817
};
814818

815819
if (is_midr_in_range_list(read_cpuid_id(), broken_cval_midrs)) {
816-
pr_warn_once("Broken CNTx_CVAL_EL1, limiting width to 32bits");
817-
return CLOCKSOURCE_MASK(32);
820+
pr_warn_once("Broken CNTx_CVAL_EL1, using 32 bit TVAL instead.\n");
821+
return CLOCKSOURCE_MASK(31);
818822
}
819823
#endif
820824
return CLOCKSOURCE_MASK(arch_counter_get_width());

drivers/clocksource/timer-npcm7xx.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static void __init npcm7xx_clocksource_init(void)
188188

189189
static int __init npcm7xx_timer_init(struct device_node *np)
190190
{
191+
struct clk *clk;
191192
int ret;
192193

193194
ret = timer_of_init(np, &npcm7xx_to);
@@ -199,6 +200,15 @@ static int __init npcm7xx_timer_init(struct device_node *np)
199200
npcm7xx_to.of_clk.rate = npcm7xx_to.of_clk.rate /
200201
(NPCM7XX_Tx_MIN_PRESCALE + 1);
201202

203+
/* Enable the clock for timer1, if it exists */
204+
clk = of_clk_get(np, 1);
205+
if (clk) {
206+
if (!IS_ERR(clk))
207+
clk_prepare_enable(clk);
208+
else
209+
pr_warn("%pOF: Failed to get clock for timer1: %pe", np, clk);
210+
}
211+
202212
npcm7xx_clocksource_init();
203213
npcm7xx_clockevents_init();
204214

drivers/clocksource/timer-ti-dm-systimer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,10 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
345345
return error;
346346

347347
r = clk_get_rate(clock);
348-
if (!r)
348+
if (!r) {
349+
clk_disable_unprepare(clock);
349350
return -ENODEV;
351+
}
350352

351353
if (is_ick)
352354
t->ick = clock;

drivers/clocksource/timer-ti-dm.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,17 +633,30 @@ static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *n
633633
static int omap_dm_timer_free(struct omap_dm_timer *cookie)
634634
{
635635
struct dmtimer *timer;
636+
struct device *dev;
637+
int rc;
636638

637639
timer = to_dmtimer(cookie);
638640
if (unlikely(!timer))
639641
return -EINVAL;
640642

641643
WARN_ON(!timer->reserved);
642644
timer->reserved = 0;
645+
646+
dev = &timer->pdev->dev;
647+
rc = pm_runtime_resume_and_get(dev);
648+
if (rc)
649+
return rc;
650+
651+
/* Clear timer configuration */
652+
dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
653+
654+
pm_runtime_put_sync(dev);
655+
643656
return 0;
644657
}
645658

646-
int omap_dm_timer_get_irq(struct omap_dm_timer *cookie)
659+
static int omap_dm_timer_get_irq(struct omap_dm_timer *cookie)
647660
{
648661
struct dmtimer *timer = to_dmtimer(cookie);
649662
if (timer)
@@ -1135,6 +1148,10 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
11351148
goto err_disable;
11361149
}
11371150
__omap_dm_timer_init_regs(timer);
1151+
1152+
/* Clear timer configuration */
1153+
dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
1154+
11381155
pm_runtime_put(dev);
11391156
}
11401157

@@ -1258,7 +1275,7 @@ static struct platform_driver omap_dm_timer_driver = {
12581275
.remove = omap_dm_timer_remove,
12591276
.driver = {
12601277
.name = "omap_timer",
1261-
.of_match_table = of_match_ptr(omap_timer_match),
1278+
.of_match_table = omap_timer_match,
12621279
.pm = &omap_dm_timer_pm_ops,
12631280
},
12641281
};

include/clocksource/timer-ti-dm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
struct omap_dm_timer {
6363
};
6464

65-
int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
66-
6765
u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
6866

6967
/*

0 commit comments

Comments
 (0)