omap3_beagle: use config_distro_bootcmd
authorGuillaume GARDET <guillaume.gardet@free.fr>
Tue, 25 Oct 2016 16:50:32 +0000 (18:50 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 21 Nov 2016 19:07:25 +0000 (14:07 -0500)
Add support for distro_bootcmd on MMC and fall back to prior
behavior if distro_bootcmd fails.

Tested on Beagleboad xM to boot GRUB2 (and then Linux kernel) in EFI mode
from MMC.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
include/configs/omap3_beagle.h

index 8a69a5f9764c1142868407e44137ca87cfa2fdc5..9850aa6c059a99d08c229199c26343516db8d8cb 100644 (file)
 #define CONFIG_SYS_MAX_NAND_DEVICE     1               /* Max number of NAND */
                                                        /* devices */
 
+#define BOOT_TARGET_DEVICES(func) \
+       func(MMC, mmc, 0)
+
+#define CONFIG_BOOTCOMMAND \
+       "run findfdt; " \
+       "run distro_bootcmd; " \
+       "mmc dev ${mmcdev}; if mmc rescan; then " \
+               "if run userbutton; then " \
+                       "setenv bootenv uEnv.txt;" \
+               "else " \
+                       "setenv bootenv user.txt;" \
+               "fi;" \
+               "echo SD/MMC found on device ${mmcdev};" \
+               "if run loadbootenv; then " \
+                       "echo Loaded environment from ${bootenv};" \
+                       "run importbootenv;" \
+               "fi;" \
+               "if test -n $uenvcmd; then " \
+                       "echo Running uenvcmd ...;" \
+                       "run uenvcmd;" \
+               "fi;" \
+               "if run loadbootscript; then " \
+                       "run bootscript; " \
+               "else " \
+                       "if run loadimage; then " \
+                               "run mmcboot;" \
+                       "fi;" \
+               "fi; " \
+       "fi;" \
+       "run nandboot;" \
+       "setenv bootfile zImage;" \
+       "if run loadimage; then " \
+               "run loadfdt;" \
+               "run mmcbootz; " \
+       "fi; " \
+
+#include <config_distro_bootcmd.h>
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x80200000\0" \
+       "kernel_addr_r=0x80200000\0" \
        "rdaddr=0x81000000\0" \
+       "initrd_addr_r=0x81000000\0" \
        "fdt_high=0xffffffff\0" \
        "fdtaddr=0x80f80000\0" \
+       "fdt_addr_r=0x80f80000\0" \
        "usbtty=cdc_acm\0" \
        "bootfile=uImage\0" \
        "ramdisk=ramdisk.gz\0" \
        "userbutton=if gpio input 173; then run userbutton_xm; " \
                "else run userbutton_nonxm; fi;\0" \
        "userbutton_xm=gpio input 4;\0" \
-       "userbutton_nonxm=gpio input 7;\0"
-/* "run userbutton" will return 1 (false) if pressed and 0 (true) if not */
-#define CONFIG_BOOTCOMMAND \
-       "run findfdt; " \
-       "mmc dev ${mmcdev}; if mmc rescan; then " \
-               "if run userbutton; then " \
-                       "setenv bootenv uEnv.txt;" \
-               "else " \
-                       "setenv bootenv user.txt;" \
-               "fi;" \
-               "echo SD/MMC found on device ${mmcdev};" \
-               "if run loadbootenv; then " \
-                       "echo Loaded environment from ${bootenv};" \
-                       "run importbootenv;" \
-               "fi;" \
-               "if test -n $uenvcmd; then " \
-                       "echo Running uenvcmd ...;" \
-                       "run uenvcmd;" \
-               "fi;" \
-               "if run loadbootscript; then " \
-                       "run bootscript; " \
-               "else " \
-                       "if run loadimage; then " \
-                               "run mmcboot;" \
-                       "fi;" \
-               "fi; " \
-       "fi;" \
-       "run nandboot;" \
-       "setenv bootfile zImage;" \
-       "if run loadimage; then " \
-               "run loadfdt;" \
-               "run mmcbootz; " \
-       "fi; " \
+       "userbutton_nonxm=gpio input 7;\0" \
+       BOOTENV
 
 /*
  * OMAP3 has 12 GP timers, they can be driven by the system clock