From: Paul Barker Date: Tue, 11 Mar 2025 20:57:45 +0000 (+0000) Subject: reset: rzg2l-usbphy-ctrl: Connect up vbus regulator X-Git-Tag: v2025.07-rc1~18^2~20^2~7 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6cc00a56e7d33a43401212065052a6e2a5a8d2b;p=pandora-u-boot.git reset: rzg2l-usbphy-ctrl: Connect up vbus regulator 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 Signed-off-by: Paul Barker --- diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 80e83a40bdf..5edbb3c25b4 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -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 diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c index afd647e00b1..622d7b9cf4f 100644 --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -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),