diff mbox

ARM: mvebu: fix RAM size for Armada XP board DB-MV784MP-GP

Message ID 1363101135-21635-1-git-send-email-jason@lakedaemon.net (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Cooper March 12, 2013, 3:12 p.m. UTC
The board is supplied with a 4GB RAM module.  This value can be
overridden by the bootloader based on probed memory size.  We set it to
a reasonable value here.

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
As promised, catching this fix in the -rc cycle.

For those not familiar, earlier versions of the patch adding this board listed
3GB because that is all that was visible.  I mistaken applied v3 of the patch
instead of v4 which properly listed 4GB.  This patch cleans up my error.

 arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Sergei Shtylyov March 13, 2013, 2:30 p.m. UTC | #1
Hello.

On 12-03-2013 19:12, Jason Cooper wrote:

> The board is supplied with a 4GB RAM module.  This value can be
> overridden by the bootloader based on probed memory size.  We set it to
> a reasonable value here.

> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
> ---
> As promised, catching this fix in the -rc cycle.

> For those not familiar, earlier versions of the patch adding this board listed
> 3GB because that is all that was visible.  I mistaken applied v3 of the patch
> instead of v4 which properly listed 4GB.  This patch cleans up my error.

>   arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)

> diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
> index 1c8afe2..4a2776a 100644
> --- a/arch/arm/boot/dts/armada-xp-gp.dts
> +++ b/arch/arm/boot/dts/armada-xp-gp.dts
> @@ -28,12 +28,11 @@
>   		device_type = "memory";
>
>   		/*
> -		 * 4 GB of plug-in RAM modules by default but only 3GB
> -		 * are visible, the amount of memory available can be
> -		 * changed by the bootloader according the size of the
> -		 * module actually plugged
> +		 * 4 GB of plug-in RAM modules by default. The amount of memory
> +		 * available can be changed by the bootloader according the

    "According to the size".

> +		 * size of the module actually plugged
>   		 */
> -		reg = <0x00000000 0xC0000000>;
> +		reg = <0x00000000 0xD0000000>;

    But this is not 4G?

>   	};

WBR, Sergei
Gregory CLEMENT March 13, 2013, 2:37 p.m. UTC | #2
On 03/13/2013 03:30 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 12-03-2013 19:12, Jason Cooper wrote:
> 
>> The board is supplied with a 4GB RAM module.  This value can be
>> overridden by the bootloader based on probed memory size.  We set it to
>> a reasonable value here.
> 
>> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
>> ---
>> As promised, catching this fix in the -rc cycle.
> 
>> For those not familiar, earlier versions of the patch adding this board listed
>> 3GB because that is all that was visible.  I mistaken applied v3 of the patch
>> instead of v4 which properly listed 4GB.  This patch cleans up my error.
> 
>>   arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
>> diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
>> index 1c8afe2..4a2776a 100644
>> --- a/arch/arm/boot/dts/armada-xp-gp.dts
>> +++ b/arch/arm/boot/dts/armada-xp-gp.dts
>> @@ -28,12 +28,11 @@
>>   		device_type = "memory";
>>
>>   		/*
>> -		 * 4 GB of plug-in RAM modules by default but only 3GB
>> -		 * are visible, the amount of memory available can be
>> -		 * changed by the bootloader according the size of the
>> -		 * module actually plugged
>> +		 * 4 GB of plug-in RAM modules by default. The amount of memory
>> +		 * available can be changed by the bootloader according the
> 
>     "According to the size".
> 
>> +		 * size of the module actually plugged
>>   		 */
>> -		reg = <0x00000000 0xC0000000>;
>> +		reg = <0x00000000 0xD0000000>;
> 
>     But this is not 4G?

You're totally right!
It should be reg = <0x00000000 0xF0000000>;

> 
>>   	};
> 
> WBR, Sergei
>
Jason Cooper March 13, 2013, 2:39 p.m. UTC | #3
On Wed, Mar 13, 2013 at 06:30:30PM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 12-03-2013 19:12, Jason Cooper wrote:
> 
> >The board is supplied with a 4GB RAM module.  This value can be
> >overridden by the bootloader based on probed memory size.  We set it to
> >a reasonable value here.
> 
> >Signed-off-by: Jason Cooper <jason@lakedaemon.net>
> >---
> >As promised, catching this fix in the -rc cycle.
> 
> >For those not familiar, earlier versions of the patch adding this board listed
> >3GB because that is all that was visible.  I mistaken applied v3 of the patch
> >instead of v4 which properly listed 4GB.  This patch cleans up my error.
> 
> >  arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> >diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
> >index 1c8afe2..4a2776a 100644
> >--- a/arch/arm/boot/dts/armada-xp-gp.dts
> >+++ b/arch/arm/boot/dts/armada-xp-gp.dts
> >@@ -28,12 +28,11 @@
> >  		device_type = "memory";
> >
> >  		/*
> >-		 * 4 GB of plug-in RAM modules by default but only 3GB
> >-		 * are visible, the amount of memory available can be
> >-		 * changed by the bootloader according the size of the
> >-		 * module actually plugged
> >+		 * 4 GB of plug-in RAM modules by default. The amount of memory
> >+		 * available can be changed by the bootloader according the
> 
>    "According to the size".

ok.

> >+		 * size of the module actually plugged
> >  		 */
> >-		reg = <0x00000000 0xC0000000>;
> >+		reg = <0x00000000 0xD0000000>;
> 
>    But this is not 4G?

