]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_usb.c
fdt: allow for builds that don't want env and bd_t nodes
[karo-tx-uboot.git] / common / cmd_usb.c
index fcc66621a3f7bb9dd974399983084cb62b8d5a8c..45e07f175c8792b6c5814c776e51207aa1b482f2 100644 (file)
@@ -28,8 +28,9 @@
 #include <common.h>
 #include <command.h>
 #include <asm/byteorder.h>
+#include <part.h>
 
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
 
 #include <usb.h>
 
@@ -444,6 +445,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        int i;
        struct usb_device *dev = NULL;
+       extern char usb_started;
 #ifdef CONFIG_USB_STORAGE
        block_dev_desc_t *stor_dev;
 #endif
@@ -477,6 +479,10 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                usb_stop();
                return 0;
        }
+       if (!usb_started) {
+               printf("USB is stopped. Please issue 'usb start' first.\n");
+               return 1;
+       }
        if (strncmp(argv[1],"tree",4) == 0) {
                printf("\nDevice Tree:\n");
                usb_show_tree(usb_get_dev_index(0));
@@ -603,10 +609,10 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 
-#endif /* (CONFIG_COMMANDS & CFG_CMD_USB) */
+#endif
 
 
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
 
 #ifdef CONFIG_USB_STORAGE
 U_BOOT_CMD(