On 9/16/20 2:57 PM, peng....@nxp.com wrote: > From: Ye Li <ye...@nxp.com> > > 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.
Can we get rid of the board-specific function and move the information into the DT, and then have the driver extract the info from the DT while correctly managing clock and power domains ?