All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings
@ 2022-10-22 12:11 Linus Walleij
  2022-10-22 12:18 ` [PATCH 2/2 v1] usb: phy: phy-gpio-vbus-usb: Add device tree probing Linus Walleij
  2022-10-24 19:16 ` [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Rob Herring
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2022-10-22 12:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Linus Walleij, Felipe Balbi, devicetree

This adds a simple device tree binding for a GPIO-based
VBUS detection PHY.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../bindings/phy/phy-usb-vbus-gpio.yaml       | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml

diff --git a/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml b/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml
new file mode 100644
index 000000000000..4e10b58f8235
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/phy-usb-vbus-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO-based VBUS detection USB PHY
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: A VBUS event occurs when a USB plug is attached to
+  a USB host and peripheral, the voltage (VBUS) is exposed from the
+  host to the peripheral when the last of the two ends of the
+  cable is plugged in. This can be either on the host side or on
+  the peripheral side, whichever comes last. It is possible to
+  provide a very simple USB VBUS detection mechanism by using a
+  GPIO line that will trigger on an edge event on the VBUS
+  pin.
+
+properties:
+  compatible:
+    const: phy-usb-vbus-gpio
+
+  "#phy-cells":
+    const: 0
+
+  vbus-gpios:
+    maxItems: 1
+    description: The GPIO line connected to VBUS
+
+required:
+  - compatible
+  - "#phy-cells"
+  - vbus-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    usb1_phy: phy {
+        compatible = "phy-usb-vbus-gpio";
+        #phy-cells = <0>;
+        vbus-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+    };
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2 v1] usb: phy: phy-gpio-vbus-usb: Add device tree probing
  2022-10-22 12:11 [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Linus Walleij
@ 2022-10-22 12:18 ` Linus Walleij
  2022-10-24 19:16 ` [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-10-22 12:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Linus Walleij, Felipe Balbi

Make it possible to probe the GPIO VBUS detection driver
from the device tree compatible.

Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/usb/phy/phy-gpio-vbus-usb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index f13f5530746c..a9e4355a1b65 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -366,12 +366,20 @@ static const struct dev_pm_ops gpio_vbus_dev_pm_ops = {
 
 MODULE_ALIAS("platform:gpio-vbus");
 
+static const struct of_device_id gpio_vbus_of_match[] = {
+	{
+		.compatible = "phy-usb-vbus-gpio",
+	},
+	{},
+};
+
 static struct platform_driver gpio_vbus_driver = {
 	.driver = {
 		.name  = "gpio-vbus",
 #ifdef CONFIG_PM
 		.pm = &gpio_vbus_dev_pm_ops,
 #endif
+		.of_match_table = gpio_vbus_of_match,
 	},
 	.probe		= gpio_vbus_probe,
 	.remove		= gpio_vbus_remove,
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings
  2022-10-22 12:11 [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Linus Walleij
  2022-10-22 12:18 ` [PATCH 2/2 v1] usb: phy: phy-gpio-vbus-usb: Add device tree probing Linus Walleij
@ 2022-10-24 19:16 ` Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2022-10-24 19:16 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Greg Kroah-Hartman, linux-usb, Felipe Balbi, devicetree

On Sat, Oct 22, 2022 at 02:11:48PM +0200, Linus Walleij wrote:
> This adds a simple device tree binding for a GPIO-based
> VBUS detection PHY.
> 
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  .../bindings/phy/phy-usb-vbus-gpio.yaml       | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml b/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml
> new file mode 100644
> index 000000000000..4e10b58f8235
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/phy-usb-vbus-gpio.yaml
> @@ -0,0 +1,47 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/phy-usb-vbus-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: GPIO-based VBUS detection USB PHY
> +
> +maintainers:
> +  - Linus Walleij <linus.walleij@linaro.org>
> +
> +description: A VBUS event occurs when a USB plug is attached to
> +  a USB host and peripheral, the voltage (VBUS) is exposed from the
> +  host to the peripheral when the last of the two ends of the
> +  cable is plugged in. This can be either on the host side or on
> +  the peripheral side, whichever comes last. It is possible to
> +  provide a very simple USB VBUS detection mechanism by using a
> +  GPIO line that will trigger on an edge event on the VBUS
> +  pin.

We already have Vbus GPIOs in the USB connector binding and there is 
also the usb-nop-transceiver. Surely one of those works for you? 
Preferably the former.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-24 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-22 12:11 [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Linus Walleij
2022-10-22 12:18 ` [PATCH 2/2 v1] usb: phy: phy-gpio-vbus-usb: Add device tree probing Linus Walleij
2022-10-24 19:16 ` [PATCH 1/2 v1] usb: phy: phy-gpio-vbus-usb: Add devicetree bindings Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.