[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB3PR0402MB3916A7348E71A33E4746D5FAF5FD0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
Date: Thu, 27 Jun 2019 12:49:17 +0000
From: Anson Huang <anson.huang@....com>
To: Daniel Lezcano <daniel.lezcano@...aro.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>,
"l.stach@...gutronix.de" <l.stach@...gutronix.de>,
Abel Vesa <abel.vesa@....com>,
"ccaione@...libre.com" <ccaione@...libre.com>,
"angus@...ea.ca" <angus@...ea.ca>,
"andrew.smirnov@...il.com" <andrew.smirnov@...il.com>,
"agx@...xcpu.org" <agx@...xcpu.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
CC: dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH RESEND V2 2/3] clocksource: imx-sysctr: Make timer work
with clock driver using platform driver model
Hi, Daniel
> On 23/06/2019 14:38, Anson.Huang@....com wrote:
> > 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, add an option
> > of skipping of_clk operation for system counter driver, an optional
> > property "clock-frequency" is introduced to pass the frequency value
> > to system counter driver and indicate driver to skip of_clk
> > operations.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@....com>
> > ---
> > Changes since V1:
> > - improve commit log, no content change.
> > ---
> > drivers/clocksource/timer-imx-sysctr.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/clocksource/timer-imx-sysctr.c
> > b/drivers/clocksource/timer-imx-sysctr.c
> > index fd7d680..8ff3d7e 100644
> > --- a/drivers/clocksource/timer-imx-sysctr.c
> > +++ b/drivers/clocksource/timer-imx-sysctr.c
> > @@ -129,6 +129,14 @@ static void __init sysctr_clockevent_init(void)
> > static int __init sysctr_timer_init(struct device_node *np) {
> > int ret = 0;
> > + u32 rate;
> > +
> > + if (!of_property_read_u32(np, "clock-frequency",
> > + &rate)) {
> > + to_sysctr.of_clk.rate = rate;
> > + to_sysctr.of_clk.period = DIV_ROUND_UP(rate, HZ);
> > + to_sysctr.flags &= ~TIMER_OF_CLOCK;
> > + }
>
> Please take the opportunity to add the TIMER_OF_CLOCK_FREQUENCY flag in
> timer-of and the corresponding code above.
OK, so another patch for timer-of is necessary, if TIMER_OF_CLOCK_FREQUENCY flag
is present, just read the "clock-frequency" from DT instead of getting clock rate from
clock tree, right? I think this becomes a common case for timer driver, as more and more
platforms will use platform driver model for clock driver, it would be good if timer-of can
provide solution.
>
> Then check the clock-frequency presence and add TIMER_OF_CLOCK or
> TIMER_OF_CLOCK_FREQUENCY flag to the timer-of structure.
>
> eg:
>
> to_sysctr.flags |= of_find_property(np, "clock-frequency", NULL) ?
> TIMER_OF_CLOCK_FREQUENCY : TIMER_OF_CLOCK;
>
OK.
Thanks,
Anson.
Powered by blists - more mailing lists