linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 3/4] clk: introduce the common clock framework
Date: Fri, 9 Mar 2012 08:57:20 +0100	[thread overview]
Message-ID: <20120309075720.GC16608@lunn.ch> (raw)
In-Reply-To: <20120308232549.GU3852@pengutronix.de>

> I'd say use the nonstatic ones. I think using the static initializers
> will cause us much pain in the future. I've been through several rebases
> on the i.MX clock rework and everytime I wish my sed foo would be
> better. Now imagine what happens when it turns out that the internal
> struct clk layout or the structs for the muxes/dividers/gates have to
> be changed.

/*****************************************************************************
 * CLK tree
 ****************************************************************************/
static DEFINE_SPINLOCK(gating_lock);

#define DEFINE_KIRKWOOD_CLK_GATE(_name, _bit)                           \
        DEFINE_CLK_GATE(_name, "tclk", NULL, 0,                         \
                        (void __iomem *)CLOCK_GATING_CTRL,              \
                        _bit, 0, &gating_lock)

DEFINE_KIRKWOOD_CLK_GATE(clk_ge0,    CGC_BIT_GE0);
DEFINE_KIRKWOOD_CLK_GATE(clk_pex0,   CGC_BIT_PEX0);
DEFINE_KIRKWOOD_CLK_GATE(clk_usb0,   CGC_BIT_USB0);
DEFINE_KIRKWOOD_CLK_GATE(clk_sdio,   CGC_BIT_SDIO);
DEFINE_KIRKWOOD_CLK_GATE(clk_tsu,    CGC_BIT_TSU);
DEFINE_KIRKWOOD_CLK_GATE(clk_dunit,  CGC_BIT_DUNIT);
DEFINE_KIRKWOOD_CLK_GATE(clk_runit,  CGC_BIT_RUNIT);

I've so far not had any problems, and not needed an sed foo.  I do
only have a dozen or so clocks, which helps. But even so, all the real
pain is hidden inside DEFINE_CLK_GATE() which Mike maintains.

I guess the problem comes when you are not using the basic clk
providers, but your own provider. What might help is if
linux/clk-provider.h could provide some macros to do most of the
generic definitions. Something like:

#define DEFINE_CLK_GENERIC(_name, _flags, _ops)                 \
        static struct clk _name;                                \
        static char *_name##_parent_names[] = {};               \
        static struct clk _name = {                             \
                .name = #_name,                                 \
                .ops = &_ops,                                   \
                .hw = &_name##_hw.hw,                           \
                .parent_names = _name##_parent_names,           \
                .num_parents =                                  \
                        ARRAY_SIZE(_name##_parent_names),       \
                .flags = _flags,                                \
        };

and then you have something like

#define DEFINE_CLK_IMX(_name, _flags, _foo, _bar)               \
        static struct clk_imx _name##_hw = {                    \
                .hw = {                                         \
                        .clk = &_name,                          \
                },                                              \
                .foo = _foo,                                    \
                .bar = _bar,                                    \
        };                                                      \
	DEFINE_CLK_GENERIC(_name, _flags, clk_imx_ops)           

	Andrew

  reply	other threads:[~2012-03-09  7:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03  8:28 [PATCH v5 0/4] common clk framework Mike Turquette
2012-03-03  8:28 ` [PATCH v5 1/4] Documentation: common clk API Mike Turquette
2012-03-03  8:28 ` [PATCH v5 2/4] clk: Kconfig: add entry for HAVE_CLK_PREPARE Mike Turquette
2012-03-05  2:04   ` Richard Zhao
2012-03-05 19:46     ` Turquette, Mike
2012-03-03  8:29 ` [PATCH v5 3/4] clk: introduce the common clock framework Mike Turquette
2012-03-03 13:31   ` Sascha Hauer
2012-03-03 17:14     ` Turquette, Mike
2012-03-04 11:52       ` Sascha Hauer
2012-03-05  0:12         ` Turquette, Mike
2012-03-05  7:38           ` Sascha Hauer
2012-03-05 20:03             ` Turquette, Mike
2012-03-06 19:00               ` Sascha Hauer
2012-03-07 21:20                 ` Turquette, Mike
2012-03-08  6:27                   ` Andrew Lunn
2012-03-08 23:25                     ` Sascha Hauer
2012-03-09  7:57                       ` Andrew Lunn [this message]
2012-03-09 18:25                         ` Turquette, Mike
2012-03-19  7:01                           ` Shawn Guo
2012-03-19 11:22                             ` Sascha Hauer
2012-03-09 18:18                     ` Turquette, Mike
2012-03-09  0:51                   ` Thomas Gleixner
2012-03-17  3:23                   ` Saravana Kannan
2012-03-19  5:38                     ` Shawn Guo
2012-03-19  7:42                     ` Shawn Guo
2012-03-05  9:22   ` Richard Zhao
2012-03-14  2:03     ` Turquette, Mike
2012-03-13 11:24   ` Sascha Hauer
2012-03-13 23:43     ` Turquette, Mike
2012-03-14  8:48       ` Sascha Hauer
2012-03-14 20:47         ` Turquette, Mike
2012-03-14 21:28           ` Thomas Gleixner
2012-03-14 22:13             ` Turquette, Mike
2012-03-14 22:18               ` Thomas Gleixner
2012-03-03  8:29 ` [PATCH v5 4/4] clk: basic clock hardware types Mike Turquette
2012-03-04 14:26   ` Andrew Lunn
2012-03-04 14:35   ` Andrew Lunn
2012-03-05  0:15     ` Turquette, Mike
2012-03-04 17:42   ` Andrew Lunn
2012-03-05  0:30     ` Turquette, Mike
2012-03-05  8:48       ` Andrew Lunn
2012-03-05  9:29         ` Sascha Hauer
2012-03-05 10:17           ` Andrew Lunn
2012-03-09 23:38             ` Turquette, Mike
2012-03-04 20:33   ` [PATCH] clk: Fix compile errors in DEFINE_CLK_GATE Andrew Lunn
2012-03-05  0:31     ` Turquette, Mike
2012-03-07 21:20   ` [PATCH v5 4/4] clk: basic clock hardware types Sascha Hauer
2012-03-09 22:50     ` Turquette, Mike
2012-03-09  2:34 ` [PATCH v5 0/4] common clk framework Richard Zhao
2012-03-09  9:19   ` Sascha Hauer
2012-03-09 18:35   ` Turquette, Mike

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=20120309075720.GC16608@lunn.ch \
    --to=andrew@lunn.ch \
    --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).