Interesting, this was the value given in v4 of the original patch adding
this board.  I should have double-checked it. v2 on the way.

thx,

Jason.
Gregory CLEMENT March 13, 2013, 2:42 p.m. UTC | #4
On 03/13/2013 03:39 PM, Jason Cooper wrote:
> On Wed, Mar 13, 2013 at 06:30:30PM +0400, Sergei Shtylyov wrote:
>> Hello.
>>
>> On 12-03-2013 19:12, Jason Cooper wrote:
>>
>>> The board is supplied with a 4GB RAM module.  This value can be
>>> overridden by the bootloader based on probed memory size.  We set it to
>>> a reasonable value here.
>>
>>> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
>>> ---
>>> As promised, catching this fix in the -rc cycle.
>>
>>> For those not familiar, earlier versions of the patch adding this board listed
>>> 3GB because that is all that was visible.  I mistaken applied v3 of the patch
>>> instead of v4 which properly listed 4GB.  This patch cleans up my error.
>>
>>>  arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
>>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>
>>> diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
>>> index 1c8afe2..4a2776a 100644
>>> --- a/arch/arm/boot/dts/armada-xp-gp.dts
>>> +++ b/arch/arm/boot/dts/armada-xp-gp.dts
>>> @@ -28,12 +28,11 @@
>>>  		device_type = "memory";
>>>
>>>  		/*
>>> -		 * 4 GB of plug-in RAM modules by default but only 3GB
>>> -		 * are visible, the amount of memory available can be
>>> -		 * changed by the bootloader according the size of the
>>> -		 * module actually plugged
>>> +		 * 4 GB of plug-in RAM modules by default. The amount of memory
>>> +		 * available can be changed by the bootloader according the
>>
>>    "According to the size".
> 
> ok.
> 
>>> +		 * size of the module actually plugged
>>>  		 */
>>> -		reg = <0x00000000 0xC0000000>;
>>> +		reg = <0x00000000 0xD0000000>;
>>
>>    But this is not 4G?
> 
> Interesting, this was the value given in v4 of the original patch adding
> this board.  I should have double-checked it. v2 on the way.
> 

I was wrong in my initial version, all we can do in 32 bits is not 4GB but 4GB-1B:
reg = <0x00000000 0xFFFFFFFF>

> thx,
> 
> Jason.
>
Jason Cooper March 13, 2013, 2:50 p.m. UTC | #5
On Wed, Mar 13, 2013 at 03:37:00PM +0100, Gregory CLEMENT wrote:
> On 03/13/2013 03:30 PM, Sergei Shtylyov wrote:
> > Hello.
> > 
> > On 12-03-2013 19:12, Jason Cooper wrote:
> > 
> >> The board is supplied with a 4GB RAM module.  This value can be
> >> overridden by the bootloader based on probed memory size.  We set it to
> >> a reasonable value here.
> > 
> >> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
> >> ---
> >> As promised, catching this fix in the -rc cycle.
> > 
> >> For those not familiar, earlier versions of the patch adding this board listed
> >> 3GB because that is all that was visible.  I mistaken applied v3 of the patch
> >> instead of v4 which properly listed 4GB.  This patch cleans up my error.
> > 
> >>   arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
> >>   1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> >> diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
> >> index 1c8afe2..4a2776a 100644
> >> --- a/arch/arm/boot/dts/armada-xp-gp.dts
> >> +++ b/arch/arm/boot/dts/armada-xp-gp.dts
> >> @@ -28,12 +28,11 @@
> >>   		device_type = "memory";
> >>
> >>   		/*
> >> -		 * 4 GB of plug-in RAM modules by default but only 3GB
> >> -		 * are visible, the amount of memory available can be
> >> -		 * changed by the bootloader according the size of the
> >> -		 * module actually plugged
> >> +		 * 4 GB of plug-in RAM modules by default. The amount of memory
> >> +		 * available can be changed by the bootloader according the
> > 
> >     "According to the size".
> > 
> >> +		 * size of the module actually plugged
> >>   		 */
> >> -		reg = <0x00000000 0xC0000000>;
> >> +		reg = <0x00000000 0xD0000000>;
> > 
> >     But this is not 4G?
> 
> You're totally right!
> It should be reg = <0x00000000 0xF0000000>;

