diff mbox

[02/11] ARM: imx: use dynamic mapping for CCM

Message ID 1430058672-9267-3-git-send-email-shawn.guo@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Guo April 26, 2015, 2:31 p.m. UTC
Replace the static mapping of CCM block in clock drivers with dynamic
mapping.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-imx/clk-imx1.c  | 3 ++-
 arch/arm/mach-imx/clk-imx31.c | 5 ++++-
 arch/arm/mach-imx/clk-imx35.c | 5 ++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

Comments

Nicolae Rosia April 26, 2015, 7:45 p.m. UTC | #1
Hi,

On Sun, Apr 26, 2015 at 5:31 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Replace the static mapping of CCM block in clock drivers with dynamic
> mapping.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  arch/arm/mach-imx/clk-imx1.c  | 3 ++-
>  arch/arm/mach-imx/clk-imx31.c | 5 ++++-
>  arch/arm/mach-imx/clk-imx35.c | 5 ++++-
>  3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
> index f4a76e841966..5301d2ebb234 100644
> --- a/arch/arm/mach-imx/clk-imx1.c
> +++ b/arch/arm/mach-imx/clk-imx1.c
> @@ -75,7 +75,8 @@ static void __init _mx1_clocks_init(unsigned long fref)
>
>  int __init mx1_clocks_init(unsigned long fref)
>  {
> -       ccm = MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR);
> +       ccm = ioremap(MX1_CCM_BASE_ADDR, SZ_4K);
> +       BUG_ON(!ccm);
>
>         _mx1_clocks_init(fref);
>
> diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
> index 8a103a2c8b68..2aaccadb9e13 100644
> --- a/arch/arm/mach-imx/clk-imx31.c
> +++ b/arch/arm/mach-imx/clk-imx31.c
> @@ -50,9 +50,12 @@ static struct clk_onecell_data clk_data;
>
>  int __init mx31_clocks_init(unsigned long fref)
>  {
> -       void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
> +       void __iomem *base;
>         struct device_node *np;
>
> +       base = ioremap(MX31_CCM_BASE_ADDR, SZ_4K);
> +       BUG_ON(!base);
> +
>         clk[dummy] = imx_clk_fixed("dummy", 0);
>         clk[ckih] = imx_clk_fixed("ckih", fref);
>         clk[ckil] = imx_clk_fixed("ckil", 32768);
> diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
> index 4ef1e8bdac5b..14f33ec049bc 100644
> --- a/arch/arm/mach-imx/clk-imx35.c
> +++ b/arch/arm/mach-imx/clk-imx35.c
> @@ -71,11 +71,14 @@ static struct clk *clk[clk_max];
>
>  int __init mx35_clocks_init(void)
>  {
> -       void __iomem *base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
> +       void __iomem *base;
>         u32 pdr0, consumer_sel, hsp_sel;
>         struct arm_ahb_div *aad;
>         unsigned char *hsp_div;
>
> +       base = ioremap(MX35_CCM_BASE_ADDR, SZ_4K);
> +       BUG_ON(base);
BUG_ON(!base) ?

> +
>         pdr0 = __raw_readl(base + MXC_CCM_PDR0);
>         consumer_sel = (pdr0 >> 16) & 0xf;
>         aad = &clk_consumer[consumer_sel];
> --
> 1.9.1
>

Best regards,
Nicolae Rosia
Shawn Guo April 27, 2015, 7:54 a.m. UTC | #2
On Sun, Apr 26, 2015 at 10:45:18PM +0300, Nicolae Rosia wrote:
> > diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
> > index 4ef1e8bdac5b..14f33ec049bc 100644
> > --- a/arch/arm/mach-imx/clk-imx35.c
> > +++ b/arch/arm/mach-imx/clk-imx35.c
> > @@ -71,11 +71,14 @@ static struct clk *clk[clk_max];
> >
> >  int __init mx35_clocks_init(void)
> >  {
> > -       void __iomem *base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
> > +       void __iomem *base;
> >         u32 pdr0, consumer_sel, hsp_sel;
> >         struct arm_ahb_div *aad;
> >         unsigned char *hsp_div;
> >
> > +       base = ioremap(MX35_CCM_BASE_ADDR, SZ_4K);
> > +       BUG_ON(base);
> BUG_ON(!base) ?

Oops.  Fixed.  Thanks for spotting it, Nicolae.

Shawn
diff mbox

Patch

diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index f4a76e841966..5301d2ebb234 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -75,7 +75,8 @@  static void __init _mx1_clocks_init(unsigned long fref)
 
 int __init mx1_clocks_init(unsigned long fref)
 {
-	ccm = MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR);
+	ccm = ioremap(MX1_CCM_BASE_ADDR, SZ_4K);
+	BUG_ON(!ccm);
 
 	_mx1_clocks_init(fref);
 
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 8a103a2c8b68..2aaccadb9e13 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -50,9 +50,12 @@  static struct clk_onecell_data clk_data;
 
 int __init mx31_clocks_init(unsigned long fref)
 {
-	void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
+	void __iomem *base;
 	struct device_node *np;
 
+	base = ioremap(MX31_CCM_BASE_ADDR, SZ_4K);
+	BUG_ON(!base);
+
 	clk[dummy] = imx_clk_fixed("dummy", 0);
 	clk[ckih] = imx_clk_fixed("ckih", fref);
 	clk[ckil] = imx_clk_fixed("ckil", 32768);
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 4ef1e8bdac5b..14f33ec049bc 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -71,11 +71,14 @@  static struct clk *clk[clk_max];
 
 int __init mx35_clocks_init(void)
 {
-	void __iomem *base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
+	void __iomem *base;
 	u32 pdr0, consumer_sel, hsp_sel;
 	struct arm_ahb_div *aad;
 	unsigned char *hsp_div;
 
+	base = ioremap(MX35_CCM_BASE_ADDR, SZ_4K);
+	BUG_ON(base);
+
 	pdr0 = __raw_readl(base + MXC_CCM_PDR0);
 	consumer_sel = (pdr0 >> 16) & 0xf;
 	aad = &clk_consumer[consumer_sel];