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 v2 2/2] ARM: i.MX25 clk: Use of_clk_init() for DT case
Date: Wed, 25 Jun 2014 08:24:23 +0200	[thread overview]
Message-ID: <20140625062423.GH15686@pengutronix.de> (raw)
In-Reply-To: <1403529927-13868-2-git-send-email-denis@eukrea.com>

On Mon, Jun 23, 2014 at 03:25:27PM +0200, Denis Carikli wrote:
> Replace .init_time() hook with of_clk_init() for DT targets.
> 
> Based on:
>   d4347ee ARM: i.MX27 clk: Use of_clk_init() for DT case
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
> Changelog v1->v2:
> - Rebased.
> - Removing the warning about the useless int i declaration.
> ---
>  arch/arm/mach-imx/clk-imx25.c |  287 +++++++++++++++++++++--------------------
>  arch/arm/mach-imx/common.h    |    1 -
>  arch/arm/mach-imx/imx25-dt.c  |    6 -
>  3 files changed, 144 insertions(+), 150 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
> index e759a6d..49ab1d6 100644
> --- a/arch/arm/mach-imx/clk-imx25.c
> +++ b/arch/arm/mach-imx/clk-imx25.c
> @@ -32,31 +32,29 @@
>  #include "hardware.h"
>  #include "mx25.h"
>  
> -#define CRM_BASE	MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
> +static void __iomem *ccm __initdata;
>  
> -#define CCM_MPCTL	0x00
> -#define CCM_UPCTL	0x04
> -#define CCM_CCTL	0x08
> -#define CCM_CGCR0	0x0C
> -#define CCM_CGCR1	0x10
> -#define CCM_CGCR2	0x14
> -#define CCM_PCDR0	0x18
> -#define CCM_PCDR1	0x1C
> -#define CCM_PCDR2	0x20
> -#define CCM_PCDR3	0x24
> -#define CCM_RCSR	0x28
> -#define CCM_CRDR	0x2C
> -#define CCM_DCVR0	0x30
> -#define CCM_DCVR1	0x34
> -#define CCM_DCVR2	0x38
> -#define CCM_DCVR3	0x3c
> -#define CCM_LTR0	0x40
> -#define CCM_LTR1	0x44
> -#define CCM_LTR2	0x48
> -#define CCM_LTR3	0x4c
> -#define CCM_MCR		0x64
> -
> -#define ccm(x)	(CRM_BASE + (x))
> +#define CCM_MPCTL	(ccm + 0x00)
> +#define CCM_UPCTL	(ccm + 0x04)
> +#define CCM_CCTL	(ccm + 0x08)
> +#define CCM_CGCR0	(ccm + 0x0C)
> +#define CCM_CGCR1	(ccm + 0x10)
> +#define CCM_CGCR2	(ccm + 0x14)
> +#define CCM_PCDR0	(ccm + 0x18)
> +#define CCM_PCDR1	(ccm + 0x1C)
> +#define CCM_PCDR2	(ccm + 0x20)
> +#define CCM_PCDR3	(ccm + 0x24)
> +#define CCM_RCSR	(ccm + 0x28)
> +#define CCM_CRDR	(ccm + 0x2C)
> +#define CCM_DCVR0	(ccm + 0x30)
> +#define CCM_DCVR1	(ccm + 0x34)
> +#define CCM_DCVR2	(ccm + 0x38)
> +#define CCM_DCVR3	(ccm + 0x3c)
> +#define CCM_LTR0	(ccm + 0x40)
> +#define CCM_LTR1	(ccm + 0x44)
> +#define CCM_LTR2	(ccm + 0x48)
> +#define CCM_LTR3	(ccm + 0x4c)
> +#define CCM_MCR		(ccm + 0x64)
>  
>  static struct clk_onecell_data clk_data;
>  
> @@ -93,134 +91,136 @@ static struct clk *clk[clk_max];
>  
>  static int __init __mx25_clocks_init(unsigned long osc_rate)
>  {
> +	BUG_ON(!ccm);
> +
>  	clk[dummy] = imx_clk_fixed("dummy", 0);
>  	clk[osc] = imx_clk_fixed("osc", osc_rate);
> -	clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL));
> -	clk[upll] = imx_clk_pllv1("upll", "osc", ccm(CCM_UPCTL));
> +	clk[mpll] = imx_clk_pllv1("mpll", "osc", CCM_MPCTL);
> +	clk[upll] = imx_clk_pllv1("upll", "osc", CCM_UPCTL);

This huge diffstat could be avoided by doing:

#define ccm(x)	((ccm_base) + (x))

And passing ccm_base as argument to __mx25_clocks_init.

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:[~2014-06-25  6:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 13:25 [PATCH v2 1/2] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
2014-06-23 13:25 ` [PATCH v2 2/2] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
2014-06-25  6:24   ` Sascha Hauer [this message]
2014-06-25  7:06     ` Lothar Waßmann
2014-06-25  6:20 ` [PATCH v2 1/2] ARM: dts: i.MX25: Fix gpt timers clocks Sascha Hauer
2014-06-25  6:20 ` Shawn Guo

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=20140625062423.GH15686@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).