All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP2/3/4: Convert bases in omap_globals to physical address
@ 2010-01-26  8:40 Santosh Shilimkar
  2010-01-26  8:40 ` [PATCH] OMAP2/3/4: ioremap address space Santosh Shilimkar
  0 siblings, 1 reply; 9+ messages in thread
From: Santosh Shilimkar @ 2010-01-26  8:40 UTC (permalink / raw)
  To: linux-omap; +Cc: Santosh Shilimkar, Kevin Hilman, Tony Lindgren

This is a clean-up patch towards dynamic allocation of IO space
instead of using harcoded macros to calculate virtual addresses.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/common.c                |   46 ++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h   |   14 ++++----
 arch/arm/plat-omap/include/plat/omap24xx.h |    2 +
 arch/arm/plat-omap/include/plat/omap34xx.h |    1 +
 4 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bf1eaf3..d1ed69c 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -227,12 +227,12 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
+	.tap	= OMAP2420_IDCODE_BASE,
+	.sdrc	= OMAP2420_SDRC_BASE,
+	.sms	= OMAP2420_SMS_BASE,
+	.ctrl	= OMAP2420_CTRL_BASE,
+	.prm	= OMAP2420_PRM_BASE,
+	.cm	= OMAP2420_CM_BASE,
 };
 
 void __init omap2_set_globals_242x(void)
@@ -245,12 +245,12 @@ void __init omap2_set_globals_242x(void)
 
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.tap	= OMAP243X_IDCODE_BASE,
+	.sdrc	= OMAP243X_SDRC_BASE,
+	.sms	= OMAP243X_SMS_BASE,
+	.ctrl	= OMAP243X_CTRL_BASE,
+	.prm	= OMAP2430_PRM_BASE,
+	.cm	= OMAP2430_CM_BASE,
 };
 
 void __init omap2_set_globals_243x(void)
@@ -263,12 +263,12 @@ void __init omap2_set_globals_243x(void)
 
 static struct omap_globals omap343x_globals = {
 	.class	= OMAP343X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.tap	= OMAP343X_IDCODE_BASE,
+	.sdrc	= OMAP343X_SDRC_BASE,
+	.sms	= OMAP343X_SMS_BASE,
+	.ctrl	= OMAP343X_CTRL_BASE,
+	.prm	= OMAP3430_PRM_BASE,
+	.cm	= OMAP3430_CM_BASE,
 };
 
 void __init omap2_set_globals_343x(void)
@@ -280,11 +280,11 @@ void __init omap2_set_globals_343x(void)
 #if defined(CONFIG_ARCH_OMAP4)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.tap	= OMAP443X_SCM_BASE,
+	.ctrl	= OMAP443X_CTRL_BASE,
+	.prm	= OMAP4430_PRM_BASE,
+	.cm	= OMAP4430_CM_BASE,
+	.cm2	= OMAP4430_CM2_BASE,
 };
 
 void __init omap2_set_globals_443x(void)
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c2227..c486fda 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -40,13 +40,13 @@ extern struct sys_timer omap_timer;
 /* IO bases for various OMAP processors */
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
-	void __iomem	*tap;		/* Control module ID code */
-	void __iomem	*sdrc;		/* SDRAM Controller */
-	void __iomem	*sms;		/* SDRAM Memory Scheduler */
-	void __iomem	*ctrl;		/* System Control Module */
-	void __iomem	*prm;		/* Power and Reset Management */
-	void __iomem	*cm;		/* Clock Management */
-	void __iomem	*cm2;
+	unsigned long	tap;		/* Control module ID code */
+	unsigned long	sdrc;		/* SDRAM Controller */
+	unsigned long	sms;		/* SDRAM Memory Scheduler */
+	unsigned long	ctrl;		/* System Control Module */
+	unsigned long	prm;		/* Power and Reset Management */
+	unsigned long	cm;		/* Clock Management */
+	unsigned long	cm2;
 };
 
 void omap2_set_globals_242x(void);
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h
index 696edfc..c04a5d7 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -48,6 +48,7 @@
 #define OMAP2420_SDRC_BASE	(L3_24XX_BASE + 0x9000)
 #define OMAP2420_SMS_BASE	0x68008000
 #define OMAP2420_GPMC_BASE	0x6800a000
+#define OMAP2420_IDCODE_BASE	0x48014000
 
 #define OMAP2430_32KSYNCT_BASE	(L4_WK_243X_BASE + 0x20000)
 #define OMAP2430_PRCM_BASE	(L4_WK_243X_BASE + 0x6000)
@@ -60,6 +61,7 @@
 #define OMAP243X_SCM_BASE	(L4_WK_243X_BASE + 0x2000)
 #define OMAP243X_CTRL_BASE	OMAP243X_SCM_BASE
 #define OMAP243X_HS_BASE	(L4_24XX_BASE + 0x000ac000)
+#define OMAP243X_IDCODE_BASE	0x4900a000
 
 /* DSP SS */
 #define OMAP2420_DSP_BASE	0x58000000
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h
index 077f059..e5cc8d2 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -43,6 +43,7 @@
 #define OMAP34XX_GPMC_BASE	0x6E000000
 #define OMAP343X_SCM_BASE	0x48002000
 #define OMAP343X_CTRL_BASE	OMAP343X_SCM_BASE
+#define OMAP343X_IDCODE_BASE	0x4830a000
 
 #define OMAP34XX_IC_BASE	0x48200000
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] OMAP2/3/4: ioremap address space
  2010-01-26  8:40 [PATCH] OMAP2/3/4: Convert bases in omap_globals to physical address Santosh Shilimkar
@ 2010-01-26  8:40 ` Santosh Shilimkar
  2010-01-26 15:46   ` Tony Lindgren
  0 siblings, 1 reply; 9+ messages in thread
From: Santosh Shilimkar @ 2010-01-26  8:40 UTC (permalink / raw)
  To: linux-omap; +Cc: Santosh Shilimkar, Kevin Hilman, Tony Lindgren

This patch update the sdrc, prcm, tap and control module to
allocate iospace dynamically

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/control.c |    6 +++++-
 arch/arm/mach-omap2/id.c      |    7 ++++++-
 arch/arm/mach-omap2/prcm.c    |   16 +++++++++++++---
 arch/arm/mach-omap2/sdrc.c    |   11 +++++++++--
 4 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..43f8a33 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	omap2_ctrl_base = omap2_globals->ctrl;
+	/* Static mapping, never released */
+	if (omap2_globals->ctrl) {
+		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
+		WARN_ON(!omap2_ctrl_base);
+	}
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a091b53..fb5921b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
 void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
 {
 	omap_revision = omap2_globals->class;
-	tap_base = omap2_globals->tap;
+
+	/* Static mapping, never released */
+	if (omap2_globals->tap) {
+		tap_base = ioremap(omap2_globals->tap, SZ_4K);
+		WARN_ON(!tap_base);
+	}
 
 	if (cpu_is_omap34xx())
 		tap_prod_id = 0x0210;
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 3ea8177..56682b8 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -257,9 +257,19 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	prm_base = omap2_globals->prm;
-	cm_base = omap2_globals->cm;
-	cm2_base = omap2_globals->cm2;
+	/* Static mapping, never released */
+	if (omap2_globals->prm) {
+		prm_base = ioremap(omap2_globals->prm, SZ_8K);
+		WARN_ON(!prm_base);
+	}
+	if (omap2_globals->cm) {
+		cm_base = ioremap(omap2_globals->cm, SZ_8K);
+		WARN_ON(!cm_base);
+	}
+	if (omap2_globals->cm2) {
+		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
+		WARN_ON(!cm2_base);
+	}
 }
 
 #ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index cbfbd14..4c65f56 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -119,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	omap2_sdrc_base = omap2_globals->sdrc;
-	omap2_sms_base = omap2_globals->sms;
+	/* Static mapping, never released */
+	if (omap2_globals->sdrc) {
+		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
+		WARN_ON(!omap2_sdrc_base);
+	}
+	if (omap2_globals->sms) {
+		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
+		WARN_ON(!omap2_sms_base);
+	}
 }
 
 /**
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] OMAP2/3/4: ioremap address space
  2010-01-26  8:40 ` [PATCH] OMAP2/3/4: ioremap address space Santosh Shilimkar
