From: Alastair D'Silva <alastair@d-silva.org>
To: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>,
Vinod Koul <vkoul@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>,
Xu Rao <raoxu@uniontech.com>,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733
Date: Tue, 01 Dec 2026 10:22:23 +1100 [thread overview]
Message-ID: <be3b18bffdbeff56ea98da7927316b98f4dd2079.camel@d-silva.org> (raw)
In-Reply-To: <20261116105544.669029-3-vinicius.eduardo.pedrosa@gmail.com>
On Mon, 2026-11-16 at 07:55 -0300, Vinicius Pedrosa wrote:
> sun4i_usb_phy_init() deasserts the PHY reset first and clears SIDDQ in
> the PMU HCI_PHY_CTL register afterwards. The order comes from the H3
> support and the reason for it isn't documented.
>
> On a Cubie A7Z (A733), the Wi-Fi module on USB1 sometimes came up
> at full speed on the OHCI companion and failed enumeration with -62.
> This happened in 3 of 40 warm boots with a separate local PHY tuning
> change applied.
>
> With that tuning disabled, the current order failed once in 31 warm
> boots. Clearing SIDDQ before releasing reset had no failures in 60
> warm boots in the same interleaved run, or in 10 cold boots.
> Why the order matters is not understood.
>
> The vendor BSP clears SIDDQ while the PHY is still in reset, in its
> common host path.
>
> Add a config flag for the early clear and set it only for the A733,
> whose config is otherwise the D1 one. The other SoCs keep the current
> order: the manuals don't specify one and they weren't tested.
>
> Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
> ---
> drivers/phy/allwinner/phy-sun4i-usb.c | 35 +++++++++++++++++++++++----
> 1 file changed, 30 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
> index e2fbf8ccf99e..c918085a9281 100644
> --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> @@ -105,6 +105,7 @@ struct sun4i_usb_phy_cfg {
> bool phy0_dual_route;
> bool needs_phy2_siddq;
> bool siddq_in_base;
> + bool siddq_before_reset;
> bool poll_vbusen;
> int missing_phys;
> };
> @@ -253,6 +254,19 @@ static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable)
> writel(reg_value, phy->pmu);
> }
>
> +static void sun4i_usb_phy_clear_hci_phy_ctl(struct sun4i_usb_phy *phy)
> +{
> + struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
> + u32 val;
> +
> + if (!phy->pmu || !data->cfg->hci_phy_ctl_clear)
> + return;
> +
> + val = readl(phy->pmu + REG_HCI_PHY_CTL);
> + val &= ~data->cfg->hci_phy_ctl_clear;
> + writel(val, phy->pmu + REG_HCI_PHY_CTL);
> +}
> +
> static int sun4i_usb_phy_init(struct phy *_phy)
> {
> struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
> @@ -270,6 +284,10 @@ static int sun4i_usb_phy_init(struct phy *_phy)
> return ret;
> }
>
> + /* Some SoCs want SIDDQ cleared while the PHY is still in reset. */
> + if (data->cfg->siddq_before_reset)
> + sun4i_usb_phy_clear_hci_phy_ctl(phy);
> +
> ret = reset_control_deassert(phy->reset);
> if (ret) {
> clk_disable_unprepare(phy->clk2);
> @@ -321,11 +339,8 @@ static int sun4i_usb_phy_init(struct phy *_phy)
> clk_disable_unprepare(phy->clk2);
> }
>
> - if (phy->pmu && data->cfg->hci_phy_ctl_clear) {
> - val = readl(phy->pmu + REG_HCI_PHY_CTL);
> - val &= ~data->cfg->hci_phy_ctl_clear;
> - writel(val, phy->pmu + REG_HCI_PHY_CTL);
> - }
> + if (!data->cfg->siddq_before_reset)
> + sun4i_usb_phy_clear_hci_phy_ctl(phy);
>
> if (data->cfg->siddq_in_base) {
> if (phy->index == 0) {
> @@ -1013,6 +1028,15 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = {
> .siddq_in_base = true,
> };
>
> +static const struct sun4i_usb_phy_cfg sun60i_a733_cfg = {
> + .phyctl_offset = REG_PHYCTL_A33,
> + .dedicated_clocks = true,
> + .hci_phy_ctl_clear = PHY_CTL_SIDDQ,
> + .phy0_dual_route = true,
> + .siddq_in_base = true,
> + .siddq_before_reset = true,
> +};
> +
> static const struct of_device_id sun4i_usb_phy_of_match[] = {
> { .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg },
> { .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg },
> @@ -1029,6 +1053,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
> .data = &sun50i_a64_cfg},
> { .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
> { .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg },
> + { .compatible = "allwinner,sun60i-a733-usb-phy", .data = &sun60i_a733_cfg },
> { .compatible = "allwinner,suniv-f1c100s-usb-phy",
> .data = &suniv_f1c100s_cfg },
> { },
Tested on an Orange Pi 4 Pro enumerating the onboard USB 2.0 hub, a USB drive chained
off one of the ports, and confirmed the partition table was read by the kernel.
Reviewed-by: Alastair D'Silva <alastair@d-silva.org>
Tested-by: Alastair D'Silva <alastair@d-silva.org>
--
Alastair D'Silva
prev parent reply other threads:[~2026-11-30 23:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 10:55 [PATCH v2 0/2] phy: sun4i-usb: add the Allwinner A733 USB PHY Vinicius Pedrosa
2026-11-16 10:55 ` [PATCH v2 1/2] dt-bindings: phy: document Allwinner A733 USB-2.0 PHY Vinicius Pedrosa
2026-11-23 11:13 ` Krzysztof Kozlowski
2026-11-16 10:55 ` [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 Vinicius Pedrosa
2026-11-27 14:05 ` Manivannan Sadhasivam
2026-11-30 23:22 ` Alastair D'Silva [this message]
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=be3b18bffdbeff56ea98da7927316b98f4dd2079.camel@d-silva.org \
--to=alastair@d-silva.org \
--cc=andre.przywara@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=raoxu@uniontech.com \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=vinicius.eduardo.pedrosa@gmail.com \
--cc=vkoul@kernel.org \
--cc=wens@kernel.org \
/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®