cmd_usb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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. static int do_usb_stop_keyboard(int force)
  402. {
  403. #ifdef CONFIG_USB_KEYBOARD
  404. if (usb_kbd_deregister(force) != 0) {
  405. printf("USB not stopped: usbkbd still using USB\n");
  406. return 1;
  407. }
  408. #endif
  409. return 0;
  410. }
  411. /******************************************************************************
  412. * usb command intepreter
  413. */
  414. static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  415. {
  416. int i;
  417. struct usb_device *dev = NULL;
  418. extern char usb_started;
  419. #ifdef CONFIG_USB_STORAGE
  420. block_dev_desc_t *stor_dev;
  421. #endif
  422. if (argc < 2)
  423. return CMD_RET_USAGE;
  424. if ((strncmp(argv[1], "reset", 5) == 0) ||
  425. (strncmp(argv[1], "start", 5) == 0)) {
  426. bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
  427. if (do_usb_stop_keyboard(1) != 0)
  428. return 1;
  429. usb_stop();
  430. printf("(Re)start USB...\n");
  431. if (usb_init() >= 0) {
  432. #ifdef CONFIG_USB_STORAGE
  433. /* try to recognize storage devices immediately */
  434. usb_stor_curr_dev = usb_stor_scan(1);
  435. #endif
  436. #ifdef CONFIG_USB_HOST_ETHER
  437. /* try to recognize ethernet devices immediately */
  438. usb_ether_curr_dev = usb_host_eth_scan(1);
  439. #endif
  440. #ifdef CONFIG_USB_KEYBOARD
  441. drv_usb_kbd_init();
  442. #endif
  443. }
  444. return 0;
  445. }
  446. if (strncmp(argv[1], "stop", 4) == 0) {
  447. if (argc != 2)
  448. console_assign(stdin, "serial");
  449. if (do_usb_stop_keyboard(0) != 0)
  450. return 1;
  451. printf("stopping USB..\n");
  452. usb_stop();
  453. return 0;
  454. }
  455. if (!usb_started) {
  456. printf("USB is stopped. Please issue 'usb start' first.\n");
  457. return 1;
  458. }
  459. if (strncmp(argv[1], "tree", 4) == 0) {
  460. puts("USB device tree:\n");
  461. for (i = 0; i < USB_MAX_DEVICE; i++) {
  462. dev = usb_get_dev_index(i);
  463. if (dev == NULL)
  464. break;
  465. if (dev->parent == NULL)
  466. usb_show_tree(dev);
  467. }
  468. return 0;
  469. }
  470. if (strncmp(argv[1], "inf", 3) == 0) {
  471. int d;
  472. if (argc == 2) {
  473. for (d = 0; d < USB_MAX_DEVICE; d++) {
  474. dev = usb_get_dev_index(d);
  475. if (dev == NULL)
  476. break;
  477. usb_display_desc(dev);
  478. usb_display_config(dev);
  479. }
  480. return 0;
  481. } else {
  482. i = simple_strtoul(argv[2], NULL, 10);
  483. printf("config for device %d\n", i);
  484. dev = usb_find_device(i);
  485. if (dev == NULL) {
  486. printf("*** No device available ***\n");
  487. return 0;
  488. } else {
  489. usb_display_desc(dev);
  490. usb_display_config(dev);
  491. }
  492. }
  493. return 0;
  494. }
  495. if (strncmp(argv[1], "test", 4) == 0) {
  496. if (argc < 5)
  497. return CMD_RET_USAGE;
  498. i = simple_strtoul(argv[2], NULL, 10);
  499. dev = usb_find_device(i);
  500. if (dev == NULL) {
  501. printf("Device %d does not exist.\n", i);
  502. return 1;
  503. }
  504. i = simple_strtoul(argv[3], NULL, 10);
  505. return usb_test(dev, i, argv[4]);
  506. }
  507. #ifdef CONFIG_USB_STORAGE
  508. if (strncmp(argv[1], "stor", 4) == 0)
  509. return usb_stor_info();
  510. if (strncmp(argv[1], "part", 4) == 0) {
  511. int devno, ok = 0;
  512. if (argc == 2) {
  513. for (devno = 0; ; ++devno) {
  514. stor_dev = usb_stor_get_dev(devno);
  515. if (stor_dev == NULL)
  516. break;
  517. if (stor_dev->type != DEV_TYPE_UNKNOWN) {
  518. ok++;
  519. if (devno)
  520. printf("\n");
  521. debug("print_part of %x\n", devno);
  522. print_part(stor_dev);
  523. }
  524. }
  525. } else {
  526. devno = simple_strtoul(argv[2], NULL, 16);
  527. stor_dev = usb_stor_get_dev(devno);
  528. if (stor_dev != NULL &&
  529. stor_dev->type != DEV_TYPE_UNKNOWN) {
  530. ok++;
  531. debug("print_part of %x\n", devno);
  532. print_part(stor_dev);
  533. }
  534. }
  535. if (!ok) {
  536. printf("\nno USB devices available\n");
  537. return 1;
  538. }
  539. return 0;
  540. }
  541. if (strcmp(argv[1], "read") == 0) {
  542. if (usb_stor_curr_dev < 0) {
  543. printf("no current device selected\n");
  544. return 1;
  545. }
  546. if (argc == 5) {
  547. unsigned long addr = simple_strtoul(argv[2], NULL, 16);
  548. unsigned long blk = simple_strtoul(argv[3], NULL, 16);
  549. unsigned long cnt = simple_strtoul(argv[4], NULL, 16);
  550. unsigned long n;
  551. printf("\nUSB read: device %d block # %ld, count %ld"
  552. " ... ", usb_stor_curr_dev, blk, cnt);
  553. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  554. n = stor_dev->block_read(usb_stor_curr_dev, blk, cnt,
  555. (ulong *)addr);
  556. printf("%ld blocks read: %s\n", n,
  557. (n == cnt) ? "OK" : "ERROR");
  558. if (n == cnt)
  559. return 0;
  560. return 1;
  561. }
  562. }
  563. if (strcmp(argv[1], "write") == 0) {
  564. if (usb_stor_curr_dev < 0) {
  565. printf("no current device selected\n");
  566. return 1;
  567. }
  568. if (argc == 5) {
  569. unsigned long addr = simple_strtoul(argv[2], NULL, 16);
  570. unsigned long blk = simple_strtoul(argv[3], NULL, 16);
  571. unsigned long cnt = simple_strtoul(argv[4], NULL, 16);
  572. unsigned long n;
  573. printf("\nUSB write: device %d block # %ld, count %ld"
  574. " ... ", usb_stor_curr_dev, blk, cnt);
  575. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  576. n = stor_dev->block_write(usb_stor_curr_dev, blk, cnt,
  577. (ulong *)addr);
  578. printf("%ld blocks write: %s\n", n,
  579. (n == cnt) ? "OK" : "ERROR");
  580. if (n == cnt)
  581. return 0;
  582. return 1;
  583. }
  584. }
  585. if (strncmp(argv[1], "dev", 3) == 0) {
  586. if (argc == 3) {
  587. int dev = (int)simple_strtoul(argv[2], NULL, 10);
  588. printf("\nUSB device %d: ", dev);
  589. stor_dev = usb_stor_get_dev(dev);
  590. if (stor_dev == NULL) {
  591. printf("unknown device\n");
  592. return 1;
  593. }
  594. printf("\n Device %d: ", dev);
  595. dev_print(stor_dev);
  596. if (stor_dev->type == DEV_TYPE_UNKNOWN)
  597. return 1;
  598. usb_stor_curr_dev = dev;
  599. printf("... is now current device\n");
  600. return 0;
  601. } else {
  602. printf("\nUSB device %d: ", usb_stor_curr_dev);
  603. stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
  604. dev_print(stor_dev);
  605. if (stor_dev->type == DEV_TYPE_UNKNOWN)
  606. return 1;
  607. return 0;
  608. }
  609. return 0;
  610. }
  611. #endif /* CONFIG_USB_STORAGE */
  612. return CMD_RET_USAGE;
  613. }
  614. U_BOOT_CMD(
  615. usb, 5, 1, do_usb,
  616. "USB sub-system",
  617. "start - start (scan) USB controller\n"
  618. "usb reset - reset (rescan) USB controller\n"
  619. "usb stop [f] - stop USB [f]=force stop\n"
  620. "usb tree - show USB device tree\n"
  621. "usb info [dev] - show available USB devices\n"
  622. "usb test [dev] [port] [mode] - set USB 2.0 test mode\n"
  623. " (specify port 0 to indicate the device's upstream port)\n"
  624. " Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]\n"
  625. #ifdef CONFIG_USB_STORAGE
  626. "usb storage - show details of USB storage devices\n"
  627. "usb dev [dev] - show or set current USB storage device\n"
  628. "usb part [dev] - print partition table of one or all USB storage"
  629. " devices\n"
  630. "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
  631. " to memory address `addr'\n"
  632. "usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'\n"
  633. " from memory address `addr'"
  634. #endif /* CONFIG_USB_STORAGE */
  635. );
  636. #ifdef CONFIG_USB_STORAGE
  637. U_BOOT_CMD(
  638. usbboot, 3, 1, do_usbboot,
  639. "boot from USB device",
  640. "loadAddr dev:part"
  641. );
  642. #endif /* CONFIG_USB_STORAGE */