$ printf "0x%08x\n" `echo "4 * (1024 ^ 3)" | bc`
0x100000000

?

thx,

Jason.
Jason Cooper March 13, 2013, 2:54 p.m. UTC | #6
On Wed, Mar 13, 2013 at 03:42:43PM +0100, Gregory CLEMENT wrote:
> On 03/13/2013 03:39 PM, Jason Cooper wrote:
> > On Wed, Mar 13, 2013 at 06:30:30PM +0400, Sergei Shtylyov wrote:
> >> Hello.
> >>
> >> On 12-03-2013 19:12, Jason Cooper wrote:
> >>
> >>> The board is supplied with a 4GB RAM module.  This value can be
> >>> overridden by the bootloader based on probed memory size.  We set it to
> >>> a reasonable value here.
> >>
> >>> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
> >>> ---
> >>> As promised, catching this fix in the -rc cycle.
> >>
> >>> For those not familiar, earlier versions of the patch adding this board listed
> >>> 3GB because that is all that was visible.  I mistaken applied v3 of the patch
> >>> instead of v4 which properly listed 4GB.  This patch cleans up my error.
> >>
> >>>  arch/arm/boot/dts/armada-xp-gp.dts | 9 ++++-----
> >>>  1 file changed, 4 insertions(+), 5 deletions(-)
> >>
> >>> diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
> >>> index 1c8afe2..4a2776a 100644
> >>> --- a/arch/arm/boot/dts/armada-xp-gp.dts
> >>> +++ b/arch/arm/boot/dts/armada-xp-gp.dts
> >>> @@ -28,12 +28,11 @@
> >>>  		device_type = "memory";
> >>>
> >>>  		/*
> >>> -		 * 4 GB of plug-in RAM modules by default but only 3GB
> >>> -		 * are visible, the amount of memory available can be
> >>> -		 * changed by the bootloader according the size of the
> >>> -		 * module actually plugged
> >>> +		 * 4 GB of plug-in RAM modules by default. The amount of memory
> >>> +		 * available can be changed by the bootloader according the
> >>
> >>    "According to the size".
> > 
> > ok.
> > 
> >>> +		 * size of the module actually plugged
> >>>  		 */
> >>> -		reg = <0x00000000 0xC0000000>;
> >>> +		reg = <0x00000000 0xD0000000>;
> >>
> >>    But this is not 4G?
> > 
> > Interesting, this was the value given in v4 of the original patch adding
> > this board.  I should have double-checked it. v2 on the way.
> > 
> 
> I was wrong in my initial version, all we can do in 32 bits is not 4GB but 4GB-1B:
> reg = <0x00000000 0xFFFFFFFF>

hmmm, with the impending conquering of the server market by ARM, you'd
think we'd at least be able to parse a 64 bit integer...

thx,

Jason.
Jason Gunthorpe March 13, 2013, 5:13 p.m. UTC | #7
On Wed, Mar 13, 2013 at 10:54:19AM -0400, Jason Cooper wrote:

> > I was wrong in my initial version, all we can do in 32 bits is not
> > 4GB but 4GB-1B: reg = <0x00000000 0xFFFFFFFF>
> 
> hmmm, with the impending conquering of the server market by ARM, you'd
> think we'd at least be able to parse a 64 bit integer...

AFAIK, it would be like this:

