mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry <dbaryshkov@gmail.com>
To: "Paul Walmsley" <paul@pwsan.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	"Haavard Skinnemoen" <haavard.skinnemoen@atmel.com>,
	"Russell King" <rmk+lkml@arm.linux.org.uk>,
	"Paul Mundt" <lethal@linux-sh.org>,
	"pHilipp Zabel" <philipp.zabel@gmail.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	tony@atomide.com, "David Brownell" <david-b@pacbell.net>,
	hiroshi.DOYU@nokia.com
Subject: Re: [PATCH 0/5] Clocklib: generic clocks framework
Date: Fri, 2 May 2008 13:40:41 +0400	[thread overview]
Message-ID: <bc64b4640805020240q6054ecbbr3c569699b69edd8b@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0805012221220.7405@utopia.booyaka.com>

Hi,


2008/5/2, Paul Walmsley <paul@pwsan.com>:
> Hello Dmitry,
>
>
>  On Sat, 26 Apr 2008, Dmitry wrote:
>
>  > 2008/4/25, Paul Walmsley <paul@pwsan.com>:
>  > >
>
> > > I wouldn't pretend to have a comprehensive list at this point.  But from a
>  > >  brief look, your clk_round_rate() and clk_set_rate() implementations will
>  > >  not work for the present OMAP clock tree.  In OMAP, many parent clocks do
>  > >  not have the same rate as their children.
>  >
>  > You can easily override any calculations in your clk->set_rate/clk->round_rate/
>  > clk->get_rate functions.
>
>
> The problem is that parent clocks shouldn't be automatically set to the
>  same rate as child clocks.  We could probably hack around it in
>  clk->set_rate to ignore those spurious rate changes, but really they
>  shouldn't be done in the first place, at least on OMAP.  clk->set_rate
>  should handle parent rate changes if necessary.  Removing this from
>  clocklib looks trivial - involves deleting about ten lines of clocklib
>  code?

OK. I'll introduce the clk_set_rate_propagate that should be used as a
->set_rate callback. The get_rate logic (to default to the parent
clock) seems to be OK from my POV. Will that suite you?

>
>
>  > My first goals are:
>  > 1) to have an infrastructure to plug in my clocks in a platform-independant way
>
>
> Doesn't the existing clock framework do this already?  Or are you really
>  referring to your clk_functions/multiple consumer additions?  If the
>  latter, then we all would be better served by discussing why the existing
>  clock interface doesn't meet your needs, and figuring out what to do about
>  it, rather than by merging code that initially appears to be common, but
>  with you having the ultimate intention of extending the common clock
>  interface to implement the features that you want.

Yes and no. Nearly all platforms have some type of clk_register. But
to use it you have to burry deeply in the platform code. There is no
easy way for a driver to provide clocks on both the PXA and SA-1100
arms, not telling about other platforms.

>
>
>  > 2) to drop lots of copies of nearly the same code.
>
>
> I don't really see much of a problem with the current situation, as long
>  as all of the implementations use the same interface.  Right now,
>  architectures are free to change their underlying code without having to
>  worry about breaking other architectures or dealing with new gatekeepers,
>  and that's a big plus for the status quo.  Russell is the person who
>  shoulders the burden here of multiple implementations, and when this
>  becomes a pressing problem, I would expect him to be doing most of the
>  advocacy for common code.

Nearly all platform-dependant code is still left in hands of platform
maintainers. There are only few assumptions built into the clocklib.
And I've just agreed to remove one of them.

>
>
>  > >  Assumptions that you make in clocklib may not work well for future chips.
>  > >  Changing clocklib will affect many architectures.  For example, perhaps
>  > >  someone may wish to implement clocks as an actual in-memory tree rather
>  > >  than a list.  Or perhaps someone may need to handle clock usecounting
>  > >  differently, for situations when multiple clocks might share the same
>  > >  enable/disable code, but with different parents.
>  >
>  > Sorry, but WTF? Do you prefer to keep a lot of code and disallow
>  > merging a generification just because of some-that-may-even-not-exist
>  > cases? That sounds
>  > pretty... strange.
>  > And your examples are really strange.
>
>
> Those examples are real; they have been discussed in the past or proposed
>  for the future for OMAP clock framework.  Regarding the second example,
>  that's a very real issue for us right now with our interface clocks, and
>  flexible usecounting is one of the ways that we've considered solving it.
>  As far as the tree example goes, we've got about 200 struct clks in the
>  latest OMAP clock framework, and this will probably increase by 50% over
>  the next year.  We have clock tree operations that have to move both up
>  and down the tree.  Right now we're doing sequential scans on a clock
>  list, but chances are quite high that we will be doing this very
>  differently a few months.