@ 2010-01-26 15:46   ` Tony Lindgren
  2010-01-27  5:09     ` Shilimkar, Santosh
  2010-01-27  5:44     ` Shilimkar, Santosh
  0 siblings, 2 replies; 9+ messages in thread
From: Tony Lindgren @ 2010-01-26 15:46 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: linux-omap, Kevin Hilman

* Santosh Shilimkar <santosh.shilimkar@ti.com> [100126 00:37]:
> This patch update the sdrc, prcm, tap and control module to
> allocate iospace dynamically
> 
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> CC: Kevin Hilman <khilman@deeprootsystems.com>
> CC: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/control.c |    6 +++++-
>  arch/arm/mach-omap2/id.c      |    7 ++++++-
>  arch/arm/mach-omap2/prcm.c    |   16 +++++++++++++---
>  arch/arm/mach-omap2/sdrc.c    |   11 +++++++++--
>  4 files changed, 33 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
> index cdd1f35..43f8a33 100644
> --- a/arch/arm/mach-omap2/control.c
> +++ b/arch/arm/mach-omap2/control.c
> @@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
>  
>  void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
>  {
> -	omap2_ctrl_base = omap2_globals->ctrl;
> +	/* Static mapping, never released */
> +	if (omap2_globals->ctrl) {
> +		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
> +		WARN_ON(!omap2_ctrl_base);
> +	}
>  }
>  
>  void __iomem *omap_ctrl_base_get(void)
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index a091b53..fb5921b 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
>  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
>  {
>  	omap_revision = omap2_globals->class;
> -	tap_base = omap2_globals->tap;
> +
> +	/* Static mapping, never released */
> +	if (omap2_globals->tap) {
> +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> +		WARN_ON(!tap_base);
> +	}
>  
>  	if (cpu_is_omap34xx())
>  		tap_prod_id = 0x0210;

Nice clean-up.

We need to check carefully that the cpu detection is done by the time
we do the ioremap.. Initially we only know the machine class such as
34xx/24xx.

We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
so all these mappings may not work properly.

Also, we should merge this as one patch to keep the system booting
between the patches.

Regards,

Tony

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] OMAP2/3/4: ioremap address space
  2010-01-26 15:46   ` Tony Lindgren
@ 2010-01-27  5:09     ` Shilimkar, Santosh
  2010-01-27  5:44     ` Shilimkar, Santosh
  1 sibling, 0 replies; 9+ messages in thread
From: Shilimkar, Santosh @ 2010-01-27  5:09 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Kevin Hilman

> -----Original Message-----
> From: Tony Lindgren [mailto:tony@atomide.com]
> Sent: Tuesday, January 26, 2010 9:16 PM
> To: Shilimkar, Santosh
> Cc: linux-omap@vger.kernel.org; Kevin Hilman
> Subject: Re: [PATCH] OMAP2/3/4: ioremap address space
> 
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [100126 00:37]:
> > This patch update the sdrc, prcm, tap and control module to
> > allocate iospace dynamically
> >
> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > CC: Kevin Hilman <khilman@deeprootsystems.com>
> > CC: Tony Lindgren <tony@atomide.com>
> > ---
> >  arch/arm/mach-omap2/control.c |    6 +++++-
> >  arch/arm/mach-omap2/id.c      |    7 ++++++-
> >  arch/arm/mach-omap2/prcm.c    |   16 +++++++++++++---
> >  arch/arm/mach-omap2/sdrc.c    |   11 +++++++++--
> >  4 files changed, 33 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
> > index cdd1f35..43f8a33 100644
> > --- a/arch/arm/mach-omap2/control.c
> > +++ b/arch/arm/mach-omap2/control.c
> > @@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
> >
> >  void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
> >  {
> > -	omap2_ctrl_base = omap2_globals->ctrl;
> > +	/* Static mapping, never released */
> > +	if (omap2_globals->ctrl) {
> > +		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
> > +		WARN_ON(!omap2_ctrl_base);
> > +	}
> >  }
> >
> >  void __iomem *omap_ctrl_base_get(void)
> > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > index a091b53..fb5921b 100644
> > --- a/arch/arm/mach-omap2/id.c
> > +++ b/arch/arm/mach-omap2/id.c
> > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> >  {
> >  	omap_revision = omap2_globals->class;
> > -	tap_base = omap2_globals->tap;
> > +
> > +	/* Static mapping, never released */
> > +	if (omap2_globals->tap) {
> > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > +		WARN_ON(!tap_base);
> > +	}
> >
> >  	if (cpu_is_omap34xx())
> >  		tap_prod_id = 0x0210;
> 
> Nice clean-up.
> 
> We need to check carefully that the cpu detection is done by the time
> we do the ioremap.. Initially we only know the machine class such as
> 34xx/24xx.
Machine class is good enough to select the correct omap_global descriptor.
Isn't it ?
> We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> so all these mappings may not work properly.
>
> Also, we should merge this as one patch to keep the system booting
> between the patches.
Git bisect would be problem. We can merge them together. 

Regards,
Santosh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] OMAP2/3/4: ioremap address space
  2010-01-26 15:46   ` Tony Lindgren
  2010-01-27  5:09     ` Shilimkar, Santosh
