]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - common/cmd_usb.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[karo-tx-uboot.git] / common / cmd_usb.c
1 /*
2  * (C) Copyright 2001
3  * Denis Peter, MPL AG Switzerland
4  *
5  * Most of this source has been derived from the Linux USB
6  * project.
7  *
8  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24  * MA 02111-1307 USA
25  *
26  */
27
28 #include <common.h>
29 #include <command.h>
30 #include <asm/byteorder.h>
31 #include <part.h>
32 #include <usb.h>
33
34 #ifdef CONFIG_USB_STORAGE
35 static int usb_stor_curr_dev = -1; /* current device */
36 #endif
37 #ifdef CONFIG_USB_HOST_ETHER
38 static int usb_ether_curr_dev = -1; /* current ethernet device */
39 #endif
40
41 /* some display routines (info command) */
42 char *usb_get_class_desc(unsigned char dclass)
43 {
44         switch (dclass) {
45         case USB_CLASS_PER_INTERFACE:
46                 return "See Interface";
47         case USB_CLASS_AUDIO:
48                 return "Audio";
49         case USB_CLASS_COMM:
50                 return "Communication";
51         case USB_CLASS_HID:
52                 return "Human Interface";
53         case USB_CLASS_PRINTER:
54                 return "Printer";
55         case USB_CLASS_MASS_STORAGE:
56                 return "Mass Storage";
57         case USB_CLASS_HUB:
58                 return "Hub";
59         case USB_CLASS_DATA:
60                 return "CDC Data";
61         case USB_CLASS_VENDOR_SPEC:
62                 return "Vendor specific";
63         default:
64                 return "";
65         }
66 }
67
68 void usb_display_class_sub(unsigned char dclass, unsigned char subclass,
69                            unsigned char proto)
70 {
71         switch (dclass) {
72         case USB_CLASS_PER_INTERFACE:
73                 printf("See Interface");
74                 break;
75         case USB_CLASS_HID:
76                 printf("Human Interface, Subclass: ");
77                 switch (subclass) {
78                 case USB_SUB_HID_NONE:
79                         printf("None");
80                         break;
81                 case USB_SUB_HID_BOOT:
82                         printf("Boot ");
83                         switch (proto) {
84                         case USB_PROT_HID_NONE:
85                                 printf("None");
86                                 break;
87                         case USB_PROT_HID_KEYBOARD:
88                                 printf("Keyboard");
89                                 break;
90                         case USB_PROT_HID_MOUSE:
91                                 printf("Mouse");
92                                 break;
93                         default:
94                                 printf("reserved");
95                                 break;
96                         }
97                         break;
98                 default:
99                         printf("reserved");
100                         break;
101                 }
102                 break;
103         case USB_CLASS_MASS_STORAGE:
104                 printf("Mass Storage, ");
105                 switch (subclass) {
106                 case US_SC_RBC:
107                         printf("RBC ");
108                         break;
109                 case US_SC_8020:
110                         printf("SFF-8020i (ATAPI)");
111                         break;
112                 case US_SC_QIC:
113                         printf("QIC-157 (Tape)");
114                         break;
115                 case US_SC_UFI:
116                         printf("UFI");
117                         break;
118                 case US_SC_8070:
119                         printf("SFF-8070");
120                         break;
121                 case US_SC_SCSI:
122                         printf("Transp. SCSI");
123                         break;
124                 default:
125                         printf("reserved");
126                         break;
127                 }
128                 printf(", ");
129                 switch (proto) {
130                 case US_PR_CB:
131                         printf("Command/Bulk");
132                         break;
133                 case US_PR_CBI:
134                         printf("Command/Bulk/Int");
135                         break;
136                 case US_PR_BULK:
137                         printf("Bulk only");
138                         break;
139                 default:
140                         printf("reserved");
141                         break;
142                 }
143                 break;
144         default:
145                 printf("%s", usb_get_class_desc(dclass));
146                 break;
147         }
148 }
149
150 void usb_display_string(struct usb_device *dev, int index)
151 {
152         char buffer[256];
153         if (index != 0) {
154                 if (usb_string(dev, index, &buffer[0], 256) > 0)
155                         printf("String: \"%s\"", buffer);
156         }
157 }
158
159 void usb_display_desc(struct usb_device *dev)
160 {
161         if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) {
162                 printf("%d: %s,  USB Revision %x.%x\n", dev->devnum,
163                 usb_get_class_desc(dev->config.if_desc[0].desc.bInterfaceClass),
164                                    (dev->descriptor.bcdUSB>>8) & 0xff,
165                                    dev->descriptor.bcdUSB & 0xff);
166
167                 if (strlen(dev->mf) || strlen(dev->prod) ||
168                     strlen(dev->serial))
169                         printf(" - %s %s %s\n", dev->mf, dev->prod,
170                                 dev->serial);
171                 if (dev->descriptor.bDeviceClass) {
172                         printf(" - Class: ");
173                         usb_display_class_sub(dev->descriptor.bDeviceClass,
174                                               dev->descriptor.bDeviceSubClass,
175                                               dev->descriptor.bDeviceProtocol);
176                         printf("\n");
177                 } else {
178                         printf(" - Class: (from Interface) %s\n",
179                                usb_get_class_desc(
180                                 dev->config.if_desc[0].desc.bInterfaceClass));
181                 }
182                 printf(" - PacketSize: %d  Configurations: %d\n",
183                         dev->descriptor.bMaxPacketSize0,
184                         dev->descriptor.bNumConfigurations);
185                 printf(" - Vendor: 0x%04x  Product 0x%04x Version %d.%d\n",
186                         dev->descriptor.idVendor, dev->descriptor.idProduct,
187                         (dev->descriptor.bcdDevice>>8) & 0xff,
188                         dev->descriptor.bcdDevice & 0xff);
189         }
190
191 }
192
193 void usb_display_conf_desc(struct usb_configuration_descriptor *config,
194                            struct usb_device *dev)
195 {
196         printf("   Configuration: %d\n", config->bConfigurationValue);
197         printf("   - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces,
198                (config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
199                (config->bmAttributes & 0x20) ? "Remote Wakeup " : "",
200                 config->bMaxPower*2);
201         if (config->iConfiguration) {
202                 printf("   - ");
203                 usb_display_string(dev, config->iConfiguration);
204                 printf("\n");
205         }
206 }
207
208 void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,
209                          struct usb_device *dev)
210 {
211         printf("     Interface: %d\n", ifdesc->bInterfaceNumber);
212         printf("     - Alternate Setting %d, Endpoints: %d\n",
213                 ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
214         printf("     - Class ");
215         usb_display_class_sub(ifdesc->bInterfaceClass,
216                 ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
217         printf("\n");
218         if (ifdesc->iInterface) {
219                 printf("     - ");
220                 usb_display_string(dev, ifdesc->iInterface);
221                 printf("\n");
222         }
223 }
224
225 void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
226 {
227         printf("     - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf,
228                 (epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
229         switch ((epdesc->bmAttributes & 0x03)) {
230         case 0:
231                 printf("Control");
232                 break;
233         case 1:
234                 printf("Isochronous");
235                 break;
236         case 2:
237                 printf("Bulk");
238                 break;
239         case 3:
240                 printf("Interrupt");
241                 break;
242         }
243         printf(" MaxPacket %d", epdesc->wMaxPacketSize);
244         if ((epdesc->bmAttributes & 0x03) == 0x3)
245                 printf(" Interval %dms", epdesc->bInterval);
246         printf("\n");
247 }
248
249 /* main routine to diasplay the configs, interfaces and endpoints */
250 void usb_display_config(struct usb_device *dev)
251 {
252         struct usb_config *config;
253         struct usb_interface *ifdesc;
254         struct usb_endpoint_descriptor *epdesc;
255         int i, ii;
256
257         config = &dev->config;
258         usb_display_conf_desc(&config->desc, dev);
259         for (i = 0; i < config->no_of_if; i++) {
260                 ifdesc = &config->if_desc[i];
261                 usb_display_if_desc(&ifdesc->desc, dev);
262                 for (ii = 0; ii < ifdesc->no_of_ep; ii++) {
263                         epdesc = &ifdesc->ep_desc[ii];
264                         usb_display_ep_desc(epdesc);
265                 }
266         }
267         printf("\n");
268 }
269
270 static inline char *portspeed(int speed)
271 {
272         if (speed == USB_SPEED_HIGH)
273                 return "480 Mb/s";
274         else if (speed == USB_SPEED_LOW)
275                 return "1.5 Mb/s";
276         else
277                 return "12 Mb/s";
278 }
279
280 /* shows the device tree recursively */
281 void usb_show_tree_graph(struct usb_device *dev, char *pre)
282 {
283         int i, index;
284         int has_child, last_child;
285
286         index = strlen(pre);
287         printf(" %s", pre);
288         /* check if the device has connected children */
289         has_child = 0;
290         for (i = 0; i < dev->maxchild; i++) {
291                 if (dev->children[i] != NULL)
292                         has_child = 1;
293         }
294         /* check if we are the last one */
295         last_child = 1;
296         if (dev->parent != NULL) {
297                 for (i = 0; i < dev->parent->maxchild; i++) {
298                         /* search for children */
299                         if (dev->parent->children[i] == dev) {
300                                 /* found our pointer, see if we have a
301                                  * little sister
302                                  */
303                                 while (i++ < dev->parent->maxchild) {
304                                         if (dev->parent->children[i] != NULL) {
305                                                 /* found a sister */
306                                                 last_child = 0;
307                                                 break;
308                                         } /* if */
309                                 } /* while */
310                         } /* device found */
311                 } /* for all children of the parent */
312                 printf("\b+-");
313                 /* correct last child */
314                 if (last_child)
315                         pre[index-1] = ' ';
316         } /* if not root hub */
317         else
318                 printf(" ");
319         printf("%d ", dev->devnum);
320         pre[index++] = ' ';
321         pre[index++] = has_child ? '|' : ' ';
322         pre[index] = 0;
323         printf(" %s (%s, %dmA)\n", usb_get_class_desc(
324                                         dev->config.if_desc[0].desc.bInterfaceClass),
325                                         portspeed(dev->speed),
326                                         dev->config.desc.bMaxPower * 2);
327         if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
328                 printf(" %s  %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
329         printf(" %s\n", pre);
330         if (dev->maxchild > 0) {
331                 for (i = 0; i < dev->maxchild; i++) {
332                         if (dev->children[i] != NULL) {
333                                 usb_show_tree_graph(dev->children[i], pre);
334                                 pre[index] = 0;
335                         }
336                 }
337         }
338 }
339
340 /* main routine for the tree command */
341 void usb_show_tree(struct usb_device *dev)
342 {
343         char preamble[32];
344
345         memset(preamble, 0, 32);
346         usb_show_tree_graph(dev, &preamble[0]);
347 }
348
349
350 /******************************************************************************
351  * usb boot command intepreter. Derived from diskboot
352  */
353 #ifdef CONFIG_USB_STORAGE
354 int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
355 {
356         char *boot_device = NULL;
357         char *ep;
358         int dev, part = 1;
359         ulong addr, cnt;
360         disk_partition_t info;
361         image_header_t *hdr;
362         block_dev_desc_t *stor_dev;
363 #if defined(CONFIG_FIT)
364         const void *fit_hdr = NULL;
365 #endif
366
367         switch (argc) {
368         case 1:
369                 addr = CONFIG_SYS_LOAD_ADDR;
370                 boot_device = getenv("bootdevice");
371                 break;
372         case 2:
373                 addr = simple_strtoul(argv[1], NULL, 16);
374                 boot_device = getenv("bootdevice");
375                 break;
376         case 3:
377                 addr = simple_strtoul(argv[1], NULL, 16);
378                 boot_device = argv[2];
379                 break;
380         default:
381                 return cmd_usage(cmdtp);
382         }
383
384         if (!boot_device) {
385                 puts("\n** No boot device **\n");
386                 return 1;
387         }
388
389         dev = simple_strtoul(boot_device, &ep, 16);
390         stor_dev = usb_stor_get_dev(dev);
391         if (stor_dev == NULL || stor_dev->type == DEV_TYPE_UNKNOWN) {
392                 printf("\n** Device %d not available\n", dev);
393                 return 1;
394         }
395         if (stor_dev->block_read == NULL) {
396                 printf("storage device not initialized. Use usb scan\n");
397                 return 1;
398         }
399         if (*ep) {
400                 if (*ep != ':') {
401                         puts("\n** Invalid boot device, use `dev[:part]' **\n");
402                         return 1;
403                 }
404                 part = simple_strtoul(++ep, NULL, 16);
405         }
406
407         if (get_partition_info(stor_dev, part, &info)) {
408                 /* try to boot raw .... */
409                 strncpy((char *)&info.type[0], BOOT_PART_TYPE,
410                         sizeof(BOOT_PART_TYPE));
411                 strncpy((char *)&info.name[0], "Raw", 4);
412                 info.start = 0;
413                 info.blksz = 0x200;
414                 info.size = 2880;
415                 printf("error reading partinfo...try to boot raw\n");
416         }
417         if ((strncmp((char *)info.type, BOOT_PART_TYPE,
418             sizeof(info.type)) != 0) &&
419             (strncmp((char *)info.type, BOOT_PART_COMP,
420             sizeof(info.type)) != 0)) {
421                 printf("\n** Invalid partition type \"%.32s\""
422                         " (expect \"" BOOT_PART_TYPE "\")\n",
423                         info.type);
424                 return 1;
425         }
426         printf("\nLoading from USB device %d, partition %d: "
427                 "Name: %.32s  Type: %.32s\n",
428                 dev, part, info.name, info.type);
429
430         debug("First Block: %ld,  # of blocks: %ld, Block Size: %ld\n",
431                 info.start, info.size, info.blksz);
432
433         if (stor_dev->block_read(dev, info.start, 1, (ulong *)addr) != 1) {
434                 printf("** Read error on %d:%d\n", dev, part);
435                 return 1;
436         }
437
438         switch (genimg_get_format((void *)addr)) {
439         case IMAGE_FORMAT_LEGACY:
440                 hdr = (image_header_t *)addr;
441
442                 if (!image_check_hcrc(hdr)) {
443                         puts("\n** Bad Header Checksum **\n");
444                         return 1;
445                 }
446
447                 image_print_contents(hdr);
448
449                 cnt = image_get_image_size(hdr);
450                 break;
451 #if defined(CONFIG_FIT)
452         case IMAGE_FORMAT_FIT:
453                 fit_hdr = (const void *)addr;
454                 puts("Fit image detected...\n");
455
456                 cnt = fit_get_size(fit_hdr);
457                 break;
458 #endif
459         default:
460                 puts("** Unknown image type\n");
461                 return 1;
462         }
463
464         cnt += info.blksz - 1;
465         cnt /= info.blksz;
466         cnt -= 1;
467
468         if (stor_dev->block_read(dev, info.start+1, cnt,
469                       (ulong *)(addr+info.blksz)) != cnt) {
470                 printf("\n** Read error on %d:%d\n", dev, part);
471                 return 1;
472         }
473
474 #if defined(CONFIG_FIT)
475         /* This cannot be done earlier, we need complete FIT image in RAM
476          * first
477          */
478         if (genimg_get_format((void *)addr) == IMAGE_FORMAT_FIT) {
479                 if (!fit_check_format(fit_hdr)) {
480                         puts("** Bad FIT image format\n");
481                         return 1;
482                 }
483                 fit_print_contents(fit_hdr);
484         }
485 #endif
486
487         /* Loading ok, update default load address */
488         load_addr = addr;
489
490         flush_cache(addr, (cnt+1)*info.blksz);
491
492         return bootm_maybe_autostart(cmdtp, argv[0]);
493 }
494 #endif /* CONFIG_USB_STORAGE */
495
496
497 /******************************************************************************
498  * usb command intepreter
499  */
500 int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
501 {
502
503         int i;
504         struct usb_device *dev = NULL;
505         extern char usb_started;
506 #ifdef CONFIG_USB_STORAGE
507         block_dev_desc_t *stor_dev;
508 #endif
509
510         if (argc < 2)
511                 return cmd_usage(cmdtp);
512
513         if ((strncmp(argv[1], "reset", 5) == 0) ||
514                  (strncmp(argv[1], "start", 5) == 0)) {
515                 usb_stop();
516                 printf("(Re)start USB...\n");
517                 i = usb_init();
518                 if (i >= 0) {
519 #ifdef CONFIG_USB_STORAGE
520                         /* try to recognize storage devices immediately */
521                         usb_stor_curr_dev = usb_stor_scan(1);
522 #endif
523 #ifdef CONFIG_USB_HOST_ETHER
524                         /* try to recognize ethernet devices immediately */
525                         usb_ether_curr_dev = usb_host_eth_scan(1);
526 #endif
527                 }
528                 return 0;
529         }
530         if (strncmp(argv[1], "stop", 4) == 0) {
531 #ifdef CONFIG_USB_KEYBOARD
532                 if (argc == 2) {
533                         if (usb_kbd_deregister() != 0) {
534                                 printf("USB not stopped: usbkbd still"
535                                         " using USB\n");
536                                 return 1;
537                         }
538                 } else {
539                         /* forced stop, switch console in to serial */
540                         console_assign(stdin, "serial");
541                         usb_kbd_deregister();
542                 }
543 #endif
544                 printf("stopping USB..\n");
545                 usb_stop();
546                 return 0;
547         }
548         if (!usb_started) {
549                 printf("USB is stopped. Please issue 'usb start' first.\n");
550                 return 1;
551         }
552         if (strncmp(argv[1], "tree", 4) == 0) {
553                 printf("\nDevice Tree:\n");
554                 usb_show_tree(usb_get_dev_index(0));
555                 return 0;
556         }
557         if (strncmp(argv[1], "inf", 3) == 0) {
558                 int d;
559                 if (argc == 2) {
560                         for (d = 0; d < USB_MAX_DEVICE; d++) {
561                                 dev = usb_get_dev_index(d);
562                                 if (dev == NULL)
563                                         break;
564                                 usb_display_desc(dev);
565                                 usb_display_config(dev);
566                         }
567                         return 0;
568                 } else {
569                         int d;
570
571                         i = simple_strtoul(argv[2], NULL, 16);
572                         printf("config for device %d\n", i);
573                         for (d = 0; d < USB_MAX_DEVICE; d++) {
574                                 dev = usb_get_dev_index(d);
575                                 if (dev == NULL)
576                                         break;
577                                 if (dev->devnum == i)
578                                         break;
579                         }
580                         if (dev == NULL) {
581                                 printf("*** No device available ***\n");
582                                 return 0;
583                         } else {
584                                 usb_display_desc(dev);
585                                 usb_display_config(dev);
586                         }
587                 }
588                 return 0;
589         }
590 #ifdef CONFIG_USB_STORAGE
591         if (strncmp(argv[1], "stor", 4) == 0)
592                 return usb_stor_info();
593
594         if (strncmp(argv[1], "part", 4) == 0) {
595                 int devno, ok = 0;
596                 if (argc == 2) {
597                         for (devno = 0; ; ++devno) {
598                                 stor_dev = usb_stor_get_dev(devno);
599                                 if (stor_dev == NULL)
600                                         break;
601                                 if (stor_dev->type != DEV_TYPE_UNKNOWN) {
602                                         ok++;
603                                         if (devno)
604                                                 printf("\n");
605                                         debug("print_part of %x\n", devno);
606                                         print_part(stor_dev);
607                                 }
608                         }
609                 } else {
610                         devno = simple_strtoul(argv[2], NULL, 16);
611                         stor_dev = usb_stor_get_dev(devno);
612                         if (stor_dev != NULL &&
613                             stor_dev->type != DEV_TYPE_UNKNOWN) {
614                                 ok++;
615                                 debug("print_part of %x\n", devno);
616                                 print_part(stor_dev);
617                         }
618                 }
619                 if (!ok) {
620                         printf("\nno USB devices available\n");
621                         return 1;
622                 }
623                 return 0;
624         }
625         if (strcmp(argv[1], "read") == 0) {
626                 if (usb_stor_curr_dev < 0) {
627                         printf("no current device selected\n");
628                         return 1;
629                 }
630                 if (argc == 5) {
631                         unsigned long addr = simple_strtoul(argv[2], NULL, 16);
632                         unsigned long blk  = simple_strtoul(argv[3], NULL, 16);
633                         unsigned long cnt  = simple_strtoul(argv[4], NULL, 16);
634                         unsigned long n;
635                         printf("\nUSB read: device %d block # %ld, count %ld"
636                                 " ... ", usb_stor_curr_dev, blk, cnt);
637                         stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
638                         n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
639                                                  (ulong *)addr);
640                         printf("%ld blocks read: %s\n", n,
641                                 (n == cnt) ? "OK" : "ERROR");
642                         if (n == cnt)
643                                 return 0;
644                         return 1;
645                 }
646         }
647         if (strcmp(argv[1], "write") == 0) {
648                 if (usb_stor_curr_dev < 0) {
649                         printf("no current device selected\n");
650                         return 1;
651                 }
652                 if (argc == 5) {
653                         unsigned long addr = simple_strtoul(argv[2], NULL, 16);
654                         unsigned long blk  = simple_strtoul(argv[3], NULL, 16);
655                         unsigned long cnt  = simple_strtoul(argv[4], NULL, 16);
656                         unsigned long n;
657                         printf("\nUSB write: device %d block # %ld, count %ld"
658                                 " ... ", usb_stor_curr_dev, blk, cnt);
659                         stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
660                         n = stor_dev->block_write(usb_stor_curr_dev, blk, cnt,
661                                                 (ulong *)addr);
662                         printf("%ld blocks write: %s\n", n,
663                                 (n == cnt) ? "OK" : "ERROR");
664                         if (n == cnt)
665                                 return 0;
666                         return 1;
667                 }
668         }
669         if (strncmp(argv[1], "dev", 3) == 0) {
670                 if (argc == 3) {
671                         int dev = (int)simple_strtoul(argv[2], NULL, 10);
672                         printf("\nUSB device %d: ", dev);
673                         stor_dev = usb_stor_get_dev(dev);
674                         if (stor_dev == NULL) {
675                                 printf("unknown device\n");
676                                 return 1;
677                         }
678                         printf("\n    Device %d: ", dev);
679                         dev_print(stor_dev);
680                         if (stor_dev->type == DEV_TYPE_UNKNOWN)
681                                 return 1;
682                         usb_stor_curr_dev = dev;
683                         printf("... is now current device\n");
684                         return 0;
685                 } else {
686                         printf("\nUSB device %d: ", usb_stor_curr_dev);
687                         stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
688                         dev_print(stor_dev);
689                         if (stor_dev->type == DEV_TYPE_UNKNOWN)
690                                 return 1;
691                         return 0;
692                 }
693                 return 0;
694         }
695 #endif /* CONFIG_USB_STORAGE */
696         return cmd_usage(cmdtp);
697 }
698
699 #ifdef CONFIG_USB_STORAGE
700 U_BOOT_CMD(
701         usb,    5,      1,      do_usb,
702         "USB sub-system",
703         "start - start (scan) USB controller\n"
704         "usb reset - reset (rescan) USB controller\n"
705         "usb stop [f] - stop USB [f]=force stop\n"
706         "usb tree - show USB device tree\n"
707         "usb info [dev] - show available USB devices\n"
708         "usb storage - show details of USB storage devices\n"
709         "usb dev [dev] - show or set current USB storage device\n"
710         "usb part [dev] - print partition table of one or all USB storage"
711         " devices\n"
712         "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
713         "    to memory address `addr'\n"
714         "usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'\n"
715         "    from memory address `addr'"
716 );
717
718
719 U_BOOT_CMD(
720         usbboot,        3,      1,      do_usbboot,
721         "boot from USB device",
722         "loadAddr dev:part"
723 );
724
725 #else
726 U_BOOT_CMD(
727         usb,    5,      1,      do_usb,
728         "USB sub-system",
729         "start - start (scan) USB controller\n"
730         "usb reset - reset (rescan) USB controller\n"
731         "usb tree - show USB device tree\n"
732         "usb info [dev] - show available USB devices"
733 );
734 #endif