linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Russell King <rmk@arm.linux.org.uk>
Cc: John Jacques <john.jacques@lsi.com>,
	linuxppc-dev list <linuxppc-dev@ozlabs.org>,
	devicetree-discuss@lists.ozlabs.org,
	Torez Smith <torez@us.ibm.com>,
	Mark Brown <broonie@sirena.org.uk>
Subject: Re: ARM clock API to PowerPC
Date: Thu, 13 Aug 2009 09:47:31 +1000	[thread overview]
Message-ID: <1250120851.3587.71.camel@pasglop> (raw)
In-Reply-To: <20090812234048.GB7118@flint.arm.linux.org.uk>

> > Ok. So I may have misunderstood what names were for. In my mind, those
> > were the name of the clock input on the HW device :-)
> 
> Oh, I do hope I didn't say that was wrong, because that is quite
> correct.  What the idea with passing a NULL 'name' with drivers
> which only had one input was to force people to avoid using 'name'
> as the sole way to match.

I see. So basically, they are meant to be the input names, but have been
abused by people to be "global scope" clock names and hence mess
happened.

> When I originally wrote the AMBA primecell drivers, I did use things
> like 'UARTCLK' and 'AACICLK' for the clk_get() name - since these
> were the name on the device, and that really only provided people
> with a bad example to follow.  Especially if you consider that the
> hardware I had was FPGA based development boards where the clocking
> layout lent itself well to ignoring the 'dev' argument.

Right.

> > Right. I didn't intend to name the clock sources. I intended to name the
> > clock -inputs- of a given device. IE. clk_get(dev, name) in my mind
> > meant "give me the clock provider that feeds my "name" input).
> 
> That's absolutely the right way to look at it!

Cool :-) It did feel right indeed.

> > Allright but passing a NULL doesn't help for drivers with multiple clock
> > inputs. IE. How do you want to deal with that ? Do you want to deprecate
> > the named API and instead provide a new clk_get_for_input(dev,
> > clk_input) (clk_input could be name or numerical ... tbd) ?
> 
> NULL certainly doesn't help for drivers with multiple clock inputs.
> For those, you have to explicitly name the input.  To take the
> example commits I pointed at (the OMAP watchdog driver) OMAP blocks
> generally have two clock inputs - a functional clock and an
> interface clock.

Right, that's a common setup.

> Originally, the driver was effectively setup to match by clock source
> name (wdt2_fck, wdt2_ick) which was SoC specific.  What the commits
> did was convert things to looking using the names of the inputs
> (aka consumer name) - so dev + "fck" and dev + "ick".

Ok, cool, so we are on the same page.

> That results in clkdev looking up the clocks for device "omap_wdt"
> for inputs "fck" and "ick" respectively.  On OMAP1 platforms, there
> isn't an "ick" as such, so there's a match-any-device dummy "ick"
> entry.  On OMAP2 and OMAP3 (the later revs) there are specific
> clocks for these, and so the dummy entry is missing.
> 
> So, the approach I took was: where it is well defined that a device
> has only one clock input, we pass a NULL name.  If it has more than
> one clock input, we pass the specific consumer name required.

Makes sense. I think this will work beautifully with the device-tree too
with the idea of having properties that then provide the binding for a
given clock input to the clock provider and the clock ID on that
provider (my proposal makes the later a number because doing strings can
be awkward in OF land in such mapping tables but I might go back to
strings, we'll see).

> > Or am I missing a piece of the puzzle ?
> 
> Maybe - and since you're just starting to look at clkdev, I'll point
> out that it's actually not intuitive which way around the "wildcard"
> matching works in clkdev.  The clk_get() arguments aren't the
> wildcards, they're in the clk_lookup structure.  Yes, it seems odd,
> but if you consider it from the point of view of the platform code
> wanting to match clocks to a specific set of devices and clock inputs,
> it's actually the way around that you want.

Ok. I'll read up a bit and see if I can get my head around it.

Thanks !

Cheers,
Ben.

  reply	other threads:[~2009-08-12 23:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12  7:57 ARM clock API to PowerPC Benjamin Herrenschmidt
2009-08-12  8:29 ` Benjamin Herrenschmidt
2009-08-12 17:31   ` Mitch Bradley
2009-08-12 21:30     ` Benjamin Herrenschmidt
2009-08-12 11:19 ` Josh Boyer
2009-08-12 13:40   ` Kumar Gala
2009-08-12 21:29     ` Benjamin Herrenschmidt
2009-08-13  8:59       ` Li Yang-R58472
2009-08-14  9:29         ` Benjamin Herrenschmidt
2009-08-14 11:29           ` Guennadi Liakhovetski
2009-08-14 12:07             ` Benjamin Herrenschmidt
2009-08-15 12:43               ` Russell King
2009-08-15 22:18                 ` Benjamin Herrenschmidt
2009-08-16  5:09                   ` Grant Likely
2009-08-12 12:35 ` Mark Brown
2009-08-12 21:34   ` Benjamin Herrenschmidt
2009-08-12 21:44     ` Mark Brown
2009-08-12 21:56       ` Benjamin Herrenschmidt
2009-08-12 22:20         ` Mark Brown
2009-08-12 22:32           ` Benjamin Herrenschmidt
2009-08-12 23:00             ` Mark Brown
2009-08-12 23:15               ` Benjamin Herrenschmidt
2009-08-12 22:28         ` Russell King
2009-08-12 22:45           ` Mark Brown
2009-08-12 22:52           ` Benjamin Herrenschmidt
2009-08-12 23:40             ` Russell King
2009-08-12 23:47               ` Benjamin Herrenschmidt [this message]
2009-08-13  3:45               ` Benjamin Herrenschmidt

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=1250120851.3587.71.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=broonie@sirena.org.uk \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=john.jacques@lsi.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=torez@us.ibm.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;
as well as URLs for NNTP newsgroup(s).