@ 2010-01-27  5:44     ` Shilimkar, Santosh
  1 sibling, 0 replies; 9+ messages in thread
From: Shilimkar, Santosh @ 2010-01-27  5:44 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Kevin Hilman

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

<snip>

> > >  void __iomem *omap_ctrl_base_get(void)
> > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > index a091b53..fb5921b 100644
> > > --- a/arch/arm/mach-omap2/id.c
> > > +++ b/arch/arm/mach-omap2/id.c
> > > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> > >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> > >  {
> > >  	omap_revision = omap2_globals->class;
> > > -	tap_base = omap2_globals->tap;
> > > +
> > > +	/* Static mapping, never released */
> > > +	if (omap2_globals->tap) {
> > > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > > +		WARN_ON(!tap_base);
> > > +	}
> > >
> > >  	if (cpu_is_omap34xx())
> > >  		tap_prod_id = 0x0210;
> >
> > Nice clean-up.
> >
> > We need to check carefully that the cpu detection is done by the time
> > we do the ioremap.. Initially we only know the machine class such as
> > 34xx/24xx.
> Machine class is good enough to select the correct omap_global descriptor.
> Isn't it ?
> > We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> > so all these mappings may not work properly.
> >
> > Also, we should merge this as one patch to keep the system booting
> > between the patches.
> Git bisect would be problem. We can merge them together.
Merged patch attached.

Regards,
Santosh


[-- Attachment #2: 0001-OMAP2-3-4-ioremap-omap_globals-modules.patch --]
[-- Type: application/octet-stream, Size: 8825 bytes --]

From 450be14d15263e9443cfa7d9d902e8fde6f08e8b Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Wed, 27 Jan 2010 11:12:54 +0530
Subject: [PATCH] OMAP2/3/4: ioremap omap_globals modules

This is a clean-up patch towards dynamic allocation of IO space
instead of using harcoded macros to calculate virtual addresses.

Also update the sdrc, prcm, tap and control module to
allocate iospace dynamically

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/control.c              |    6 +++-
 arch/arm/mach-omap2/id.c                   |    7 ++++-
 arch/arm/mach-omap2/prcm.c                 |   16 ++++++++--
 arch/arm/mach-omap2/sdrc.c                 |   11 +++++-
 arch/arm/plat-omap/common.c                |   46 ++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h   |   14 ++++----
 arch/arm/plat-omap/include/plat/omap24xx.h |    2 +
 arch/arm/plat-omap/include/plat/omap34xx.h |    1 +
 8 files changed, 66 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..43f8a33 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	omap2_ctrl_base = omap2_globals->ctrl;
+	/* Static mapping, never released */
+	if (omap2_globals->ctrl) {
+		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
+		WARN_ON(!omap2_ctrl_base);
+	}
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a091b53..fb5921b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
 void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
 {
 	omap_revision = omap2_globals->class;
-	tap_base = omap2_globals->tap;
+
+	/* Static mapping, never released */
+	if (omap2_globals->tap) {
+		tap_base = ioremap(omap2_globals->tap, SZ_4K);
+		WARN_ON(!tap_base);
+	}
 
 	if (cpu_is_omap34xx())
 		tap_prod_id = 0x0210;
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 3ea8177..56682b8 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -257,9 +257,19 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	prm_base = omap2_globals->prm;
-	cm_base = omap2_globals->cm;
-	cm2_base = omap2_globals->cm2;
+	/* Static mapping, never released */
+	if (omap2_globals->prm) {
+		prm_base = ioremap(omap2_globals->prm, SZ_8K);
+		WARN_ON(!prm_base);
+	}
+	if (omap2_globals->cm) {
+		cm_base = ioremap(omap2_globals->cm, SZ_8K);
+		WARN_ON(!cm_base);
+	}
+	if (omap2_globals->cm2) {
+		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
+		WARN_ON(!cm2_base);
+	}
 }
 
 #ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index cbfbd14..4c65f56 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -119,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	omap2_sdrc_base = omap2_globals->sdrc;
-	omap2_sms_base = omap2_globals->sms;
+	/* Static mapping, never released */
+	if (omap2_globals->sdrc) {
+		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
+		WARN_ON(!omap2_sdrc_base);
+	}
+	if (omap2_globals->sms) {
+		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
+		WARN_ON(!omap2_sms_base);
+	}
 }
 
 /**
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bf1eaf3..d1ed69c 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -227,12 +227,12 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
+	.tap	= OMAP2420_IDCODE_BASE,
+	.sdrc	= OMAP2420_SDRC_BASE,
+	.sms	= OMAP2420_SMS_BASE,
+	.ctrl	= OMAP2420_CTRL_BASE,
+	.prm	= OMAP2420_PRM_BASE,
+	.cm	= OMAP2420_CM_BASE,
 };
 
 void __init omap2_set_globals_242x(void)
@@ -245,12 +245,12 @@ void __init omap2_set_globals_242x(void)
 
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.tap	= OMAP243X_IDCODE_BASE,
+	.sdrc	= OMAP243X_SDRC_BASE,
+	.sms	= OMAP243X_SMS_BASE,
+	.ctrl	= OMAP243X_CTRL_BASE,
+	.prm	= OMAP2430_PRM_BASE,
+	.cm	= OMAP2430_CM_BASE,
 };
 
 void __init omap2_set_globals_243x(void)
@@ -263,12 +263,12 @@ void __init omap2_set_globals_243x(void)
 
 static struct omap_globals omap343x_globals = {
 	.class	= OMAP343X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.tap	= OMAP343X_IDCODE_BASE,
+	.sdrc	= OMAP343X_SDRC_BASE,
+	.sms	= OMAP343X_SMS_BASE,
+	.ctrl	= OMAP343X_CTRL_BASE,
+	.prm	= OMAP3430_PRM_BASE,
+	.cm	= OMAP3430_CM_BASE,
 };
 
 void __init omap2_set_globals_343x(void)
@@ -280,11 +280,11 @@ void __init omap2_set_globals_343x(void)
 #if defined(CONFIG_ARCH_OMAP4)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.tap	= OMAP443X_SCM_BASE,
+	.ctrl	= OMAP443X_CTRL_BASE,
+	.prm	= OMAP4430_PRM_BASE,
+	.cm	= OMAP4430_CM_BASE,
+	.cm2	= OMAP4430_CM2_BASE,
 };
 
 void __init omap2_set_globals_443x(void)
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c2227..c486fda 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -40,13 +40,13 @@ extern struct sys_timer omap_timer;
 /* IO bases for various OMAP processors */
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
-	void __iomem	*tap;		/* Control module ID code */
-	void __iomem	*sdrc;		/* SDRAM Controller */
-	void __iomem	*sms;		/* SDRAM Memory Scheduler */
-	void __iomem	*ctrl;		/* System Control Module */
-	void __iomem	*prm;		/* Power and Reset Management */
-	void __iomem	*cm;		/* Clock Management */
-	void __iomem	*cm2;
+	unsigned long	tap;		/* Control module ID code */
+	unsigned long	sdrc;		/* SDRAM Controller */
+	unsigned long	sms;		/* SDRAM Memory Scheduler */
+	unsigned long	ctrl;		/* System Control Module */
+	unsigned long	prm;		/* Power and Reset Management */
+	unsigned long	cm;		/* Clock Management */
+	unsigned long	cm2;
 };
 
 void omap2_set_globals_242x(void);
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h
index 696edfc..c04a5d7 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -48,6 +48,7 @@
 #define OMAP2420_SDRC_BASE	(L3_24XX_BASE + 0x9000)
 #define OMAP2420_SMS_BASE	0x68008000
 #define OMAP2420_GPMC_BASE	0x6800a000
+#define OMAP2420_IDCODE_BASE	0x48014000
 
 #define OMAP2430_32KSYNCT_BASE	(L4_WK_243X_BASE + 0x20000)
 #define OMAP2430_PRCM_BASE	(L4_WK_243X_BASE + 0x6000)
@@ -60,6 +61,7 @@
 #define OMAP243X_SCM_BASE	(L4_WK_243X_BASE + 0x2000)
 #define OMAP243X_CTRL_BASE	OMAP243X_SCM_BASE
 #define OMAP243X_HS_BASE	(L4_24XX_BASE + 0x000ac000)
+#define OMAP243X_IDCODE_BASE	0x4900a000
 
 /* DSP SS */
 #define OMAP2420_DSP_BASE	0x58000000
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h
index 077f059..e5cc8d2 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -43,6 +43,7 @@
 #define OMAP34XX_GPMC_BASE	0x6E000000
 #define OMAP343X_SCM_BASE	0x48002000
 #define OMAP343X_CTRL_BASE	OMAP343X_SCM_BASE
+#define OMAP343X_IDCODE_BASE	0x4830a000
 
 #define OMAP34XX_IC_BASE	0x48200000
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH] OMAP2/3/4: ioremap address space
  2010-02-05  5:32   ` Shilimkar, Santosh
