[PATCH v7 16/24] usb: gadget: atmel_usba_udc: set endpoint capabilities
Anders Roxell <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
usb_gadget_ep_match_desc() reads the caps field and compares the wanted
packet size against maxpacket_limit. atmel_usba_udc sets neither, it only
sets maxpacket, so no endpoint matches after the dwc3 resync re-imports
epautoconf.c. Same problem dwc2 had in commit c5c4cc4c6b98 ("usb: gadget:
dwc2: Set endpoint capabilities via .caps field").
Set the capabilities like the kernel driver does, and use
usb_ep_set_maxpacket_limit() for the fifo size, like commit 6f9c431a2062
("usb: gadget: dwc2: Use usb_ep_set_maxpacket_limit() for fifo sizes").
Compile tested only.
Suggested-by: Mattijs Korpershoek <[email protected]>
Link: https://lore.kernel.org/u-boot/[email protected]/
Signed-off-by: Anders Roxell <[email protected]>
---
drivers/usb/gadget/atmel_usba_udc.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 52900ad654cf..bcbfe5272d5f 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1188,7 +1188,7 @@ static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata,
ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
ep->ep.ops = &usba_ep_ops;
ep->ep.name = pdata->ep[i].name;
- ep->ep.maxpacket = pdata->ep[i].fifo_size;
+ usb_ep_set_maxpacket_limit(&ep->ep, pdata->ep[i].fifo_size);
ep->fifo_size = ep->ep.maxpacket;
ep->udc = udc;
INIT_LIST_HEAD(&ep->queue);
@@ -1196,6 +1196,16 @@ static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata,
ep->index = pdata->ep[i].index;
ep->can_dma = pdata->ep[i].can_dma;
ep->can_isoc = pdata->ep[i].can_isoc;
+
+ if (i == 0) {
+ ep->ep.caps.type_control = 1;
+ } else {
+ ep->ep.caps.type_iso = ep->can_isoc;
+ ep->ep.caps.type_bulk = 1;
+ ep->ep.caps.type_int = 1;
+ }
+ ep->ep.caps.dir_in = 1;
+ ep->ep.caps.dir_out = 1;
if (i)
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
};
--
2.53.0