From patchwork Tue Jul 2 18:00:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13720121 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FD9A16B394; Tue, 2 Jul 2024 18:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943259; cv=none; b=bJK5jBUj1yCUpc0tRiBFZAuNQ0QCH4yLZmkh1WFbTt2Nhr8fM3K16LF8+YhGSokxdXJhNl+YHoBSo2/g/b+punM2BjID1CAu58ZIckbuXIZT/P15458i4A2vdiU8hpoEMIyXQ78t8YgSxerAL9O5nIxVQzvoOCQI687RRgoTE30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719943259; c=relaxed/simple; bh=LQpgV0q+1Z2A1bLT06iPn8tWMT17hOQlwfMOjjvXzO8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D1Mfsy0Zc8AmYMrR79I6q9hKS82DeHyI/2+38EYWvcR2N2OZnFK/cxkICrYdmQqAaiKNdoN7KOamN8APvbctLDJcxhjvfrGrNYq+LjBMKEI/Q6/3kpLaFqBIAl31s70GjV9Rt4MxwMUO6zgM+O9BBc6zdiQ5RhMEoBtG1+MNYMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.09,178,1716217200"; d="scan'208";a="214008648" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 03 Jul 2024 03:00:56 +0900 Received: from localhost.localdomain (unknown [10.226.93.72]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 06BB04005623; Wed, 3 Jul 2024 03:00:50 +0900 (JST) From: Biju Das To: Yoshihiro Shimoda Cc: Biju Das , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Geert Uytterhoeven , Magnus Damm , devicetree@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v5 3/4] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Date: Tue, 2 Jul 2024 19:00:17 +0100 Message-ID: <20240702180032.207275-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240702180032.207275-1-biju.das.jz@bp.renesas.com> References: <20240702180032.207275-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use regulator_hardware_enable() for controlling VBUS enable for RZ/G2L alike SoCs in interrupt context. Signed-off-by: Biju Das Acked-by: Vinod Koul Reviewed-by: Yoshihiro Shimoda --- v4->v5: * Added Ack from Vinod. v3->v4: * Updated commit description with regulator_hardware_enable() * Used devm_regulator_get_exclusive() to get regulator handle. v2->v3: * Replaced regulator's regmap API with newly introduced regulator_set_hardware_enable_register to enable/disable regulator in interrupt context. * Dropped using "usb_vbus-supply" v1->v2: * Used regulator driver's regmap to handle VBUS. --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 8 +++++++- 1 file changed, 7 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..7594f64eb737 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -188,6 +188,9 @@ 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 (ch->vbus) + regulator_hardware_enable(ch->vbus, vbus); + vbus_ctrl_reg = USB2_VBCTRL; vbus_ctrl_val = USB2_VBCTRL_VBOUT; } @@ -718,7 +721,10 @@ 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"); + if (channel->soc_no_adp_ctrl && channel->is_otg_channel) + channel->vbus = devm_regulator_get_exclusive(dev, "vbus"); + else + channel->vbus = devm_regulator_get_optional(dev, "vbus"); if (IS_ERR(channel->vbus)) { if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) { ret = PTR_ERR(channel->vbus);