Skip to content

Commit

Permalink
Merge tag 'timers-v6.13-rc1' of https://git.linaro.org/people/daniel.…
Browse files Browse the repository at this point in the history
…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/[email protected]
  • Loading branch information
KAGA-KOKO committed Nov 13, 2024
2 parents 3c2fb01 + 08b97fb commit 228ad72
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 90 deletions.
21 changes: 0 additions & 21 deletions Documentation/devicetree/bindings/timer/actions,owl-timer.txt

This file was deleted.

107 changes: 107 additions & 0 deletions Documentation/devicetree/bindings/timer/actions,owl-timer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/timer/actions,owl-timer.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Actions Semi Owl timer

maintainers:
- Andreas Färber <[email protected]>

description:
Actions Semi Owl SoCs provide 32bit and 2Hz timers.
The 32bit timers support dynamic irq, as well as one-shot mode.

properties:
compatible:
enum:
- actions,s500-timer
- actions,s700-timer
- actions,s900-timer

clocks:
maxItems: 1

interrupts:
minItems: 1
maxItems: 6

interrupt-names:
minItems: 1
maxItems: 6
items:
enum:
- 2hz0
- 2hz1
- timer0
- timer1
- timer2
- timer3

reg:
maxItems: 1

required:
- compatible
- clocks
- interrupts
- interrupt-names
- reg

allOf:
- if:
properties:
compatible:
contains:
enum:
- actions,s500-timer
then:
properties:
interrupts:
minItems: 4
maxItems: 4
interrupt-names:
items:
- const: 2hz0
- const: 2hz1
- const: timer0
- const: timer1

- if:
properties:
compatible:
contains:
enum:
- actions,s700-timer
- actions,s900-timer
then:
properties:
interrupts:
minItems: 1
maxItems: 1
interrupt-names:
items:
- const: timer1

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
soc {
#address-cells = <1>;
#size-cells = <1>;
timer@b0168000 {
compatible = "actions,s500-timer";
reg = <0xb0168000 0x100>;
clocks = <&hosc>;
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "2hz0", "2hz1", "timer0", "timer1";
};
};
...
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ F: Documentation/devicetree/bindings/mmc/owl-mmc.yaml
F: Documentation/devicetree/bindings/net/actions,owl-emac.yaml
F: Documentation/devicetree/bindings/pinctrl/actions,*
F: Documentation/devicetree/bindings/power/actions,owl-sps.txt
F: Documentation/devicetree/bindings/timer/actions,owl-timer.txt
F: Documentation/devicetree/bindings/timer/actions,owl-timer.yaml
F: arch/arm/boot/dts/actions/
F: arch/arm/mach-actions/
F: arch/arm64/boot/dts/actions/
Expand Down
7 changes: 0 additions & 7 deletions arch/mips/ralink/Kconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
if RALINK

config CLKEVT_RT3352
bool
depends on SOC_RT305X || SOC_MT7620
default y
select TIMER_OF
select CLKSRC_MMIO

config RALINK_ILL_ACC
bool
depends on SOC_RT305X
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/ralink/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ ifndef CONFIG_MIPS_GIC
obj-y += clk.o timer.o
endif

obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o

obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o

obj-$(CONFIG_IRQ_INTC) += irq.o
Expand Down
12 changes: 11 additions & 1 deletion drivers/clocksource/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ config ARM_GT_INITIAL_PRESCALER_VAL
This affects CPU_FREQ max delta from the initial frequency.

config ARM_TIMER_SP804
bool "Support for Dual Timer SP804 module" if COMPILE_TEST
bool "Support for Dual Timer SP804 module"
depends on ARM || ARM64 || COMPILE_TEST
depends on GENERIC_SCHED_CLOCK && HAVE_CLK
select CLKSRC_MMIO
select TIMER_OF if OF
Expand Down Expand Up @@ -753,4 +754,13 @@ config EP93XX_TIMER
Enables support for the Cirrus Logic timer block
EP93XX.