@ 2010-02-05 13:59     ` Shilimkar, Santosh
  0 siblings, 0 replies; 9+ messages in thread
From: Shilimkar, Santosh @ 2010-02-05 13:59 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Kevin Hilman

[-- Attachment #1: Type: text/plain, Size: 3599 bytes --]

Tony,
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
> Shilimkar, Santosh
> Sent: Friday, February 05, 2010 11:02 AM
> To: Tony Lindgren
> Cc: linux-omap@vger.kernel.org; Kevin Hilman
> Subject: RE: [PATCH] OMAP2/3/4: ioremap address space
> 
> > -----Original Message-----
> > From: Tony Lindgren [mailto:tony@atomide.com]
> > Sent: Friday, February 05, 2010 3:21 AM
> > To: Shilimkar, Santosh
> > Cc: linux-omap@vger.kernel.org; Kevin Hilman
> > Subject: Re: [PATCH] OMAP2/3/4: ioremap address space
> >
> > * Shilimkar, Santosh <santosh.shilimkar@ti.com> [100204 11:45]:
> > > Tony,
> > >
> > > -----Original Message-----
> > > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
> > Shilimkar, Santosh
> > > Sent: Wednesday, January 27, 2010 11:14 AM
> > > To: Tony Lindgren
> > > Cc: linux-omap@vger.kernel.org; Kevin Hilman
> > > Subject: RE: [PATCH] OMAP2/3/4: ioremap address space
> > >
> > > <snip>
> > >
> > > > > >  void __iomem *omap_ctrl_base_get(void)
> > > > > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > > > > index a091b53..fb5921b 100644
> > > > > > --- a/arch/arm/mach-omap2/id.c
> > > > > > +++ b/arch/arm/mach-omap2/id.c
> > > > > > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> > > > > >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> > > > > >  {
> > > > > >  	omap_revision = omap2_globals->class;
> > > > > > -	tap_base = omap2_globals->tap;
> > > > > > +
> > > > > > +	/* Static mapping, never released */
> > > > > > +	if (omap2_globals->tap) {
> > > > > > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > > > > > +		WARN_ON(!tap_base);
> > > > > > +	}
> > > > > >
> > > > > >  	if (cpu_is_omap34xx())
> > > > > >  		tap_prod_id = 0x0210;
> > > > >
> > > > > Nice clean-up.
> > > > >
> > > > > We need to check carefully that the cpu detection is done by the time
> > > > > we do the ioremap.. Initially we only know the machine class such as
> > > > > 34xx/24xx.
> > > > Machine class is good enough to select the correct omap_global descriptor.
> >
> > Yeah but ioremap uses cpu_is_omap2420() and cpu_is_omap2430(), so we can't
> > use that for setting tap_base. Basically ioremap() won't work in this
> > case until omap2_check_revision() is done.
> >
> > I _think_ the others are safe..
> You are correct.
> > > > Isn't it ?
> > > > > We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> > > > > so all these mappings may not work properly.
> > > > >
> > > > > Also, we should merge this as one patch to keep the system booting
> > > > > between the patches.
> > > > Git bisect would be problem. We can merge them together.
> > > Merged patch attached.
> > >
> > > How do we proceed with this? I can test this patch with omap3_defconfig and see if
> > > the Image works on OMAP3430, OMAP3630 and OMAP4430 SDPs.
> >
> > How about leave tap changes from this patcht, and ioremap the rest?
> >
> > Then let's try it out in l-o master for next few weeks and then merge
> > it assuming things are OK.
> 
> Sound good to me. Will spin the new version with this and post.
Attached version generated against mainline with tap changes is dropped tested on
OMAP3430 and OMAP4430 SDP
  
A slightly modified version because of recent uart changes also attached
Tested with linux-omap multi-omap(omap3_defconfig) build on OMAP4430 and OMAP3430 SDP.


Regards, 
Santosh



[-- Attachment #2: 0001-V2-OMAP2-3-4-ioremap-omap_globals-modules.patch --]
[-- Type: application/octet-stream, Size: 6825 bytes --]

From f557b30be2a176dfe3c15bf1aa7d90e0ed1752cf Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Fri, 5 Feb 2010 19:00:34 +0530
Subject: [PATCH] V2: OMAP2/3/4: ioremap omap_globals modules

This is a clean-up patch towards dynamic allocation of IO space
instead of using harcoded macros to calculate virtual addresses.

Also update the sdrc, prcm, tap and control module to
allocate iospace dynamically

As per Tony's suggestion V2 version drops tap changes
becasue ioremap uses cpu_is_omap2420() and cpu_is_omap2430(),
so we can't use that for setting tap_base. Hence ioremap()
won't work for tap until omap2_check_revision() is done

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/control.c            |    6 ++++-
 arch/arm/mach-omap2/prcm.c               |   16 ++++++++++--
 arch/arm/mach-omap2/sdrc.c               |   11 +++++++-
 arch/arm/plat-omap/common.c              |   38 +++++++++++++++---------------
 arch/arm/plat-omap/include/plat/common.h |   12 ++++----
 5 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..43f8a33 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	omap2_ctrl_base = omap2_globals->ctrl;
+	/* Static mapping, never released */
+	if (omap2_globals->ctrl) {
+		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
+		WARN_ON(!omap2_ctrl_base);
+	}
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index cf466ea..14a2439 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -254,9 +254,19 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	prm_base = omap2_globals->prm;
-	cm_base = omap2_globals->cm;
-	cm2_base = omap2_globals->cm2;
+	/* Static mapping, never released */
+	if (omap2_globals->prm) {
+		prm_base = ioremap(omap2_globals->prm, SZ_8K);
+		WARN_ON(!prm_base);
+	}
+	if (omap2_globals->cm) {
+		cm_base = ioremap(omap2_globals->cm, SZ_8K);
+		WARN_ON(!cm_base);
+	}
+	if (omap2_globals->cm2) {
+		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
+		WARN_ON(!cm2_base);
+	}
 }
 
 #ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index cbfbd14..4c65f56 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -119,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	omap2_sdrc_base = omap2_globals->sdrc;
-	omap2_sms_base = omap2_globals->sms;
+	/* Static mapping, never released */
+	if (omap2_globals->sdrc) {
+		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
+		WARN_ON(!omap2_sdrc_base);
+	}
+	if (omap2_globals->sms) {
+		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
+		WARN_ON(!omap2_sms_base);
+	}
 }
 
 /**
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index dddc027..d5cd311 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -254,11 +254,11 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
+	.sdrc	= OMAP2420_SDRC_BASE,
+	.sms	= OMAP2420_SMS_BASE,
+	.ctrl	= OMAP2420_CTRL_BASE,
+	.prm	= OMAP2420_PRM_BASE,
+	.cm	= OMAP2420_CM_BASE,
 };
 
 void __init omap2_set_globals_242x(void)
@@ -272,11 +272,11 @@ void __init omap2_set_globals_242x(void)
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.sdrc	= OMAP243X_SDRC_BASE,
+	.sms	= OMAP243X_SMS_BASE,
+	.ctrl	= OMAP243X_CTRL_BASE,
+	.prm	= OMAP2430_PRM_BASE,
+	.cm	= OMAP2430_CM_BASE,
 };
 
 void __init omap2_set_globals_243x(void)
@@ -290,11 +290,11 @@ void __init omap2_set_globals_243x(void)
 static struct omap_globals omap343x_globals = {
 	.class	= OMAP343X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.sdrc	= OMAP343X_SDRC_BASE,
+	.sms	= OMAP343X_SMS_BASE,
+	.ctrl	= OMAP343X_CTRL_BASE,
+	.prm	= OMAP3430_PRM_BASE,
+	.cm	= OMAP3430_CM_BASE,
 };
 
 void __init omap2_set_globals_343x(void)
@@ -307,10 +307,10 @@ void __init omap2_set_globals_343x(void)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.ctrl	= OMAP443X_CTRL_BASE,
+	.prm	= OMAP4430_PRM_BASE,
+	.cm	= OMAP4430_CM_BASE,
+	.cm2	= OMAP4430_CM2_BASE,
 };
 
 void __init omap2_set_globals_443x(void)
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c2227..20608ad 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -41,12 +41,12 @@ extern struct sys_timer omap_timer;
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
 	void __iomem	*tap;		/* Control module ID code */
-	void __iomem	*sdrc;		/* SDRAM Controller */
-	void __iomem	*sms;		/* SDRAM Memory Scheduler */
-	void __iomem	*ctrl;		/* System Control Module */
-	void __iomem	*prm;		/* Power and Reset Management */
-	void __iomem	*cm;		/* Clock Management */
-	void __iomem	*cm2;
+	unsigned long	sdrc;		/* SDRAM Controller */
+	unsigned long	sms;		/* SDRAM Memory Scheduler */
+	unsigned long	ctrl;		/* System Control Module */
+	unsigned long	prm;		/* Power and Reset Management */
+	unsigned long	cm;		/* Clock Management */
+	unsigned long	cm2;
 };
 
 void omap2_set_globals_242x(void);
-- 
1.6.0.4


[-- Attachment #3: 0001-multi-omap4-OMAP2-3-4-ioremap-omap_globals-modules.patch --]
[-- Type: application/octet-stream, Size: 6480 bytes --]

From 3df9b20a9464d852ccc2df23e099df38d9f4c1e2 Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Fri, 5 Feb 2010 19:00:34 +0530
Subject: [PATCH] multi-omap4: OMAP2/3/4: ioremap omap_globals modules

This is a clean-up patch towards dynamic allocation of IO space
instead of using harcoded macros to calculate virtual addresses.

Also update the sdrc, prcm, tap and control module to
allocate iospace dynamically

As per Tony's suggestion V2 version drops tap changes
becasue ioremap uses cpu_is_omap2420() and cpu_is_omap2430(),
so we can't use that for setting tap_base. Hence ioremap()
won't work for tap until omap2_check_revision() is done

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/control.c            |    6 +++++-
 arch/arm/mach-omap2/prcm.c               |   16 +++++++++++++---
 arch/arm/mach-omap2/sdrc.c               |   11 +++++++++--
 arch/arm/plat-omap/common.c              |   28 ++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |   12 ++++++------
 5 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..43f8a33 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	omap2_ctrl_base = omap2_globals->ctrl;
+	/* Static mapping, never released */
+	if (omap2_globals->ctrl) {
+		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
+		WARN_ON(!omap2_ctrl_base);
+	}
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index e8e121a..338d5f6 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -279,9 +279,19 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	prm_base = omap2_globals->prm;
-	cm_base = omap2_globals->cm;
-	cm2_base = omap2_globals->cm2;
+	/* Static mapping, never released */
+	if (omap2_globals->prm) {
+		prm_base = ioremap(omap2_globals->prm, SZ_8K);
+		WARN_ON(!prm_base);
+	}
+	if (omap2_globals->cm) {
+		cm_base = ioremap(omap2_globals->cm, SZ_8K);
+		WARN_ON(!cm_base);
+	}
+	if (omap2_globals->cm2) {
+		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
+		WARN_ON(!cm2_base);
+	}
 }
 
 #ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index cbfbd14..4c65f56 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -119,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	omap2_sdrc_base = omap2_globals->sdrc;
-	omap2_sms_base = omap2_globals->sms;
+	/* Static mapping, never released */
+	if (omap2_globals->sdrc) {
+		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
+		WARN_ON(!omap2_sdrc_base);
+	}
+	if (omap2_globals->sms) {
+		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
+		WARN_ON(!omap2_sms_base);
+	}
 }
 
 /**
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 4f29e8c..d106375 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -277,11 +277,11 @@ void __init omap2_set_globals_242x(void)
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.sdrc	= OMAP243X_SDRC_BASE,
+	.sms	= (OMAP243X_SMS_BASE),
+	.ctrl	= (OMAP243X_CTRL_BASE),
+	.prm	= (OMAP2430_PRM_BASE),
+	.cm	= (OMAP2430_CM_BASE),
 	.uart1_phys	= OMAP2_UART1_BASE,
 	.uart2_phys	= OMAP2_UART2_BASE,
 	.uart3_phys	= OMAP2_UART3_BASE,
@@ -298,11 +298,11 @@ void __init omap2_set_globals_243x(void)
 static struct omap_globals omap3_globals = {
 	.class	= OMAP343X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.sdrc	= (OMAP343X_SDRC_BASE),
+	.sms	= (OMAP343X_SMS_BASE),
+	.ctrl	= (OMAP343X_CTRL_BASE),
+	.prm	= (OMAP3430_PRM_BASE),
+	.cm	= (OMAP3430_CM_BASE),
 	.uart1_phys	= OMAP3_UART1_BASE,
 	.uart2_phys	= OMAP3_UART2_BASE,
 	.uart3_phys	= OMAP3_UART3_BASE,
@@ -325,10 +325,10 @@ void __init omap2_set_globals_36xx(void)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.ctrl	= (OMAP443X_CTRL_BASE),
+	.prm	= (OMAP4430_PRM_BASE),
+	.cm	= (OMAP4430_CM_BASE),
+	.cm2	= (OMAP4430_CM2_BASE),
 	.uart1_phys	= OMAP4_UART1_BASE,
 	.uart2_phys	= OMAP4_UART2_BASE,
 	.uart3_phys	= OMAP4_UART3_BASE,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index e04a58e..dc8a897 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -41,12 +41,12 @@ extern struct sys_timer omap_timer;
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
 	void __iomem	*tap;		/* Control module ID code */
-	void __iomem	*sdrc;		/* SDRAM Controller */
-	void __iomem	*sms;		/* SDRAM Memory Scheduler */
-	void __iomem	*ctrl;		/* System Control Module */
-	void __iomem	*prm;		/* Power and Reset Management */
-	void __iomem	*cm;		/* Clock Management */
-	void __iomem	*cm2;
+	unsigned long   sdrc;           /* SDRAM Controller */
+	unsigned long   sms;            /* SDRAM Memory Scheduler */
+	unsigned long   ctrl;           /* System Control Module */
+	unsigned long   prm;            /* Power and Reset Management */
+	unsigned long   cm;             /* Clock Management */
+	unsigned long   cm2;
 	unsigned long	uart1_phys;
 	unsigned long	uart2_phys;
 	unsigned long	uart3_phys;
-- 
1.5.4.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH] OMAP2/3/4: ioremap address space
  2010-02-04 21:50 ` Tony Lindgren
