[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190628033041.8513-3-Anson.Huang@nxp.com>
Date: Fri, 28 Jun 2019 11:30:39 +0800
From: Anson.Huang@....com
To: daniel.lezcano@...aro.org, tglx@...utronix.de, robh+dt@...nel.org,
mark.rutland@....com, shawnguo@...nel.org, s.hauer@...gutronix.de,
kernel@...gutronix.de, festevam@...il.com, leonard.crestez@....com,
viresh.kumar@...aro.org, daniel.baluta@....com, ping.bai@....com,
l.stach@...gutronix.de, abel.vesa@....com,
andrew.smirnov@...il.com, ccaione@...libre.com, angus@...ea.ca,
agx@...xcpu.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: Linux-imx@....com
Subject: [PATCH V3 3/5] clocksource: imx-sysctr: Make timer work with clock driver using platform driver model
From: Anson Huang <Anson.Huang@....com>
On some i.MX8M platforms, clock driver uses platform driver
model and it is NOT ready during timer initialization phase,
the clock operations will fail and system counter driver will
fail too. As all the i.MX8M platforms' system counter clock
are from OSC which is always enabled, so it is no need to enable
clock for system counter driver, the ONLY thing is to pass
clock frequence to driver.
To make system counter driver work for upper scenario, if DT's
system counter node has property "clock-frequency" present,
setting TIMER_OF_CLOCK_FREQUENCY flag to indicate timer-of driver
to get clock frequency from DT directly instead of of_clk operation
via clk APIs.
Signed-off-by: Anson Huang <Anson.Huang@....com>
---
Changes since V2:
- do runtime check to decide whether using TIMER_OF_CLOCK_FREQUENCY or TIMER_OF_CLOCK
according to DT node settings.
---
drivers/clocksource/timer-imx-sysctr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
index fd7d680..73e3193 100644
--- a/drivers/clocksource/timer-imx-sysctr.c
+++ b/drivers/clocksource/timer-imx-sysctr.c
@@ -98,7 +98,7 @@ static irqreturn_t sysctr_timer_interrupt(int irq, void *dev_id)
}
static struct timer_of to_sysctr = {
- .flags = TIMER_OF_IRQ | TIMER_OF_CLOCK | TIMER_OF_BASE,
+ .flags = TIMER_OF_IRQ | TIMER_OF_BASE,
.clkevt = {
.name = "i.MX system counter timer",
.features = CLOCK_EVT_FEAT_ONESHOT |
@@ -114,6 +114,7 @@ static struct timer_of to_sysctr = {
},
.of_clk = {
.name = "per",
+ .prop_name = "clock-frequency",
},
};
@@ -130,6 +131,9 @@ static int __init sysctr_timer_init(struct device_node *np)
{
int ret = 0;
+ to_sysctr.flags |= of_find_property(np, "clock-frequency", NULL) ?
+ TIMER_OF_CLOCK_FREQUENCY : TIMER_OF_CLOCK;
+
ret = timer_of_init(np, &to_sysctr);
if (ret)
return ret;
--
2.7.4
Powered by blists - more mailing lists