[U-Boot] [PATCH 3/3] ARM: rpi_b: use new generic $bootcmd

Stephen Warren
2014-07-30T22:37:16Z

From: Stephen Warren <swarren@nvidia.com>

Replace the custom $bootcmd with that from <config_distro_bootcmd.h>.
There should be no functional change, since the new generic $bootcmd was
derived strongly from tegra-common-post.h, after which this part of
rpi_b.h was modelled.

The #defines to enable/disable U-Boot commands/features were moved
earlier in rpi_b.h, so they are set up before config_distro_bootcmd.h
is included, since it tests whether certain features should be included
based on those defines.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Note that while I've tested the Tegra conversion, I haven't tested this
one yet. I also didn't convert Wanda/Beagle/Panda, since I don't have
those boards to test. If this series is accepted, hopefully Dennis can
convert them, or perhaps I can try doing so blind:-)
---
include/configs/rpi_b.h | 129 ++++++++++++++----------------------------------
1 file changed, 36 insertions(+), 93 deletions(-)

diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h
index ff48598dd562..eea8471666fb 100644
--- a/include/configs/rpi_b.h
+++ b/include/configs/rpi_b.h
@@ -101,6 +101,38 @@
"env import -t ${loadaddr} ${filesize}; " \
"fi"

+/* Shell */
+#define CONFIG_SYS_MAXARGS 8
+#define CONFIG_SYS_PROMPT "U-Boot> "
+#define CONFIG_COMMAND_HISTORY
+
+/* Commands */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_GPIO
+#define CONFIG_CMD_MMC
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_CMD_PART
+
+/* Device tree support */
+#define CONFIG_OF_BOARD_SETUP
+/* ATAGs support for bootm/bootz */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+
+#include <config_distro_defaults.h>
+
+/* Some things don't make sense on this HW or yet */
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_SAVEENV
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_MII
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_PING
+
+/* Environment */
#define ENV_DEVICE_SETTINGS \
"stdin=serial,lcd\0" \
"stdout=serial,lcd\0" \
@@ -138,104 +170,15 @@
"fdtfile=bcm2835-rpi-b.dtb\0" \
"ramdisk_addr_r=0x02100000\0" \

-#define BOOTCMDS_MMC \
- "mmc_boot=" \
- "setenv devtype mmc; " \
- "if mmc dev ${devnum}; then " \
- "run scan_boot; " \
- "fi\0" \
- "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0"
-#define BOOT_TARGETS_MMC "mmc0"
-
-#define BOOTCMDS_COMMON \
- "rootpart=1\0" \
- \
- "do_script_boot=" \
- "load ${devtype} ${devnum}:${rootpart} " \
- "${scriptaddr} ${prefix}${script}; " \
- "source ${scriptaddr}\0" \
- \
- "script_boot=" \
- "for script in ${boot_scripts}; do " \
- "if test -e ${devtype} ${devnum}:${rootpart} " \
- "${prefix}${script}; then " \
- "echo Found ${prefix}${script}; " \
- "run do_script_boot; " \
- "echo SCRIPT FAILED: continuing...; " \
- "fi; " \
- "done\0" \
- \
- "do_sysboot_boot=" \
- "sysboot ${devtype} ${devnum}:${rootpart} any " \
- "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
- \
- "sysboot_boot=" \
- "if test -e ${devtype} ${devnum}:${rootpart} " \
- "${prefix}extlinux/extlinux.conf; then " \
- "echo Found ${prefix}extlinux/extlinux.conf; " \
- "run do_sysboot_boot; " \
- "echo SCRIPT FAILED: continuing...; " \
- "fi\0" \
- \
- "scan_boot=" \
- "echo Scanning ${devtype} ${devnum}...; " \
- "for prefix in ${boot_prefixes}; do " \
- "run sysboot_boot; " \
- "run script_boot; " \
- "done\0" \
- \
- "boot_targets=" \
- BOOT_TARGETS_MMC " " \
- "\0" \
- \
- "boot_prefixes=/\0" \
- \
- "boot_scripts=boot.scr.uimg\0" \
- \
- BOOTCMDS_MMC
-
-#define CONFIG_BOOTCOMMAND \
- "for target in ${boot_targets}; do run bootcmd_${target}; done"
-
-#define CONFIG_BOOTCOMMAND \
- "for target in ${boot_targets}; do run bootcmd_${target}; done"
+#define BOOT_TARGET_DEVICES(func) \
+ func(MMC, mmc, 0)
+#include <config_distro_bootcmd.h>

#define CONFIG_EXTRA_ENV_SETTINGS \
ENV_DEVICE_SETTINGS \
ENV_MEM_LAYOUT_SETTINGS \
- BOOTCMDS_COMMON
+ BOOTENV

#define CONFIG_BOOTDELAY 2

-/* Shell */
-#define CONFIG_SYS_MAXARGS 8
-#define CONFIG_SYS_PROMPT "U-Boot> "
-#define CONFIG_COMMAND_HISTORY
-
-/* Commands */
-#include <config_cmd_default.h>
-#define CONFIG_CMD_GPIO
-#define CONFIG_CMD_MMC
-#define CONFIG_PARTITION_UUIDS
-#define CONFIG_CMD_PART
-
-/* Device tree support */
-#define CONFIG_OF_BOARD_SETUP
-/* ATAGs support for bootm/bootz */
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_CMDLINE_TAG
-#define CONFIG_INITRD_TAG
-
-#include <config_distro_defaults.h>
-
-/* Some things don't make sense on this HW or yet */
-#undef CONFIG_CMD_FPGA
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_NFS
-#undef CONFIG_CMD_SAVEENV
-#undef CONFIG_CMD_DHCP
-#undef CONFIG_CMD_MII
-#undef CONFIG_CMD_NET
-#undef CONFIG_CMD_PING
-
#endif
--
1.9.1