Hello,
After using the DWC3 USB controller both in U-boot and the Linux kernel for the AM5748 device I have several questions. Unfortunately I do not have the documentation of the Synopsis DWC3 IP, which I believe is only available under NDA. Therefore I would like to inform if my findings, after a lot of testing and debugging, are correct.
One of the major issues seen is that the configuring of the DWC3 in U-boot has an impact on the usage in the Linux environment. When the USB is used in U-boot, using an 'usb start', this has an impact on the configuration and usage in Linux. Eventually resulting in a kernel oops.
U-boot related questions:
1. In U-boot it seems like the device is always configured to be in peripheral mode if the utmi-mode is software (DWC3_OMAP_UTMI_MODE_SW). We want to use the device in USB host mode in U-boot, is there a reason it defaults to peripheral mode in the driver?
2. It seems 2 drivers are compiled in for some evaluation boards, but in the end only the dwc3-generic.c glue driver is used. Is the define in the board header file, as can be seen here, a left over?
3. In the Linux kernel driver the USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT flag has been removed as mentioned here. In U-boot this flag is still actively set here. Does this have an impact on the functionality of the device?
4. It seems cleanup functionality is completely missing before Linux is started. It seems like a USB configuration has been performed, but just before Linux boots using bootm, the usb_stop() call does not seem to do a proper cleanup. Is this a side effect of using the CLASS_NOP class for the glue layer or was this intentional?
Linux kernel related questions:
1. In the Linux driver I noticed that during the registration of the extcon driver, only two scenarios are checked. What I am missing here is the case when both if statements are not valid, in which case I guess dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); should be called to initialize the DWC3 for that specific case where VBUS is not valid. It is done like this in the dwc3_omap_vbus_notifier() function in case VBUS is not valid. This missing initialization seems to be causing trouble in our specific scenario, especially since the DWC3 had been configured in U-boot and it cannot be assumed in the Linux kernel none of the registers have been touched.
In case we boot Linux without using USB in U-boot we do not see any issues. Only after U-boot has configured the DWC3 registers, specifically the UTMI_OTG_STATUS register, issues start to occur during initialization. It seems specifically related to the missing dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); in the Linux kernel driver during initialization. Once that call is added in the driver, the issues do indeed disappear.
Before proposing such a change I would like to get feedback from TI, since as stated earlier I do not have sufficient documentation to judge if any of the above is absolutely correct.
Thank you in advance.
Kind regards,
Marcel