/ {
        #address-cells = <2>;
        #size-cells = <2>;
        memory {
                device_type = "memory";
                reg = <0 0  1 0>;
        };

And the other children nodes must be revised to support the 2 dw
address and size..

Regards,
Jason
Jason Gunthorpe March 13, 2013, 5:35 p.m. UTC | #8
On Wed, Mar 13, 2013 at 03:37:00PM +0100, Gregory CLEMENT wrote:

> >> +		 * size of the module actually plugged
> >>   		 */
> >> -		reg = <0x00000000 0xC0000000>;
> >> +		reg = <0x00000000 0xD0000000>;
> > 
> >     But this is not 4G?
> 
> You're totally right!
> It should be reg = <0x00000000 0xF0000000>;

Isn't it 'right' as it is? The various included DT's put devices at
address 0xd0008000 for instance, memory shouldn't overlap that..

Ie you loose the address space 0xD0000000 -> 0x100000000 due to
internal registers.

If the HW supports > 32 bit physical addressing then you'd want to
program the DDR mapping to put some of the DDR above the 4G limit.

Cheers,
Jason
Andrew Lunn March 13, 2013, 5:43 p.m. UTC | #9
On Wed, Mar 13, 2013 at 11:35:59AM -0600, Jason Gunthorpe wrote:
> On Wed, Mar 13, 2013 at 03:37:00PM +0100, Gregory CLEMENT wrote:
> 
> > >> +		 * size of the module actually plugged
> > >>   		 */
> > >> -		reg = <0x00000000 0xC0000000>;
> > >> +		reg = <0x00000000 0xD0000000>;
> > > 
> > >     But this is not 4G?
> > 
> > You're totally right!
> > It should be reg = <0x00000000 0xF0000000>;
> 
> Isn't it 'right' as it is? The various included DT's put devices at
> address 0xd0008000 for instance, memory shouldn't overlap that..

Shouldn't DT describe the hardware? The hardware has 4GB. How much of
it Linux decides to use so as to avoid overlaps with registers etc, is
not a hardware issue, but software.

    Andrew
Jason Gunthorpe March 13, 2013, 6:30 p.m. UTC | #10
On Wed, Mar 13, 2013 at 06:43:24PM +0100, Andrew Lunn wrote:
> On Wed, Mar 13, 2013 at 11:35:59AM -0600, Jason Gunthorpe wrote:
> > On Wed, Mar 13, 2013 at 03:37:00PM +0100, Gregory CLEMENT wrote:
> > 
> > > >> +		 * size of the module actually plugged
> > > >>   		 */
> > > >> -		reg = <0x00000000 0xC0000000>;
> > > >> +		reg = <0x00000000 0xD0000000>;
> > > > 
> > > >     But this is not 4G?
> > > 
> > > You're totally right!
> > > It should be reg = <0x00000000 0xF0000000>;
> > 
> > Isn't it 'right' as it is? The various included DT's put devices at
> > address 0xd0008000 for instance, memory shouldn't overlap that..
> 
> Shouldn't DT describe the hardware? The hardware has 4GB. How much of
> it Linux decides to use so as to avoid overlaps with registers etc, is
> not a hardware issue, but software.

Sure, but which HW? The 'reg' in 'memory' is not describing a DDR
bus. It is describing the DDR address mapping registers in the SOC -
and they are probably set for 0 -> 0xD0000000 by the firmware.

To describe the 4G of DDR you need DT nodes that show:
- The N DDR chip selects going to each DDR rank
- How much memory is in each DDR rank
- How each chip select is currently mapped into CPU address space

This is the minimal amount of information needed for Linux to
reprogram the entire address map, if it so chooses.

To me, the *address map* in the DTB passed from the firwmare should
reflect the state of the machine when the OS is started. That way an
OS without drivers for the address map hardware will function
properly.

Regards,
Jason
Jason Cooper March 14, 2013, 3:39 p.m. UTC | #11
On Wed, Mar 13, 2013 at 11:13:07AM -0600, Jason Gunthorpe wrote:
> On Wed, Mar 13, 2013 at 10:54:19AM -0400, Jason Cooper wrote:
> 
> > > I was wrong in my initial version, all we can do in 32 bits is not
> > > 4GB but 4GB-1B: reg = <0x00000000 0xFFFFFFFF>
> > 
> > hmmm, with the impending conquering of the server market by ARM, you'd
> > think we'd at least be able to parse a 64 bit integer...
> 
> AFAIK, it would be like this:
> 
> / {
>         #address-cells = <2>;
>         #size-cells = <2>;
>         memory {
>                 device_type = "memory";
>                 reg = <0 0  1 0>;
>         };
> 
> And the other children nodes must be revised to support the 2 dw
> address and size..

Agreed, but that's a pretty invasive change for a fix.  I'll go with
0xFFFFFFFF for now, and look forward to LPAE support including proper
64bit values.

thx,

Jason.
diff mbox

Patch

diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 1c8afe2..4a2776a 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -28,12 +28,11 @@ 
 		device_type = "memory";
 
 		/*
-		 * 4 GB of plug-in RAM modules by default but only 3GB
-		 * are visible, the amount of memory available can be
-		 * changed by the bootloader according the size of the
-		 * module actually plugged
+		 * 4 GB of plug-in RAM modules by default. The amount of memory
+		 * available can be changed by the bootloader according the
+		 * size of the module actually plugged
 		 */
-		reg = <0x00000000 0xC0000000>;
+		reg = <0x00000000 0xD0000000>;
 	};
 
 	soc {