1 /* 2 * (C) Copyright 2015 Google, Inc 3 * Written by Simon Glass <sjg@chromium.org> 4 * 5 * usb_match_device() modified from Linux kernel v4.0. 6 * 7 * SPDX-License-Identifier: GPL-2.0+ 8 */ 9 10 #include <common.h> 11 #include <dm.h> 12 #include <errno.h> 13 #include <memalign.h> 14 #include <usb.h> 15 #include <dm/device-internal.h> 16 #include <dm/lists.h> 17 #include <dm/root.h> 18 #include <dm/uclass-internal.h> 19 20 DECLARE_GLOBAL_DATA_PTR; 21 22 extern bool usb_started; /* flag for the started/stopped USB status */ 23 static bool asynch_allowed; 24 25 struct usb_uclass_priv { 26 int companion_device_count; 27 }; 28 29 int usb_disable_asynch(int disable) 30 { 31 int old_value = asynch_allowed; 32 33 asynch_allowed = !disable; 34 return old_value; 35 } 36 37 int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer, 38 int length, int interval) 39 { 40 struct udevice *bus = udev->controller_dev; 41 struct dm_usb_ops *ops = usb_get_ops(bus); 42 43 if (!ops->interrupt) 44 return -ENOSYS; 45 46 return ops->interrupt(bus, udev, pipe, buffer, length, interval); 47 } 48 49 int submit_control_msg(struct usb_device *udev, unsigned long pipe, 50 void *buffer, int length, struct devrequest *setup) 51 { 52 struct udevice *bus = udev->controller_dev; 53 struct dm_usb_ops *ops = usb_get_ops(bus); 54 struct usb_uclass_priv *uc_priv = bus->uclass->priv; 55 int err; 56 57 if (!ops->control) 58 return -ENOSYS; 59 60 err = ops->control(bus, udev, pipe, buffer, length, setup); 61 if (setup->request == USB_REQ_SET_FEATURE && 62 setup->requesttype == USB_RT_PORT && 63 setup->value == cpu_to_le16(USB_PORT_FEAT_RESET) && 64 err == -ENXIO) { 65 /* Device handed over to companion after port reset */ 66 uc_priv->companion_device_count++; 67 } 68 69 return err; 70 } 71 72 int submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void *buffer, 73 int length) 74 { 75 struct udevice *bus = udev->controller_dev; 76 struct dm_usb_ops *ops = usb_get_ops(bus); 77 78 if (!ops->bulk) 79 return -ENOSYS; 80 81 return ops->bulk(bus, udev, pipe, buffer, length); 82 } 83 84 struct int_queue *create_int_queue(struct usb_device *udev, 85 unsigned long pipe, int queuesize, int elementsize, 86 void *buffer, int interval) 87 { 88 struct udevice *bus = udev->controller_dev; 89 struct dm_usb_ops *ops = usb_get_ops(bus); 90 91 if (!ops->create_int_queue) 92 return NULL; 93 94 return ops->create_int_queue(bus, udev, pipe, queuesize, elementsize, 95 buffer, interval); 96 } 97 98 void *poll_int_queue(struct usb_device *udev, struct int_queue *queue) 99 { 100 struct udevice *bus = udev->controller_dev; 101 struct dm_usb_ops *ops = usb_get_ops(bus); 102 103 if (!ops->poll_int_queue) 104 return NULL; 105 106 return ops->poll_int_queue(bus, udev, queue); 107 } 108 109 int destroy_int_queue(struct usb_device *udev, struct int_queue *queue) 110 { 111 struct udevice *bus = udev->controller_dev; 112 struct dm_usb_ops *ops = usb_get_ops(bus); 113 114 if (!ops->destroy_int_queue) 115 return -ENOSYS; 116 117 return ops->destroy_int_queue(bus, udev, queue); 118 } 119 120 int usb_alloc_device(struct usb_device *udev) 121 { 122 struct udevice *bus = udev->controller_dev; 123 struct dm_usb_ops *ops = usb_get_ops(bus); 124 125 /* This is only requird by some controllers - current XHCI */ 126 if (!ops->alloc_device) 127 return 0; 128 129 return ops->alloc_device(bus, udev); 130 } 131 132 int usb_reset_root_port(struct usb_device *udev) 133 { 134 struct udevice *bus = udev->controller_dev; 135 struct dm_usb_ops *ops = usb_get_ops(bus); 136 137 if (!ops->reset_root_port) 138 return -ENOSYS; 139 140 return ops->reset_root_port(bus, udev); 141 } 142 143 int usb_stop(void) 144 { 145 struct udevice *bus; 146 struct uclass *uc; 147 struct usb_uclass_priv *uc_priv; 148 int err = 0, ret; 149 150 /* De-activate any devices that have been activated */ 151 ret = uclass_get(UCLASS_USB, &uc); 152 if (ret) 153 return ret; 154 155 uc_priv = uc->priv; 156 157 uclass_foreach_dev(bus, uc) { 158 ret = device_remove(bus); 159 if (ret && !err) 160 err = ret; 161 } 162 163 #ifdef CONFIG_SANDBOX 164 struct udevice *dev; 165 166 /* Reset all enulation devices */ 167 ret = uclass_get(UCLASS_USB_EMUL, &uc); 168 if (ret) 169 return ret; 170 171 uclass_foreach_dev(dev, uc) 172 usb_emul_reset(dev); 173 #endif 174 #ifdef CONFIG_USB_STORAGE 175 usb_stor_reset(); 176 #endif 177 usb_hub_reset(); 178 uc_priv->companion_device_count = 0; 179 usb_started = 0; 180 181 return err; 182 } 183 184 static void usb_scan_bus(struct udevice *bus, bool recurse) 185 { 186 struct usb_bus_priv *priv; 187 struct udevice *dev; 188 int ret; 189 190 priv = dev_get_uclass_priv(bus); 191 192 assert(recurse); /* TODO: Support non-recusive */ 193 194 printf("scanning bus %d for devices... ", bus->seq); 195 debug("\n"); 196 ret = usb_scan_device(bus, 0, USB_SPEED_FULL, &dev); 197 if (ret) 198 printf("failed, error %d\n", ret); 199 else if (priv->next_addr == 0) 200 printf("No USB Device found\n"); 201 else 202 printf("%d USB Device(s) found\n", priv->next_addr); 203 } 204 205 int usb_init(void) 206 { 207 int controllers_initialized = 0; 208 struct usb_uclass_priv *uc_priv; 209 struct usb_bus_priv *priv; 210 struct udevice *bus; 211 struct uclass *uc; 212 int count = 0; 213 int ret; 214 215 asynch_allowed = 1; 216 usb_hub_reset(); 217 218 ret = uclass_get(UCLASS_USB, &uc); 219 if (ret) 220 return ret; 221 222 uc_priv = uc->priv; 223 224 uclass_foreach_dev(bus, uc) { 225 /* init low_level USB */ 226 printf("USB%d: ", count); 227 count++; 228 ret = device_probe(bus); 229 if (ret == -ENODEV) { /* No such device. */ 230 puts("Port not available.\n"); 231 controllers_initialized++; 232 continue; 233 } 234 235 if (ret) { /* Other error. */ 236 printf("probe failed, error %d\n", ret); 237 continue; 238 } 239 controllers_initialized++; 240 usb_started = true; 241 } 242 243 /* 244 * lowlevel init done, now scan the bus for devices i.e. search HUBs 245 * and configure them, first scan primary controllers. 246 */ 247 uclass_foreach_dev(bus, uc) { 248 if (!device_active(bus)) 249 continue; 250 251 priv = dev_get_uclass_priv(bus); 252 if (!priv->companion) 253 usb_scan_bus(bus, true); 254 } 255 256 /* 257 * Now that the primary controllers have been scanned and have handed 258 * over any devices they do not understand to their companions, scan 259 * the companions if necessary. 260 */ 261 if (uc_priv->companion_device_count) { 262 uclass_foreach_dev(bus, uc) { 263 if (!device_active(bus)) 264 continue; 265 266 priv = dev_get_uclass_priv(bus); 267 if (priv->companion) 268 usb_scan_bus(bus, true); 269 } 270 } 271 272 debug("scan end\n"); 273 /* if we were not able to find at least one working bus, bail out */ 274 if (!count) 275 printf("No controllers found\n"); 276 else if (controllers_initialized == 0) 277 printf("USB error: all controllers failed lowlevel init\n"); 278 279 return usb_started ? 0 : -1; 280 } 281 282 static struct usb_device *find_child_devnum(struct udevice *parent, int devnum) 283 { 284 struct usb_device *udev; 285 struct udevice *dev; 286 287 if (!device_active(parent)) 288 return NULL; 289 udev = dev_get_parent_priv(parent); 290 if (udev->devnum == devnum) 291 return udev; 292 293 for (device_find_first_child(parent, &dev); 294 dev; 295 device_find_next_child(&dev)) { 296 udev = find_child_devnum(dev, devnum); 297 if (udev) 298 return udev; 299 } 300 301 return NULL; 302 } 303 304 struct usb_device *usb_get_dev_index(struct udevice *bus, int index) 305 { 306 struct udevice *dev; 307 int devnum = index + 1; /* Addresses are allocated from 1 on USB */ 308 309 device_find_first_child(bus, &dev); 310 if (!dev) 311 return NULL; 312 313 return find_child_devnum(dev, devnum); 314 } 315 316 int usb_post_bind(struct udevice *dev) 317 { 318 /* Scan the bus for devices */ 319 return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false); 320 } 321 322 int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) 323 { 324 struct usb_platdata *plat; 325 struct udevice *dev; 326 int ret; 327 328 /* Find the old device and remove it */ 329 ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev); 330 if (ret) 331 return ret; 332 ret = device_remove(dev); 333 if (ret) 334 return ret; 335 336 plat = dev_get_platdata(dev); 337 plat->init_type = USB_INIT_DEVICE; 338 ret = device_probe(dev); 339 if (ret) 340 return ret; 341 *ctlrp = dev_get_priv(dev); 342 343 return 0; 344 } 345 346 /* returns 0 if no match, 1 if match */ 347 int usb_match_device(const struct usb_device_descriptor *desc, 348 const struct usb_device_id *id) 349 { 350 if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && 351 id->idVendor != le16_to_cpu(desc->idVendor)) 352 return 0; 353 354 if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && 355 id->idProduct != le16_to_cpu(desc->idProduct)) 356 return 0; 357 358 /* No need to test id->bcdDevice_lo != 0, since 0 is never 359 greater than any unsigned number. */ 360 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && 361 (id->bcdDevice_lo > le16_to_cpu(desc->bcdDevice))) 362 return 0; 363 364 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && 365 (id->bcdDevice_hi < le16_to_cpu(desc->bcdDevice))) 366 return 0; 367 368 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && 369 (id->bDeviceClass != desc->bDeviceClass)) 370 return 0; 371 372 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && 373 (id->bDeviceSubClass != desc->bDeviceSubClass)) 374 return 0; 375 376 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && 377 (id->bDeviceProtocol != desc->bDeviceProtocol)) 378 return 0; 379 380 return 1; 381 } 382 383 /* returns 0 if no match, 1 if match */ 384 int usb_match_one_id_intf(const struct usb_device_descriptor *desc, 385 const struct usb_interface_descriptor *int_desc, 386 const struct usb_device_id *id) 387 { 388 /* The interface class, subclass, protocol and number should never be 389 * checked for a match if the device class is Vendor Specific, 390 * unless the match record specifies the Vendor ID. */ 391 if (desc->bDeviceClass == USB_CLASS_VENDOR_SPEC && 392 !(id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && 393 (id->match_flags & (USB_DEVICE_ID_MATCH_INT_CLASS | 394 USB_DEVICE_ID_MATCH_INT_SUBCLASS | 395 USB_DEVICE_ID_MATCH_INT_PROTOCOL | 396 USB_DEVICE_ID_MATCH_INT_NUMBER))) 397 return 0; 398 399 if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) && 400 (id->bInterfaceClass != int_desc->bInterfaceClass)) 401 return 0; 402 403 if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) && 404 (id->bInterfaceSubClass != int_desc->bInterfaceSubClass)) 405 return 0; 406 407 if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) && 408 (id->bInterfaceProtocol != int_desc->bInterfaceProtocol)) 409 return 0; 410 411 if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER) && 412 (id->bInterfaceNumber != int_desc->bInterfaceNumber)) 413 return 0; 414 415 return 1; 416 } 417 418 /* returns 0 if no match, 1 if match */ 419 int usb_match_one_id(struct usb_device_descriptor *desc, 420 struct usb_interface_descriptor *int_desc, 421 const struct usb_device_id *id) 422 { 423 if (!usb_match_device(desc, id)) 424 return 0; 425 426 return usb_match_one_id_intf(desc, int_desc, id); 427 } 428 429 /** 430 * usb_find_and_bind_driver() - Find and bind the right USB driver 431 * 432 * This only looks at certain fields in the descriptor. 433 */ 434 static int usb_find_and_bind_driver(struct udevice *parent, 435 struct usb_device_descriptor *desc, 436 struct usb_interface_descriptor *iface, 437 int bus_seq, int devnum, 438 struct udevice **devp) 439 { 440 struct usb_driver_entry *start, *entry; 441 int n_ents; 442 int ret; 443 char name[30], *str; 444 445 *devp = NULL; 446 debug("%s: Searching for driver\n", __func__); 447 start = ll_entry_start(struct usb_driver_entry, usb_driver_entry); 448 n_ents = ll_entry_count(struct usb_driver_entry, usb_driver_entry); 449 for (entry = start; entry != start + n_ents; entry++) { 450 const struct usb_device_id *id; 451 struct udevice *dev; 452 const struct driver *drv; 453 struct usb_dev_platdata *plat; 454 455 for (id = entry->match; id->match_flags; id++) { 456 if (!usb_match_one_id(desc, iface, id)) 457 continue; 458 459 drv = entry->driver; 460 /* 461 * We could pass the descriptor to the driver as 462 * platdata (instead of NULL) and allow its bind() 463 * method to return -ENOENT if it doesn't support this 464 * device. That way we could continue the search to 465 * find another driver. For now this doesn't seem 466 * necesssary, so just bind the first match. 467 */ 468 ret = device_bind(parent, drv, drv->name, NULL, -1, 469 &dev); 470 if (ret) 471 goto error; 472 debug("%s: Match found: %s\n", __func__, drv->name); 473 dev->driver_data = id->driver_info; 474 plat = dev_get_parent_platdata(dev); 475 plat->id = *id; 476 *devp = dev; 477 return 0; 478 } 479 } 480 481 /* Bind a generic driver so that the device can be used */ 482 snprintf(name, sizeof(name), "generic_bus_%x_dev_%x", bus_seq, devnum); 483 str = strdup(name); 484 if (!str) 485 return -ENOMEM; 486 ret = device_bind_driver(parent, "usb_dev_generic_drv", str, devp); 487 488 error: 489 debug("%s: No match found: %d\n", __func__, ret); 490 return ret; 491 } 492 493 /** 494 * usb_find_child() - Find an existing device which matches our needs 495 * 496 * 497 */ 498 static int usb_find_child(struct udevice *parent, 499 struct usb_device_descriptor *desc, 500 struct usb_interface_descriptor *iface, 501 struct udevice **devp) 502 { 503 struct udevice *dev; 504 505 *devp = NULL; 506 for (device_find_first_child(parent, &dev); 507 dev; 508 device_find_next_child(&dev)) { 509 struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); 510 511 /* If this device is already in use, skip it */ 512 if (device_active(dev)) 513 continue; 514 debug(" %s: name='%s', plat=%d, desc=%d\n", __func__, 515 dev->name, plat->id.bDeviceClass, desc->bDeviceClass); 516 if (usb_match_one_id(desc, iface, &plat->id)) { 517 *devp = dev; 518 return 0; 519 } 520 } 521 522 return -ENOENT; 523 } 524 525 int usb_scan_device(struct udevice *parent, int port, 526 enum usb_device_speed speed, struct udevice **devp) 527 { 528 struct udevice *dev; 529 bool created = false; 530 struct usb_dev_platdata *plat; 531 struct usb_bus_priv *priv; 532 struct usb_device *parent_udev; 533 int ret; 534 ALLOC_CACHE_ALIGN_BUFFER(struct usb_device, udev, 1); 535 struct usb_interface_descriptor *iface = &udev->config.if_desc[0].desc; 536 537 *devp = NULL; 538 memset(udev, '\0', sizeof(*udev)); 539 udev->controller_dev = usb_get_bus(parent); 540 priv = dev_get_uclass_priv(udev->controller_dev); 541 542 /* 543 * Somewhat nasty, this. We create a local device and use the normal 544 * USB stack to read its descriptor. Then we know what type of device 545 * to create for real. 546 * 547 * udev->dev is set to the parent, since we don't have a real device 548 * yet. The USB stack should not access udev.dev anyway, except perhaps 549 * to find the controller, and the controller will either be @parent, 550 * or some parent of @parent. 551 * 552 * Another option might be to create the device as a generic USB 553 * device, then morph it into the correct one when we know what it 554 * should be. This means that a generic USB device would morph into 555 * a network controller, or a USB flash stick, for example. However, 556 * we don't support such morphing and it isn't clear that it would 557 * be easy to do. 558 * 559 * Yet another option is to split out the USB stack parts of udev 560 * into something like a 'struct urb' (as Linux does) which can exist 561 * independently of any device. This feels cleaner, but calls for quite 562 * a big change to the USB stack. 563 * 564 * For now, the approach is to set up an empty udev, read its 565 * descriptor and assign it an address, then bind a real device and 566 * stash the resulting information into the device's parent 567 * platform data. Then when we probe it, usb_child_pre_probe() is called 568 * and it will pull the information out of the stash. 569 */ 570 udev->dev = parent; 571 udev->speed = speed; 572 udev->devnum = priv->next_addr + 1; 573 udev->portnr = port; 574 debug("Calling usb_setup_device(), portnr=%d\n", udev->portnr); 575 parent_udev = device_get_uclass_id(parent) == UCLASS_USB_HUB ? 576 dev_get_parent_priv(parent) : NULL; 577 ret = usb_setup_device(udev, priv->desc_before_addr, parent_udev); 578 debug("read_descriptor for '%s': ret=%d\n", parent->name, ret); 579 if (ret) 580 return ret; 581 ret = usb_find_child(parent, &udev->descriptor, iface, &dev); 582 debug("** usb_find_child returns %d\n", ret); 583 if (ret) { 584 if (ret != -ENOENT) 585 return ret; 586 ret = usb_find_and_bind_driver(parent, &udev->descriptor, iface, 587 udev->controller_dev->seq, 588 udev->devnum, &dev); 589 if (ret) 590 return ret; 591 created = true; 592 } 593 plat = dev_get_parent_platdata(dev); 594 debug("%s: Probing '%s', plat=%p\n", __func__, dev->name, plat); 595 plat->devnum = udev->devnum; 596 plat->udev = udev; 597 priv->next_addr++; 598 ret = device_probe(dev); 599 if (ret) { 600 debug("%s: Device '%s' probe failed\n", __func__, dev->name); 601 priv->next_addr--; 602 if (created) 603 device_unbind(dev); 604 return ret; 605 } 606 *devp = dev; 607 608 return 0; 609 } 610 611 /* 612 * Detect if a USB device has been plugged or unplugged. 613 */ 614 int usb_detect_change(void) 615 { 616 struct udevice *hub; 617 struct uclass *uc; 618 int change = 0; 619 int ret; 620 621 ret = uclass_get(UCLASS_USB_HUB, &uc); 622 if (ret) 623 return ret; 624 625 uclass_foreach_dev(hub, uc) { 626 struct usb_device *udev; 627 struct udevice *dev; 628 629 if (!device_active(hub)) 630 continue; 631 for (device_find_first_child(hub, &dev); 632 dev; 633 device_find_next_child(&dev)) { 634 struct usb_port_status status; 635 636 if (!device_active(dev)) 637 continue; 638 639 udev = dev_get_parent_priv(dev); 640 if (usb_get_port_status(udev, udev->portnr, &status) 641 < 0) 642 /* USB request failed */ 643 continue; 644 645 if (le16_to_cpu(status.wPortChange) & 646 USB_PORT_STAT_C_CONNECTION) 647 change++; 648 } 649 } 650 651 return change; 652 } 653 654 int usb_child_post_bind(struct udevice *dev) 655 { 656 struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); 657 const void *blob = gd->fdt_blob; 658 int val; 659 660 if (dev->of_offset == -1) 661 return 0; 662 663 /* We only support matching a few things */ 664 val = fdtdec_get_int(blob, dev->of_offset, "usb,device-class", -1); 665 if (val != -1) { 666 plat->id.match_flags |= USB_DEVICE_ID_MATCH_DEV_CLASS; 667 plat->id.bDeviceClass = val; 668 } 669 val = fdtdec_get_int(blob, dev->of_offset, "usb,interface-class", -1); 670 if (val != -1) { 671 plat->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS; 672 plat->id.bInterfaceClass = val; 673 } 674 675 return 0; 676 } 677 678 struct udevice *usb_get_bus(struct udevice *dev) 679 { 680 struct udevice *bus; 681 682 for (bus = dev; bus && device_get_uclass_id(bus) != UCLASS_USB; ) 683 bus = bus->parent; 684 if (!bus) { 685 /* By design this cannot happen */ 686 assert(bus); 687 debug("USB HUB '%s' does not have a controller\n", dev->name); 688 } 689 690 return bus; 691 } 692 693 int usb_child_pre_probe(struct udevice *dev) 694 { 695 struct usb_device *udev = dev_get_parent_priv(dev); 696 struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); 697 int ret; 698 699 if (plat->udev) { 700 /* 701 * Copy over all the values set in the on stack struct 702 * usb_device in usb_scan_device() to our final struct 703 * usb_device for this dev. 704 */ 705 *udev = *(plat->udev); 706 /* And clear plat->udev as it will not be valid for long */ 707 plat->udev = NULL; 708 udev->dev = dev; 709 } else { 710 /* 711 * This happens with devices which are explicitly bound 712 * instead of being discovered through usb_scan_device() 713 * such as sandbox emul devices. 714 */ 715 udev->dev = dev; 716 udev->controller_dev = usb_get_bus(dev); 717 udev->devnum = plat->devnum; 718 719 /* 720 * udev did not go through usb_scan_device(), so we need to 721 * select the config and read the config descriptors. 722 */ 723 ret = usb_select_config(udev); 724 if (ret) 725 return ret; 726 } 727 728 return 0; 729 } 730 731 UCLASS_DRIVER(usb) = { 732 .id = UCLASS_USB, 733 .name = "usb", 734 .flags = DM_UC_FLAG_SEQ_ALIAS, 735 .post_bind = usb_post_bind, 736 .priv_auto_alloc_size = sizeof(struct usb_uclass_priv), 737 .per_child_auto_alloc_size = sizeof(struct usb_device), 738 .per_device_auto_alloc_size = sizeof(struct usb_bus_priv), 739 .child_post_bind = usb_child_post_bind, 740 .child_pre_probe = usb_child_pre_probe, 741 .per_child_platdata_auto_alloc_size = sizeof(struct usb_dev_platdata), 742 }; 743 744 UCLASS_DRIVER(usb_dev_generic) = { 745 .id = UCLASS_USB_DEV_GENERIC, 746 .name = "usb_dev_generic", 747 }; 748 749 U_BOOT_DRIVER(usb_dev_generic_drv) = { 750 .id = UCLASS_USB_DEV_GENERIC, 751 .name = "usb_dev_generic_drv", 752 }; 753