cmd_usb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <common.h>
  11. #include <command.h>
  12. #include <asm/byteorder.h>
  13. #include <asm/unaligned.h>
  14. #include <part.h>
  15. #include <usb.h>
  16. #ifdef CONFIG_USB_STORAGE
  17. static int usb_stor_curr_dev = -1; /* current device */
  18. #endif
  19. #ifdef CONFIG_USB_HOST_ETHER
  20. static int usb_ether_curr_dev = -1; /* current ethernet device */
  21. #endif
  22. /* some display routines (info command) */
  23. static char *usb_get_class_desc(unsigned char dclass)
  24. {
  25. switch (dclass) {
  26. case USB_CLASS_PER_INTERFACE:
  27. return "See Interface";
  28. case USB_CLASS_AUDIO:
  29. return "Audio";
  30. case USB_CLASS_COMM:
  31. return "Communication";
  32. case USB_CLASS_HID:
  33. return "Human Interface";
  34. case USB_CLASS_PRINTER:
  35. return "Printer";
  36. case USB_CLASS_MASS_STORAGE:
  37. return "Mass Storage";
  38. case USB_CLASS_HUB:
  39. return "Hub";
  40. case USB_CLASS_DATA:
  41. return "CDC Data";
  42. case USB_CLASS_VENDOR_SPEC:
  43. return "Vendor specific";
  44. default:
  45. return "";
  46. }
  47. }
  48. static void usb_display_class_sub(unsigned char dclass, unsigned char subclass,
  49. unsigned char proto)
  50. {
  51. switch (dclass) {
  52. case USB_CLASS_PER_INTERFACE:
  53. printf("See Interface");
  54. break;
  55. case USB_CLASS_HID:
  56. printf("Human Interface, Subclass: ");
  57. switch (subclass) {
  58. case USB_SUB_HID_NONE:
  59. printf("None");
  60. break;
  61. case USB_SUB_HID_BOOT:
  62. printf("Boot ");
  63. switch (proto) {
  64. case USB_PROT_HID_NONE:
  65. printf("None");
  66. break;
  67. case USB_PROT_HID_KEYBOARD:
  68. printf("Keyboard");
  69. break;
  70. case USB_PROT_HID_MOUSE:
  71. printf("Mouse");
  72. break;
  73. default:
  74. printf("reserved");
  75. break;
  76. }
  77. break;
  78. default:
  79. printf("reserved");
  80. break;
  81. }
  82. break;
  83. case USB_CLASS_MASS_STORAGE:
  84. printf("Mass Storage, ");
  85. switch (subclass) {
  86. case US_SC_RBC:
  87. printf("RBC ");
  88. break;
  89. case US_SC_8020:
  90. printf("SFF-8020i (ATAPI)");
  91. break;
  92. case US_SC_QIC:
  93. printf("QIC-157 (Tape)");
  94. break;
  95. case US_SC_UFI:
  96. printf("UFI");
  97. break;
  98. case US_SC_8070:
  99. printf("SFF-8070");
  100. break;
  101. case US_SC_SCSI:
  102. printf("Transp. SCSI");
  103. break;
  104. default:
  105. printf("reserved");
  106. break;
  107. }
  108. printf(", ");
  109. switch (proto) {
  110. case US_PR_CB:
  111. printf("Command/Bulk");
  112. break;
  113. case US_PR_CBI:
  114. printf("Command/Bulk/Int");
  115. break;
  116. case US_PR_BULK:
  117. printf("Bulk only");
  118. break;
  119. default:
  120. printf("reserved");
  121. break;
  122. }
  123. break;
  124. default:
  125. printf("%s", usb_get_class_desc(dclass));
  126. break;
  127. }
  128. }
  129. static void usb_display_string(struct usb_device *dev, int index)
  130. {
  131. ALLOC_CACHE_ALIGN_BUFFER(char, buffer, 256);
  132. if (index != 0) {
  133. if (usb_string(dev, index, &buffer[0], 256) > 0)
  134. printf("String: \"%s\"", buffer);
  135. }
  136. }
  137. static void usb_display_desc(struct usb_device *dev)
  138. {
  139. if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) {
  140. printf("%d: %s, USB Revision %x.%x\n", dev->devnum,
  141. usb_get_class_desc(dev->config.if_desc[0].desc.bInterfaceClass),
  142. (dev->descriptor.bcdUSB>>8) & 0xff,
  143. dev->descriptor.bcdUSB & 0xff);
  144. if (strlen(dev->mf) || strlen(dev->prod) ||
  145. strlen(dev->serial))
  146. printf(" - %s %s %s\n", dev->mf, dev->prod,
  147. dev->serial);
  148. if (dev->descriptor.bDeviceClass) {
  149. printf(" - Class: ");
  150. usb_display_class_sub(dev->descriptor.bDeviceClass,
  151. dev->descriptor.bDeviceSubClass,
  152. dev->descriptor.bDeviceProtocol);
  153. printf("\n");
  154. } else {
  155. printf(" - Class: (from Interface) %s\n",
  156. usb_get_class_desc(
  157. dev->config.if_desc[0].desc.bInterfaceClass));
  158. }
  159. printf(" - PacketSize: %d Configurations: %d\n",
  160. dev->descriptor.bMaxPacketSize0,
  161. dev->descriptor.bNumConfigurations);
  162. printf(" - Vendor: 0x%04x Product 0x%04x Version %d.%d\n",
  163. dev->descriptor.idVendor, dev->descriptor.idProduct,
  164. (dev->descriptor.bcdDevice>>8) & 0xff,
  165. dev->descriptor.bcdDevice & 0xff);
  166. }
  167. }
  168. static void usb_display_conf_desc(struct usb_config_descriptor *config,
  169. struct usb_device *dev)
  170. {
  171. printf(" Configuration: %d\n", config->bConfigurationValue);
  172. printf(" - Interfaces: %d %s%s%dmA\n", config->bNumInterfaces,
  173. (config->bmAttributes & 0x40) ? "Self Powered " : "Bus Powered ",
  174. (config->bmAttributes & 0x20) ? "Remote Wakeup " : "",
  175. config->bMaxPower*2);
  176. if (config->iConfiguration) {
  177. printf(" - ");
  178. usb_display_string(dev, config->iConfiguration);
  179. printf("\n");
  180. }
  181. }
  182. static void usb_display_if_desc(struct usb_interface_descriptor *ifdesc,
  183. struct usb_device *dev)
  184. {
  185. printf(" Interface: %d\n", ifdesc->bInterfaceNumber);
  186. printf(" - Alternate Setting %d, Endpoints: %d\n",
  187. ifdesc->bAlternateSetting, ifdesc->bNumEndpoints);
  188. printf(" - Class ");
  189. usb_display_class_sub(ifdesc->bInterfaceClass,
  190. ifdesc->bInterfaceSubClass, ifdesc->bInterfaceProtocol);
  191. printf("\n");
  192. if (ifdesc->iInterface) {
  193. printf(" - ");
  194. usb_display_string(dev, ifdesc->iInterface);
  195. printf("\n");
  196. }
  197. }
  198. static void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
  199. {
  200. printf(" - Endpoint %d %s ", epdesc->bEndpointAddress & 0xf,
  201. (epdesc->bEndpointAddress & 0x80) ? "In" : "Out");
  202. switch ((epdesc->bmAttributes & 0x03)) {
  203. case 0:
  204. printf("Control");
  205. break;
  206. case 1:
  207. printf("Isochronous");
  208. break;
  209. case 2:
  210. printf("Bulk");
  211. break;
  212. case 3:
  213. printf("Interrupt");
  214. break;
  215. }
  216. printf(" MaxPacket %d", get_unaligned(&epdesc->wMaxPacketSize));
  217. if ((epdesc->bmAttributes & 0x03) == 0x3)
  218. printf(" Interval %dms", epdesc->bInterval);
  219. printf("\n");
  220. }
  221. /* main routine to diasplay the configs, interfaces and endpoints */
  222. static void usb_display_config(struct usb_device *dev)
  223. {
  224. struct usb_config *config;
  225. struct usb_interface *ifdesc;
  226. struct usb_endpoint_descriptor *epdesc;
  227. int i, ii;
  228. config = &dev->config;
  229. usb_display_conf_desc(&config->desc, dev);
  230. for (i = 0; i < config->no_of_if; i++) {
  231. ifdesc = &config->if_desc[i];
  232. usb_display_if_desc(&ifdesc->desc, dev);
  233. for (ii = 0; ii < ifdesc->no_of_ep; ii++) {
  234. epdesc = &ifdesc->ep_desc[ii];
  235. usb_display_ep_desc(epdesc);
  236. }
  237. }
  238. printf("\n");
  239. }
  240. static struct usb_device *usb_find_device(int devnum)
  241. {
  242. struct usb_device *dev;
  243. int d;
  244. for (d = 0; d < USB_MAX_DEVICE; d++) {
  245. dev = usb_get_dev_index(d);
  246. if (dev == NULL)
  247. return NULL;
  248. if (dev->devnum == devnum)
  249. return dev;
  250. }
  251. return NULL;
  252. }
  253. static inline char *portspeed(int speed)
  254. {
  255. char *speed_str;
  256. switch (speed) {
  257. case USB_SPEED_SUPER:
  258. speed_str = "5 Gb/s";
  259. break;
  260. case USB_SPEED_HIGH:
  261. speed_str = "480 Mb/s";
  262. break;
  263. case USB_SPEED_LOW:
  264. speed_str = "1.5 Mb/s";
  265. break;
  266. default:
  267. speed_str = "12 Mb/s";
  268. break;
  269. }
  270. return speed_str;
  271. }
  272. /* shows the device tree recursively */
  273. static void usb_show_tree_graph(struct usb_device *dev, char *pre)
  274. {
  275. int i, index;
  276. int has_child, last_child;
  277. index = strlen(pre);
  278. printf(" %s", pre);
  279. /* check if the device has connected children */
  280. has_child = 0;
  281. for (i = 0; i < dev->maxchild; i++) {
  282. if (dev->children[i] != NULL)
  283. has_child = 1;
  284. }
  285. /* check if we are the last one */
  286. last_child = 1;
  287. if (dev->parent != NULL) {
  288. for (i = 0; i < dev->parent->maxchild; i++) {
  289. /* search for children */
  290. if (dev->parent->children[i] == dev) {
  291. /* found our pointer, see if we have a
  292. * little sister
  293. */
  294. while (i++ < dev->parent->maxchild) {
  295. if (dev->parent->children[i] != NULL) {
  296. /* found a sister */
  297. last_child = 0;
  298. break;
  299. } /* if */
  300. } /* while */
  301. } /* device found */
  302. } /* for all children of the parent */
  303. printf("\b+-");
  304. /* correct last child */
  305. if (last_child)
  306. pre[index-1] = ' ';
  307. } /* if not root hub */
  308. else
  309. printf(" ");
  310. printf("%d ", dev->devnum);
  311. pre[index++] = ' ';
  312. pre[index++] = has_child ? '|' : ' ';
  313. pre[index] = 0;
  314. printf(" %s (%s, %dmA)\n", usb_get_class_desc(
  315. dev->config.if_desc[0].desc.bInterfaceClass),
  316. portspeed(dev->speed),
  317. dev->config.desc.bMaxPower * 2);
  318. if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
  319. printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
  320. printf(" %s\n", pre);
  321. if (dev->maxchild > 0) {
  322. for (i = 0; i < dev->maxchild; i++) {
  323. if (dev->children[i] != NULL) {
  324. usb_show_tree_graph(dev->children[i], pre);
  325. pre[index] = 0;
  326. }
  327. }
  328. }
  329. }
  330. /* main routine for the tree command */
  331. static void usb_show_tree(struct usb_device *dev)
  332. {
  333. char preamble[32];
  334. memset(preamble, 0, 32);
  335. usb_show_tree_graph(dev, &preamble[0]);
  336. }
  337. static int usb_test(struct usb_device *dev, int port, char* arg)
  338. {
  339. int mode;
  340. if (port > dev->maxchild) {
  341. printf("Device is no hub or does not have %d ports.\n", port);
  342. return 1;
  343. }
  344. switch (arg[0]) {
  345. case 'J':
  346. case 'j':
  347. printf("Setting Test_J mode");
  348. mode = USB_TEST_MODE_J;
  349. break;
  350. case 'K':
  351. case 'k':
  352. printf("Setting Test_K mode");
  353. mode = USB_TEST_MODE_K;
  354. break;
  355. case 'S':
  356. case 's':
  357. printf("Setting Test_SE0_NAK mode");
  358. mode = USB_TEST_MODE_SE0_NAK;
  359. break;
  360. case 'P':
  361. case 'p':
  362. printf("Setting Test_Packet mode");
  363. mode = USB_TEST_MODE_PACKET;
  364. break;
  365. case 'F':
  366. case 'f':
  367. printf("Setting Test_Force_Enable mode");
  368. mode = USB_TEST_MODE_FORCE_ENABLE;
  369. break;
  370. default:
  371. printf("Unrecognized test mode: %s\nAvailable modes: "
  372. "J, K, S[E0_NAK], P[acket], F[orce_Enable]\n", arg);
  373. return 1;
  374. }
  375. if (port)
  376. printf(" on downstream facing port %d...\n", port);
  377. else
  378. printf(" on upstream facing port...\n");
  379. if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_FEATURE,
  380. port ? USB_RT_PORT : USB_RECIP_DEVICE,
  381. port ? USB_PORT_FEAT_TEST : USB_FEAT_TEST,
  382. (mode << 8) | port,
  383. NULL, 0, USB_CNTL_TIMEOUT) == -1) {
  384. printf("Error during SET_FEATURE.\n");
  385. return 1;
  386. } else {
  387. printf("Test mode successfully set. Use 'usb start' "
  388. "to return to normal operation.\n");
  389. return 0;
  390. }
  391. }
  392. /******************************************************************************
  393. * usb boot command intepreter. Derived from diskboot
  394. */
  395. #ifdef CONFIG_USB_STORAGE
  396. static int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  397. {
  398. return common_diskboot(cmdtp, "usb", argc, argv);
  399. }
  400. #endif /* CONFIG_USB_STORAGE */
  401. /******************************************************************************
  402. * usb command intepreter
  403. */
  404. static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  405. {
  406. int i;
  407. struct usb_device *dev = NULL;
  408. extern char usb_started;
  409. #ifdef CONFIG_USB_STORAGE
  410. block_dev_desc_t *stor_dev;
  411. #endif
  412. if (argc < 2)
  413. return CMD_RET_USAGE;
  414. if ((strncmp(argv[1], "reset", 5) == 0) ||
  415. (strncmp(argv[1], "start", 5) == 0)) {
  416. bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
  417. usb_stop();
  418. printf("(Re)start USB...\n");
  419. if (usb_init() >= 0) {
  420. #ifdef CONFIG_USB_STORAGE
  421. /* try to recognize storage devices immediately */
  422. usb_stor_curr_dev = usb_stor_scan(1);
  423. #endif
  424. #ifdef CONFIG_USB_HOST_ETHER
  425. /* try to recognize ethernet devices immediately */
  426. usb_ether_curr_dev = usb_host_eth_scan(1);
  427. #endif
  428. #ifdef CONFIG_USB_KEYBOARD
  429. drv_usb_kbd_init();
  430. #endif
  431. }
  432. return 0;
  433. }
  434. if (strncmp(argv[1], "stop", 4) == 0) {
  435. #ifdef CONFIG_USB_KEYBOARD
  436. if (argc == 2) {
  437. if (usb_kbd_deregister() != 0) {
  438. printf("USB not stopped: usbkbd still"
  439. " using USB\n");
  440. return 1;
  441. }
  442. } else {
  443. /* forced stop, switch console in to serial */
  444. console_assign(stdin, "serial");
  445. usb_kbd_deregister();
  446. }
  447. #endif
  448. printf("stopping USB..\n");
  449. usb_stop();
  450. return 0;
  451. }
  452. if (!usb_started) {
  453. printf("USB is stopped. Please issue 'usb start' first.\n");
  454. return 1;
  455. }
  456. if (strncmp(argv[1], "tree", 4) == 0) {
  457. puts("USB device tree:\n");
  458. for (i = 0; i < USB_MAX_DEVICE; i++) {
  459. dev = usb_get_dev_index(i);
  460. if (dev == NULL)
  461. break;
  462. if (dev->parent == NULL)
  463. usb_show_tree(dev);
  464. }
  465. return 0;
  466. }
  467. if (strncmp(argv[1], "inf", 3) == 0) {
  468. int d;
  469. if (argc == 2) {
  470. for (d = 0; d < USB_MAX_DEVICE; d++) {
  471. dev = usb_get_dev_index(d);
  472. if (dev == NULL)
  473. break;
  474. usb_display_desc(dev);
  475. usb_display_config(dev);
  476. }
  477. return 0;
  478. } else {
  479. i = simple_strtoul(argv[2], NULL, 10);
  480. printf("config for device %d\n", i);
  481. dev = usb_find_device(i);
  482. if (dev == NULL) {
  483. printf("*** No device available ***\n");
  484. return 0;
  485. } else {
  486. usb_display_desc(dev);
  487. usb_display_config(dev);
  488. }
  489. }
  490. return 0;
  491. }
  492. if (strncmp(argv[1], "test", 4) == 0) {
  493. if (argc < 5)
  494. return CMD_RET_USAGE;
  495. i = simple_strtoul(argv[2], NULL, 10);
  496. dev = usb_find_device(i);
  497. if (dev == NULL) {
  498. printf("Device %d does not exist.\n", i);
  499. return 1;
  500. }
  501. i = simple_strtoul(argv[3], NULL, 10);
  502. return usb_test(dev, i, argv[4]);
  503. }
  504. #ifdef CONFIG_USB_STORAGE
  505. if (strncmp(argv[1], "stor", 4) == 0)
  506. return usb_stor_info();
  507. if (strncmp(argv[1], "part", 4) == 0) {
  508. int devno, ok = 0;
  509. if (argc == 2) {
  510. for (devno = 0; ; ++devno) {
  511. stor_dev = usb_stor_get_dev(devno);
  512. if (stor_dev == NULL)
  513. break;
  514. if (stor_dev->type != DEV_TYPE_UNKNOWN) {
  515. ok++;
  516. if (devno)
  517. printf("\n");
  518. debug("print_part of %x\n", devno);
  519. print_part(stor_dev);
  520. }
  521. }
  522. } else {
  523. devno = simple_strtoul(argv[2], NULL, 16);
  524. stor_dev = usb_stor_get_dev(devno);
  525. if (stor_dev != NULL &&
  526. stor_dev->type != DEV_TYPE_UNKNOWN) {
  527. ok++;
  528. debug("print_part of %x\n", devno);
  529. print_part(stor_dev);
  530. }
  531. }
  532. if (!ok) {
  533. printf("\nno USB devices available\n");
  534. return 1;
  535. }
  536. return 0;
  537. }
  538. if (strcmp(argv[1], "read") == 0) {
  539. if (usb_stor_curr_dev < 0) {
  540. printf("no current device selected\n");
  541. return 1;
  542. }
  543. if (argc == 5) {
  544. unsigned long addr = simple_strtoul(argv[2], NULL, 16);
  545. unsigned long blk = simple_strtoul(argv[3], NULL, 16);
  546. unsigned long cnt = simple_strtoul(argv[4], NULL, 16);
  547. unsigned long n;
  548. printf("\nUSB read: device %d block # %ld, count %ld"
  549. " ... ", usb_stor_curr_dev, blk, cnt);
  550. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  551. n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
  552. (ulong *)addr);
  553. printf("%ld blocks read: %s\n", n,
  554. (n == cnt) ? "OK" : "ERROR");
  555. if (n == cnt)
  556. return 0;
  557. return 1;
  558. }
  559. }
  560. if (strcmp(argv[1], "write") == 0) {
  561. if (usb_stor_curr_dev < 0) {
  562. printf("no current device selected\n");
  563. return 1;
  564. }
  565. if (argc == 5) {
  566. unsigned long addr = simple_strtoul(argv[2], NULL, 16);
  567. unsigned long blk = simple_strtoul(argv[3], NULL, 16);
  568. unsigned long cnt = simple_strtoul(argv[4], NULL, 16);
  569. unsigned long n;
  570. printf("\nUSB write: device %d block # %ld, count %ld"
  571. " ... ", usb_stor_curr_dev, blk, cnt);
  572. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  573. n = stor_dev->block_write(usb_stor_curr_dev, blk, cnt,
  574. (ulong *)addr);
  575. printf("%ld blocks write: %s\n", n,
  576. (n == cnt) ? "OK" : "ERROR");
  577. if (n == cnt)
  578. return 0;
  579. return 1;
  580. }
  581. }
  582. if (strncmp(argv[1], "dev", 3) == 0) {
  583. if (argc == 3) {
  584. int dev = (int)simple_strtoul(argv[2], NULL, 10);
  585. printf("\nUSB device %d: ", dev);
  586. stor_dev = usb_stor_get_dev(dev);
  587. if (stor_dev == NULL) {
  588. printf("unknown device\n");
  589. return 1;
  590. }
  591. printf("\n Device %d: ", dev);
  592. dev_print(stor_dev);
  593. if (stor_dev->type == DEV_TYPE_UNKNOWN)
  594. return 1;
  595. usb_stor_curr_dev = dev;
  596. printf("... is now current device\n");
  597. return 0;
  598. } else {
  599. printf("\nUSB device %d: ", usb_stor_curr_dev);
  600. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  601. dev_print(stor_dev);
  602. if (stor_dev->type == DEV_TYPE_UNKNOWN)
  603. return 1;
  604. return 0;
  605. }
  606. return 0;
  607. }
  608. #endif /* CONFIG_USB_STORAGE */
  609. return CMD_RET_USAGE;
  610. }
  611. U_BOOT_CMD(
  612. usb, 5, 1, do_usb,
  613. "USB sub-system",
  614. "start - start (scan) USB controller\n"
  615. "usb reset - reset (rescan) USB controller\n"
  616. "usb stop [f] - stop USB [f]=force stop\n"
  617. "usb tree - show USB device tree\n"
  618. "usb info [dev] - show available USB devices\n"
  619. "usb test [dev] [port] [mode] - set USB 2.0 test mode\n"
  620. " (specify port 0 to indicate the device's upstream port)\n"
  621. " Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]\n"
  622. #ifdef CONFIG_USB_STORAGE
  623. "usb storage - show details of USB storage devices\n"
  624. "usb dev [dev] - show or set current USB storage device\n"
  625. "usb part [dev] - print partition table of one or all USB storage"
  626. " devices\n"
  627. "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
  628. " to memory address `addr'\n"
  629. "usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'\n"
  630. " from memory address `addr'"
  631. #endif /* CONFIG_USB_STORAGE */
  632. );
  633. #ifdef CONFIG_USB_STORAGE
  634. U_BOOT_CMD(
  635. usbboot, 3, 1, do_usbboot,
  636. "boot from USB device",
  637. "loadAddr dev:part"
  638. );
  639. #endif /* CONFIG_USB_STORAGE */