devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: "Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Leonard Crestez" <leonard.crestez@nxp.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Daniel Baluta" <daniel.baluta@nxp.com>,
	"Jacky Bai" <ping.bai@nxp.com>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Abel Vesa" <abel.vesa@nxp.com>,
	"Andrey Smirnov" <andrew.smirnov@gmail.com>,
	"Carlo Caione" <ccaione@baylibre.com>,
	"Angus Ainslie (Purism)" <angus@akkea.ca>,
	"Guido Günther" <agx@sigxcpu.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	devicetree@vger.kernel.org
Subject: RE: [PATCH V4 2/5] clocksource/drivers/sysctr: Add clock-frequency property
Date: Wed, 10 Jul 2019 01:30:40 +0000	[thread overview]
Message-ID: <DB3PR0402MB39167FC68991F071E9E58D81F5F00@DB3PR0402MB3916.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAL_JsqKeu-b8mbMJBtnNn1vL=RSvUXbo+g40haZnjXTW11CJ6w@mail.gmail.com>

Hi, Rob

> On Mon, Jul 1, 2019 at 3:47 AM <Anson.Huang@nxp.com> wrote:
> >
> > From: Anson Huang <Anson.Huang@nxp.com>
> 
> 'dt-bindings: timer: ...' for the subject.

OK, I made a mistake.

> 
> >
> > Systems which use platform driver model for clock driver require the
> > clock frequency to be supplied via device tree when system counter
> > driver is enabled.
> 
> This is a DT binding. What's a platform driver?

It is just trying to explain why we need to introduce this "clock-frequency"
property, nothing about the binding and platform driver.

> 
> >
> > This is necessary as in the platform driver model the of_clk
> > operations do not work correctly because system counter driver is
> > initialized in early phase of system boot up, and clock driver using
> > platform driver model is NOT ready at that time, it will cause system
> > counter driver initialization failed.
> >
> > Add clock-frequency property to the device tree bindings of the NXP
> > system counter, so the driver can tell timer-of driver to get clock
> > frequency from DT directly instead of doing of_clk operations via clk
> > APIs.
> 
> While you've now given a good explanation why you need this, it all sounds
> like linux specific issues and a DT change should not be necessary.
> 
> Presumably, 'clocks' points to a fixed-clock node, right? Just parse the 'clocks'
> phandle and fetch the frequency from that node if you need to get the
> frequency 'early'.

Sound like a better solution, I will try that, since the system counter's clock is
from osc_24m and divided by 3, since different platforms may have different divider,
so maybe I can create a fixed-clock node in DT, then system counter driver can parse
the clock and fetch the frequency from that node, will redo a V5 patch.

> 
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > No change.
> > ---
> >  .../devicetree/bindings/timer/nxp,sysctr-timer.txt        | 15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt
> > b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt
> > index d576599..7088a0e 100644
> > --- a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt
> > +++ b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt
> > @@ -11,15 +11,18 @@ Required properties:
> >  - reg :             Specifies the base physical address and size of the comapre
> >                      frame and the counter control, read & compare.
> >  - interrupts :      should be the first compare frames' interrupt
> > -- clocks :         Specifies the counter clock.
> > -- clock-names:             Specifies the clock's name of this module
> > +- clocks :          Specifies the counter clock, mutually exclusive with clock-
> frequency.
> > +- clock-names :     Specifies the clock's name of this module, mutually
> exclusive with
> > +                   clock-frequency.
> > +- clock-frequency : Specifies system counter clock frequency, mutually
> exclusive with
> > +                   clocks/clock-names.
> 
> It doesn't really work to say one or the other is needed unless you make the
> OS support both cases.

The OS already support both cases now with this patch series.

Thanks,
Anson

  reply	other threads:[~2019-07-10  1:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01  9:38 [PATCH V4 1/5] clocksource: timer-of: Support getting clock frequency from DT Anson.Huang
2019-07-01  9:38 ` [PATCH V4 2/5] clocksource/drivers/sysctr: Add clock-frequency property Anson.Huang
2019-07-09 20:30   ` Rob Herring
2019-07-10  1:30     ` Anson Huang [this message]
2019-07-10 13:23       ` Rob Herring
2019-07-11  1:04         ` Anson Huang
2019-07-01  9:38 ` [PATCH V4 3/5] clocksource: imx-sysctr: Make timer work with clock driver using platform driver model Anson.Huang
2019-07-01  9:38 ` [PATCH V4 4/5] arm64: dts: imx8mq: Add system counter node Anson.Huang
2019-07-01  9:38 ` [PATCH V4 5/5] arm64: dts: imx8mm: " Anson.Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB3PR0402MB39167FC68991F071E9E58D81F5F00@DB3PR0402MB3916.eurprd04.prod.outlook.com \
    --to=anson.huang@nxp.com \
    --cc=abel.vesa@nxp.com \
    --cc=agx@sigxcpu.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=angus@akkea.ca \
    --cc=ccaione@baylibre.com \
    --cc=daniel.baluta@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ping.bai@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).