config RALINK_TIMER
bool "Ralink System Tick Counter"
depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST
select CLKSRC_MMIO
select TIMER_OF
help
Enables support for system tick counter present on
Ralink SoCs RT3352 and MT7620.

endmenu
1 change: 1 addition & 0 deletions drivers/clocksource/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ obj-$(CONFIG_GOLDFISH_TIMER) += timer-goldfish.o
obj-$(CONFIG_GXP_TIMER) += timer-gxp.o
obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o
obj-$(CONFIG_EP93XX_TIMER) += timer-ep93xx.o
obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o
2 changes: 1 addition & 1 deletion drivers/clocksource/arm_arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ static int __init arch_timer_of_init(struct device_node *np)

arch_timers_present |= ARCH_TIMER_TYPE_CP15;

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

for (i = ARCH_TIMER_PHYS_SECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++) {
if (has_names)
Expand Down
39 changes: 0 additions & 39 deletions drivers/clocksource/dw_apb_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,6 @@ static inline void apbt_writel_relaxed(struct dw_apb_timer *timer, u32 val,
writel_relaxed(val, timer->base + offs);
}

static void apbt_disable_int(struct dw_apb_timer *timer)
{
u32 ctrl = apbt_readl(timer, APBTMR_N_CONTROL);

ctrl |= APBTMR_CONTROL_INT;
apbt_writel(timer, ctrl, APBTMR_N_CONTROL);
}

/**
* dw_apb_clockevent_pause() - stop the clock_event_device from running
*
* @dw_ced: The APB clock to stop generating events.
*/
void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced)
{
disable_irq(dw_ced->timer.irq);
apbt_disable_int(&dw_ced->timer);
}

static void apbt_eoi(struct dw_apb_timer *timer)
{
apbt_readl_relaxed(timer, APBTMR_N_EOI);
Expand Down Expand Up @@ -284,26 +265,6 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
return dw_ced;
}

/**
* dw_apb_clockevent_resume() - resume a clock that has been paused.
*
* @dw_ced: The APB clock to resume.
*/
void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced)
{
enable_irq(dw_ced->timer.irq);
}

/**
* dw_apb_clockevent_stop() - stop the clock_event_device and release the IRQ.
*
* @dw_ced: The APB clock to stop generating the events.
*/
void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced)
{
free_irq(dw_ced->timer.irq, &dw_ced->ced);
}

/**
* dw_apb_clockevent_register() - register the clock with the generic layer
*
Expand Down
39 changes: 38 additions & 1 deletion drivers/clocksource/mips-gic-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,37 @@ static u64 gic_hpt_read(struct clocksource *cs)
return gic_read_count();
}

static u64 gic_hpt_read_multicluster(struct clocksource *cs)
{
unsigned int hi, hi2, lo;
u64 count;

mips_cm_lock_other(0, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);

if (mips_cm_is64) {
count = read_gic_redir_counter();
goto out;
}

hi = read_gic_redir_counter_32h();
while (true) {
lo = read_gic_redir_counter_32l();

/* If hi didn't change then lo didn't wrap & we're done */
hi2 = read_gic_redir_counter_32h();
if (hi2 == hi)
break;

/* Otherwise, repeat with the latest hi value */
hi = hi2;
}

count = (((u64)hi) << 32) + lo;
out:
mips_cm_unlock_other();
return count;
}

