MLK-17312-5 usb: cdns3: improve the role switch process
authorPeter Chen <peter.chen@nxp.com>
Tue, 2 Jan 2018 06:45:15 +0000 (14:45 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:52:30 +0000 (14:52 -0500)
commit5d8765f187d68302f86272ad84ae36265b482e10
tree2756fc04c6055c9d14c08e68bb05b4d4a5cca545
parent2c09814ff4d9eb6c684cebb611809a423916026f
MLK-17312-5 usb: cdns3: improve the role switch process

Current design tries to switch role no matter it is a dual-role device
or a single-role device. It produces extra switch process, and have an
error message at console when tries to start a non-exist role.

In this commit, we do below changes
- The role switch work queue is only for dual-role or peripheral-only
device.
- For peripheral-only device, we need to switch role to CDNS3_ROLE_END
since we need to close vbus and turn off clocks at this role when the
cable is disconnected from the host; And we do noop when the external
cable indicates we are host.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/cdns3/core.c