]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tegra: bootcmd: start USB only when needed
authorStephen Warren <swarren@nvidia.com>
Mon, 4 Jun 2012 10:59:23 +0000 (10:59 +0000)
committerAlbert ARIBAUD (U-Boot) <uboot@lilith.(none)>
Mon, 9 Jul 2012 20:44:33 +0000 (22:44 +0200)
Instead of initializing USB as soon as bootcmd is executed, defer it
until the first boot device that (potentially in the case of network)
uses USB is scanned. This avoids initializing USB when booting from MMC,
so speeds that up.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
include/configs/tegra2-common-post.h

index 85b037c22d7bf81aa4f7fa2d8acc7cdbf9c21762..80d9c3500d33490e5a49668cc954228e0dd6615a 100644 (file)
 #endif
 
 #ifdef CONFIG_CMD_USB
+#define BOOTCMD_INIT_USB "run usb_init; "
 #define BOOTCMDS_USB \
+       "usb_init=" \
+               "if ${usb_need_init}; then " \
+                       "set usb_need_init false; " \
+                       "usb start 0; " \
+               "fi\0" \
+       \
        "usb_boot=" \
                "setenv devtype usb; " \
+               BOOTCMD_INIT_USB \
                "if usb dev ${devnum}; then " \
                        "run scan_boot; " \
                "fi\0" \
+       \
        "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
 #define BOOT_TARGETS_USB "usb0"
-#define BOOTCMD_INIT_USB "usb start 0; "
 #else
+#define BOOTCMD_INIT_USB ""
 #define BOOTCMDS_USB ""
 #define BOOT_TARGETS_USB ""
-#define BOOTCMD_INIT_USB ""
 #endif
 
 #ifdef CONFIG_CMD_DHCP
 #define BOOTCMDS_DHCP \
        "bootcmd_dhcp=" \
+               BOOTCMD_INIT_USB \
                "if dhcp ${scriptaddr} boot.scr.uimg; then "\
                        "source ${scriptaddr}; " \
                "fi\0"
        BOOTCMDS_DHCP
 
 #define CONFIG_BOOTCOMMAND \
-       BOOTCMD_INIT_USB \
        "for target in ${boot_targets}; do run bootcmd_${target}; done"
 
 #endif