linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jassisinghbrar@gmail.com (Jassi Brar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] Add a common struct clk
Date: Thu, 16 Sep 2010 22:09:16 +0900	[thread overview]
Message-ID: <AANLkTi=vaOzRcoGM9AnJ+17e0-97b76F5DW964fC3Wwp@mail.gmail.com> (raw)
In-Reply-To: <1284522014.517347.33297989274.1.gpush@pororo>

On Wed, Sep 15, 2010 at 12:40 PM, Jeremy Kerr <jeremy.kerr@canonical.com> wrote:
> We currently have 21 definitions of struct clk in the ARM architecture,
> each defined on a per-platform basis. This makes it difficult to define
> platform- (or architecture-) independent clock sources without making
> assumptions about struct clk, and impossible to compile two
> platforms with different struct clks into a single image.
>
> This change is an effort to unify struct clk where possible, by defining
> a common struct clk, containing a set of clock operations. Different
> clock implementations can set their own operations, and have a standard
> interface for generic code. The callback interface is exposed to the
> kernel proper, while the clock implementations only need to be seen by
> the platform internals.
>
> This allows us to share clock code among platforms, and makes it
> possible to dynamically create clock devices in platform-independent
> code.
>
> Platforms can enable the generic struct clock through
> CONFIG_USE_COMMON_STRUCT_CLK. In this case, the clock infrastructure
> consists of a common struct clk:
>
> struct clk {
> ? ? ? ?const struct clk_ops ? ?*ops;
> ? ? ? ?unsigned int ? ? ? ? ? ?enable_count;
> ? ? ? ?struct mutex ? ? ? ? ? ?mutex;
> };
>
> And a set of clock operations (defined per type of clock):
>
> struct clk_ops {
> ? ? ? int ? ? ? ? ? ? (*enable)(struct clk *);
> ? ? ? void ? ? ? ? ? ?(*disable)(struct clk *);
> ? ? ? unsigned long ? (*get_rate)(struct clk *);
> ? ? ? [...]
> };
>
> To define a hardware-specific clock, machine code can "subclass" the
> struct clock into a new struct (adding any device-specific data), and
> provide a set of operations:
>
> struct clk_foo {
> ? ? ? ?struct clk ? ? ?clk;
> ? ? ? ?void __iomem ? ?*some_register;
> };
>
> struct clk_ops clk_foo_ops = {
> ? ? ? ?.get_rate = clk_foo_get_rate,
> };
>
> The common clock definitions are based on a development patch from Ben
> Herrenschmidt <benh@kernel.crashing.org>.
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>

I am not sure about the scope of your assumed task, but I would still
like to bring
to your notice some points.

IMHO any clock api that aims to be used by multiple platforms should be generic
more than this one. Let me explain.
Clocks that are simply output of MUX'es inherit the rate of the parent
clock - they do have
rate yet this API would return 0 (IIRUIC).
Another scenario could have a source clock parenting more than one
child clock via
different MUX'es. It would be nice to be able to set rate of that
parent clock (after ensuring
other siblings won't complain) and have some mechanism to notify other
siblings of the change.
Or some better solution.

  reply	other threads:[~2010-09-16 13:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15  3:40 [PATCH 0/3] Common struct clk implementation, v7 Jeremy Kerr
2010-09-15  3:40 ` [PATCH 2/3] clk: Generic support for fixed-rate clocks Jeremy Kerr
2010-09-15  3:40 ` [PATCH 1/3] Add a common struct clk Jeremy Kerr
2010-09-16 13:09   ` Jassi Brar [this message]
2010-09-17  0:24     ` Jeremy Kerr
2010-09-17  0:55       ` Jassi Brar
2010-09-17  2:16         ` Jassi Brar
2010-11-27 15:56   ` Jassi Brar
2010-11-29  7:59     ` Jeremy Kerr
2010-12-07 14:31       ` Uwe Kleine-König
2010-12-08  1:02         ` Jeremy Kerr
2010-12-08  8:45           ` Uwe Kleine-König
2010-12-08 16:48           ` Ben Dooks
2010-12-09  2:16             ` Jeremy Kerr
2010-12-10 15:09               ` Richard Zhao
2010-12-11  2:21                 ` Jassi Brar
2010-09-15  3:40 ` [PATCH 3/3] arm/clkdev: Allow common struct clk usage Jeremy Kerr
2010-09-15  5:53 ` [PATCH 0/3] Common struct clk implementation, v7 Jean-Christophe PLAGNIOL-VILLARD
2010-09-15  6:08   ` Jeremy Kerr
2010-09-16  1:51     ` Paul Mundt
2010-09-15  8:15 ` Paulius Zaleckas
2010-09-15 23:15 ` Colin Cross
2010-09-16  8:19   ` Jeremy Kerr
2010-09-26 23:57   ` Ben Dooks
  -- strict thread matches above, loose matches on Subject: below --
2010-07-30  7:03 [PATCH 0/3] Common struct clk implementation, v6 Jeremy Kerr
2010-07-30  7:03 ` [PATCH 1/3] Add a common struct clk Jeremy Kerr

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='AANLkTi=vaOzRcoGM9AnJ+17e0-97b76F5DW964fC3Wwp@mail.gmail.com' \
    --to=jassisinghbrar@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).