Tell me more please about "flexible usecounting". Or please provide
pointers to relevant threads I can read.

>
>  I cited these examples not because I was interested in having you tell me
>  that my examples were unrealistic or "strange" or should be done
>  differently, but simply to reinforce the message that a top-down approach
>  to a generic clocklib is not likely to be appreciated much by maintainers.
>  I know you keep saying that your code is intended to be be strictly
>  optional.  If you want to prove it, why not consider a bottom-up approach
>  instead?  Right now you've got patches that convert two architectures to
>  use your clocklib.  Instead of using a common library, just duplicate your
>  clock code for each architecture.  There's not much to it.  Propose
>  patches to individual architecture maintainers, and persuade them to
>  replace their existing code with your own.

I don't think that's the way to go. It's pretty stupid to force all
maintainers to agree to worse code only to make it better.

I still didn't receive any strong objections regarding the PXA and
SA-1100. Few other ARM architectures that have simple clk.h would gain
from clocklib by being able to drop non-platform-specific code. The
AVR32 maintainer seems to be looking positievly to adapting clocklib
once it's merged.

Maybe we should merge the core part only for now, to let all platform
maintainers consider it, think about it, provide patches to clocklib
that will be carefully though out and later (when dust settles) merge
the remaining bits of platform support?

-- 
With best wishes
Dmitry

  reply	other threads:[~2008-05-02  9:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-20  8:29 Dmitry Baryshkov
2008-04-20  8:30 ` [PATCH 1/5] Clocklib: add generic framework for managing clocks Dmitry Baryshkov
2008-04-20  8:30 ` [PATCH 2/5] Clocklib: debugfs support Dmitry Baryshkov
2008-04-20  8:31 ` [PATCH 3/5] Clocklib: support sa1100 sub-arch Dmitry Baryshkov
2008-04-20  8:31 ` [PATCH 4/5] Clocklib: support ARM pxa sub-arch Dmitry Baryshkov
2008-04-20  8:31 ` [PATCH 5/5] Clocklib: Use correct clock for IrDA on pxa Dmitry Baryshkov
2008-04-21  7:44 ` [PATCH 0/5] Clocklib: generic clocks framework Paul Walmsley
2008-04-21  8:48   ` Dmitry
2008-04-21  9:15     ` Hiroshi DOYU
2008-04-25  9:36     ` Paul Walmsley
2008-04-25 10:39       ` Pavel Machek
2008-04-25 20:20         ` Russell King
2008-04-25 20:34           ` Dmitry
2008-04-25 20:44             ` Russell King
2008-04-25 20:51           ` Pavel Machek
2008-04-25 21:13             ` Russell King
2008-04-25 21:36               ` Dmitry
2008-04-26  8:47       ` Dmitry
2008-04-26 18:02         ` David Brownell
2008-05-02  5:23         ` Paul Walmsley
2008-05-02  9:40           ` Dmitry [this message]
2008-05-05  7:59           ` Pavel Machek
2008-04-25 22:46     ` David Brownell
2008-04-26  8:38       ` Dmitry
2008-04-26 16:29         ` David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2008-04-20  8:28 Dmitry Baryshkov
2008-04-13 14:41 Dmitry Baryshkov

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=bc64b4640805020240q6054ecbbr3c569699b69edd8b@mail.gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=haavard.skinnemoen@atmel.com \
    --cc=hiroshi.DOYU@nokia.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=pavel@ucw.cz \
    --cc=philipp.zabel@gmail.com \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=tony@atomide.com \
    /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

all inboxes | Powered by JetHome®