mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
dm: usb: Allow setting up a USB controller as a device/gadget
Some controllers support OTG (on-the-go) where they can operate as either host or device. The gadget layer in U-Boot supports this. While this layer does not interact with driver model, we can provide a function which sets up the controller in the correct way. This way the code at least builds (although it likely will not work). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
@@ -249,6 +249,30 @@ int usb_legacy_port_reset(struct usb_device *parent, int portnr)
|
||||
return usb_port_reset(parent, portnr);
|
||||
}
|
||||
|
||||
int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
|
||||
{
|
||||
struct usb_platdata *plat;
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
/* Find the old device and remove it */
|
||||
ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = device_remove(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
plat = dev_get_platdata(dev);
|
||||
plat->init_type = USB_INIT_DEVICE;
|
||||
ret = device_probe(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
*ctlrp = dev_get_priv(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* returns 0 if no match, 1 if match */
|
||||
int usb_match_device(const struct usb_device_descriptor *desc,
|
||||
const struct usb_device_id *id)
|
||||
|
Reference in New Issue
Block a user