Skip to content

Commit

Permalink
Merge tag 'timers-core-2022-01-13' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/tip/tip

Pull timer updates from Thomas Gleixner:
 "Updates for the time(r) subsystem:

  Core:

   - Make the clocksource watchdog more robust by better validation
     checks of the measurement.

  Drivers:

   - New drivers for MStar and SSD20xd SOCs

   - The usual cleanups and improvements all over the place"

* tag 'timers-core-2022-01-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  dt-bindings: timer: Add Mstar MSC313e timer devicetree bindings documentation
  clocksource/drivers/msc313e: Add support for ssd20xd-based platforms
  clocksource/drivers: Add MStar MSC313e timer support
  clocksource/drivers/pistachio: Fix -Wunused-but-set-variable warning
  clocksource/drivers/timer-imx-sysctr: Set cpumask to cpu_possible_mask
  clocksource/drivers/imx-sysctr: Mark two variable with __ro_after_init
  clocksource/drivers/renesas,ostm: Make RENESAS_OSTM symbol visible
  clocksource/drivers/renesas-ostm: Add RZ/G2L OSTM support
  dt-bindings: timer: renesas: ostm: Document Renesas RZ/G2L OSTM
  clocksource/drivers/exynos_mct: Fix silly typo resulting in checkpatch warning
  clocksource: Reduce the default clocksource_watchdog() retries to 2
  clocksource: Avoid accidental unstable marking of clocksources
  dt-bindings: timer: tpm-timer: Add imx8ulp compatible string
  reset: Add of_reset_control_get_optional_exclusive()
  clocksource/drivers/exynos_mct: Refactor resources allocation
  dt-bindings: timer: remove rockchip,rk3066-timer compatible string from rockchip,rk-timer.yaml
  dt-bindings: timer: cadence_ttc: Add power-domains
  • Loading branch information
Linus Torvalds committed Jan 13, 2022
2 parents 147cc58 + 35e13e9 commit fd04899
Show file tree
Hide file tree
Showing 16 changed files with 475 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@
clocksource.max_cswd_read_retries= [KNL]
Number of clocksource_watchdog() retries due to
external delays before the clock will be marked
unstable. Defaults to three retries, that is,
four attempts to read the clock under test.
unstable. Defaults to two retries, that is,
three attempts to read the clock under test.

clocksource.verify_n_cpus= [KNL]
Limit the number of CPUs checked for clocksources
Expand Down
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/timer/cdns,ttc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ properties:
clocks:
maxItems: 1

power-domains:
maxItems: 1

timer-width:
$ref: "/schemas/types.yaml#/definitions/uint32"
description: |
Expand Down
46 changes: 46 additions & 0 deletions Documentation/devicetree/bindings/timer/mstar,msc313e-timer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/timer/mstar,msc313e-timer.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Mstar MSC313e Timer Device Tree Bindings

maintainers:
- Daniel Palmer <daniel@0x0f.com>
- Romain Perier <romain.perier@gmail.com>

properties:
compatible:
enum:
- mstar,msc313e-timer
- sstar,ssd20xd-timer

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
maxItems: 1

required:
- compatible
- reg
- interrupts
- clocks

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
timer@6040 {
compatible = "mstar,msc313e-timer";
reg = <0x6040 0x40>;
clocks = <&xtal_div2>;
interrupts-extended = <&intc_fiq GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
};
...
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/timer/nxp,tpm-timer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ description: |
properties:
compatible:
const: fsl,imx7ulp-tpm
oneOf:
- const: fsl,imx7ulp-tpm
- items:
- const: fsl,imx8ulp-tpm
- const: fsl,imx7ulp-tpm

reg:
maxItems: 1
Expand Down
20 changes: 17 additions & 3 deletions Documentation/devicetree/bindings/timer/renesas,ostm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ properties:
compatible:
items:
- enum:
- renesas,r7s72100-ostm # RZ/A1H
- renesas,r7s9210-ostm # RZ/A2M
- const: renesas,ostm # Generic
- renesas,r7s72100-ostm # RZ/A1H
- renesas,r7s9210-ostm # RZ/A2M
- renesas,r9a07g044-ostm # RZ/G2{L,LC}
- const: renesas,ostm # Generic

reg:
maxItems: 1
Expand All @@ -37,13 +38,26 @@ properties:
power-domains:
maxItems: 1

resets:
maxItems: 1

required:
- compatible
- reg
- interrupts
- clocks
- power-domains

if:
properties:
compatible:
contains:
enum:
- renesas,r9a07g044-ostm
then:
required:
- resets

additionalProperties: false

examples:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ properties:
- enum:
- rockchip,rv1108-timer
- rockchip,rk3036-timer
- rockchip,rk3066-timer
- rockchip,rk3188-timer
- rockchip,rk3228-timer
- rockchip,rk3229-timer
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,7 @@ F: Documentation/devicetree/bindings/gpio/mstar,msc313-gpio.yaml
F: arch/arm/boot/dts/mstar-*
F: arch/arm/mach-mstar/
F: drivers/clk/mstar/
F: drivers/clocksource/timer-msc313e.c
F: drivers/gpio/gpio-msc313.c
F: drivers/rtc/rtc-msc313.c
F: drivers/watchdog/msc313e_wdt.c
Expand Down
12 changes: 11 additions & 1 deletion drivers/clocksource/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ config SH_TIMER_MTU2
This hardware comes with 16-bit timer registers.

config RENESAS_OSTM
bool "Renesas OSTM timer driver" if COMPILE_TEST
bool "Renesas OSTM timer driver"
depends on ARCH_RENESAS || COMPILE_TEST
select CLKSRC_MMIO
select TIMER_OF
help
Expand Down Expand Up @@ -671,6 +672,15 @@ config MILBEAUT_TIMER
help
Enables the support for Milbeaut timer driver.

