usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fri, 9 Nov 2018 11:44:36 +0000 (20:44 +0900)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Nov 2018 07:06:32 +0000 (09:06 +0200)
commitceb94bc52c437463f0903e61060a94a2226fb672
treeb4cc6a60fd5a80ce7a83d0dccf3c4ed2db99ccb7
parent268784ba14a7bff23bc80531d6db31986eafd54b
usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device

This patch adds a safety connection way for "forced_b_device" with
"workaround_for_vbus" like below:

< Example for R-Car E3 Ebisu >
 # modprobe <any usb gadget driver>
 # echo 1 > /sys/kernel/debug/ee020000.usb/b_device
 (connect a usb cable to host side.)
 # echo 2 > /sys/kernel/debug/ee020000.usb/b_device

Previous code should have connected a usb cable before the "b_device"
is set to 1 on the Ebisu board. However, if xHCI driver on the board
is probed, it causes some troubles:
 - Conflicts USB VBUS/signals between the board and another host.
 - "Cannot enable. Maybe the USB cable is bad?" might happen on
   both the board and another host with a usb hub.
 - Cannot enumerate a usb gadget correctly because an interruption
   of VBUS change happens unexpectedly.

Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/renesas_usb3.c