phy: usb: phy-brcm-usb: Add ability to force DRD mode to host or device
authorAl Cooper <al.cooper@broadcom.com>
Fri, 22 Sep 2017 19:34:02 +0000 (15:34 -0400)
committerKishon Vijay Abraham I <kishon@ti.com>
Tue, 3 Oct 2017 06:24:55 +0000 (11:54 +0530)
commit415060b21f318e009d865b4bcbf8f220ebc36964
tree837e78302aefa70b6ad64954ce348c885faa1068
parent49859e55e364b9e6a53ae8f80318a2e7bd35ef37
phy: usb: phy-brcm-usb: Add ability to force DRD mode to host or device

When the usb phy device mode is set to "drd", the USB port will
switch between device and host modes depending on what's plugged
into the port. Customers have asked for the ability to force
host or device mode from software. This commit adds sysfs
entries to the phy device that allow this. The sysfs for the phy
device can be found at:
/sys/bus/platform/drivers/brcmstb-usb-phy/*.usb-phy

The following sysfs entries were added:
- "dr_mode" (RO) - The current phy "dr_mode" setting.
  It will be set to one of the following values:
  - "host" - host mode
  - "peripheral " - device mode
  - "drd" - switch between device and host mode based on
    installed device
  - "typec-pd" - device/host mode is controller by the USB
    Type-C PD protocol.

If "dr_mode" is "drd"
- "drd_select" (RW) -
  It will be set to one of the following values:
  - "host" - force host mode
  - "device" - force device mode
  - "auto" - allow normal auto selection of host/device based on
    inserted USB device

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/broadcom/phy-brcm-usb.c