Skip to content

Commit

Permalink
Merge tag 'timers-v5.17-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/events updates from Daniel Lezcano:

 - Refactor resource allocation on the Exynos_mct driver without
   functional changes (Marek Szyprowski)

 - Add imx8ulp compatible string for NPX TPM driver (Jacky Bai)

 - Fix comma introduced by error by replacing it by the initial
   semicolon on the Exynos_mct (Will Deacon)

 - Add OSTM driver support on Renesas. The reset line must be
   deasserted before accessing the registers. This change depends on an
   external change resulting in a shared immutable branch
   'reset/of-get-optional-exclusive' from
   git://git.pengutronix.de/pza/linux (Biju Das)

 - Make the OSTM Kconfig option visible to user in order to let him
   disable it when ARM architected timers is enabled (Biju Das)

 - Tag two variables on iMX sysctr _ro_afterinit (Peng Fan)

 - Set the cpumask to cpu_possible_mask in order to have full benefit
   of the DYNIRQ flag on iMX sysctr (Peng Fan)

 - Tag __maybe_unused a variable in the Pistachio timer driver in order
   to fix a warning reported by the kernel test robot (Drew Fustini)

 - Add MStar MSC313e timer support and the ssd20xd-based variant, as
   well as the DT bindings (Romain Perier)

 - Remove the incompatible compatible string for the rk3066 (Johan
   Jonker)

 - Fix dts_check warnings on the cadence ttc driver by adding the power
   domain bindings (Michal Simek)

Link: https://lore.kernel.org/lkml/e093c706-c98d-29ee-0102-78b6d41c6164@linaro.org
  • Loading branch information
KAGA-KOKO committed Jan 10, 2022
2 parents 2585cf9 + 7647204 commit 6629c07
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 32 deletions.
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 @@ -2291,6 +2291,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 6629c07

Please sign in to comment.