From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
geert+renesas@glider.be, magnus.damm@gmail.com,
gregkh@linuxfoundation.org, mturquette@baylibre.com,
sboyd@kernel.org, yoshihiro.shimoda.uh@renesas.com,
biju.das.jz@bp.renesas.com, ulf.hansson@linaro.org,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-clk@vger.kernel.org, linux-pm@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 10/16] phy: renesas: rcar-gen3-usb2: Add support to initialize the bus
Date: Wed, 9 Oct 2024 11:31:15 +0300 [thread overview]
Message-ID: <229582da-270d-4188-a202-50e41493c7cb@tuxon.dev> (raw)
In-Reply-To: <CAMuHMdX1b5ZZaO+G1h=E8uv+WV7oS8xg8Hx=_+uORO7Qu33eNw@mail.gmail.com>
Hi, Geert,
On 08.10.2024 17:57, Geert Uytterhoeven wrote:
> Hi Claudiu,
>
> On Thu, Aug 22, 2024 at 5:28 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
>>
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> The Renesas RZ/G3S need to initialize the USB BUS before transferring data
>> due to hardware limitation. As the register that need to be touched for
>> this is in the address space of the USB PHY, and the UBS PHY need to be
>> initialized before any other USB drivers handling data transfer, add
>> support to initialize the USB BUS.
>>
>> As the USB PHY is probed before any other USB drivers that enables
>> clocks and de-assert the reset signals and the BUS initialization is done
>> in the probe phase, we need to add code to de-assert reset signal and
>> runtime resume the device (which enables its clocks) before accessing
>> the registers.
>>
>> As the reset signals are not required by the USB PHY driver for the other
>> USB PHY hardware variants, the reset signals and runtime PM was handled
>> only in the function that initialize the USB BUS.
>>
>> The PHY initialization was done right after runtime PM enable to have
>> all in place when the PHYs are registered.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Thanks for your patch, which is now commit 4eae16375357a2a7 ("phy:
> renesas: rcar-gen3-usb2: Add support to initialize the bus") in
> v6.12-rc1.
>
>> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
>> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
>> @@ -650,6 +658,35 @@ static enum usb_dr_mode rcar_gen3_get_dr_mode(struct device_node *np)
>> return candidate;
>> }
>>
>> +static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel)
>> +{
>> + struct device *dev = channel->dev;
>> + int ret;
>> + u32 val;
>> +
>> + channel->rstc = devm_reset_control_array_get_shared(dev);
>> + if (IS_ERR(channel->rstc))
>> + return PTR_ERR(channel->rstc);
>> +
>> + ret = pm_runtime_resume_and_get(dev);
>> + if (ret)
>> + return ret;
>> +
>> + ret = reset_control_deassert(channel->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;
>> +}
>> +
>> static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>> {
>> const struct rcar_gen3_phy_drv_data *phy_data;
>> @@ -703,6 +740,15 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>> goto error;
>> }
>>
>> + platform_set_drvdata(pdev, channel);
>> + channel->dev = dev;
>
> Unrelated change?
That's a leftover from the removal of the suspend to RAM support from the
initial work (internal only) of this series. I'll keep it in mid to remove
it on the following patches, if needed.
>
>> +
>> + if (phy_data->init_bus) {
>> + ret = rcar_gen3_phy_usb2_init_bus(channel);
>> + if (ret)
>> + goto error;
>> + }
>> +
>> channel->soc_no_adp_ctrl = phy_data->no_adp_ctrl;
>> if (phy_data->no_adp_ctrl)
>> channel->obint_enable_bits = USB2_OBINT_IDCHG_EN;
>> @@ -733,9 +779,6 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>> channel->vbus = NULL;
>> }
>>
>> - platform_set_drvdata(pdev, channel);
>> - channel->dev = dev;
>> -
>> provider = devm_of_phy_provider_register(dev, rcar_gen3_phy_usb2_xlate);
>> if (IS_ERR(provider)) {
>> dev_err(dev, "Failed to register PHY provider\n");
>
> The reset is not asserted in the error path, only in .remove().
>
> Oh, Christophe already sent a fix for that...
> "[PATCH v3] phy: renesas: rcar-gen3-usb2: Fix an error handling path
> in rcar_gen3_phy_usb2_probe()"
> https://lore.kernel.org/all/290b25827e3f0742808940719455ff0c5cb9d01d.1726329925.git.christophe.jaillet@wanadoo.fr
Yes, I messed this when removing the suspend to RAM from my initial work on
this (internal only). Thanks Christophe for handling it.
Thank you,
Claudiu Beznea
>
>> @@ -762,6 +805,7 @@ static void rcar_gen3_phy_usb2_remove(struct platform_device *pdev)
>> if (channel->is_otg_channel)
>> device_remove_file(&pdev->dev, &dev_attr_role);
>>
>> + reset_control_assert(channel->rstc);
>> pm_runtime_disable(&pdev->dev);
>> };
>
> The rest LGTM.
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2024-10-09 8:31 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 15:27 [PATCH 00/16] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
2024-08-22 15:27 ` [PATCH 01/16] clk: renesas: r9a08g045: Add clocks, resets and power domains for USB Claudiu
2024-08-29 12:35 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 02/16] dt-bindings: soc: renesas: renesas,rzg2l-sysc: Add #reset-cells for RZ/G3S Claudiu
2024-08-22 16:42 ` Conor Dooley
2024-08-22 16:44 ` Conor Dooley
2024-08-23 7:59 ` claudiu beznea
2024-08-23 7:54 ` claudiu beznea
2024-08-23 16:18 ` Conor Dooley
2024-08-23 16:26 ` claudiu beznea
2024-08-23 16:33 ` Conor Dooley
2024-08-26 10:15 ` claudiu beznea
2024-08-26 17:09 ` Conor Dooley
2024-10-08 13:24 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 03/16] dt-bindings: reset: renesas,r9a08g045-sysc: Add reset IDs for RZ/G3S SYSC reset Claudiu
2024-08-22 16:45 ` Conor Dooley
2024-10-08 13:25 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 04/16] soc: renesas: Add SYSC driver for Renesas RZ/G3S Claudiu
2024-09-24 11:32 ` Geert Uytterhoeven
2024-09-25 7:50 ` claudiu beznea
2024-10-08 13:54 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 05/16] soc: renesas: sysc: Move RZ/G3S SoC detection on SYSC driver Claudiu
2024-10-08 13:23 ` Geert Uytterhoeven
2024-10-09 8:26 ` claudiu beznea
2024-08-22 15:27 ` [PATCH 06/16] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S SoC Claudiu
2024-08-22 16:45 ` Conor Dooley
2024-10-08 14:46 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 07/16] reset: rzg2l-usbphy-ctrl: Get reset control array Claudiu
2024-08-23 7:25 ` Biju Das
2024-08-23 8:05 ` claudiu beznea
2024-08-23 8:17 ` Biju Das
2024-10-08 14:46 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 08/16] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S Claudiu
2024-08-22 16:59 ` Biju Das
2024-08-23 8:40 ` claudiu beznea
2024-08-23 8:46 ` Biju Das
2024-10-08 14:47 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 09/16] dt-bindings: usb: renesas,usbhs: Document RZ/G3S SoC Claudiu
2024-08-22 16:46 ` Conor Dooley
2024-10-08 14:51 ` Geert Uytterhoeven
2024-10-09 8:28 ` claudiu beznea
2024-08-22 15:27 ` [PATCH 10/16] phy: renesas: rcar-gen3-usb2: Add support to initialize the bus Claudiu
2024-08-23 7:35 ` Biju Das
2024-08-23 8:57 ` claudiu beznea
2024-08-23 9:01 ` Biju Das
2024-08-30 8:02 ` Vinod Koul
2024-08-30 8:06 ` Biju Das
2024-10-08 14:57 ` Geert Uytterhoeven
2024-10-09 8:31 ` claudiu beznea [this message]
2024-08-22 15:27 ` [PATCH 11/16] dt-bindings: phy: renesas,usb2-phy: Document RZ/G3S phy bindings Claudiu
2024-08-22 16:46 ` Conor Dooley
2024-10-08 14:58 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 12/16] phy: renesas: rcar-gen3-usb2: Add support for the RZ/G3S SoC Claudiu
2024-10-08 14:59 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 13/16] arm64: dts: renesas: Add #reset-cells to system controller node Claudiu
2024-10-08 14:59 ` Geert Uytterhoeven
2024-08-22 15:27 ` [PATCH 14/16] arm64: dts: renesas: r9a08g045: Add USB support Claudiu
2024-10-08 15:00 ` Geert Uytterhoeven
2024-08-22 15:28 ` [PATCH 15/16] arm64: dts: renesas: rzg3s-smarc: Enable " Claudiu
2024-10-08 15:16 ` Geert Uytterhoeven
2024-10-09 8:42 ` claudiu beznea
2024-08-22 15:28 ` [PATCH 16/16] arm64: defconfig: Enable RZ/G3S SYSC reset driver Claudiu
2024-10-08 15:17 ` Geert Uytterhoeven
2024-08-29 15:26 ` [PATCH 00/16] Add initial USB support for the Renesas RZ/G3S SoC Ulf Hansson
2024-08-30 8:22 ` claudiu beznea
2024-08-30 10:14 ` Ulf Hansson
2024-08-30 11:32 ` claudiu beznea
2024-08-31 10:32 ` Ulf Hansson
2024-09-03 10:35 ` Ulf Hansson
2024-09-03 10:58 ` claudiu beznea
2024-09-03 11:50 ` Ulf Hansson
2024-08-31 5:13 ` Biju Das
2024-09-02 7:54 ` Biju Das
2024-09-02 8:47 ` claudiu beznea
2024-09-02 8:53 ` Biju Das
2024-09-02 9:14 ` claudiu beznea
2024-09-02 9:18 ` Biju Das
2024-09-02 10:40 ` claudiu beznea
2024-09-02 10:47 ` Biju Das
2024-09-03 7:18 ` Biju Das
2024-09-03 10:25 ` claudiu beznea
2024-09-03 10:31 ` Biju Das
2024-09-03 11:00 ` claudiu beznea
2024-09-03 11:07 ` Biju Das
2024-09-03 12:00 ` Biju Das
2024-09-03 12:25 ` claudiu beznea
2024-09-03 12:37 ` Biju Das
2024-09-03 12:57 ` claudiu beznea
2024-09-03 13:09 ` Biju Das
2024-09-03 14:46 ` claudiu beznea
2024-09-03 15:30 ` Biju Das
2024-09-03 13:45 ` Biju Das
2024-09-03 14:48 ` claudiu beznea
2024-11-07 10:00 ` Claudiu Beznea
2024-11-07 16:22 ` Philipp Zabel
2024-09-03 10:19 ` claudiu beznea
2024-09-02 8:28 ` claudiu beznea
2024-08-30 8:10 ` (subset) " 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=229582da-270d-4188-a202-50e41493c7cb@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).