USB: OTG: msm: Fix ACA implementation
Synopsis 28nm PHY has two different circuits for detecting changes on
ID line. ID_DIG is designed for detecting ID_float vs ID_gnd. ID_ACA
is designed for detecting RID_A, RID_B, RID_C states. These are mutually
exclusive and enabling both circuits has undefined behavior. Enable
ID_ACA upon VBUS high or ID_gnd events to detect further ACA states.
ACA ID_GND threshold range is overlapped with OTG ID_FLOAT threshold range.
Hence PHY ID_DIG circuit can not be used for detecting ACA ID_GND. Use
PMIC ID circuit for detecting both OTG and ACA ID_GND.
Link controller can not generate PHY_ALT interrupt in host mode. But the
corresponding PHY register reflects the actual ID state. Hence implement
polling to read PHY register to detect ID_GND --> ID_A, ID_A --> ID_B
transitions. That means low power mode can not be allowed in host mode.
Also disallow suspending the device attached on the root hub. Otherwise
PHY is put into suspend state automatically upon setting SUSP bit in PORTSC
register.
Link controller can not generate asynchronous interrupt for ID_ACA changes
in low power mode. Hence disallow low power mode in ID_B and ID_C states.
USB_MSM_ACA is not selected by default. If it selected, ACA states can be
detected and low power mode is not allowed in host mode. Writing "enable"
to <debugfs>/msm_otg/aca enables ACA irrespective of USB_MSM_ACA selection.
This is meant for debugging only.
Change-Id: I51e80d803a583c5bdffc8111696943c04958f604
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
4 files changed