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: devicetree-discuss@lists.ozlabs.org,
	John Jacques <john.jacques@lsi.com>,
	linuxppc-dev list <linuxppc-dev@ozlabs.org>,
	Torez Smith <torez@us.ibm.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: Re: ARM clock API to PowerPC
Date: Sun, 16 Aug 2009 08:18:03 +1000	[thread overview]
Message-ID: <1250374683.24143.69.camel@pasglop> (raw)
In-Reply-To: <20090815124347.GB16112@flint.arm.linux.org.uk>

On Sat, 2009-08-15 at 13:43 +0100, Russell King wrote:
> On Fri, Aug 14, 2009 at 10:07:44PM +1000, Benjamin Herrenschmidt wrote:
> > My idea is that struct clock would contain function pointers for the
> > enable/disable/get_rate/ etc... methods
> 
> If you look at OMAP, doing that gets very expensive, both in terms of
> number of lines of code, size of structure and maintainence thereof. 

Well, it depends. Having the function pointer or ops structure allows
you to use different function pointers/ops per clock ... but doesn't
force you to do so :-)

For example, in the OMAP case, you could just have one struct
omap_soc_clk_ops for example that contains the existing implementations
going through the existing table etc... 

But having the func. pointers allow designers to still use struct clk
for other clock sources if they wish to, which is pretty much precluded
if they link straight into the arch.

This cover two things: external clock sources (i2c PLLs etc...) used to
clock devices, and big combo-devices that have their own sets of clocks
and subsystems that may want to use the clk API separately from the main
SoC and platform code. 

For ppc we really don't have much of a choice here anyway because we
support multiple platforms compiled in the same kernel as long as they
have a CPU core that's the same overall family, and that can be very
wide. For example, 440-type cores can exist in all sort of IBM/AMCC
cores, but also Xilinx FPGAs, and when you start saying FPGA the
possibilities go wild :-)

> Neither does a 'clk_ops' structure containing all of the function
> pointers work either for OMAP (OMAP has such a structure just for
> enable and disable methods, of which there are about two or three to
> chose from, but the rounding, set_rate and propagation methods are
> per-clk.  This balance seems to work well for OMAP.)
> 
> FYI, there are 140 struct clk definitions for OMAP24xx, and 215 for
> OMAP34xx, all statically initialized.  See arch/arm/mach-omap2/clock?4xx.h

I had a look, and it doesn't appear to be a huge deal either way. In the
relatively minor detail as to use fun. pointers vs, ops, the func
pointers may win the OMAP case becaues ops would require pretty much
allocating & populating a new ops structure for each clock ... unless
you have one standard one whose set_rate that calls back into the table
via another function pointer ;-) but then it depends how hot those code
path are.

I might initially go with flat function pointers in struct clk on ppc
for now, and we'll see how things pan out.

Cheers,
Ben.

  reply	other threads:[~2009-08-15 22:18 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 [this message]
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
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=1250374683.24143.69.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=g.liakhovetski@gmx.de \
    --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).