Skip to contentSkip to conversation

usb/phy-generic: Add support for OTG VBUS supply control

PATCH In review Mike Looijmans 2 participants 3 messages May 29, 2020 – Jun 3, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb/phy-generic: Add support for OTG VBUS supply control

This enables support for VBUS on boards where the power is supplied by a regulator. The regulator is enabled when the USB port enters HOST mode.

---
v2: Added missing "return 0;" in set_vbus method

 .../devicetree/bindings/usb/usb-nop-xceiv.txt |  3 ++
 drivers/usb/phy/phy-generic.c                 | 46 ++++++++++++++++++-
 drivers/usb/phy/phy-generic.h                 |  2 +
 3 files changed, 50 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +3 -0
index 4dc6a8ee3071..775a19fdb613 100644
@@ -16,6 +16,9 @@ Optional properties:
 
 - vcc-supply: phandle to the regulator that provides power to the PHY.
 
+- vbus-supply: phandle to the regulator that provides the VBUS power for when
+  the device is in HOST mode.
+
 - reset-gpios: Should specify the GPIO for reset.
 
 - vbus-detect-gpio: should specify the GPIO detecting a VBus insertion
drivers/usb/phy/phy-generic.c +45 -1

76 lines not on this page · raw message

drivers/usb/phy/phy-generic.h +2 -0
index 7ee80211a688..a3663639ea1e 100644
@@ -14,7 +14,9 @@ struct usb_phy_generic {
 	struct gpio_desc *gpiod_reset;
 	struct gpio_desc *gpiod_vbus;
 	struct regulator *vbus_draw;
+	struct regulator *vbus_reg;
 	bool vbus_draw_enabled;
+	bool vbus_reg_enabled;
 	unsigned long mA;
 	unsigned int vbus;
 };
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 18 lines · Mike Looijmans

This enables support for VBUS on boards where the power is supplied by a regulator. The regulator is enabled when the USB port enters HOST mode.

---
v2: Added missing "return 0;" in set_vbus method

 .../devicetree/bindings/usb/usb-nop-xceiv.txt |  3 ++
 drivers/usb/phy/phy-generic.c                 | 46 ++++++++++++++++++-
 drivers/usb/phy/phy-generic.h                 |  2 +
 3 files changed, 50 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +0 -0
index 4dc6a8ee3071..775a19fdb613 100644

Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt Optional properties: · line 21

Quoted 6 lines
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +3 -0
@@ -16,6 +16,9 @@ Optional properties:
 
 - vcc-supply: phandle to the regulator that provides power to the PHY.
 
+- vbus-supply: phandle to the regulator that provides the VBUS power for when
+  the device is in HOST mode.
+

I'm going to say no to expanding this binding...

First, there sure are a lot of controls on a NOP tranceiver.

Second, unless Vbus is supplying the PHY, then this belongs in a connector node for which this is already supported.

Quoted 3 lines
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +0 -0
 - reset-gpios: Should specify the GPIO for reset.
 
 - vbus-detect-gpio: should specify the GPIO detecting a VBus insertion
#2 lore raw

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topicproducts.com

Please consider the environment before printing this e-mail

Quoted 27 lines · Rob Herring
Quoted 18 lines · Mike Looijmans

This enables support for VBUS on boards where the power is supplied by a regulator. The regulator is enabled when the USB port enters HOST mode.

---
v2: Added missing "return 0;" in set_vbus method

  .../devicetree/bindings/usb/usb-nop-xceiv.txt |  3 ++
  drivers/usb/phy/phy-generic.c                 | 46 ++++++++++++++++++-
  drivers/usb/phy/phy-generic.h                 |  2 +
  3 files changed, 50 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +0 -0
index 4dc6a8ee3071..775a19fdb613 100644

Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt Optional properties: · line 21

Quoted 6 lines
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +3 -0
@@ -16,6 +16,9 @@ Optional properties:
 
  - vcc-supply: phandle to the regulator that provides power to the PHY.
 
+- vbus-supply: phandle to the regulator that provides the VBUS power for when
+  the device is in HOST mode.
+

I'm going to say no to expanding this binding...

Quoted 4 lines

First, there sure are a lot of controls on a NOP tranceiver.

Second, unless Vbus is supplying the PHY, then this belongs in a connector node for which this is already supported.

Clear, I moved the implementation to the DWC3 driver and will submit a new patch for that.

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt +0 -0
  - reset-gpios: Should specify the GPIO for reset.
 
  - vbus-detect-gpio: should specify the GPIO detecting a VBus insertion
Signature · 1 line
Mike Looijmans