u-boot-dfu-20250425

Usb gadget:
- Fix ACM gadget release
- Allow ACM gadget restart after releasing it
- Add 'enabled' flag to usb_ep structure

DFU:
- Fix alt buffer clearing for DeveloperBox board
This commit is contained in:
Tom Rini
2025-04-24 10:44:17 -06:00
3 changed files with 30 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
struct mtd_info *mtd;
int ret;
memset(buf, 0, sizeof(buf));
memset(buf, 0, DFU_ALT_BUF_LEN);
mtd_probe_devices();

View File

@@ -238,18 +238,21 @@ static int acm_bind(struct usb_configuration *c, struct usb_function *f)
return -ENODEV;
f_acm->ep_in = ep;
ep->driver_data = c->cdev; /* claim */
ep = usb_ep_autoconfig(gadget, &acm_fs_out_desc);
if (!ep)
return -ENODEV;
f_acm->ep_out = ep;
ep->driver_data = c->cdev; /* claim */
ep = usb_ep_autoconfig(gadget, &acm_fs_notify_desc);
if (!ep)
return -ENODEV;
f_acm->ep_notify = ep;
ep->driver_data = c->cdev; /* claim */
if (gadget_is_dualspeed(gadget)) {
/* Assume endpoint addresses are the same for both speeds */
@@ -660,6 +663,7 @@ static int acm_stdio_stop(struct stdio_dev *dev)
{
g_dnl_unregister();
g_dnl_clear_detach();
dev->priv = NULL;
return 0;
}

View File

@@ -179,6 +179,7 @@ struct usb_ep {
const struct usb_ep_ops *ops;
struct list_head ep_list;
struct usb_ep_caps caps;
bool enabled;
unsigned maxpacket:16;
unsigned maxpacket_limit:16;
unsigned max_streams:16;
@@ -230,7 +231,18 @@ static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
static inline int usb_ep_enable(struct usb_ep *ep,
const struct usb_endpoint_descriptor *desc)
{
return ep->ops->enable(ep, desc);
int ret;
if (ep->enabled)
return 0;
ret = ep->ops->enable(ep, desc);
if (ret)
return ret;
ep->enabled = true;
return 0;
}
/**
@@ -247,7 +259,18 @@ static inline int usb_ep_enable(struct usb_ep *ep,
*/
static inline int usb_ep_disable(struct usb_ep *ep)
{
return ep->ops->disable(ep);
int ret;
if (!ep->enabled)
return 0;
ret = ep->ops->disable(ep);
if (ret)
return ret;
ep->enabled = false;
return 0;
}
/**