static struct clocksource gic_clocksource = {
.name = "GIC",
.read = gic_hpt_read,
Expand Down Expand Up @@ -203,6 +234,11 @@ static int __init __gic_clocksource_init(void)
gic_clocksource.rating = 200;
gic_clocksource.rating += clamp(gic_frequency / 10000000, 0, 99);

if (mips_cps_multicluster_cpus()) {
gic_clocksource.read = &gic_hpt_read_multicluster;
gic_clocksource.vdso_clock_mode = VDSO_CLOCKMODE_NONE;
}

ret = clocksource_register_hz(&gic_clocksource, gic_frequency);
if (ret < 0)
pr_warn("Unable to register clocksource\n");
Expand Down Expand Up @@ -261,7 +297,8 @@ static int __init gic_clocksource_of_init(struct device_node *node)
* stable CPU frequency or on the platforms with CM3 and CPU frequency
* change performed by the CPC core clocks divider.
*/
if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) {
if ((mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) &&
!mips_cps_multicluster_cpus()) {
sched_clock_register(mips_cm_is64 ?
gic_read_count_64 : gic_read_count_2x32,
gic_count_width, gic_frequency);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clocksource/timer-gxp.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int __init gxp_timer_init(struct device_node *node)

clk = of_clk_get(node, 0);
if (IS_ERR(clk)) {
ret = (int)PTR_ERR(clk);
ret = PTR_ERR(clk);
pr_err("%pOFn clock not found: %d\n", node, ret);
goto err_free;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
* Ralink System Tick Counter driver present on RT3352 and MT7620 SoCs.
*
* Copyright (C) 2013 by John Crispin <[email protected]>
*/
Expand All @@ -16,8 +15,6 @@
#include <linux/of_irq.h>
#include <linux/of_address.h>

#include <asm/mach-ralink/ralink_regs.h>

#define SYSTICK_FREQ (50 * 1000)

#define SYSTICK_CONFIG 0x00
Expand All @@ -40,7 +37,7 @@ static int systick_set_oneshot(struct clock_event_device *evt);
static int systick_shutdown(struct clock_event_device *evt);

static int systick_next_event(unsigned long delta,
struct clock_event_device *evt)
struct clock_event_device *evt)
{
struct systick_device *sdev;
u32 count;
Expand All @@ -60,7 +57,7 @@ static void systick_event_handler(struct clock_event_device *dev)

static irqreturn_t systick_interrupt(int irq, void *dev_id)
{
struct clock_event_device *dev = (struct clock_event_device *) dev_id;
struct clock_event_device *dev = (struct clock_event_device *)dev_id;

dev->event_handler(dev);

Expand Down
8 changes: 4 additions & 4 deletions drivers/clocksource/timer-ti-dm-systimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ static bool __init dmtimer_is_preferred(struct device_node *np)

/* Secure gptimer12 is always clocked with a fixed source */
if (!of_property_read_bool(np, "ti,timer-secure")) {
if (!of_property_read_bool(np, "assigned-clocks"))
if (!of_property_present(np, "assigned-clocks"))
return false;

if (!of_property_read_bool(np, "assigned-clock-parents"))
if (!of_property_present(np, "assigned-clock-parents"))
return false;
}

Expand Down Expand Up @@ -686,9 +686,9 @@ subsys_initcall(dmtimer_percpu_timer_startup);

static int __init dmtimer_percpu_quirk_init(struct device_node *np, u32 pa)
{
struct device_node *arm_timer;
struct device_node *arm_timer __free(device_node) =
of_find_compatible_node(NULL, NULL, "arm,armv7-timer");

arm_timer = of_find_compatible_node(NULL, NULL, "arm,armv7-timer");
if (of_device_is_available(arm_timer)) {
pr_warn_once("ARM architected timer wrap issue i940 detected\n");
return 0;
Expand Down
8 changes: 6 additions & 2 deletions drivers/clocksource/timer-ti-dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
return -ENOMEM;

timer->irq = platform_get_irq(pdev, 0);
if (timer->irq < 0)
return timer->irq;
if (timer->irq < 0) {
if (of_property_read_bool(dev->of_node, "ti,timer-pwm"))
dev_info(dev, "Did not find timer interrupt, timer usable in PWM mode only\n");
else
return timer->irq;
}

timer->io_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(timer->io_base))
Expand Down
Loading

0 comments on commit 228ad72

Please sign in to comment.