linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/8] ARM i.MX27: implement clocks using common clock framework
Date: Mon, 19 Mar 2012 15:36:08 +0100	[thread overview]
Message-ID: <20120319143608.GZ3852@pengutronix.de> (raw)
In-Reply-To: <20120319142325.GA32469@S2101-09.ap.freescale.net>

On Mon, Mar 19, 2012 at 10:23:29PM +0800, Shawn Guo wrote:
> > +
> > +struct clkl {
> > +	struct clk_lookup lookup;
> > +	const char *clkname;
> > +};
> > +
> > +#define clkdev(d, n, c) \
> > +	{ \
> > +		.lookup.dev_id = d, \
> > +		.lookup.con_id = n, \
> > +		.clkname = c, \
> > +	},
> > +
> 
> They should at least be defined in arch/arm/mach-imx/clk.h to avoid
> the duplication in every single imx clock driver.

Yes, right. See it as a quick-n-dirty solution...

> 
> If using registration function becomes the common way that clock
> driver registers clks, they will be needed by other platforms too.
> Then, we should probably do something like below instead?
> 
> diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
> index d9a4fd0..2cde34e 100644
> --- a/include/linux/clkdev.h
> +++ b/include/linux/clkdev.h
> @@ -21,6 +21,7 @@ struct clk_lookup {
>         struct list_head        node;
>         const char              *dev_id;
>         const char              *con_id;
> +       const char              *clk_name;
>         struct clk              *clk;
>  };
> 
> @@ -31,6 +32,13 @@ struct clk_lookup {
>                 .clk = c,       \
>         }
> 
> +#define CLKDEV_INIT_N(d, n, cn)        \
> +       {                       \
> +               .dev_id = d,    \
> +               .con_id = n,    \
> +               .clk_name = cn, \
> +       }
> +

...until something better is found. Adding the clock name to clk_lookup
seems like a good start.

> > +	imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR1, 29);
> > +	imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30);
> > +	imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31);
> > +
> > +	for (i = 0; i < ARRAY_SIZE(lookups); i++) {
> > +		struct clkl *l = &lookups[i];
> > +		l->lookup.clk = __clk_lookup(l->clkname);
> 
> That's somehow unfortunate this expensive function needs to be called
> to retrieve these clks, while those registration functions should ever
> have them returned.

I wanted to avoid having 'clkbla =' before every initializer. Maybe we
can skip struct clk from struct clk_lookup and only keep the name.
__clk_lookup could then be called in clk_get. This way looking up the
clock would be done when a clock is requested and we wouldn't do it
all at once and wouldn't add delays to the boot process.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2012-03-19 14:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 13:35 i.MX: Convert v4/v5 based SoCs to common clock framework Sascha Hauer
2012-03-19 13:35 ` [PATCH 1/8] clk: add a fixed factor clock Sascha Hauer
2012-03-23  7:37   ` Philipp Zabel
2012-03-23  8:40     ` Sascha Hauer
2012-03-23  7:41   ` Philipp Zabel
2012-03-23  8:42     ` Sascha Hauer
2012-03-19 13:36 ` [PATCH 2/8] ARM i.MX: prepare for common clock framework Sascha Hauer
2012-03-19 13:36 ` [PATCH 3/8] ARM i.MX timer: request correct clock Sascha Hauer
2012-03-19 13:36 ` [PATCH 4/8] ARM i.MX: Add common clock support for pllv1 Sascha Hauer
2012-03-19 13:36 ` [PATCH 5/8] ARM i.MX1: implement clocks using common clock framework Sascha Hauer
2012-03-19 13:36 ` [PATCH 6/8] ARM i.MX21: " Sascha Hauer
2012-03-19 13:36 ` [PATCH 7/8] ARM i.MX25: " Sascha Hauer
2012-03-19 13:36 ` [PATCH 8/8] ARM i.MX27: " Sascha Hauer
2012-03-19 14:23   ` Shawn Guo
2012-03-19 14:36     ` Sascha Hauer [this message]
2012-03-19 16:17       ` Arnd Bergmann
2012-03-19 14:44 ` i.MX: Convert v4/v5 based SoCs to " Rob Herring
2012-03-20 23:27   ` 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=20120319143608.GZ3852@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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).