
Hi Adam,
On Thu, Dec 23, 2021 at 11:08 AM Adam Ford aford173@gmail.com wrote:
The imx8mm and imx8mn appear compatible with imx7d-usb flags in the OTG driver. If the dr_mode is defined as host or peripheral, the device appears to operate correctly, however the auto host/peripheral detection results in an error.
The solution isn't just adding checks for imx8mm and imx8mn to the check for imx7, because the USB clock needs to be running to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.
The init_type in both priv and plat data are the same, so it doesn't make sense to configure the data in the plat data and copy the data to priv when priv can be configured directly. Instead, rename ehci_usb_of_to_plat to ehci_usb_dr_mode and call it from the probe functions after the clocks are enabled, but before the data is required.
With that added, the additional checks for imx8mm and imx8mn will allow reading the register to automatically determine the state (host or device) of the OTG controller.
Signed-off-by: Adam Ford aford173@gmail.com
Tested "ums 0 mmc 0" on a imx7s-warp. It still works fine:
Tested-by: Fabio Estevam festevam@gmail.com