MLK-20057 usb: ehci-mx6: Fix usb type issue in DM driver
authorYe Li <ye.li@nxp.com>
Wed, 24 Oct 2018 08:08:26 +0000 (01:08 -0700)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 09:39:09 +0000 (02:39 -0700)
commit77f25be0d6ddea71fc28ecc08c8f5477054208d0
tree6e5a8088d1074a03d683bdbf2fe99725408f9611
parent1e48d07ea18ed0e6a6539c2b10613472bec11174
MLK-20057 usb: ehci-mx6: Fix usb type issue in DM driver

Currently the clocks and power of USB controller and USB PHY are both
controlled by ehci-mx6 driver in device probe. However, the function
"ehci_usb_ofdata_to_platdata" calls "ehci_usb_phy_mode"
to access PHY registers when "dr_mode" is set to OTG, both "dr_mode" and
"extcon" properties are not set in DTB. This may cause hang at accessing
USB PHY registers if the power and clocks are not enabled.

Change the usb type logic to more clear way:
1. plat->init_type: The requested USB mode type from uplayers
2. priv->init_type: The USB mode type specified by DTB or by the USB ID pin or
   by external controller like tcpc or GPIO.
3. If two init_type are not same, return failure. Align with non-DM driver.
4. USB PHY access is moved after power and clock enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit d62ffbb7fa3136062a977d4f8bdc0f03b464b8e4)
drivers/usb/host/ehci-mx6.c