diff mbox

[U-Boot] integrator: pass a Device Tree by default

Message ID 1358642957-12995-1-git-send-email-linus.walleij@linaro.org
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Linus Walleij Jan. 20, 2013, 12:49 a.m. UTC
This, enabled the FDT library for the Integrators, updates
the Integrator/CP default command to load and pass a Device
Tree when booting the kernel from the on-board ethernet,
define same environment for the Integrator/AP and move the
load address around to something even.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 include/configs/integrator-common.h |  3 ++-
 include/configs/integratorap.h      |  8 ++++++--
 include/configs/integratorcp.h      | 10 +++++++---
 3 files changed, 15 insertions(+), 6 deletions(-)

Comments

Linus Walleij Jan. 22, 2013, 7:58 a.m. UTC | #1
On Sun, Jan 20, 2013 at 1:53 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Linus Walleij,
>
>> This, enabled the FDT library for the Integrators, updates
>> the Integrator/CP default command to load and pass a Device
>> Tree when booting the kernel from the on-board ethernet,
>> define same environment for the Integrator/AP and move the
>> load address around to something even.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Shouldn't the load address be 0x8000 instead of 0x800 (it used to be 0x7fc0) ?

0x800 works fine, but honestly I don't know why Peter P ages ago chose the
very odd address 0x7fc0.

But you know U-boot way better than me, and most things work fine it seems.
What is a typical load address?

> Also, "setenv loadaddr nnnn" is nonsense, just use the usual
> CONFIG_SYS_LOAD_ADDR (which inherently sets the loadaddr env variable). Or do
> you see a problem there?

Not really, it was mainly because there is no way to set the FDT load
address as a variable, e.g. we don't have CONFIG_FDT_LOAD_ADDR,
and I wanted to keep both definitions in the same place, i.e. in the
default boot script.

On the Integrator/AP I have to load the two pieces one at the time,
manually using loady, so it is a bit helpful to have the address prints
at least.

Yours,
Linus Walleij
Marek Vasut Jan. 22, 2013, 12:04 p.m. UTC | #2
Dear Linus Walleij,

> On Sun, Jan 20, 2013 at 1:53 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Linus Walleij,
> > 
> >> This, enabled the FDT library for the Integrators, updates
> >> the Integrator/CP default command to load and pass a Device
> >> Tree when booting the kernel from the on-board ethernet,
> >> define same environment for the Integrator/AP and move the
> >> load address around to something even.
> >> 
> >> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > 
> > Shouldn't the load address be 0x8000 instead of 0x800 (it used to be
> > 0x7fc0) ?
> 
> 0x800 works fine, but honestly I don't know why Peter P ages ago chose the
> very odd address 0x7fc0.
> 
> But you know U-boot way better than me, and most things work fine it seems.
> What is a typical load address?

Heh, there ain't any "typical load address", the FDT binary is relocated at the 
end of RAM just before boot anyway, so I'm ok with any address you pick, just 
make it a sane one ;)

> > Also, "setenv loadaddr nnnn" is nonsense, just use the usual
> > CONFIG_SYS_LOAD_ADDR (which inherently sets the loadaddr env variable).
> > Or do you see a problem there?
> 
> Not really, it was mainly because there is no way to set the FDT load
> address as a variable, e.g. we don't have CONFIG_FDT_LOAD_ADDR,
> and I wanted to keep both definitions in the same place, i.e. in the
> default boot script.

Makes sense, I'll CC Albert.

> On the Integrator/AP I have to load the two pieces one at the time,
> manually using loady, so it is a bit helpful to have the address prints
> at least.

Yup.

> Yours,
> Linus Walleij

Best regards,
Marek Vasut
Linus Walleij Jan. 22, 2013, 1:01 p.m. UTC | #3
On Tue, Jan 22, 2013 at 1:04 PM, Marek Vasut <marex@denx.de> wrote:
>> On Sun, Jan 20, 2013 at 1:53 AM, Marek Vasut <marex@denx.de> wrote:

>> > Shouldn't the load address be 0x8000 instead of 0x800 (it used to be
>> > 0x7fc0) ?
>>
>> 0x800 works fine, but honestly I don't know why Peter P ages ago chose the
>> very odd address 0x7fc0.
>>
>> But you know U-boot way better than me, and most things work fine it seems.
>> What is a typical load address?
>
> Heh, there ain't any "typical load address", the FDT binary is relocated at the
> end of RAM just before boot anyway, so I'm ok with any address you pick, just
> make it a sane one ;)

OK but 0x7fc0 was the load address for the kernel, so I was sort of wondering
what a "typical" place to load the kernel would be, because 0x7fc0 seems
quite arbitrarily chosen...

