From patchwork Fri Jun 7 11:37:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13689755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF090C27C53 for ; Fri, 7 Jun 2024 11:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LeSyhaYe8y2bP66THkoKFSQ4Os7qI9GmM1D11FymAzM=; b=EBo61ZQnmyaiUE DIW2vXilNVgH8A4piThahCV/n8weas1sKNguKHmwJdaoLgz74ACZ1QjUECU4/yVYRqSkpOWXiTAy4 R4eJY8bMyp2+5utfXgu7Iw3R1mqzxG4mE7CMA1WEZ/T5WHTcE/uKN3A2ghcMNBRagfeZcYa/hRrEt YV9sjX4aCBpynLAh3QbavksLQ2gA94qKXMv9/Qlwfd+PWdDoU13ZNlOoWm8ytXwe3BaxMI63bYGTE UgHqUHxsL5FTDKAuiol7WzrO2ZrMwfLYL1AoQEIUcHrmNywAkaGreSOA+xPonBfQsIFt+38es79ga GBzbOk2FShc3UKtN8Qxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXv6-0000000DmVn-1pmh; Fri, 07 Jun 2024 11:38:08 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXv3-0000000DmSq-29WQ for linux-phy@lists.infradead.org; Fri, 07 Jun 2024 11:38:07 +0000 X-IronPort-AV: E=Sophos;i="6.08,220,1712588400"; d="scan'208";a="211042474" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 07 Jun 2024 20:37:58 +0900 Received: from localhost.localdomain (unknown [10.226.92.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8589240071E8; Fri, 7 Jun 2024 20:37:53 +0900 (JST) From: Biju Das To: Philipp Zabel , Liam Girdwood , Mark Brown , Yoshihiro Shimoda , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Biju Das , Vinod Koul , Kishon Vijay Abraham I , linux-renesas-soc@vger.kernel.org, linux-phy@lists.infradead.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , devicetree@vger.kernel.org Subject: [PATCH RFC v2 1/4] reset: renesas: Instantiate USB VBUS regulator device Date: Fri, 7 Jun 2024 12:37:42 +0100 Message-Id: <20240607113745.73934-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> References: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240607_043805_690325_D9E24118 X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org As per RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit of the VBUS Control Register(VBENCTL) register in the USBPHY Control. Expose this register as regmap and instantiate the USB VBUS regulator device, so that consumer can control the vbus using regulator API's. Signed-off-by: Biju Das --- v1->v2: * Instatiated regulator driver --- drivers/reset/reset-rzg2l-usbphy-ctrl.c | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c index 8f6fbd978591..45406d6bbb85 100644 --- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c +++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c @@ -10,10 +10,12 @@ #include #include #include +#include #include #include #define RESET 0x000 +#define VBENCTL 0x03c #define RESET_SEL_PLLRESET BIT(12) #define RESET_PLLRESET BIT(8) @@ -32,6 +34,7 @@ struct rzg2l_usbphy_ctrl_priv { struct reset_controller_dev rcdev; struct reset_control *rstc; void __iomem *base; + struct platform_device *vdev; spinlock_t lock; }; @@ -100,10 +103,19 @@ static const struct reset_control_ops rzg2l_usbphy_ctrl_reset_ops = { .status = rzg2l_usbphy_ctrl_status, }; +static const struct regmap_config rzg2l_usb_regconf = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = 1, +}; + static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct rzg2l_usbphy_ctrl_priv *priv; + struct platform_device *vdev; + struct regmap *regmap; unsigned long flags; int error; u32 val; @@ -116,6 +128,22 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); + regmap = devm_regmap_init_mmio(dev, priv->base + VBENCTL, &rzg2l_usb_regconf); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + vdev = platform_device_alloc("rzg2l-usb-vbus-regulator", pdev->id); + if (!vdev) + return -ENOMEM; + vdev->dev.parent = dev; + priv->vdev = vdev; + + error = platform_device_add(vdev); + if (error) { + platform_device_put(vdev); + return error; + } + priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(priv->rstc)) return dev_err_probe(dev, PTR_ERR(priv->rstc), @@ -160,6 +188,7 @@ static void rzg2l_usbphy_ctrl_remove(struct platform_device *pdev) { struct rzg2l_usbphy_ctrl_priv *priv = dev_get_drvdata(&pdev->dev); + platform_device_unregister(priv->vdev); pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); reset_control_assert(priv->rstc); From patchwork Fri Jun 7 11:37:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13689756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22F86C27C5F for ; Fri, 7 Jun 2024 11:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+TA5i8XKfh1dvN7ddmAojyFrP54kHL0kqliqXUTdoXs=; b=V40wZQblf4QN7N zOnO+bYfXc0oXbp26gBrjHQzVKj3+ZSboidQElNwc7RyDVYjTnUD8qrfi0k1WXaej4fBbDmm3sBiV dI+jobajkTWJlt9n3khyb207ONGfn+GtBOkYdbrDMMhbXxNRMe7zfEr8IH1vS1MKKy9kOz+DqHD0y zUfh9fkl/HPXe3YCM9rkV5ihzRDFMJJhIMM8LHo2Sd+mx0z/gULiAVc218xsr0CgO52j1tgfTTjuY 1uv3xGpjDYvXTteQkZvPm29CncQKnwwmvBr8YtTU1Ly4CkWXeBCR1XjGq13DCZvvupxF8frBL+1TI OdWJzlBclX8J+ohZBzLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXv7-0000000DmWO-3ZsB; Fri, 07 Jun 2024 11:38:09 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXv5-0000000DmTq-0hVG for linux-phy@lists.infradead.org; Fri, 07 Jun 2024 11:38:08 +0000 X-IronPort-AV: E=Sophos;i="6.08,220,1712588400"; d="scan'208";a="211042485" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 07 Jun 2024 20:38:03 +0900 Received: from localhost.localdomain (unknown [10.226.92.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 05D5C40071E8; Fri, 7 Jun 2024 20:37:58 +0900 (JST) From: Biju Das To: Liam Girdwood , Mark Brown , Yoshihiro Shimoda , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Biju Das , Vinod Koul , Kishon Vijay Abraham I , linux-renesas-soc@vger.kernel.org, linux-phy@lists.infradead.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , devicetree@vger.kernel.org Subject: [PATCH RFC v2 2/4] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Date: Fri, 7 Jun 2024 12:37:43 +0100 Message-Id: <20240607113745.73934-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> References: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240607_043807_455677_0DC50448 X-CRM114-Status: GOOD ( 18.04 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit of the VBUS Control Register. This register is mapped in the reset framework. The reset driver expose this register as regmap and instantiates this driver. The consumer device will use the regulator regmap to control the VBOUT bit as the control need to be done in the atomic context. Signed-off-by: Biju Das --- v1->v2: * New patch --- drivers/regulator/Kconfig | 9 +++ drivers/regulator/Makefile | 1 + .../regulator/renesas-usb-vbus-regulator.c | 65 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 drivers/regulator/renesas-usb-vbus-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index d333be2bea3b..0281a9a6f4ce 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER help Support for regulators implemented on Socionext UniPhier SoCs. +config REGULATOR_RZG2L_VBCTRL + tristate "Renesas RZ/G2L USB VBUS regulator driver" + depends on ARCH_RZG2L || COMPILE_TEST + depends on OF + select REGMAP_MMIO + default ARCH_RZG2L + help + Support for VBUS regulators implemented on Renesas RZ/G2L SoCs. + config REGULATOR_VCTRL tristate "Voltage controlled regulators" depends on OF diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index ba15fa5f30ad..6127ffb4b011 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -189,6 +189,7 @@ obj-$(CONFIG_REGULATOR_TPS65132) += tps65132-regulator.o obj-$(CONFIG_REGULATOR_TPS68470) += tps68470-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o twl6030-regulator.o obj-$(CONFIG_REGULATOR_UNIPHIER) += uniphier-regulator.o +obj-$(CONFIG_REGULATOR_RZG2L_VBCTRL) += renesas-usb-vbus-regulator.o obj-$(CONFIG_REGULATOR_VCTRL) += vctrl-regulator.o obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress-regulator.o obj-$(CONFIG_REGULATOR_VQMMC_IPQ4019) += vqmmc-ipq4019-regulator.o diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c new file mode 100644 index 000000000000..24582782ad40 --- /dev/null +++ b/drivers/regulator/renesas-usb-vbus-regulator.c @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Renesas USB VBUS output regulator driver +// +// Copyright (C) 2024 Renesas Electronics Corporation +// + +#include +#include +#include +#include +#include +#include +#include +#include + +static const unsigned int vbus_voltages[] = { + 3300000, 0 +}; + +static const struct regulator_ops rzg2l_usb_vbus_reg_ops = { + .list_voltage = regulator_list_voltage_table, +}; + +static const struct regulator_desc rzg2l_usb_vbus_rdesc = { + .name = "usb_vbus", + .ops = &rzg2l_usb_vbus_reg_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .volt_table = vbus_voltages, + .n_voltages = ARRAY_SIZE(vbus_voltages), +}; + +static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev) +{ + struct regulator_config config = { }; + struct device *dev = &pdev->dev; + struct regulator_dev *rdev; + + config.regmap = dev_get_regmap(dev->parent, NULL); + if (!config.regmap) + return dev_err_probe(dev, -ENOENT, "Failed to get regmap\n"); + + config.dev = dev; + config.of_node = dev->of_node; + rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config); + if (IS_ERR(rdev)) + return dev_err_probe(dev, PTR_ERR(rdev), + "not able to register vbus regulator\n"); + + return 0; +} + +static struct platform_driver rzg2l_usb_vbus_regulator_driver = { + .probe = rzg2l_usb_vbus_regulator_probe, + .driver = { + .name = "rzg2l-usb-vbus-regulator", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, +}; +module_platform_driver(rzg2l_usb_vbus_regulator_driver); + +MODULE_AUTHOR("Biju Das "); +MODULE_DESCRIPTION("Renesas RZ/G2L USB Vbus Regulator Driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Jun 7 11:37:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13689757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B36BFC27C53 for ; Fri, 7 Jun 2024 11:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SmVQyBeE6kEJgzxxhVxaJYShuz/4mQFZ9fVcHKH2MIQ=; b=MxoiZVks7KZPiK E4J3m+pZDdw9OiDTXS6GfgwYpfZrJJ0MlPf7xMxwQWk0FIjT8H/v8mnK/4JuFnn5e0mQL0hpa5T4C wpj5074agF+kbT70m4R3pqzdgIWRez4Nu3N3liPkufybGGO/rYVm2w0ZIadc7xtltUN7M0yeiS182 qOiawbwlU8lMO2z5Dkf+ph/3UuLhbyndlG28R/if6Dsq8Swp0s8zk1BkoCZS7NT9iQioiHz3svsLt +2+Me8/rMApR2x3/g71pJsXh0aUh3NG1hmyYNn1z6H5UYMj+8qo7omW9lGB4sBeo5vbPk6oVfDvX3 vVEEYv/TmJEnJOe2DhBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXvC-0000000DmZ4-1lOh; Fri, 07 Jun 2024 11:38:14 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXv8-0000000DmWJ-1Ikf for linux-phy@lists.infradead.org; Fri, 07 Jun 2024 11:38:12 +0000 X-IronPort-AV: E=Sophos;i="6.08,220,1712588400"; d="scan'208";a="211042492" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 07 Jun 2024 20:38:09 +0900 Received: from localhost.localdomain (unknown [10.226.92.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 9242A40071E8; Fri, 7 Jun 2024 20:38:04 +0900 (JST) From: Biju Das To: Yoshihiro Shimoda , Philipp Zabel , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Biju Das , Vinod Koul , Kishon Vijay Abraham I , linux-renesas-soc@vger.kernel.org, linux-phy@lists.infradead.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das Subject: [PATCH RFC v2 3/4] phy: renesas: phy-rcar-gen3-usb2: Control VBUSEN selection Date: Fri, 7 Jun 2024 12:37:44 +0100 Message-Id: <20240607113745.73934-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> References: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240607_043810_551840_2B773927 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Use regmap provided by the regulator driver to control VBUS for RZ/G2L alike SoCs. Signed-off-by: Biju Das --- v1->v2: * Used regulator driver's regmap to handle VBUS. --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index fbab6ac0f0d1..90561b6f9597 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -111,6 +112,7 @@ struct rcar_gen3_chan { struct extcon_dev *extcon; struct rcar_gen3_phy rphys[NUM_OF_PHYS]; struct regulator *vbus; + struct regmap *regmap; struct work_struct work; struct mutex lock; /* protects rphys[...].powered */ enum usb_dr_mode dr_mode; @@ -188,6 +190,10 @@ static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus) dev_vdbg(ch->dev, "%s: %08x, %d\n", __func__, val, vbus); if (ch->soc_no_adp_ctrl) { + if (vbus) + regmap_write(ch->regmap, 0, 0); + else + regmap_write(ch->regmap, 0, 1); vbus_ctrl_reg = USB2_VBCTRL; vbus_ctrl_val = USB2_VBCTRL_VBOUT; } @@ -718,7 +724,8 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) phy_set_drvdata(channel->rphys[i].phy, &channel->rphys[i]); } - channel->vbus = devm_regulator_get_optional(dev, "vbus"); + channel->vbus = devm_regulator_get(dev, channel->soc_no_adp_ctrl ? + "usb_vbus" : "vbus"); if (IS_ERR(channel->vbus)) { if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) { ret = PTR_ERR(channel->vbus); @@ -727,6 +734,14 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) channel->vbus = NULL; } + if (channel->soc_no_adp_ctrl && channel->vbus) { + channel->regmap = regulator_get_regmap(channel->vbus); + if (IS_ERR(channel->regmap)) { + ret = PTR_ERR(channel->vbus); + goto error; + } + } + platform_set_drvdata(pdev, channel); channel->dev = dev; From patchwork Fri Jun 7 11:37:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13689758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2885BC27C55 for ; Fri, 7 Jun 2024 11:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hcRaDMJGhUEv6B9BMQfOjBRiy60dABxEqsHWldbQzYk=; b=UAcBCuvuN57R3d y2kliYTTalp0y2muPgMqCBUCko8BjtTOYLsOZver0WpY9+MvNlWud3jabtCNyTHwuG3WRlzRMHs3N 33sIqjttor5dJCCB6Up6A2Hn0+FC/4KdSn4yZxrJ3h/Gb7BBEgfIYvlVrMmL3xojyrGysEYjdyEjO 7R2vxize1ziyOipJDeUo03yebFJ4fy9i6DYl0yQAEUTLJAkRzkBXZJ2eVvytycHOzPus/7YK4BxEQ Dfgnsoz/DLP/yP4oiXns3U7+NAgcctF/lkRaC7BLsWZMXvzv/HFQt3K+Lb6WszOe5sv/b47Ts0Fp3 Puhw3sWfyKTLFdOxe4vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXvE-0000000Dma3-3OTx; Fri, 07 Jun 2024 11:38:16 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXvD-0000000DmYz-0H4I for linux-phy@lists.infradead.org; Fri, 07 Jun 2024 11:38:16 +0000 X-IronPort-AV: E=Sophos;i="6.08,221,1712588400"; d="scan'208";a="207084446" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 07 Jun 2024 20:38:14 +0900 Received: from localhost.localdomain (unknown [10.226.92.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C16034005B53; Fri, 7 Jun 2024 20:38:09 +0900 (JST) From: Biju Das To: Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Biju Das , Vinod Koul , Kishon Vijay Abraham I , Liam Girdwood , Mark Brown , linux-renesas-soc@vger.kernel.org, linux-phy@lists.infradead.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , devicetree@vger.kernel.org Subject: [PATCH RFC v2 4/4] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Date: Fri, 7 Jun 2024 12:37:45 +0100 Message-Id: <20240607113745.73934-5-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> References: <20240607113745.73934-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240607_043815_242627_1AD56DAA X-CRM114-Status: UNSURE ( 8.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Replace the fixed regulator for USB VBUS. Signed-off-by: Biju Das --- v1->v2: * New patch. --- arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi b/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi index b7a3e6caa386..9105afbd5810 100644 --- a/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi +++ b/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi @@ -54,14 +54,6 @@ codec_dai: simple-audio-card,codec { }; }; - usb0_vbus_otg: regulator-usb0-vbus-otg { - compatible = "regulator-fixed"; - - regulator-name = "USB0_VBUS_OTG"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - }; - vccq_sdhi1: regulator-vccq-sdhi1 { compatible = "regulator-gpio"; regulator-name = "SDHI1 VccQ"; @@ -139,6 +131,11 @@ &ohci1 { &phyrst { status = "okay"; + vbus_usb0: usb-vbus-regulator { + regulator-name = "usb_vbus"; + regulator-min-microvolt = <0>; + regulator-max-microvolt = <3300000>; + }; }; &scif0 { @@ -171,7 +168,7 @@ &usb2_phy0 { pinctrl-0 = <&usb0_pins>; pinctrl-names = "default"; - vbus-supply = <&usb0_vbus_otg>; + vbus-supply = <&vbus_usb0>; status = "okay"; };