arm/km: define fdt_high env variable and allow backwards compatibility
authorGerlando Falauto <gerlando.falauto@keymile.com>
Mon, 27 Jan 2014 15:58:28 +0000 (16:58 +0100)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 13 Feb 2014 15:18:13 +0000 (16:18 +0100)
Add set_fdthigh subcommand to "subbootcmds" (release) so to set "fdt_high"
This is necessary on Kirkwood so that the FDT does not get relocated
above the memory limit that the kernel cannot access
(that is the memory part reserved for the switch).
This was tested on NUSA1, where it is necessary, and on ETER1, where it
doesn't seem to hurt.

We want the scripts to also work with older versions of u-boot, where:
a) set_fdthigh is not defined (will be default env for newer u-boots)
b) the fdt will not be available

For this reason, we use "set_fdthigh" to tell whether we are running
a newer (FDT-aware) u-boot or not.
So if "set_fdthigh" runs successfully or arch != arm we try loading
the fdt; otherwise we proceed normally.

Notice how, contrary to release mode, set_fdthigh will _not_ be part of
subbootcmds for develop and ramfs, but will be executed as part of
"tftpfdt".

Since this is only needed for kirkwood cards, and it prevents the kernel
from booting on QorIQ (though it seemed to work on ETER1), we change
its definition in the default env for powerpc so that the value is only
set on ARM.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
board/keymile/scripts/develop-common.txt
board/keymile/scripts/ramfs-common.txt
include/configs/km/keymile-common.h
include/configs/km/km-powerpc.h
include/configs/km/km_arm.h
include/configs/km/kmp204x-common.h

index f49b26a23308f2656234c4ef1153fb4befe3290f..a80812a5d044fd1ff318bc7c8ec0039542b6f882 100644 (file)
@@ -3,7 +3,7 @@ bootcmd=run ${subbootcmds}
 configure=run set_uimage; km_setboardid && saveenv && reset
 subbootcmds=tftpfdt tftpkernel nfsargs add_default boot
 nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${toolchain}/${arch}
-tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb
+tftpfdt=if run set_fdthigh || test ${arch} != arm; then tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; else true; fi
 tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage}
 toolchain=/opt/eldk
 rootfssize=0
index 0cfb36fba01c2efdf993ddcba8d334d1f7d952b8..d79ad2e21b2c83863ca5eb476e5b07e9dbc95b65 100644 (file)
@@ -7,7 +7,7 @@ nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
 configure=run set_uimage; km_setboardid && saveenv && reset
 rootfsfile=${hostname}/rootfsImage
 setrootfsaddr=setexpr value ${pnvramaddr} - ${rootfssize} && setenv rootfsaddr 0x${value}
-tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb
+tftpfdt=if run set_fdthigh || test ${arch} != arm; then tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; else true; fi
 tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage}
 tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage
 set_uimage=printenv uimage || setenv uimage uImage
index cb53dbd768f7a7d21e836b73573b0bc5ae264f2d..7361072c98275bfc8c8345f8586eb34265d1c8f4 100644 (file)
  * - 'release': for a standalone system                kernel/rootfs from flash
  */
 #define CONFIG_KM_DEF_ENV_BOOTTARGETS                                  \
-       "subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel " \
-               "flashargs add_default addpanic boot\0"                 \
+       "subbootcmds=ubiattach ubicopy cramfsloadfdt set_fdthigh "      \
+               "cramfsloadkernel flashargs add_default addpanic boot\0"\
        "develop="                                                      \
                "tftp 200000 scripts/develop-${arch}.txt && "           \
                "env import -t 200000 ${filesize} && "                  \
index b03fdd9b66adecc2906eb20c96e391bedb21f7e1..763c5bad82c40d095470c34ec85db5be1a9a46a4 100644 (file)
@@ -77,6 +77,7 @@
                "cp.b ${load_addr_r} " __stringify(BOOTFLASH_START)     \
                "  ${filesize} && "                                     \
                "protect on " __stringify(BOOTFLASH_START) "  +${filesize}\0"\
+       "set_fdthigh=true\0"                                            \
        ""
 
 #endif /* __CONFIG_KEYMILE_POWERPC_H */
index a5cc1c5126a9389fe49d329852a1eb3dada4e6e9..6d77680c82a5a3e1cb48e80f0f18357cac2a4ed7 100644 (file)
@@ -81,6 +81,7 @@
 #define CONFIG_KM_DEF_ENV_CPU                                          \
        "u-boot="__stringify(CONFIG_HOSTNAME) "/u-boot.kwb\0"           \
        CONFIG_KM_UPDATE_UBOOT                                          \
+       "set_fdthigh=setenv fdt_high ${kernelmem}\0"                    \
        ""
 
 #define CONFIG_SKIP_LOWLEVEL_INIT      /* disable board lowlevel_init */
index 2466649b15c7ce1d548a45a715d32d4b313b1a17..569b574a2b95016e21c3f9edf7e12e47e8ace650 100644 (file)
@@ -420,6 +420,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);
        "update="                                                       \
                "sf probe 0;sf erase 0 +${filesize};"                   \
                "sf write ${load_addr_r} 0 ${filesize};\0"              \
+       "set_fdthigh=true\0"                                            \
        ""
 
 #define CONFIG_HW_ENV_SETTINGS                                         \