@ 2010-02-05  5:32   ` Shilimkar, Santosh
  2010-02-05 13:59     ` Shilimkar, Santosh
  0 siblings, 1 reply; 9+ messages in thread
From: Shilimkar, Santosh @ 2010-02-05  5:32 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Kevin Hilman

> -----Original Message-----
> From: Tony Lindgren [mailto:tony@atomide.com]
> Sent: Friday, February 05, 2010 3:21 AM
> To: Shilimkar, Santosh
> Cc: linux-omap@vger.kernel.org; Kevin Hilman
> Subject: Re: [PATCH] OMAP2/3/4: ioremap address space
> 
> * Shilimkar, Santosh <santosh.shilimkar@ti.com> [100204 11:45]:
> > Tony,
> >
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
> Shilimkar, Santosh
> > Sent: Wednesday, January 27, 2010 11:14 AM
> > To: Tony Lindgren
> > Cc: linux-omap@vger.kernel.org; Kevin Hilman
> > Subject: RE: [PATCH] OMAP2/3/4: ioremap address space
> >
> > <snip>
> >
> > > > >  void __iomem *omap_ctrl_base_get(void)
> > > > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > > > index a091b53..fb5921b 100644
> > > > > --- a/arch/arm/mach-omap2/id.c
> > > > > +++ b/arch/arm/mach-omap2/id.c
> > > > > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> > > > >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> > > > >  {
> > > > >  	omap_revision = omap2_globals->class;
> > > > > -	tap_base = omap2_globals->tap;
> > > > > +
> > > > > +	/* Static mapping, never released */
> > > > > +	if (omap2_globals->tap) {
> > > > > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > > > > +		WARN_ON(!tap_base);
> > > > > +	}
> > > > >
> > > > >  	if (cpu_is_omap34xx())
> > > > >  		tap_prod_id = 0x0210;
> > > >
> > > > Nice clean-up.
> > > >
> > > > We need to check carefully that the cpu detection is done by the time
> > > > we do the ioremap.. Initially we only know the machine class such as
> > > > 34xx/24xx.
> > > Machine class is good enough to select the correct omap_global descriptor.
> 
> Yeah but ioremap uses cpu_is_omap2420() and cpu_is_omap2430(), so we can't
> use that for setting tap_base. Basically ioremap() won't work in this
> case until omap2_check_revision() is done.
> 
> I _think_ the others are safe..
You are correct.
> > > Isn't it ?
> > > > We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> > > > so all these mappings may not work properly.
> > > >
> > > > Also, we should merge this as one patch to keep the system booting
> > > > between the patches.
> > > Git bisect would be problem. We can merge them together.
> > Merged patch attached.
> >
> > How do we proceed with this? I can test this patch with omap3_defconfig and see if
> > the Image works on OMAP3430, OMAP3630 and OMAP4430 SDPs.
> 
> How about leave tap changes from this patcht, and ioremap the rest?
> 
> Then let's try it out in l-o master for next few weeks and then merge
> it assuming things are OK.

Sound good to me. Will spin the new version with this and post.

Regards,
Santosh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] OMAP2/3/4: ioremap address space
  2010-02-04 19:48 Shilimkar, Santosh
