From: Dmitry <dbaryshkov@gmail.com>
To: "Paul Mundt" <lethal@linux-sh.org>, Dmitry <dbaryshkov@gmail.com>,
"Haavard Skinnemoen" <haavard.skinnemoen@atmel.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
hskinnemoen@atmel.com, domen.puncer@telargo.com,
tony@atomide.com, rmk+kernel@arm.linux.org.uk, paul@pwsan.com
Subject: Re: [PATCH 1/3] Clocklib: add generic framework for managing clocks.
Date: Thu, 27 Mar 2008 12:52:15 +0300 [thread overview]
Message-ID: <bc64b4640803270252q7199b3c8g62b7483c310dba6a@mail.gmail.com> (raw)
In-Reply-To: <20080326174433.GA13104@linux-sh.org>
Hi,
2008/3/26, Paul Mundt <lethal@linux-sh.org>:
> On Wed, Mar 26, 2008 at 07:52:34PM +0300, Dmitry wrote:
> > 2008/3/26, Haavard Skinnemoen <haavard.skinnemoen@atmel.com>:
>
> > > Hmm...this is exactly twice as big as the struct I'm currently using,
> > > it doesn't contain all the fields I need, and it's undocumented.
> >
> > I've added a more sofisticated arch convertion patch (the clocklib for
> > ARM PXA chips).
> >
>
> What you've converted is still pretty tame in comparison to what this
> sort of framework has to handle. Something like the OMAP struct clk is
> more like a worst-case and is representative of how large this structure
> will get for everyone if it is to be shared without dropping
> functionality.
No, I don't want to add any more fields to generic struct clk. All
fancy fields should
go intro arch (or even clock-type) specific "priv" struct.
>
>
> > > I have quite a few clocks, so the increased memory consumption is quite
> > > significant. What are the advantages of this?
> >
> > At maximum 55, IIUC. I counted 32 or so additional bytes in the struct
> > (over avr32-specific one). That would count up to 1.5 K overhead. Is
> > that really too much for current kernels?
> >
>
> Your idea of maximum and my hardware's idea of maximum have very little
> in common. Most of these platforms are dealing with hundreds of different
> clocks, though they are not necessarily all interfaced in software
> control (mostly because a lot of them auto-gate, and because writing up
> struct clk definitions for 200+ clocks for 30 different CPUs isn't
> exactly my idea of a good time). This does not mean that more clocks will
> not be hooked up as the need arises.
I have an idea of extendability and not "maximisation". And btw if
those clocks can be controlled from the kernel, one will write a
patch to control them to get better power
management, ease driver interfaces, etc.
> On Wed, Mar 26, 2008 at 08:04:41PM +0300, Dmitry wrote:
> > 2008/3/26, Paul Mundt <lethal@linux-sh.org>:
>
> > > Conversely it also has fields that I don't need. If struct clk could have
> > > been done generically without growing to insane sizes, it would have been
> > > done so in linux/clk.h a long time ago. The main thing there is API
> > > consistency for drivers, leaving the details up to the architecture.
> >
> > In reality, as noted David Brownell on LAKML, there is no API consistency.
> > The driver has no way to know whether clk API is implemented at all or whether
> > the "optional" functions do exist.
> >
>
> There is certainly API consistency. If there were not, we wouldn't have
> linux/clk.h. The fact that many platforms add on top of this does not
> detract from the fact that we have a common API that is currently shared.
I don't mean "additions". I meant optional "rate-controlling"
functions that some platforms
event don't try to implement.
>
> There is indeed no way to know what optional functionality exists, but
> your proposed structure and interface largely works around that problem
> by ignoring all of the optional functionality. This works great for an
> idealized set of platforms and clock configurations, but quickly runs in
> to the same issue that linux/clk.h has today. It's not clear how your
> proposed interface helps any of this other than providing a struct clk
> that can be used more generically.
In the current situation if the "rate" or "parent" functionality
doesn't exist and the driver tries to use it, one would either get
compilation errors, or some non-standard -ENOsmth error.
With my patchset if the CLOCK_LIB is selected, the driver can assume
that it can safely call all linux/clk.h functions and if requested
feature isn't supported it'll get -EINVAL.
> > Moreover clocks aren't limited only to platform-specific code. As an
> > example of the in-tree driver that will benefit from clocklib you can
> > check drivers/mfd/sm501.c which contains it's own set of functions
> > to manage clocks.
> >
>
> That's certainly true, it's definitely worthwhile to try and unify as
> much of the interface as possible. Perhaps it makes more sense to try and
> have a common struct clk with the bare essentials and then allow the
> platforms to extend that functionality based on their own capabilities.
> This could be done through the private data I suppose.
Yup! Or as Haavard suggested, via clock extention. I took the first
way, because
I didn't want to conflict too much with OMAP clocks (plat-omap/clock.c
uses clocks
extension for self purposes. Probably this can be merged).
> > That's one of the initial reasons of this patchserie: I have a device
> > that can be installed on several platforms. And I want for this device
> > to provide clocks to some other devices.
> >
>
> I don't disagree with your intentions, or that something like this would
> be a good idea. What needs to happen first is having a look at all of the
> different versions of the clock framework that are out there and coming
> up with a consolidated struct clk, then seeing if the resulting size is
> practical enough to actually use for any significant number of clocks.
That sound constructive. Good!
>
> Your current definition doesn't meet the requirements of all of the
> struct clk users in the kernel, and it's already getting quite big
> compared to what people (avr32, sh, some ARM platforms, etc.) are using
> today. This is a good indicator of why a common definition wasn't a good
> fit in the first place.
>
IMHO It wasn't good when the linux/clk.h first arrived. Now we already
have a few implmentations of it, so we can really judge what is common
and can be moved
to generic code, what is platform-specific.
--
With best wishes
Dmitry
next prev parent reply other threads:[~2008-03-27 9:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-26 15:49 [PATCH 0/3] Clocklib: generic clocks framework Dmitry Baryshkov
2008-03-26 15:52 ` [PATCH 1/3] Clocklib: add generic framework for managing clocks Dmitry Baryshkov
2008-03-26 16:04 ` Haavard Skinnemoen
2008-03-26 16:14 ` Paul Mundt
2008-03-26 17:04 ` Dmitry
2008-03-26 20:09 ` Russell King
2008-03-26 16:52 ` Dmitry
2008-03-26 17:44 ` Paul Mundt
2008-03-27 9:52 ` Dmitry [this message]
2008-03-26 17:44 ` Juergen Beisert
2008-03-27 9:06 ` Haavard Skinnemoen
2008-03-27 9:18 ` Russell King
2008-03-27 9:26 ` Haavard Skinnemoen
2008-03-27 9:33 ` Russell King
2008-03-27 9:50 ` Paul Mundt
2008-03-27 9:53 ` Haavard Skinnemoen
2008-03-27 10:08 ` Dmitry
2008-03-27 10:20 ` Haavard Skinnemoen
2008-03-27 13:33 ` Dmitry
2008-03-27 9:29 ` pHilipp Zabel
2008-03-27 9:36 ` Russell King
2008-03-28 14:23 ` Pavel Machek
2008-03-29 12:36 ` Haavard Skinnemoen
2008-03-26 15:52 ` [PATCH 2/3] Clocklib: debugfs support Dmitry Baryshkov
2008-03-26 15:53 ` [PATCH 3/3] Clocklib: support sa1100 sub-arch Dmitry Baryshkov
2008-03-26 16:17 ` [PATCH 4/4] Clocklib: support ARM pxa sub-arch Dmitry Baryshkov
2008-06-26 12:50 [PATCH 0/3] Clocklib: generic framework for clocks managing [v3] Dmitry Baryshkov
2008-06-26 12:51 ` [PATCH 1/3] Clocklib: add generic framework for managing clocks Dmitry Baryshkov
2008-06-26 15:00 ` pHilipp Zabel
2008-06-26 15:03 ` Dmitry Baryshkov
2008-07-03 20:31 ` Ben Dooks
2008-07-04 8:44 ` Pavel Machek
2008-07-04 9:04 ` Dmitry Baryshkov
2008-07-04 9:12 ` Haavard Skinnemoen
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=bc64b4640803270252q7199b3c8g62b7483c310dba6a@mail.gmail.com \
--to=dbaryshkov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=domen.puncer@telargo.com \
--cc=haavard.skinnemoen@atmel.com \
--cc=hskinnemoen@atmel.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=rmk+kernel@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®