Yours,
Linus Walleij
Marek Vasut Jan. 22, 2013, 1:16 p.m. UTC | #4
Dear Linus Walleij,

> On Tue, Jan 22, 2013 at 1:04 PM, Marek Vasut <marex@denx.de> wrote:
> >> On Sun, Jan 20, 2013 at 1:53 AM, Marek Vasut <marex@denx.de> wrote:
> >> > Shouldn't the load address be 0x8000 instead of 0x800 (it used to be
> >> > 0x7fc0) ?
> >> 
> >> 0x800 works fine, but honestly I don't know why Peter P ages ago chose
> >> the very odd address 0x7fc0.
> >> 
> >> But you know U-boot way better than me, and most things work fine it
> >> seems. What is a typical load address?
> > 
> > Heh, there ain't any "typical load address", the FDT binary is relocated
> > at the end of RAM just before boot anyway, so I'm ok with any address
> > you pick, just make it a sane one ;)
> 
> OK but 0x7fc0 was the load address for the kernel, so I was sort of
> wondering what a "typical" place to load the kernel would be, because
> 0x7fc0 seems quite arbitrarily chosen...

Indeed. I usually stick FDT far past the kernel, but that's just my preference I 
think.

> Yours,
> Linus Walleij

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/include/configs/integrator-common.h b/include/configs/integrator-common.h
index 564b418..f4a182c 100644
--- a/include/configs/integrator-common.h
+++ b/include/configs/integrator-common.h
@@ -30,7 +30,7 @@ 
 #define CONFIG_SYS_MEMTEST_END		0x10000000
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_TIMERBASE		0x13000100	/* Timer1 */
-#define CONFIG_SYS_LOAD_ADDR		0x7fc0	/* default load address */
+#define CONFIG_SYS_LOAD_ADDR		0x800	/* default load address */
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size*/
@@ -41,6 +41,7 @@ 
 
 #define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs  */
 #define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_OF_LIBFDT		/* enable passing a Device Tree */
 #define CONFIG_MISC_INIT_R		/* call misc_init_r during start up */
 
 /*
diff --git a/include/configs/integratorap.h b/include/configs/integratorap.h
index c6907b5..3bf47d4 100644
--- a/include/configs/integratorap.h
+++ b/include/configs/integratorap.h
@@ -62,9 +62,13 @@ 
  */
 #include <config_cmd_default.h>
 
-#define CONFIG_BOOTDELAY	2
+#define CONFIG_BOOTDELAY	0
 #define CONFIG_BOOTARGS		"root=/dev/mtdblock0 console=ttyAM0 console=tty"
-#define CONFIG_BOOTCOMMAND	""
+#define CONFIG_BOOTCOMMAND	"setenv servip 192.168.1.100 ; " \
+  "setenv loadaddr 0x00000800 ; " \
+  "setenv fdtaddr 0x00800000 ; " \
+  "echo \"\\\\$loadaddr = $loadaddr, \\\\$fdtaddr=$fdtaddr\" ; " \
+  "echo \"load binaries then: bootm $loadaddr - $fdtaddr\""
 
 /*
  * Miscellaneous configurable options
diff --git a/include/configs/integratorcp.h b/include/configs/integratorcp.h
index ca02a6f..ccc22e4 100644
--- a/include/configs/integratorcp.h
+++ b/include/configs/integratorcp.h
@@ -60,11 +60,15 @@ 
 #include <config_cmd_default.h>
 
 #define CONFIG_BOOTDELAY	2
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock0 console=ttyAMA0 console=tty ip=dhcp netdev=27,0,0xfc800000,0xfc800010,eth0 video=clcdfb:0"
-#define CONFIG_BOOTCOMMAND "tftpboot ; bootm"
 #define CONFIG_SERVERIP 192.168.1.100
 #define CONFIG_IPADDR 192.168.1.104
-#define CONFIG_BOOTFILE "uImage"
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock0 console=ttyAMA0 console=tty ip=dhcp netdev=27,0,0xfc800000,0xfc800010,eth0 video=clcdfb:0"
+#define CONFIG_BOOTCOMMAND "setenv servip 192.168.1.100 ; " \
+  "setenv loadaddr 0x00000800 ; " \
+  "setenv fdtaddr 0x00800000 ; " \
+  "bootp $loadaddr $servip:uImage ; " \
+  "bootp $fdtaddr $servip:integratorcp.dtb ; " \
+  "bootm $loadaddr - $fdtaddr"
 
 /*
  * Miscellaneous configurable options