All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladislav.Zakharov@synopsys.com (Vlad Zakharov)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] arc: get rate from clk driver instead of reading device tree
Date: Thu, 9 Mar 2017 19:33:14 +0000	[thread overview]
Message-ID: <1489087993.2333.20.camel@synopsys.com> (raw)
In-Reply-To: <9769fc4e-ffa4-143f-bb49-a42735e29d54@synopsys.com>

Hi Vineet,

On Wed, 2017-02-22@10:49 -0800, Vineet Gupta wrote:
> On 02/22/2017 02:36 AM, Vlad Zakharov wrote:
> > We were reading clock rate directly from device tree "clock-frequency"
> > property of corresponding clock node in show_cpuinfo function.
> >?
> > Such approach is correct only in case cpu is always clocked by
> > "fixed-clock". If we use clock driver that allows rate to be changed
> > this won't work as rate may change during the time or even
> > "clock-frequency" property may not be presented at all.
> >?
> > So this commit replaces reading device tree with getting rate from clock
> > driver. This approach is much more flexible and will work for both fixed
> > and mutable clocks.
> 
> So except the clk_put() comment - this looks much better to me.
> 
> And while we are at it - one of my wish list has been to print the core clk in
> early boot - i.e. in setup_processor()->arc_cpu_mumbojumbo() call path which is
> different from the other case u fixed. Any ideas how to do that - clk framework
> will not have init by then - so we need to read out from FDT or some such !

We can either parse FDT or read from real hardware - but is that the point?
I thought the goal is to get rid of as much board-dependent code as possible, isn't it?

In fact there are two ways of getting frequencies before clk framework inits:?

? 1) Parse FDT - this way is not platform-dependent, but if someone adds clock nodes without "clock-frequency" property
this is gonna fail. The second issue here is that device tree property is not believed to be accurate - actual value may
differ. So, there are a lot of disadvantages.

? 2) Read values from real hardware: this is platform-dependent way and we will have add such "hacks" for each supported
platform even if clock driver is provided for such platform. And that's why I don't like this way.

Of course clk framework initializes a bit later. But maybe we can wait for this and add just a couple of code lines that
read rate using common clk API?

-- 
Best regards,
Vlad Zakharov <vzakhar at synopsys.com>

  reply	other threads:[~2017-03-09 19:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 10:36 [PATCH] arc: get rate from clk driver instead of reading device tree Vlad Zakharov
2017-02-22 10:36 ` Vlad Zakharov
2017-02-22 18:34 ` Vineet Gupta
2017-02-22 18:34   ` Vineet Gupta
2017-02-28 15:11   ` Alexey Brodkin
2017-02-28 15:11     ` Alexey Brodkin
2017-02-22 18:49 ` Vineet Gupta
2017-02-22 18:49   ` Vineet Gupta
2017-03-09 19:33   ` Vlad Zakharov [this message]
2017-03-10  1:24     ` Vineet Gupta

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=1489087993.2333.20.camel@synopsys.com \
    --to=vladislav.zakharov@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.