Using the i.MX 8XLite System-on-Module by SolidRun on a custom base board here. U-Boot is on branch lf_v2022.04 with few patches by SolidRun on top. This is the latest code provided by SolidRun for this SoM.
The USB OTG features work fine with `CONFIG_LOG_MAX_LEVEL` up to 6.
For log level >= 7 calling `usb_gadget_initialize()` leads to a crash/exception when `ci_udc_otg_probe()` calls `pinctrl_select_state(&priv->otgdev, "default")`. This happens for example when typing 'ums 0 mmc 0' or 'fastboot usb 0' in U-Boot console.
See console log output, here with some instrumentational log messages added:
drivers/usb/gadget/ci_udc.c:1427- ci_udc_otg_probe() ci-udc-otg usbg1: entering ci_udc_otg_probe()
drivers/usb/gadget/ci_udc.c:1428- ci_udc_otg_probe() ci-udc-otg usbg1: priv: 00000000bd876aa0
drivers/usb/gadget/ci_udc.c:1430- ci_udc_otg_probe() ci-udc-otg usbg1: calling devfdt_get_addr(00000000bd876c20)
drivers/usb/gadget/ci_udc.c:1432- ci_udc_otg_probe() ci-udc-otg usbg1: ehci: 000000005b0d0000
drivers/usb/gadget/ci_udc.c:1434- ci_udc_otg_probe() ci-udc-otg usbg1: calling pinctrl_select_state(00000000bd876c20, "default")
"Synchronous Abort" handler, esr 0x96000007
elr: 00000000800719bc lr : 0000000080084b38 (reloc)
elr: 00000000bfcb89bc lr : 00000000bfccbb38
x0 : 00000000bd876c20 x1 : 00000000bfd15e50
x2 : 0000000000000000 x3 : 00000000bd864f18
x4 : 00000000ffffffff x5 : 00000000bd864f18
x6 : 00000000ffffffff x7 : 0000000000000009
x8 : 000000000000002c x9 : 0000000000000008
x10: 00000000bfd01c66 x11: 0000000000000002
x12: 0000000000002080 x13: 0000000000000000
x14: 0000000000000000 x15: 00000000bfc67e50
x16: 0000000000000000 x17: 0000000000000000
x18: 00000000bd864d70 x19: 00000000bd876c20
x20: 00000000bfd15e50 x21: 00000000bd876aa0
x22: 00000000bd876c20 x23: 000000005b0d0000
x24: 00000000bfd03e78 x25: 00000000bfd1f178
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 00000000800200d0
Code: aa0003f3 aa0103f4 b40004a0 f9400002 (b9400840)
Resetting CPU ...
### ERROR ### Please RESET the board ###
I consider this a bug introduced by NXP in the downstream changes to the ci-udc-otg driver, especially the dm support added with Git commit v2022.04-313-g316a3cb4c2b ("MLK-22336-1 usb: ci_udc: Convert driver to DM_USB_GADGET"), already committed back in 2019 by Sherry Sun, but that never made it to mainline U-Boot.
I suspect the member `struct udevice otgdev` in the priv struct of the driver is not correctly initialized? Is this forum the right place to discuss those issues?
Where should such bugs be reported? Will those driver changes eventually be upstreamed to mainline U-Boot master?