From: Dmitry <dbaryshkov@gmail.com>
To: "David Brownell" <david-b@pacbell.net>
Cc: "Paul Walmsley" <paul@pwsan.com>,
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, hiroshi.DOYU@nokia.com
Subject: Re: [PATCH 0/5] Clocklib: generic clocks framework
Date: Sat, 26 Apr 2008 12:38:15 +0400 [thread overview]
Message-ID: <bc64b4640804260138v29fada38m55f3e4c053aa1a41@mail.gmail.com> (raw)
In-Reply-To: <200804251546.52495.david-b@pacbell.net>
Hi,
2008/4/26 David Brownell <david-b@pacbell.net>:
> On Monday 21 April 2008, Dmitry wrote:
> > > - I don't think that I understand the clk_functions part of your code.
> > > Is this a shorthand to construct aliases to other struct clks?
> >
> > Yes, that's one of usages for it. E.g. current AT91 code has same
> > functionality named at91_clock_associate.
>
> As in:
>
> at91_clock_associate("usart0_clk", &pdev0->dev, "usart");
> at91_clock_associate("usart1_clk", &pdev1->dev, "usart");
> at91_clock_associate("usart2_clk", &pdev2->dev, "usart");
>
> That essentially maps a device and logical clock name to a specific
> clock (those "usartX_clk" identifiers are global), so that drivers
> can clk_get(dev, "usart") and get the right clock. It decouples
> clock and device declarations, which should help when integrating
> external clocks too.
>
> The assumption that clk_get(NULL, "usartX_clk") works is mostly
> just a convenience, although it's probably a fair assumption for
> many other SOC platforms. Conceptually that first parameter is
> a clock, not a name.
Yes. It's just a convenient form to specify the parent (holding) clock
(usartX_clk).
Usually you register all such clocks via an array of various clocks,
so it's just
easier to specify the name, than the struct clk pointer. Hope this makes it more
clear.
>
>
> > > +struct clk_function {
> > > + const char *parent;
> > > + void *priv;
> > > + struct clk clk;
> > > +};
>
> That doesn't really seem attuned to the task of associating
> logical clock names to devices. Wouldn't it be better to
> have something directly addressing that core mechanism?
In reality it does. Some platforms prefer to specify name+device,
some prefer name + id of the device, etc. Thus this definition.
For example of dev+name association, you can check the PXA
patch (e.g. for {FF,BT,ST,HW}UARTCLK -> UARTCLK definitions).
The association is done with the help of the clk_dev_ops operations.
Maybe them should be moved to the generic library.
> > Also once we get to multiple chips providers/users, we'll see,
>
> > that the clock simply can't have just one record in the clocks tree.
>
> I don't follow. Why not? If a clock has multiple records, I'd
> expect its refcounts would easily get borked. I think I don't
> like your notion of a "wrapper clock".
It seems, I failed to describe it correctly.
Let's suppose this situation:
We have CLK, that is connected to the pin CK1 of the device dev_A and to the pin
CK36M of the device dev_B.
The we'll have these clocks:
.CLK count=0
\- CK1 count=0 for dev_A
\- CK36M count=0 for dev_B
When device dev_A enables it's clock,
we'll have this:
.CLK count=1
\- CK1 count=1 for dev_A
\- CK36M count=0 for dev_B
After that dev_B enables it's clock:
.CLK count=2
\- CK1 count=1 for dev_A
\- CK36M count=1 for dev_B
So refcounting is correct.
> > It's provided by some
> > pin (provider_name) and then consumed by several devices (several
> > consumer_name + consumer_device pairs). That is it.
>
> There would still be just one clock though. It shouldn't matter
> how clk_get(this_dev, "c1") and clk_get(that_dev, "c2") find it.
> Hashtable, linked list, divination, ... so long as it works.
>
> Those other records should just hold {dev, name} ==> clock mappings;
> they wouldn't be records for the clock itself. But those "functions"
> do not seem to record just mappings.
It's easier from the abstraction POV to make that "records" to be real clocks.
Why introduce another object, if we can unify access to both types?
--
With best wishes
Dmitry
next prev parent reply other threads:[~2008-04-26 8:38 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
2008-05-05 7:59 ` Pavel Machek
2008-04-25 22:46 ` David Brownell
2008-04-26 8:38 ` Dmitry [this message]
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=bc64b4640804260138v29fada38m55f3e4c053aa1a41@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®