The resynced epautoconf.c matches endpoints on the caps field, not on the
name. ci_udc never fills caps in, so usb_ep_autoconfig() finds no endpoint
after the resync.

ci_udc keeps its endpoints in a static table, so set caps and
maxpacket_limit there instead of calling usb_ep_set_maxpacket_limit().

The names say what each endpoint is: ep1in-bulk, ep2out-bulk and
ep3in-int are fixed type and direction. Entry 4 is the template for
ep4 and up, those are free, so let them take any type and direction.

Tested on an i.MX93 board with ums.

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/ci_udc.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 87194601f67a..69616b16b052 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -121,28 +121,57 @@ __weak void ci_init_after_reset(struct ehci_ctrl *ctrl)
 static const struct usb_ep ci_ep_init[5] = {
        [0] = { /* EP 0 */
                .maxpacket      = 64,
+               .maxpacket_limit = 64,
                .name           = "ep0",
                .ops            = &ci_ep_ops,
+               .caps           = {
+                       .type_control   = 1,
+                       .dir_in         = 1,
+                       .dir_out        = 1,
+               },
        },
        [1] = {
                .maxpacket      = 512,
+               .maxpacket_limit = 512,
                .name           = "ep1in-bulk",
                .ops            = &ci_ep_ops,
+               .caps           = {
+                       .type_bulk      = 1,
+                       .dir_in         = 1,
+               },
        },
        [2] = {
                .maxpacket      = 512,
+               .maxpacket_limit = 512,
                .name           = "ep2out-bulk",
                .ops            = &ci_ep_ops,
+               .caps           = {
+                       .type_bulk      = 1,
+                       .dir_out        = 1,
+               },
        },
        [3] = {
                .maxpacket      = 512,
+               .maxpacket_limit = 512,
                .name           = "ep3in-int",
                .ops            = &ci_ep_ops,
+               .caps           = {
+                       .type_int       = 1,
+                       .dir_in         = 1,
+               },
        },
        [4] = {
                .maxpacket      = 512,
+               .maxpacket_limit = 512,
                .name           = "ep-",
                .ops            = &ci_ep_ops,
+               .caps           = {
+                       .type_iso       = 1,
+                       .type_bulk      = 1,
+                       .type_int       = 1,
+                       .dir_in         = 1,
+                       .dir_out        = 1,
+               },
        },
 };
 
-- 
2.53.0

Reply via email to