@ 2010-02-04 21:50 ` Tony Lindgren
  2010-02-05  5:32   ` Shilimkar, Santosh
  0 siblings, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2010-02-04 21:50 UTC (permalink / raw)
  To: Shilimkar, Santosh; +Cc: linux-omap, Kevin Hilman

* Shilimkar, Santosh <santosh.shilimkar@ti.com> [100204 11:45]:
> Tony,
> 
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Shilimkar, Santosh
> Sent: Wednesday, January 27, 2010 11:14 AM
> To: Tony Lindgren
> Cc: linux-omap@vger.kernel.org; Kevin Hilman
> Subject: RE: [PATCH] OMAP2/3/4: ioremap address space
> 
> <snip>
> 
> > > >  void __iomem *omap_ctrl_base_get(void)
> > > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > > index a091b53..fb5921b 100644
> > > > --- a/arch/arm/mach-omap2/id.c
> > > > +++ b/arch/arm/mach-omap2/id.c
> > > > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> > > >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> > > >  {
> > > >  	omap_revision = omap2_globals->class;
> > > > -	tap_base = omap2_globals->tap;
> > > > +
> > > > +	/* Static mapping, never released */
> > > > +	if (omap2_globals->tap) {
> > > > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > > > +		WARN_ON(!tap_base);
> > > > +	}
> > > >
> > > >  	if (cpu_is_omap34xx())
> > > >  		tap_prod_id = 0x0210;
> > >
> > > Nice clean-up.
> > >
> > > We need to check carefully that the cpu detection is done by the time
> > > we do the ioremap.. Initially we only know the machine class such as
> > > 34xx/24xx.
> > Machine class is good enough to select the correct omap_global descriptor.

Yeah but ioremap uses cpu_is_omap2420() and cpu_is_omap2430(), so we can't
use that for setting tap_base. Basically ioremap() won't work in this
case until omap2_check_revision() is done.

I _think_ the others are safe..

> > Isn't it ?
> > > We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> > > so all these mappings may not work properly.
> > >
> > > Also, we should merge this as one patch to keep the system booting
> > > between the patches.
> > Git bisect would be problem. We can merge them together.
> Merged patch attached.
> 
> How do we proceed with this? I can test this patch with omap3_defconfig and see if
> the Image works on OMAP3430, OMAP3630 and OMAP4430 SDPs.

How about leave tap changes from this patcht, and ioremap the rest?

Then let's try it out in l-o master for next few weeks and then merge
it assuming things are OK.

Regards,

Tony

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] OMAP2/3/4: ioremap address space
@ 2010-02-04 19:48 Shilimkar, Santosh
  2010-02-04 21:50 ` Tony Lindgren
  0 siblings, 1 reply; 9+ messages in thread
From: Shilimkar, Santosh @ 2010-02-04 19:48 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Kevin Hilman

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

Tony,

-----Original Message-----
From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Shilimkar, Santosh
Sent: Wednesday, January 27, 2010 11:14 AM
To: Tony Lindgren
Cc: linux-omap@vger.kernel.org; Kevin Hilman
Subject: RE: [PATCH] OMAP2/3/4: ioremap address space

<snip>

> > >  void __iomem *omap_ctrl_base_get(void)
> > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > index a091b53..fb5921b 100644
> > > --- a/arch/arm/mach-omap2/id.c
> > > +++ b/arch/arm/mach-omap2/id.c
> > > @@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
> > >  void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
> > >  {
> > >  	omap_revision = omap2_globals->class;
> > > -	tap_base = omap2_globals->tap;
> > > +
> > > +	/* Static mapping, never released */
> > > +	if (omap2_globals->tap) {
> > > +		tap_base = ioremap(omap2_globals->tap, SZ_4K);
> > > +		WARN_ON(!tap_base);
> > > +	}
> > >
> > >  	if (cpu_is_omap34xx())
> > >  		tap_prod_id = 0x0210;
> >
> > Nice clean-up.
> >
> > We need to check carefully that the cpu detection is done by the time
> > we do the ioremap.. Initially we only know the machine class such as
> > 34xx/24xx.
> Machine class is good enough to select the correct omap_global descriptor.
> Isn't it ?
> > We have at least cpu_is_omap2420 and cpu_is_omap2430 being used in io.c,
> > so all these mappings may not work properly.
> >
> > Also, we should merge this as one patch to keep the system booting
> > between the patches.
> Git bisect would be problem. We can merge them together.
Merged patch attached.

How do we proceed with this? I can test this patch with omap3_defconfig and see if
the Image works on OMAP3430, OMAP3630 and OMAP4430 SDPs.

Please suggest.

Regards,
Santosh

[-- Attachment #2: 0001-OMAP2-3-4-ioremap-omap_globals-modules.patch --]
[-- Type: application/octet-stream, Size: 8825 bytes --]

From 450be14d15263e9443cfa7d9d902e8fde6f08e8b Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Wed, 27 Jan 2010 11:12:54 +0530
Subject: [PATCH] OMAP2/3/4: ioremap omap_globals modules

This is a clean-up patch towards dynamic allocation of IO space
instead of using harcoded macros to calculate virtual addresses.

Also update the sdrc, prcm, tap and control module to
allocate iospace dynamically

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/control.c              |    6 +++-
 arch/arm/mach-omap2/id.c                   |    7 ++++-
 arch/arm/mach-omap2/prcm.c                 |   16 ++++++++--
 arch/arm/mach-omap2/sdrc.c                 |   11 +++++-
 arch/arm/plat-omap/common.c                |   46 ++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h   |   14 ++++----
 arch/arm/plat-omap/include/plat/omap24xx.h |    2 +
 arch/arm/plat-omap/include/plat/omap34xx.h |    1 +
 8 files changed, 66 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index cdd1f35..43f8a33 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -140,7 +140,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	omap2_ctrl_base = omap2_globals->ctrl;
+	/* Static mapping, never released */
+	if (omap2_globals->ctrl) {
+		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
+		WARN_ON(!omap2_ctrl_base);
+	}
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index a091b53..fb5921b 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -407,7 +407,12 @@ void __init omap2_check_revision(void)
 void __init omap2_set_globals_tap(struct omap_globals *omap2_globals)
 {
 	omap_revision = omap2_globals->class;
-	tap_base = omap2_globals->tap;
+
+	/* Static mapping, never released */
+	if (omap2_globals->tap) {
+		tap_base = ioremap(omap2_globals->tap, SZ_4K);
+		WARN_ON(!tap_base);
+	}
 
 	if (cpu_is_omap34xx())
 		tap_prod_id = 0x0210;
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 3ea8177..56682b8 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -257,9 +257,19 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	prm_base = omap2_globals->prm;
-	cm_base = omap2_globals->cm;
-	cm2_base = omap2_globals->cm2;
+	/* Static mapping, never released */
+	if (omap2_globals->prm) {
+		prm_base = ioremap(omap2_globals->prm, SZ_8K);
+		WARN_ON(!prm_base);
+	}
+	if (omap2_globals->cm) {
+		cm_base = ioremap(omap2_globals->cm, SZ_8K);
+		WARN_ON(!cm_base);
+	}
+	if (omap2_globals->cm2) {
+		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
+		WARN_ON(!cm2_base);
+	}
 }
 
 #ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index cbfbd14..4c65f56 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -119,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	omap2_sdrc_base = omap2_globals->sdrc;
-	omap2_sms_base = omap2_globals->sms;
+	/* Static mapping, never released */
+	if (omap2_globals->sdrc) {
+		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
+		WARN_ON(!omap2_sdrc_base);
+	}
+	if (omap2_globals->sms) {
+		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
+		WARN_ON(!omap2_sms_base);
+	}
 }
 
 /**
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bf1eaf3..d1ed69c 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -227,12 +227,12 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
+	.tap	= OMAP2420_IDCODE_BASE,
+	.sdrc	= OMAP2420_SDRC_BASE,
+	.sms	= OMAP2420_SMS_BASE,
+	.ctrl	= OMAP2420_CTRL_BASE,
+	.prm	= OMAP2420_PRM_BASE,
+	.cm	= OMAP2420_CM_BASE,
 };
 
 void __init omap2_set_globals_242x(void)
@@ -245,12 +245,12 @@ void __init omap2_set_globals_242x(void)
 
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.tap	= OMAP243X_IDCODE_BASE,
+	.sdrc	= OMAP243X_SDRC_BASE,
+	.sms	= OMAP243X_SMS_BASE,
+	.ctrl	= OMAP243X_CTRL_BASE,
+	.prm	= OMAP2430_PRM_BASE,
+	.cm	= OMAP2430_CM_BASE,
 };
 
 void __init omap2_set_globals_243x(void)
@@ -263,12 +263,12 @@ void __init omap2_set_globals_243x(void)
 
 static struct omap_globals omap343x_globals = {
 	.class	= OMAP343X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
-	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.tap	= OMAP343X_IDCODE_BASE,
+	.sdrc	= OMAP343X_SDRC_BASE,
+	.sms	= OMAP343X_SMS_BASE,
+	.ctrl	= OMAP343X_CTRL_BASE,
+	.prm	= OMAP3430_PRM_BASE,
+	.cm	= OMAP3430_CM_BASE,
 };
 
 void __init omap2_set_globals_343x(void)
@@ -280,11 +280,11 @@ void __init omap2_set_globals_343x(void)
 #if defined(CONFIG_ARCH_OMAP4)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
-	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
-	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
-	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
-	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.tap	= OMAP443X_SCM_BASE,
+	.ctrl	= OMAP443X_CTRL_BASE,
+	.prm	= OMAP4430_PRM_BASE,
+	.cm	= OMAP4430_CM_BASE,
+	.cm2	= OMAP4430_CM2_BASE,
 };
 
 void __init omap2_set_globals_443x(void)
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c2227..c486fda 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -40,13 +40,13 @@ extern struct sys_timer omap_timer;
 /* IO bases for various OMAP processors */
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
-	void __iomem	*tap;		/* Control module ID code */
-	void __iomem	*sdrc;		/* SDRAM Controller */
-	void __iomem	*sms;		/* SDRAM Memory Scheduler */
-	void __iomem	*ctrl;		/* System Control Module */
-	void __iomem	*prm;		/* Power and Reset Management */
-	void __iomem	*cm;		/* Clock Management */
-	void __iomem	*cm2;
+	unsigned long	tap;		/* Control module ID code */
+	unsigned long	sdrc;		/* SDRAM Controller */
+	unsigned long	sms;		/* SDRAM Memory Scheduler */
+	unsigned long	ctrl;		/* System Control Module */
+	unsigned long	prm;		/* Power and Reset Management */
+	unsigned long	cm;		/* Clock Management */
+	unsigned long	cm2;
 };
 
 void omap2_set_globals_242x(void);
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h
index 696edfc..c04a5d7 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -48,6 +48,7 @@
 #define OMAP2420_SDRC_BASE	(L3_24XX_BASE + 0x9000)
 #define OMAP2420_SMS_BASE	0x68008000
 #define OMAP2420_GPMC_BASE	0x6800a000
+#define OMAP2420_IDCODE_BASE	0x48014000
 
 #define OMAP2430_32KSYNCT_BASE	(L4_WK_243X_BASE + 0x20000)
 #define OMAP2430_PRCM_BASE	(L4_WK_243X_BASE + 0x6000)
@@ -60,6 +61,7 @@
 #define OMAP243X_SCM_BASE	(L4_WK_243X_BASE + 0x2000)
 #define OMAP243X_CTRL_BASE	OMAP243X_SCM_BASE
 #define OMAP243X_HS_BASE	(L4_24XX_BASE + 0x000ac000)
+#define OMAP243X_IDCODE_BASE	0x4900a000
 
 /* DSP SS */
 #define OMAP2420_DSP_BASE	0x58000000
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h
index 077f059..e5cc8d2 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -43,6 +43,7 @@
 #define OMAP34XX_GPMC_BASE	0x6E000000
 #define OMAP343X_SCM_BASE	0x48002000
 #define OMAP343X_CTRL_BASE	OMAP343X_SCM_BASE
+#define OMAP343X_IDCODE_BASE	0x4830a000
 
 #define OMAP34XX_IC_BASE	0x48200000
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-02-05 13:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-26  8:40 [PATCH] OMAP2/3/4: Convert bases in omap_globals to physical address Santosh Shilimkar
2010-01-26  8:40 ` [PATCH] OMAP2/3/4: ioremap address space Santosh Shilimkar
2010-01-26 15:46   ` Tony Lindgren
2010-01-27  5:09     ` Shilimkar, Santosh
2010-01-27  5:44     ` Shilimkar, Santosh
2010-02-04 19:48 Shilimkar, Santosh
2010-02-04 21:50 ` Tony Lindgren
2010-02-05  5:32   ` Shilimkar, Santosh
2010-02-05 13:59     ` Shilimkar, Santosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.