reset: rzg2l-usbphy-ctrl: Connect up vbus regulator
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Tue, 11 Mar 2025 20:57:45 +0000 (20:57 +0000)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 19 Mar 2025 02:36:19 +0000 (03:36 +0100)
Bind the USB VBUS regulator driver under the USB PHY reset driver for
the Renesas RZ/G2L and related SoCs. This additional bind is needed as
the corresponding device tree node does not contain a compatible string.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
drivers/reset/Kconfig
drivers/reset/reset-rzg2l-usbphy-ctrl.c

index 80e83a4..5edbb3c 100644 (file)
@@ -239,6 +239,7 @@ config RESET_AT91
 config RESET_RZG2L_USBPHY_CTRL
        bool "Enable support for Renesas RZ/G2L USB 2.0 PHY control"
        depends on DM_RESET
+       select REGULATOR_RZG2L_USBPHY
        help
          Enable support for controlling USB 2.0 PHY resets on the Renesas
          RZ/G2L SoC. This is required for USB 2.0 functionality to work on this
index afd647e..622d7b9 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <asm/io.h>
 #include <dm.h>
+#include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <renesas/rzg2l-usbphy.h>
@@ -103,10 +104,38 @@ static const struct udevice_id rzg2l_usbphy_ctrl_ids[] = {
        { /* sentinel */ }
 };
 
+static int rzg2l_usbphy_ctrl_bind(struct udevice *dev)
+{
+       struct driver *drv;
+       ofnode node;
+       int ret;
+
+       node = ofnode_find_subnode(dev_ofnode(dev), "regulator-vbus");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "Failed to find vbus regulator devicetree node\n");
+               return -ENOENT;
+       }
+
+       drv = lists_driver_lookup_name("rzg2l_usbphy_regulator");
+       if (!drv) {
+               dev_err(dev, "Failed to find vbus regulator driver\n");
+               return -ENOENT;
+       }
+
+       ret = device_bind(dev, drv, dev->name, NULL, node, NULL);
+       if (ret) {
+               dev_err(dev, "Failed to bind vbus regulator: %d\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
 U_BOOT_DRIVER(rzg2l_usbphy_ctrl) = {
        .name           = "rzg2l_usbphy_ctrl",
        .id             = UCLASS_RESET,
        .of_match       = rzg2l_usbphy_ctrl_ids,
+       .bind           = rzg2l_usbphy_ctrl_bind,
        .probe          = rzg2l_usbphy_ctrl_probe,
        .ops            = &rzg2l_usbphy_ctrl_ops,
        .priv_auto      = sizeof(struct rzg2l_usbphy_ctrl_priv),