diff mbox

[U-Boot,V3,4/5] ARM: OMAP4/5: Change the default boot command to work with device tree

Message ID 1364272056-27886-5-git-send-email-r.sricharan@ti.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

SRICHARAN R March 26, 2013, 4:27 a.m. UTC
Now with kernel moving to all device tree, the default
boot command is changed to pass the device tree blob.
Also, adding the findfdt command to get the dt-blob
based on the board.

Thanks to Tom Rini <trini@ti.com> for suggesting this.

Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sricharan R <r.sricharan@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
---
 [V2] Corrected the board file name for omap4 boards
      in findfdt command
 [V3] Changed fdtaddr as per Tom Rini's comments

 include/configs/omap4_common.h |   13 +++++++++++--
 include/configs/omap5_common.h |   11 +++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

Comments

Tom Rini March 27, 2013, 3:45 p.m. UTC | #1
On Tue, Mar 26, 2013 at 09:57:35AM +0530, Sricharan R wrote:

> Now with kernel moving to all device tree, the default
> boot command is changed to pass the device tree blob.
> Also, adding the findfdt command to get the dt-blob
> based on the board.
[snip]
> @@ -153,7 +155,9 @@
>  	"mmcargs=setenv bootargs console=${console} " \
>  		"vram=${vram} " \
>  		"root=${mmcroot} " \
> -		"rootfstype=${mmcrootfstype}\0" \
> +		"rootfstype=${mmcrootfstype}; " \
> +		"run findfdt; " \
> +		"fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \

I missed this part before, sorry.  What we do on am335x_evm to allow
for easier overrides is:
- bootcmd runs findfdt (since we'll need it in all cases).
- Enable CONFIG_CMD_FS_GENERIC
- Add a 'loadfdt' command that can be called out ala loaduimage
- Use 'load' in loadfdt/loaduimage so that we don't care what the
  underlying filesystem type is.
- Use bootdir to help with overrides as well:
loaduimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}

So that we can easily grab from the first partition (FAT) or another
partition (ext3/4/etc).
SRICHARAN R March 28, 2013, 5:40 p.m. UTC | #2
On Wednesday 27 March 2013 09:15 PM, Tom Rini wrote:
> On Tue, Mar 26, 2013 at 09:57:35AM +0530, Sricharan R wrote:
> 
>> Now with kernel moving to all device tree, the default
>> boot command is changed to pass the device tree blob.
>> Also, adding the findfdt command to get the dt-blob
>> based on the board.
> [snip]
>> @@ -153,7 +155,9 @@
>>  	"mmcargs=setenv bootargs console=${console} " \
>>  		"vram=${vram} " \
>>  		"root=${mmcroot} " \
>> -		"rootfstype=${mmcrootfstype}\0" \
>> +		"rootfstype=${mmcrootfstype}; " \
>> +		"run findfdt; " \
>> +		"fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
> 
> I missed this part before, sorry.  What we do on am335x_evm to allow
> for easier overrides is:
> - bootcmd runs findfdt (since we'll need it in all cases).
> - Enable CONFIG_CMD_FS_GENERIC
> - Add a 'loadfdt' command that can be called out ala loaduimage
> - Use 'load' in loadfdt/loaduimage so that we don't care what the
>   underlying filesystem type is.
> - Use bootdir to help with overrides as well:
> loaduimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
> loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
> 
> So that we can easily grab from the first partition (FAT) or another
> partition (ext3/4/etc).
> 
 Yeah, liked this. Thanks for detailed explanation. Will add this
 then for better.

Regards,
 Sricharan
diff mbox

Patch

diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index 6ae6a0f..f34c130 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -138,6 +138,7 @@ 
  */
 
 #define CONFIG_BOOTDELAY	3
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
 
 #define CONFIG_ENV_OVERWRITE
 
@@ -145,6 +146,7 @@ 
 	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"fdt_high=0xffffffff\0" \
+	"fdtaddr=0x80f80000\0" \
 	"usbtty=cdc_acm\0" \
 	"vram=16M\0" \
 	"mmcdev=0\0" \
@@ -153,7 +155,9 @@ 
 	"mmcargs=setenv bootargs console=${console} " \
 		"vram=${vram} " \
 		"root=${mmcroot} " \
-		"rootfstype=${mmcrootfstype}\0" \
+		"rootfstype=${mmcrootfstype}; " \
+		"run findfdt; " \
+		"fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
 		"source ${loadaddr}\0" \
@@ -163,7 +167,12 @@ 
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
-		"bootm ${loadaddr}\0" \
+		"bootm ${loadaddr} - ${fdtaddr}\0" \
+	"findfdt="\
+		"if test $board_name = sdp4430; then " \
+			"setenv fdtfile omap4-sdp.dtb; fi; " \
+		"if test $board_name = panda; then " \
+			"setenv fdtfile omap4-panda-es.dtb; fi\0" \
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index 6d7aa7b..bcbf9cc 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -137,6 +137,7 @@ 
  */
 
 #define CONFIG_BOOTDELAY	3
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
 
 #define CONFIG_ENV_OVERWRITE
 
@@ -144,6 +145,7 @@ 
 	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"fdt_high=0xffffffff\0" \
+	"fdtaddr=0x80f80000\0" \
 	"usbtty=cdc_acm\0" \
 	"vram=16M\0" \
 	"mmcdev=0\0" \
@@ -152,7 +154,9 @@ 
 	"mmcargs=setenv bootargs console=${console} " \
 		"vram=${vram} " \
 		"root=${mmcroot} " \
-		"rootfstype=${mmcrootfstype}\0" \
+		"rootfstype=${mmcrootfstype}; " \
+		"run findfdt; " \
+		"fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
 	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
 	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
 		"source ${loadaddr}\0" \
@@ -162,7 +166,10 @@ 
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
-		"bootm ${loadaddr}\0" \
+		"bootm ${loadaddr} - ${fdtaddr}\0" \
+	"findfdt="\
+		"if test $board_name = omap5_uevm; then " \
+			"setenv fdtfile omap5-uevm.dtb; fi;\0 " \
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \