From: Neil Armstrong <neil.armstrong@linaro.org>
To: Claudiu <claudiu.beznea@tuxon.dev>,
yoshihiro.shimoda.uh@renesas.com, vkoul@kernel.org,
kishon@kernel.org, geert+renesas@glider.be,
magnus.damm@gmail.com, p.zabel@pengutronix.de
Cc: linux-renesas-soc@vger.kernel.org, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH v2 2/2] phy: renesas: rcar-gen3-usb2: Add suspend/resume support
Date: Wed, 19 Nov 2025 15:49:58 +0100 [thread overview]
Message-ID: <782ebaf9-38d9-4695-b5af-3cf77118e282@linaro.org> (raw)
In-Reply-To: <20251119120418.686224-3-claudiu.beznea.uj@bp.renesas.com>
On 11/19/25 13:04, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> The Renesas RZ/G3S supports a power saving mode where power to most of the
> SoC components is turned off. The USB PHY is among these components.
> Because of this the settings applied in driver probe need to be executed
> also on resume path. On suspend path only reset signal need to be asserted.
> Add suspend/resume support.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v2:
> - dropped the changes that were integrated in patch 1/2
>
> drivers/phy/renesas/phy-rcar-gen3-usb2.c | 57 +++++++++++++++++-------
> 1 file changed, 42 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> index b9d5bb52e02c..3c063e4dea41 100644
> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> @@ -132,6 +132,7 @@ struct rcar_gen3_chan {
> struct device *dev; /* platform_device's device */
> const struct rcar_gen3_phy_drv_data *phy_data;
> struct extcon_dev *extcon;
> + struct reset_control *rstc;
> struct rcar_gen3_phy rphys[NUM_OF_PHYS];
> struct regulator *vbus;
> struct work_struct work;
> @@ -778,38 +779,24 @@ static void rcar_gen3_reset_assert(void *data)
> static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel)
> {
> struct device *dev = channel->dev;
> - struct reset_control *rstc;
> int ret;
> u32 val;
>
> if (!channel->phy_data->init_bus)
> return 0;
>
> - rstc = devm_reset_control_array_get_shared(dev);
> - if (IS_ERR(rstc))
> - return PTR_ERR(rstc);
> -
> ret = pm_runtime_resume_and_get(dev);
> if (ret)
> return ret;
>
> - ret = reset_control_deassert(rstc);
> - if (ret)
> - goto rpm_put;
> -
> - ret = devm_add_action_or_reset(dev, rcar_gen3_reset_assert, rstc);
> - if (ret)
> - goto rpm_put;
> -
> val = readl(channel->base + USB2_AHB_BUS_CTR);
> val &= ~USB2_AHB_BUS_CTR_MBL_MASK;
> val |= USB2_AHB_BUS_CTR_MBL_INCR4;
> writel(val, channel->base + USB2_AHB_BUS_CTR);
>
> -rpm_put:
> pm_runtime_put(dev);
>
> - return ret;
> + return 0;
> }
>
> static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> @@ -849,6 +836,18 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> }
> }
>
> + channel->rstc = devm_reset_control_array_get_optional_shared(dev);
> + if (IS_ERR(channel->rstc))
> + return PTR_ERR(channel->rstc);
> +
> + ret = reset_control_deassert(channel->rstc);
> + if (ret)
> + return ret;
> +
> + ret = devm_add_action_or_reset(dev, rcar_gen3_reset_assert, channel->rstc);
> + if (ret)
> + return ret;
> +
> /*
> * devm_phy_create() will call pm_runtime_enable(&phy->dev);
> * And then, phy-core will manage runtime pm for this device.
> @@ -937,10 +936,38 @@ static void rcar_gen3_phy_usb2_remove(struct platform_device *pdev)
> pm_runtime_disable(&pdev->dev);
> };
>
> +static int rcar_gen3_phy_usb2_suspend(struct device *dev)
> +{
> + struct rcar_gen3_chan *channel = dev_get_drvdata(dev);
> +
> + return reset_control_assert(channel->rstc);
> +}
> +
> +static int rcar_gen3_phy_usb2_resume(struct device *dev)
> +{
> + struct rcar_gen3_chan *channel = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = reset_control_deassert(channel->rstc);
> + if (ret)
> + return ret;
> +
> + ret = rcar_gen3_phy_usb2_init_bus(channel);
> + if (ret)
> + reset_control_assert(channel->rstc);
> +
> + return ret;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(rcar_gen3_phy_usb2_pm_ops,
> + rcar_gen3_phy_usb2_suspend,
> + rcar_gen3_phy_usb2_resume);
> +
> static struct platform_driver rcar_gen3_phy_usb2_driver = {
> .driver = {
> .name = "phy_rcar_gen3_usb2",
> .of_match_table = rcar_gen3_phy_usb2_match_table,
> + .pm = pm_ptr(&rcar_gen3_phy_usb2_pm_ops),
> },
> .probe = rcar_gen3_phy_usb2_probe,
> .remove = rcar_gen3_phy_usb2_remove,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
next prev parent reply other threads:[~2025-11-19 14:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 12:04 [PATCH v2 0/2] phy: renesas: rcar-gen3-usb2: Add suspend to RAM support Claudiu
2025-11-19 12:04 ` [PATCH v2 1/2] phy: renesas: rcar-gen3-usb2: Move phy_data->init_bus check Claudiu
2025-11-19 14:49 ` Neil Armstrong
2025-11-19 12:04 ` [PATCH v2 2/2] phy: renesas: rcar-gen3-usb2: Add suspend/resume support Claudiu
2025-11-19 14:49 ` Neil Armstrong [this message]
2025-11-20 17:11 ` [PATCH v2 0/2] phy: renesas: rcar-gen3-usb2: Add suspend to RAM support Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=782ebaf9-38d9-4695-b5af-3cf77118e282@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=geert+renesas@glider.be \
--cc=kishon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=vkoul@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®