diff mbox

[2/9] davinci: sram: ioremap the davinci_soc_info specified sram regions

Message ID 80c0c2ff5a39baf6140c08460c2691b178c038c0.1305668470.git.bengardiner@nanometrics.ca (mailing list archive)
State Changes Requested
Headers show

Commit Message

Ben Gardiner May 17, 2011, 9:41 p.m. UTC
The current davinci init sets up SRAM in iotables. There has been an observed
failure to boot a da850 with 128K specified in the iotable.

Make the davinci sram allocator -- now based on RMK's consolidated SRAM
support -- do an ioremap of the region specified by the entries in
davinci_soc_info before registering with pv_pool_create().

This commit breaks runtime of davinci boards since the regions that
the sram init is now trying to ioremap have been iomapped by their
iotable entries. The iotable entries will be removed in the patches
to come.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
---
 arch/arm/mach-davinci/sram.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

Comments

Sekhar Nori May 18, 2011, 12:11 p.m. UTC | #1
Hi Russell,

On Wed, May 18, 2011 at 10:21:40, Jean-Christophe PLAGNIOL-VILLARD wrote:

> On 17:41 Tue 17 May     , Ben Gardiner wrote:

> > diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
> > index 219d4c5..96026df 100644
> > --- a/arch/arm/mach-davinci/sram.c
> > +++ b/arch/arm/mach-davinci/sram.c
> > @@ -8,6 +8,7 @@
> >   * the Free Software Foundation; either version 2 of the License, or
> >   * (at your option) any later version.
> >   */
> > +#include <linux/io.h>
> >  #include <linux/module.h>
> >  #include <linux/init.h>
> >  #include <asm/pv-pool.h>
> > @@ -26,16 +27,23 @@ EXPORT_SYMBOL_GPL(davinci_pv_pool);
> >   */
> >  static int __init sram_init(void)
> >  {
> > +	void *addr;
> >  	unsigned len = davinci_soc_info.sram_len;
> >  	int status = 0;
> >  
> >  	if (len) {
> >  		len = min_t(unsigned, len, SRAM_SIZE);
> > -		davinci_pv_pool = pv_pool_create((void *)SRAM_VIRT,
> > +		addr = ioremap(davinci_soc_info.sram_phys, len);
> > +		if (!addr)
> > +			return -EIO;
> > +
> > +		davinci_pv_pool = pv_pool_create(addr,
> >  					davinci_soc_info.sram_phys, len,
> >  					ilog2(SRAM_GRANULARITY));
> please use the gennalloc directly as discuss with Andrew and Russell my patch
> will present in the .40

With Jean-Christophe's patch getting merged, would you be dropping
your PV pool patch?

Thanks,
Sekhar
Russell King - ARM Linux May 18, 2011, 12:14 p.m. UTC | #2
On Wed, May 18, 2011 at 05:41:56PM +0530, Nori, Sekhar wrote:
> Hi Russell,
> 
> On Wed, May 18, 2011 at 10:21:40, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 
> > On 17:41 Tue 17 May     , Ben Gardiner wrote:
> 
> > > diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
> > > index 219d4c5..96026df 100644
> > > --- a/arch/arm/mach-davinci/sram.c
> > > +++ b/arch/arm/mach-davinci/sram.c
> > > @@ -8,6 +8,7 @@
> > >   * the Free Software Foundation; either version 2 of the License, or
> > >   * (at your option) any later version.
> > >   */
> > > +#include <linux/io.h>
> > >  #include <linux/module.h>
> > >  #include <linux/init.h>
> > >  #include <asm/pv-pool.h>
> > > @@ -26,16 +27,23 @@ EXPORT_SYMBOL_GPL(davinci_pv_pool);
> > >   */
> > >  static int __init sram_init(void)
> > >  {
> > > +	void *addr;
> > >  	unsigned len = davinci_soc_info.sram_len;
> > >  	int status = 0;
> > >  
> > >  	if (len) {
> > >  		len = min_t(unsigned, len, SRAM_SIZE);
> > > -		davinci_pv_pool = pv_pool_create((void *)SRAM_VIRT,
> > > +		addr = ioremap(davinci_soc_info.sram_phys, len);
> > > +		if (!addr)
> > > +			return -EIO;
> > > +
> > > +		davinci_pv_pool = pv_pool_create(addr,
> > >  					davinci_soc_info.sram_phys, len,
> > >  					ilog2(SRAM_GRANULARITY));
> > please use the gennalloc directly as discuss with Andrew and Russell my patch
> > will present in the .40
> 
> With Jean-Christophe's patch getting merged, would you be dropping
> your PV pool patch?

I'll make that decision once JC's patch has actually been merged.  JC's
patch doesn't do any of the consolidation work, so that needs addressing
still.
Sekhar Nori May 18, 2011, 1:18 p.m. UTC | #3
Hi Ben,

On Wed, May 18, 2011 at 03:11:58, Ben Gardiner wrote:

> diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
> index 219d4c5..96026df 100644
> --- a/arch/arm/mach-davinci/sram.c
> +++ b/arch/arm/mach-davinci/sram.c
> @@ -8,6 +8,7 @@
>   * the Free Software Foundation; either version 2 of the License, or
>   * (at your option) any later version.
>   */
> +#include <linux/io.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <asm/pv-pool.h>
> @@ -26,16 +27,23 @@ EXPORT_SYMBOL_GPL(davinci_pv_pool);
>   */
>  static int __init sram_init(void)
>  {
> +	void *addr;
>  	unsigned len = davinci_soc_info.sram_len;
>  	int status = 0;
>  
>  	if (len) {
>  		len = min_t(unsigned, len, SRAM_SIZE);
> -		davinci_pv_pool = pv_pool_create((void *)SRAM_VIRT,
> +		addr = ioremap(davinci_soc_info.sram_phys, len);
> +		if (!addr)
> +			return -EIO;

-ENOMEM here (for the next time you post). See Sergei's
mail on error codes below. Useful stuff.

https://patchwork.kernel.org/patch/47365/

Thanks,
Sekhar
Ben Gardiner May 18, 2011, 1:36 p.m. UTC | #4
Hi Sekhar,

Thanks for the review.

On Wed, May 18, 2011 at 9:18 AM, Nori, Sekhar <nsekhar@ti.com> wrote:

[...]

>>       if (len) {
>>               len = min_t(unsigned, len, SRAM_SIZE);
>> -             davinci_pv_pool = pv_pool_create((void *)SRAM_VIRT,
>> +             addr = ioremap(davinci_soc_info.sram_phys, len);
>> +             if (!addr)
>> +                     return -EIO;
>
> -ENOMEM here (for the next time you post). See Sergei's
> mail on error codes below. Useful stuff.
>
> https://patchwork.kernel.org/patch/47365/

Will do. Thanks for the useful reference also (and to Sergei for writing it).

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index 219d4c5..96026df 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -8,6 +8,7 @@ 
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <asm/pv-pool.h>
@@ -26,16 +27,23 @@  EXPORT_SYMBOL_GPL(davinci_pv_pool);
  */
 static int __init sram_init(void)
 {
+	void *addr;
 	unsigned len = davinci_soc_info.sram_len;
 	int status = 0;
 
 	if (len) {
 		len = min_t(unsigned, len, SRAM_SIZE);
-		davinci_pv_pool = pv_pool_create((void *)SRAM_VIRT,
+		addr = ioremap(davinci_soc_info.sram_phys, len);
+		if (!addr)
+			return -EIO;
+
+		davinci_pv_pool = pv_pool_create(addr,
 					davinci_soc_info.sram_phys, len,
 					ilog2(SRAM_GRANULARITY));
-		if (!davinci_pv_pool)
+		if (!davinci_pv_pool) {
+			iounmap(addr);
 			status = -ENOMEM;
+		}
 	}
 	return status;
 }