mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
- Add rktimer for rv1126 Rockchip based board (Jagan Teki)
- Initialize hrtimer based broadcast clock event device on RISC-V before C3STOP can be used (Conor Dooley) - Add DT binding for RISC-V timer and add the C3STOP flag if the DT tells the timer can not wake up the CPU (Anup Patel) - Increase the RISC-V timer rating as it is more efficient than mmio timers (Samuel Holland) - Drop obsolete dependency on COMPILE_TEST on microchip-pit64b as the OF is already depending on it (Jean Delvare) - Mark sh_cmt, sh_tmu, em_sti drivers as non-removable (Uwe Kleine-König) - Add binding description for mediatek,mt8365-systimer (Bernhard Rosenkränzer) - Add compatibles for T-Head's C9xx (Icenowy Zheng) - Restrict the microchip-pit64b compilation to the ARM architecture and add the delay timer (Claudiu Beznea) - Set the static key to select the SBI or Sstc timer sooner to prevent the first call to use the SBI while Sstc must be used (Matt Evans) - Add the CLOCK_EVT_FEAT_DYNIRQ flag to optimize the timer wake up on the sun4i platform (Yangtao Li) -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEGn3N4YVz0WNVyHskqDIjiipP6E8FAmPqLssACgkQqDIjiipP 6E/LvwgApZOFjzIQs0a/5Ank/amG3qJ9Gm6Fau9ntJZCnUYe/uA2NTm3IGWFBJl9 saSAXugzL894P2jF3n9r7kY4WhlOvlVpEIIfjxGwRkCo0R0OtIWFuz26b1iBpCQ7 OwQR2lxB7Fc4c8mnMMRpgpWeraQGLLPEqAoRpeF4h2UjObzqqNjxDr3MeDVaDiea QfhGRw3b7pKu9NTyXT6TnMMx8UC8nFCdmdQc3g7KuvkI32ZbC15voFI+XicjY56n homYY+UAK3zyVM53RXamrKbjWA06OzlN7+4ab1DHsmEWBcJ0Q+2sogHnLPpwwaEL Dfhu/JU0rtORDGI+lgUF677iw6+oAA== =xNOw -----END PGP SIGNATURE----- Merge tag 'timers-v6.3-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core Pull clocksource/event changes from Daniel Lezcano: - Add rktimer for rv1126 Rockchip based board (Jagan Teki) - Initialize hrtimer based broadcast clock event device on RISC-V before C3STOP can be used (Conor Dooley) - Add DT binding for RISC-V timer and add the C3STOP flag if the DT tells the timer can not wake up the CPU (Anup Patel) - Increase the RISC-V timer rating as it is more efficient than mmio timers (Samuel Holland) - Drop obsolete dependency on COMPILE_TEST on microchip-pit64b as the OF is already depending on it (Jean Delvare) - Mark sh_cmt, sh_tmu, em_sti drivers as non-removable (Uwe Kleine-König) - Add binding description for mediatek,mt8365-systimer (Bernhard Rosenkränzer) - Add compatibles for T-Head's C9xx (Icenowy Zheng) - Restrict the microchip-pit64b compilation to the ARM architecture and add the delay timer (Claudiu Beznea) - Set the static key to select the SBI or Sstc timer sooner to prevent the first call to use the SBI while Sstc must be used (Matt Evans) - Add the CLOCK_EVT_FEAT_DYNIRQ flag to optimize the timer wake up on the sun4i platform (Yangtao Li) Link: https://lore.kernel/org/r/b7d1d982-d717-2930-b353-19b92cbe390f@linaro.org
This commit is contained in:
commit
7b0f95f28f
|
|
@ -33,6 +33,7 @@ Required properties:
|
|||
|
||||
For those SoCs that use CPUX
|
||||
* "mediatek,mt6795-systimer" for MT6795 compatible timers (CPUX)
|
||||
* "mediatek,mt8365-systimer" for MT8365 compatible timers (CPUX)
|
||||
|
||||
- reg: Should contain location and length for timer register.
|
||||
- clocks: Should contain system clock.
|
||||
|
|
|
|||
52
Documentation/devicetree/bindings/timer/riscv,timer.yaml
Normal file
52
Documentation/devicetree/bindings/timer/riscv,timer.yaml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/timer/riscv,timer.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: RISC-V timer
|
||||
|
||||
maintainers:
|
||||
- Anup Patel <anup@brainfault.org>
|
||||
|
||||
description: |+
|
||||
RISC-V platforms always have a RISC-V timer device for the supervisor-mode
|
||||
based on the time CSR defined by the RISC-V privileged specification. The
|
||||
timer interrupts of this device are configured using the RISC-V SBI Time
|
||||
extension or the RISC-V Sstc extension.
|
||||
|
||||
The clock frequency of RISC-V timer device is specified via the
|
||||
"timebase-frequency" DT property of "/cpus" DT node which is described
|
||||
in Documentation/devicetree/bindings/riscv/cpus.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- riscv,timer
|
||||
|
||||
interrupts-extended:
|
||||
minItems: 1
|
||||
maxItems: 4096 # Should be enough?
|
||||
|
||||
riscv,timer-cannot-wake-cpu:
|
||||
type: boolean
|
||||
description:
|
||||
If present, the timer interrupt cannot wake up the CPU from one or
|
||||
more suspend/idle states.
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- interrupts-extended
|
||||
|
||||
examples:
|
||||
- |
|
||||
timer {
|
||||
compatible = "riscv,timer";
|
||||
interrupts-extended = <&cpu1intc 5>,
|
||||
<&cpu2intc 5>,
|
||||
<&cpu3intc 5>,
|
||||
<&cpu4intc 5>;
|
||||
};
|
||||
...
|
||||
|
|
@ -17,6 +17,7 @@ properties:
|
|||
- items:
|
||||
- enum:
|
||||
- rockchip,rv1108-timer
|
||||
- rockchip,rv1126-timer
|
||||
- rockchip,rk3036-timer
|
||||
- rockchip,rk3128-timer
|
||||
- rockchip,rk3188-timer
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ description:
|
|||
property of "/cpus" DT node. The "timebase-frequency" DT property is
|
||||
described in Documentation/devicetree/bindings/riscv/cpus.yaml
|
||||
|
||||
T-Head C906/C910 CPU cores include an implementation of CLINT too, however
|
||||
their implementation lacks a memory-mapped MTIME register, thus not
|
||||
compatible with SiFive ones.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
|
|
@ -29,6 +33,10 @@ properties:
|
|||
- starfive,jh7100-clint
|
||||
- canaan,k210-clint
|
||||
- const: sifive,clint0
|
||||
- items:
|
||||
- enum:
|
||||
- allwinner,sun20i-d1-clint
|
||||
- const: thead,c900-clint
|
||||
- items:
|
||||
- const: sifive,clint0
|
||||
- const: riscv,clint0
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ config 32BIT
|
|||
|
||||
config RISCV
|
||||
def_bool y
|
||||
select ARCH_CLOCKSOURCE_INIT
|
||||
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
|
||||
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
|
||||
select ARCH_HAS_BINFMT_FLAT
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/of_clk.h>
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/delay.h>
|
||||
#include <asm/sbi.h>
|
||||
|
|
@ -29,13 +30,6 @@ void __init time_init(void)
|
|||
|
||||
of_clk_init(NULL);
|
||||
timer_probe();
|
||||
}
|
||||
|
||||
void clocksource_arch_init(struct clocksource *cs)
|
||||
{
|
||||
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
|
||||
cs->vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER;
|
||||
#else
|
||||
cs->vdso_clock_mode = VDSO_CLOCKMODE_NONE;
|
||||
#endif
|
||||
tick_setup_hrtimer_broadcast();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -706,7 +706,7 @@ config INGENIC_OST
|
|||
|
||||
config MICROCHIP_PIT64B
|
||||
bool "Microchip PIT64B support"
|
||||
depends on OF || COMPILE_TEST
|
||||
depends on OF && ARM
|
||||
select TIMER_OF
|
||||
help
|
||||
This option enables Microchip PIT64B timer for Atmel
|
||||
|
|
|
|||
|
|
@ -333,11 +333,6 @@ static int em_sti_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int em_sti_remove(struct platform_device *pdev)
|
||||
{
|
||||
return -EBUSY; /* cannot unregister clockevent and clocksource */
|
||||
}
|
||||
|
||||
static const struct of_device_id em_sti_dt_ids[] = {
|
||||
{ .compatible = "renesas,em-sti", },
|
||||
{},
|
||||
|
|
@ -346,10 +341,10 @@ MODULE_DEVICE_TABLE(of, em_sti_dt_ids);
|
|||
|
||||
static struct platform_driver em_sti_device_driver = {
|
||||
.probe = em_sti_probe,
|
||||
.remove = em_sti_remove,
|
||||
.driver = {
|
||||
.name = "em_sti",
|
||||
.of_match_table = em_sti_dt_ids,
|
||||
.suppress_bind_attrs = true,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1145,17 +1145,12 @@ static int sh_cmt_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sh_cmt_remove(struct platform_device *pdev)
|
||||
{
|
||||
return -EBUSY; /* cannot unregister clockevent and clocksource */
|
||||
}
|
||||
|
||||
static struct platform_driver sh_cmt_device_driver = {
|
||||
.probe = sh_cmt_probe,
|
||||
.remove = sh_cmt_remove,
|
||||
.driver = {
|
||||
.name = "sh_cmt",
|
||||
.of_match_table = of_match_ptr(sh_cmt_of_table),
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.id_table = sh_cmt_id_table,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -632,11 +632,6 @@ static int sh_tmu_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sh_tmu_remove(struct platform_device *pdev)
|
||||
{
|
||||
return -EBUSY; /* cannot unregister clockevent and clocksource */
|
||||
}
|
||||
|
||||
static const struct platform_device_id sh_tmu_id_table[] = {
|
||||
{ "sh-tmu", SH_TMU },
|
||||
{ "sh-tmu-sh3", SH_TMU_SH3 },
|
||||
|
|
@ -652,10 +647,10 @@ MODULE_DEVICE_TABLE(of, sh_tmu_of_table);
|
|||
|
||||
static struct platform_driver sh_tmu_device_driver = {
|
||||
.probe = sh_tmu_probe,
|
||||
.remove = sh_tmu_remove,
|
||||
.driver = {
|
||||
.name = "sh_tmu",
|
||||
.of_match_table = of_match_ptr(sh_tmu_of_table),
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.id_table = sh_tmu_id_table,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
|
|
@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
|
|||
static void __iomem *mchp_pit64b_cs_base;
|
||||
/* Default cycles for clockevent timer. */
|
||||
static u64 mchp_pit64b_ce_cycles;
|
||||
/* Delay timer. */
|
||||
static struct delay_timer mchp_pit64b_dt;
|
||||
|
||||
static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
|
||||
{
|
||||
|
|
@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
|
|||
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
|
||||
}
|
||||
|
||||
static unsigned long notrace mchp_pit64b_dt_read(void)
|
||||
{
|
||||
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
|
||||
}
|
||||
|
||||
static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
|
||||
{
|
||||
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
|
||||
|
|
@ -376,6 +384,10 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
|
|||
|
||||
sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
|
||||
|
||||
mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
|
||||
mchp_pit64b_dt.freq = clk_rate;
|
||||
register_current_timer_delay(&mchp_pit64b_dt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <asm/timex.h>
|
||||
|
||||
static DEFINE_STATIC_KEY_FALSE(riscv_sstc_available);
|
||||
static bool riscv_timer_cannot_wake_cpu;
|
||||
|
||||
static int riscv_clock_next_event(unsigned long delta,
|
||||
struct clock_event_device *ce)
|
||||
|
|
@ -73,10 +74,15 @@ static u64 notrace riscv_sched_clock(void)
|
|||
|
||||
static struct clocksource riscv_clocksource = {
|
||||
.name = "riscv_clocksource",
|
||||
.rating = 300,
|
||||
.rating = 400,
|
||||
.mask = CLOCKSOURCE_MASK(64),
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
.read = riscv_clocksource_rdtime,
|
||||
#if IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER,
|
||||
#else
|
||||
.vdso_clock_mode = VDSO_CLOCKMODE_NONE,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int riscv_timer_starting_cpu(unsigned int cpu)
|
||||
|
|
@ -85,6 +91,8 @@ static int riscv_timer_starting_cpu(unsigned int cpu)
|
|||
|
||||
ce->cpumask = cpumask_of(cpu);
|
||||
ce->irq = riscv_clock_event_irq;
|
||||
if (riscv_timer_cannot_wake_cpu)
|
||||
ce->features |= CLOCK_EVT_FEAT_C3STOP;
|
||||
clockevents_config_and_register(ce, riscv_timebase, 100, 0x7fffffff);
|
||||
|
||||
enable_percpu_irq(riscv_clock_event_irq,
|
||||
|
|
@ -139,6 +147,13 @@ static int __init riscv_timer_init_dt(struct device_node *n)
|
|||
if (cpuid != smp_processor_id())
|
||||
return 0;
|
||||
|
||||
child = of_find_compatible_node(NULL, NULL, "riscv,timer");
|
||||
if (child) {
|
||||
riscv_timer_cannot_wake_cpu = of_property_read_bool(child,
|
||||
"riscv,timer-cannot-wake-cpu");
|
||||
of_node_put(child);
|
||||
}
|
||||
|
||||
domain = NULL;
|
||||
child = of_get_compatible_child(n, "riscv,cpu-intc");
|
||||
if (!child) {
|
||||
|
|
@ -177,6 +192,11 @@ static int __init riscv_timer_init_dt(struct device_node *n)
|
|||
return error;
|
||||
}
|
||||
|
||||
if (riscv_isa_extension_available(NULL, SSTC)) {
|
||||
pr_info("Timer interrupt in S-mode is available via sstc extension\n");
|
||||
static_branch_enable(&riscv_sstc_available);
|
||||
}
|
||||
|
||||
error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING,
|
||||
"clockevents/riscv/timer:starting",
|
||||
riscv_timer_starting_cpu, riscv_timer_dying_cpu);
|
||||
|
|
@ -184,11 +204,6 @@ static int __init riscv_timer_init_dt(struct device_node *n)
|
|||
pr_err("cpu hp setup state failed for RISCV timer [%d]\n",
|
||||
error);
|
||||
|
||||
if (riscv_isa_extension_available(NULL, SSTC)) {
|
||||
pr_info("Timer interrupt in S-mode is available via sstc extension\n");
|
||||
static_branch_enable(&riscv_sstc_available);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ static struct timer_of to = {
|
|||
.clkevt = {
|
||||
.name = "sun4i_tick",
|
||||
.rating = 350,
|
||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
|
||||
CLOCK_EVT_FEAT_DYNIRQ,
|
||||
.set_state_shutdown = sun4i_clkevt_shutdown,
|
||||
.set_state_periodic = sun4i_clkevt_set_periodic,
|
||||
.set_state_oneshot = sun4i_clkevt_set_oneshot,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user