[PATCH v7 20/24] usb: musb-new: set endpoint capabilities
Anders Roxell <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
musb-new sets maxpacket directly and leaves caps empty, so usb_gadget_ep_match_desc() rejects every endpoint once epautoconf.c comes from the kernel. The shared fifo endpoints need both directions, the others only the one they are wired for. The kernel driver already gets this right. Take the caps and the usb_ep_set_maxpacket_limit() calls from the kernel driver. 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/musb-new/musb_gadget.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c index 7daff5850f19..cb55f9ab458e 100644 --- a/drivers/usb/musb-new/musb_gadget.c +++ b/drivers/usb/musb-new/musb_gadget.c @@ -1841,17 +1841,32 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) ep->end_point.name = ep->name; INIT_LIST_HEAD(&ep->end_point.ep_list); if (!epnum) { - ep->end_point.maxpacket = 64; + usb_ep_set_maxpacket_limit(&ep->end_point, 64); + ep->end_point.caps.type_control = 1; ep->end_point.ops = &musb_g_ep0_ops; musb->g.ep0 = &ep->end_point; } else { if (is_in) - ep->end_point.maxpacket = hw_ep->max_packet_sz_tx; + usb_ep_set_maxpacket_limit(&ep->end_point, + hw_ep->max_packet_sz_tx); else - ep->end_point.maxpacket = hw_ep->max_packet_sz_rx; + usb_ep_set_maxpacket_limit(&ep->end_point, + hw_ep->max_packet_sz_rx); + ep->end_point.caps.type_iso = 1; + ep->end_point.caps.type_bulk = 1; + ep->end_point.caps.type_int = 1; ep->end_point.ops = &musb_ep_ops; list_add_tail(&ep->end_point.ep_list, &musb->g.ep_list); } + + if (!epnum || hw_ep->is_shared_fifo) { + ep->end_point.caps.dir_in = 1; + ep->end_point.caps.dir_out = 1; + } else if (is_in) { + ep->end_point.caps.dir_in = 1; + } else { + ep->end_point.caps.dir_out = 1; + } } /* -- 2.53.0