diff mbox

[U-Boot] omap3evm: Pass 'mem' argument to linux kernel

Message ID 1317122493-26452-1-git-send-email-premi@ti.com
State Changes Requested
Headers show

Commit Message

Sanjeev Premi Sept. 27, 2011, 11:21 a.m. UTC
In absence of this argument, Linux kernel doesn't boot.

Default value has been set to 128M to ensure that
Linux kernel boots on older EVMs as well.

Signed-off-by: Sanjeev Premi <premi@ti.com>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
---

 This patch has been created against u-boot-ti/next.

 include/configs/omap3_evm.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Igor Grinberg Sept. 27, 2011, 12:05 p.m. UTC | #1
On 09/27/11 14:21, Sanjeev Premi wrote:
> In absence of this argument, Linux kernel doesn't boot.
> 
> Default value has been set to 128M to ensure that
> Linux kernel boots on older EVMs as well.

This change affects all EVMs, unless they explicitly change/remove
the memsize variable or change the *args variables.

Can't the get_ram_size() function be used for detecting the actual
amount of RAM? and then the memory tag or FDT equivalent
(if there is one) used to pass the memory size information?

> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> ---
> 
>  This patch has been created against u-boot-ti/next.
> 
>  include/configs/omap3_evm.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
> index 7af30c2..ea51216 100644
> --- a/include/configs/omap3_evm.h
> +++ b/include/configs/omap3_evm.h
> @@ -200,11 +200,14 @@
>  	"loadaddr=0x82000000\0" \
>  	"usbtty=cdc_acm\0" \
>  	"mmcdev=0\0" \
> +	"memsize=128M\0" \
>  	"console=ttyO0,115200n8\0" \
>  	"mmcargs=setenv bootargs console=${console} " \
> +		"mem=${memsize}\0 " \
>  		"root=/dev/mmcblk0p2 rw " \
>  		"rootfstype=ext3 rootwait\0" \
>  	"nandargs=setenv bootargs console=${console} " \
> +		"mem=${memsize}\0 " \
>  		"root=/dev/mtdblock4 rw " \
>  		"rootfstype=jffs2\0" \
>  	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
Sanjeev Premi Sept. 27, 2011, 6:08 p.m. UTC | #2
> -----Original Message-----
> From: Igor Grinberg [mailto:grinberg@compulab.co.il] 
> Sent: Tuesday, September 27, 2011 5:35 PM
> To: Premi, Sanjeev
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH] omap3evm: Pass 'mem' argument 
> to linux kernel

Sorry missed this mail earlier...

> 
> On 09/27/11 14:21, Sanjeev Premi wrote:
> > In absence of this argument, Linux kernel doesn't boot.
> > 
> > Default value has been set to 128M to ensure that
> > Linux kernel boots on older EVMs as well.
> 
> This change affects all EVMs, unless they explicitly change/remove
> the memsize variable or change the *args variables.

Today without this patch, all EVMs should anyway be broken :(
...but may be working as users may have their own bootargs with
"mem=XYZM" in their bootargs.

The patch only ensures that the kernel would boot if there was
no "saved" environment e.g. when environment partition is erased.
or when u-boot is flashed on new boards.

> 
> Can't the get_ram_size() function be used for detecting the actual
> amount of RAM? and then the memory tag or FDT equivalent
> (if there is one) used to pass the memory size information?
> 

Yes something like this can be done, but that would mean string
manipulation at run-time. Question is - when we should/ shouldn't
do this manipulation.

If user wants to explicitly pass only a portion of memory to Linux
using environment variables, we shouldn't be manipulating the
bootargs.

~sanjeev

[snip]...[snip]
Wolfgang Denk Sept. 28, 2011, 6:47 p.m. UTC | #3
Dear Sanjeev Premi,

In message <1317122493-26452-1-git-send-email-premi@ti.com> you wrote:
> In absence of this argument, Linux kernel doesn't boot.
> 
> Default value has been set to 128M to ensure that
> Linux kernel boots on older EVMs as well.
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> ---

Why do we need to pass any mem= argument at all?  This should never be
necessary.  If it is, then this is a bug in the Linux kernel and needs
to be fixed there.


Best regards,

Wolfgang Denk
Wolfgang Denk Sept. 28, 2011, 6:53 p.m. UTC | #4
Dear "Premi, Sanjeev",

In message <B85A65D85D7EB246BE421B3FB0FBB59302577A8A72@dbde02.ent.ti.com> you wrote:
>
> > Can't the get_ram_size() function be used for detecting the actual
> > amount of RAM? and then the memory tag or FDT equivalent
> > (if there is one) used to pass the memory size information?
> 
> Yes something like this can be done, but that would mean string
> manipulation at run-time. Question is - when we should/ shouldn't
> do this manipulation.

I don't understand what you are trying to say.

There are two possibilities:

- In a FDT enabled kernel, memory information is passed in the device
  tree; no "string manipulation" is needed anywhere.  If the user
  decides to overwrite the auto-detected settings by using a "mem="
  boot argument, this is his decision and of course he can do so.

- Without FDT support, on ARM systems we pass a memory information in
  one or more ATAG_MEM entries.  Again, no "string manipulation" is
  needed anywhere.

> If user wants to explicitly pass only a portion of memory to Linux
> using environment variables, we shouldn't be manipulating the
> bootargs.

This statement makes even less ense to me.  Passing a "mem=" boot
argument is the official, documented way to acchive this.  So what
makes you think we should not pass such a boot argument?

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 7af30c2..ea51216 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -200,11 +200,14 @@ 
 	"loadaddr=0x82000000\0" \
 	"usbtty=cdc_acm\0" \
 	"mmcdev=0\0" \
+	"memsize=128M\0" \
 	"console=ttyO0,115200n8\0" \
 	"mmcargs=setenv bootargs console=${console} " \
+		"mem=${memsize}\0 " \
 		"root=/dev/mmcblk0p2 rw " \
 		"rootfstype=ext3 rootwait\0" \
 	"nandargs=setenv bootargs console=${console} " \
+		"mem=${memsize}\0 " \
 		"root=/dev/mtdblock4 rw " \
 		"rootfstype=jffs2\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \