Skip to content

Commit

Permalink
Merge tag 'timers-v6.2-rc1' of https://git.linaro.org/people/daniel.l…
Browse files Browse the repository at this point in the history
…ezcano/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
  • Loading branch information
Thomas Gleixner committed Dec 9, 2022
2 parents ebe1173 + 83571a4 commit 18a2078
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ properties:
- description: The timer interrupt of timer 0

clocks:
maxItems: 1
items:
- description: The reference clock for timer 0
- description: The reference clock for timer 1
- description: The reference clock for timer 2
- description: The reference clock for timer 3
- description: The reference clock for timer 4
minItems: 1

required:
- compatible
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/timer/renesas,cmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ properties:
- enum:
- renesas,r8a779a0-cmt0 # 32-bit CMT0 on R-Car V3U
- renesas,r8a779f0-cmt0 # 32-bit CMT0 on R-Car S4-8
- renesas,r8a779g0-cmt0 # 32-bit CMT0 on R-Car V4H
- const: renesas,rcar-gen4-cmt0 # 32-bit CMT0 on R-Car Gen4

- items:
- enum:
- renesas,r8a779a0-cmt1 # 48-bit CMT on R-Car V3U
- renesas,r8a779f0-cmt1 # 48-bit CMT on R-Car S4-8
- renesas,r8a779g0-cmt1 # 48-bit CMT on R-Car V4H
- const: renesas,rcar-gen4-cmt1 # 48-bit CMT on R-Car Gen4

reg:
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/timer/renesas,tmu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ properties:
- renesas,tmu-r8a77995 # R-Car D3
- renesas,tmu-r8a779a0 # R-Car V3U
- renesas,tmu-r8a779f0 # R-Car S4-8
- renesas,tmu-r8a779g0 # R-Car V4H
- const: renesas,tmu

reg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ properties:
- enum:
- rockchip,rv1108-timer
- rockchip,rk3036-timer
- rockchip,rk3128-timer
- rockchip,rk3188-timer
- rockchip,rk3228-timer
- rockchip,rk3229-timer
Expand Down
10 changes: 7 additions & 3 deletions drivers/clocksource/arm_arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/clocksource.h>
#include <linux/clocksource_ids.h>
#include <linux/interrupt.h>
#include <linux/kstrtox.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <linux/io.h>
Expand Down Expand Up @@ -97,7 +98,7 @@ static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EV

static int __init early_evtstrm_cfg(char *buf)
{
return strtobool(buf, &evtstrm_enable);
return kstrtobool(buf, &evtstrm_enable);
}
early_param("clocksource.arm_arch_timer.evtstrm", early_evtstrm_cfg);

Expand Down Expand Up @@ -806,15 +807,18 @@ static u64 __arch_timer_check_delta(void)
/*
* XGene-1 implements CVAL in terms of TVAL, meaning
* that the maximum timer range is 32bit. Shame on them.
*
* Note that TVAL is signed, thus has only 31 of its
* 32 bits to express magnitude.
*/
MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
APM_CPU_PART_POTENZA)),
{},
};

if (is_midr_in_range_list(read_cpuid_id(), broken_cval_midrs)) {
pr_warn_once("Broken CNTx_CVAL_EL1, limiting width to 32bits");
return CLOCKSOURCE_MASK(32);
pr_warn_once("Broken CNTx_CVAL_EL1, using 32 bit TVAL instead.\n");
return CLOCKSOURCE_MASK(31);
}
#endif
return CLOCKSOURCE_MASK(arch_counter_get_width());
Expand Down
10 changes: 10 additions & 0 deletions drivers/clocksource/timer-npcm7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ static void __init npcm7xx_clocksource_init(void)

static int __init npcm7xx_timer_init(struct device_node *np)
{
struct clk *clk;
int ret;

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

/* Enable the clock for timer1, if it exists */
clk = of_clk_get(np, 1);
if (clk) {
if (!IS_ERR(clk))
clk_prepare_enable(clk);
else
pr_warn("%pOF: Failed to get clock for timer1: %pe", np, clk);
}

npcm7xx_clocksource_init();
npcm7xx_clockevents_init();

Expand Down
4 changes: 3 additions & 1 deletion drivers/clocksource/timer-ti-dm-systimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
return error;

r = clk_get_rate(clock);
if (!r)
if (!r) {
clk_disable_unprepare(clock);
return -ENODEV;
}

if (is_ick)
t->ick = clock;
Expand Down
21 changes: 19 additions & 2 deletions drivers/clocksource/timer-ti-dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,17 +633,30 @@ static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *n
static int omap_dm_timer_free(struct omap_dm_timer *cookie)
{
struct dmtimer *timer;
struct device *dev;
int rc;

timer = to_dmtimer(cookie);
if (unlikely(!timer))
return -EINVAL;

WARN_ON(!timer->reserved);
timer->reserved = 0;

dev = &timer->pdev->dev;
rc = pm_runtime_resume_and_get(dev);
if (rc)
return rc;

/* Clear timer configuration */
dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);

pm_runtime_put_sync(dev);

return 0;
}

int omap_dm_timer_get_irq(struct omap_dm_timer *cookie)
static int omap_dm_timer_get_irq(struct omap_dm_timer *cookie)
{
struct dmtimer *timer = to_dmtimer(cookie);
if (timer)
Expand Down Expand Up @@ -1135,6 +1148,10 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
goto err_disable;
}
__omap_dm_timer_init_regs(timer);

/* Clear timer configuration */
dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);

pm_runtime_put(dev);
}

Expand Down Expand Up @@ -1258,7 +1275,7 @@ static struct platform_driver omap_dm_timer_driver = {
.remove = omap_dm_timer_remove,
.driver = {
.name = "omap_timer",
.of_match_table = of_match_ptr(omap_timer_match),
.of_match_table = omap_timer_match,
.pm = &omap_dm_timer_pm_ops,
},
};
Expand Down
2 changes: 0 additions & 2 deletions include/clocksource/timer-ti-dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
struct omap_dm_timer {
};

int omap_dm_timer_get_irq(struct omap_dm_timer *timer);

u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);

/*
Expand Down

0 comments on commit 18a2078

Please sign in to comment.