MLK-22307 usb: chipidea: usbmisc: usb charger detection improvement
authorLi Jun <jun.li@nxp.com>
Thu, 18 Jul 2019 10:40:46 +0000 (18:40 +0800)
committerLi Jun <jun.li@nxp.com>
Wed, 24 Jul 2019 10:29:54 +0000 (18:29 +0800)
commit7e91c4fca9ab8907f0b670f17d9796a5c64d804d
tree22494ec25a068499a9d71280ea4615a7071b8e1d
parentd0bc419aec687ccf5adf9151bc3b34d73a92c7f0
MLK-22307 usb: chipidea: usbmisc: usb charger detection improvement

Improve the usb charger detection for imx7D/S and imx845s, which use
the same USB PHY, the main improvements:
1. Keep OPMODE override to be non-driving during the whole charger
   detection process according the USB PHY data sheet(Table 6-7
   Battery Charging Operations)
2. Disable DCDENB after data contact finished.
3. Use the BC 1.2 defined process for primary and secondary detection:
   - VDP_SRC is connected to USB_OTG*_DP and IDM_SINK is connected to
     USB_OTG*_DN, for primary detection;
   - VDM_SRC is connected to USB_OTG*_DN and IDP_SINK is connected to
     USB_OTG*_DP, for seconday detection.
   Check Battery Charger Detection Output bit(CHRGDET) to determine
   SDP/CDP/DCP.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 7ca78ff4a324bb495e7d888640a0956c985ed04d)
drivers/usb/chipidea/usbmisc_imx.c