config MSC313E_TIMER
bool "MSC313E timer driver" if COMPILE_TEST
select TIMER_OF
select CLKSRC_MMIO
help
Enables support for the MStar MSC313E timer driver.
This provides access to multiple interrupt generating
programmable 32-bit free running incrementing counters.

config INGENIC_TIMER
bool "Clocksource/timer using the TCU in Ingenic JZ SoCs"
default MACH_INGENIC
Expand Down
1 change: 1 addition & 0 deletions drivers/clocksource/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ obj-$(CONFIG_CSKY_MP_TIMER) += timer-mp-csky.o
obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o
obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o
obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o
obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o
52 changes: 31 additions & 21 deletions drivers/clocksource/exynos_mct.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ static int exynos4_mct_starting_cpu(unsigned int cpu)
evt->tick_resume = set_state_shutdown;
evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
CLOCK_EVT_FEAT_PERCPU;
evt->rating = MCT_CLKEVENTS_RATING,
evt->rating = MCT_CLKEVENTS_RATING;

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

Expand Down Expand Up @@ -504,11 +504,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu)
return 0;
}

static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base)
static int __init exynos4_timer_resources(struct device_node *np)
{
int err, cpu;
struct clk *mct_clk, *tick_clk;

reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: unable to ioremap mct address space\n", __func__);

tick_clk = of_clk_get_by_name(np, "fin_pll");
if (IS_ERR(tick_clk))
panic("%s: unable to determine tick clock rate\n", __func__);
Expand All @@ -519,9 +522,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
panic("%s: unable to retrieve mct clock instance\n", __func__);
clk_prepare_enable(mct_clk);

reg_base = base;
if (!reg_base)
panic("%s: unable to ioremap mct address space\n", __func__);
return 0;
}

static int __init exynos4_timer_interrupts(struct device_node *np,
unsigned int int_type)
{
int nr_irqs, i, err, cpu;

mct_int_type = int_type;

/* This driver uses only one global timer interrupt */
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);

/*
* Find out the number of local irqs specified. The local
* timer irqs are specified after the four global timer
* irqs are specified.
*/
nr_irqs = of_irq_count(np);
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
mct_irqs[i] = irq_of_parse_and_map(np, i);

if (mct_int_type == MCT_INT_PPI) {

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

static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
{
u32 nr_irqs, i;
int ret;

mct_int_type = int_type;

/* This driver uses only one global timer interrupt */
mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);

/*
* Find out the number of local irqs specified. The local
* timer irqs are specified after the four global timer
* irqs are specified.
*/
nr_irqs = of_irq_count(np);
for (i = MCT_L0_IRQ; i < nr_irqs; i++)
mct_irqs[i] = irq_of_parse_and_map(np, i);
ret = exynos4_timer_resources(np);
if (ret)
return ret;

ret = exynos4_timer_resources(np, of_iomap(np, 0));
ret = exynos4_timer_interrupts(np, int_type);
if (ret)
return ret;

Expand Down
39 changes: 38 additions & 1 deletion drivers/clocksource/renesas-ostm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/sched_clock.h>
#include <linux/slab.h>

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

static int __init ostm_init(struct device_node *np)
{
struct reset_control *rstc;
struct timer_of *to;
int ret;

to = kzalloc(sizeof(*to), GFP_KERNEL);
if (!to)
return -ENOMEM;

rstc = of_reset_control_get_optional_exclusive(np, NULL);
if (IS_ERR(rstc)) {
ret = PTR_ERR(rstc);
goto err_free;
}

reset_control_deassert(rstc);

to->flags = TIMER_OF_BASE | TIMER_OF_CLOCK;
if (system_clock) {
/*
Expand All @@ -178,7 +189,7 @@ static int __init ostm_init(struct device_node *np)

ret = timer_of_init(np, to);
if (ret)
goto err_free;
goto err_reset;

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

err_cleanup:
timer_of_cleanup(to);
err_reset:
reset_control_assert(rstc);
reset_control_put(rstc);
err_free:
kfree(to);
return ret;
}

TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);

#ifdef CONFIG_ARCH_R9A07G044
static int __init ostm_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;

return ostm_init(dev->of_node);
}

static const struct of_device_id ostm_of_table[] = {
{ .compatible = "renesas,ostm", },
{ /* sentinel */ }
};

static struct platform_driver ostm_device_driver = {
.driver = {
.name = "renesas_ostm",
.of_match_table = of_match_ptr(ostm_of_table),
.suppress_bind_attrs = true,
},
};
builtin_platform_driver_probe(ostm_device_driver, ostm_probe);
#endif
6 changes: 3 additions & 3 deletions drivers/clocksource/timer-imx-sysctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#define SYS_CTR_CLK_DIV 0x3

static void __iomem *sys_ctr_base;
static u32 cmpcr;
static void __iomem *sys_ctr_base __ro_after_init;
static u32 cmpcr __ro_after_init;

static void sysctr_timer_enable(bool enable)
{
Expand Down Expand Up @@ -119,7 +119,7 @@ static struct timer_of to_sysctr = {

static void __init sysctr_clockevent_init(void)
{
to_sysctr.clkevt.cpumask = cpumask_of(0);
to_sysctr.clkevt.cpumask = cpu_possible_mask;

clockevents_config_and_register(&to_sysctr.clkevt,
timer_of_rate(&to_sysctr),
Expand Down
Loading

0 comments on commit fd04899

Please sign in to comment.