[<prev] [next>] [day] [month] [year] [list]
Message-ID: <175883601551.709179.8418809190993423615.tip-bot2@tip-bot2>
Date: Thu, 25 Sep 2025 21:33:35 -0000
From: "tip-bot2 for Daniel Lezcano" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/clocksource] clocksource/drivers/vf-pit: Rework the base
address usage
The following commit has been merged into the timers/clocksource branch of tip:
Commit-ID: 361580317976ff25ce4eddbf207d06b0aca9ab22
Gitweb: https://git.kernel.org/tip/361580317976ff25ce4eddbf207d06b0aca9ab22
Author: Daniel Lezcano <daniel.lezcano@...aro.org>
AuthorDate: Mon, 04 Aug 2025 17:23:22 +02:00
Committer: Daniel Lezcano <daniel.lezcano@...aro.org>
CommitterDate: Tue, 23 Sep 2025 12:28:42 +02:00
clocksource/drivers/vf-pit: Rework the base address usage
This change passes the base address to the clockevent and clocksource
initialization functions in order to use different base address in the
next changes.
No functional changes intended.
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
Link: https://lore.kernel.org/r/20250804152344.1109310-5-daniel.lezcano@linaro.org
---
drivers/clocksource/timer-vf-pit.c | 35 ++++++++++++++++++-----------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer-vf-pit.c
index e4a8b32..6a5f940 100644
--- a/drivers/clocksource/timer-vf-pit.c
+++ b/drivers/clocksource/timer-vf-pit.c
@@ -66,8 +66,16 @@ static u64 notrace pit_read_sched_clock(void)
return ~readl(clksrc_base + PITCVAL);
}
-static int __init pit_clocksource_init(struct pit_timer *pit, unsigned long rate)
+static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem *base,
+ unsigned long rate)
{
+ /*
+ * The channels 0 and 1 can be chained to build a 64-bit
+ * timer. Let's use the channel 2 as a clocksource and leave
+ * the channels 0 and 1 unused for anyone else who needs them
+ */
+ pit->clksrc_base = base + PIT_CH(2);
+
/* set the max load value and start the clock source counter */
writel(0, pit->clksrc_base + PITTCTRL);
writel(~0, pit->clksrc_base + PITLDVAL);
@@ -76,8 +84,9 @@ static int __init pit_clocksource_init(struct pit_timer *pit, unsigned long rate
clksrc_base = pit->clksrc_base;
sched_clock_register(pit_read_sched_clock, 32, rate);
+
return clocksource_mmio_init(pit->clksrc_base + PITCVAL, "vf-pit", rate,
- 300, 32, clocksource_mmio_readl_down);
+ 300, 32, clocksource_mmio_readl_down);
}
static int pit_set_next_event(unsigned long delta, struct clock_event_device *ced)
@@ -137,8 +146,16 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static int __init pit_clockevent_init(struct pit_timer *pit, unsigned long rate, int irq)
+static int __init pit_clockevent_init(struct pit_timer *pit, void __iomem *base,
+ unsigned long rate, int irq)
{
+ /*
+ * The channels 0 and 1 can be chained to build a 64-bit
+ * timer. Let's use the channel 3 as a clockevent and leave
+ * the channels 0 and 1 unused for anyone else who needs them
+ */
+ pit->clkevt_base = base + PIT_CH(3);
+
writel(0, pit->clkevt_base + PITTCTRL);
writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG);
@@ -182,14 +199,6 @@ static int __init pit_timer_init(struct device_node *np)
return -ENXIO;
}
- /*
- * PIT0 and PIT1 can be chained to build a 64-bit timer,
- * so choose PIT2 as clocksource, PIT3 as clockevent device,
- * and leave PIT0 and PIT1 unused for anyone else who needs them.
- */
- pit_timer.clksrc_base = timer_base + PIT_CH(2);
- pit_timer.clkevt_base = timer_base + PIT_CH(3);
-
irq = irq_of_parse_and_map(np, 0);
if (irq <= 0)
return -EINVAL;
@@ -208,10 +217,10 @@ static int __init pit_timer_init(struct device_node *np)
/* enable the pit module */
writel(~PITMCR_MDIS, timer_base + PITMCR);
- ret = pit_clocksource_init(&pit_timer, clk_rate);
+ ret = pit_clocksource_init(&pit_timer, timer_base, clk_rate);
if (ret)
return ret;
- return pit_clockevent_init(&pit_timer, clk_rate, irq);
+ return pit_clockevent_init(&pit_timer, timer_base, clk_rate, irq);
}
TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init);
Powered by blists - more mailing lists