mtu3 already uses usb_ep_set_maxpacket_limit(), so only the caps field is
missing. Without it usb_gadget_ep_match_desc() finds no endpoint after
the dwc3 resync.

Set the capabilities like the kernel driver does.

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/mtu3/mtu3_gadget.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index da633faae7b2..f209bf47d073 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -591,10 +591,20 @@ static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep 
*mep,
        /* initialize maxpacket as SS */
        if (!epnum) {
                usb_ep_set_maxpacket_limit(&mep->ep, USB_HS_MAXP);
+               mep->ep.caps.type_control = 1;
+               mep->ep.caps.dir_in = 1;
+               mep->ep.caps.dir_out = 1;
                mep->ep.ops = &mtu3_ep0_ops;
                mtu->g.ep0 = &mep->ep;
        } else {
                usb_ep_set_maxpacket_limit(&mep->ep, USB_SS_MAXP);
+               mep->ep.caps.type_iso = 1;
+               mep->ep.caps.type_bulk = 1;
+               mep->ep.caps.type_int = 1;
+               if (is_in)
+                       mep->ep.caps.dir_in = 1;
+               else
+                       mep->ep.caps.dir_out = 1;
                mep->ep.ops = &mtu3_ep_ops;
                list_add_tail(&mep->ep.ep_list, &mtu->g.ep_list);
        }
-- 
2.53.0

Reply via email to