* [PATCH v2 0/2] phy: sun4i-usb: add the Allwinner A733 USB PHY @ 2026-11-16 10:55 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-16 10:55 ` [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 Vinicius Pedrosa 0 siblings, 2 replies; 6+ messages in thread From: Vinicius Pedrosa @ 2026-11-16 10:55 UTC (permalink / raw) To: Vinod Koul Cc: Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel This adds the A733 to the sun4i-usb PHY driver. It works with the D1 settings, except that the A733 gets SIDDQ cleared before the PHY reset is released (patch 2). That made an intermittent USB1 enumeration failure go away on my board. I only have one Cubie A7Z, running a local DT, since there's no A733 dtsi upstream yet. Only USB1 is enabled in it, so PHY0 (the OTG port) never went through the new order. The boots ran the same reorder on top of 7.3-rc6, before I turned it into a per-SoC flag. The numbers are in patch 2. The comparison inside the last run alone (1/31 vs 0/60) isn't statistically significant, so it leans on the earlier 3/40 too. One question. The vendor BSP uses this order in common code, for every SoC. I kept it per SoC because I can't test the others and the manual says nothing about the order. Would you prefer it for all the SoCs that clear PHY_CTL_SIDDQ (D1, H616, and A100/A523 through the D1 fallback), or is a per-SoC flag fine? Changes in v2: - Reword the binding commit message into a single paragraph (Krzysztof) - Rebase on phy/next and drop the dependency on Xu Rao's "phy: allwinner: sun4i-usb: disable the PHY2 PMU clock after SIDDQ setup". Patch 2 only overlaps with it in context. v1: https://lore.kernel.org/all/20261029172325.3425046-1-vinicius.eduardo.pedrosa@gmail.com/ Vinicius Vinicius Pedrosa (2): dt-bindings: phy: document Allwinner A733 USB-2.0 PHY phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 .../phy/allwinner,sun50i-a64-usb-phy.yaml | 1 + drivers/phy/allwinner/phy-sun4i-usb.c | 35 ++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) base-commit: 6bdfbe223ed4735073c299a6645ebd3faac3f51f -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] dt-bindings: phy: document Allwinner A733 USB-2.0 PHY 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 ` 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 1 sibling, 1 reply; 6+ messages in thread From: Vinicius Pedrosa @ 2026-11-16 10:55 UTC (permalink / raw) To: Vinod Koul Cc: Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel The Allwinner A733 USB 2.0 PHY uses the same configuration as the D1, so add its compatible with the D1 fallback. The A733-specific compatible lets the driver clear SIDDQ before releasing the PHY reset, without changing the PHY configuration. Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> --- .../devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml b/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml index 580c3296a18d..da4ad6fb3531 100644 --- a/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml +++ b/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml @@ -23,6 +23,7 @@ properties: - enum: - allwinner,sun50i-a100-usb-phy - allwinner,sun55i-a523-usb-phy + - allwinner,sun60i-a733-usb-phy - const: allwinner,sun20i-d1-usb-phy reg: -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: phy: document Allwinner A733 USB-2.0 PHY 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 0 siblings, 0 replies; 6+ messages in thread From: Krzysztof Kozlowski @ 2026-11-23 11:13 UTC (permalink / raw) To: Vinicius Pedrosa Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Mon, Nov 16, 2026 at 07:55:43AM -0300, Vinicius Pedrosa wrote: > The Allwinner A733 USB 2.0 PHY uses the same configuration as the D1, > so add its compatible with the D1 fallback. The A733-specific > compatible lets the driver clear SIDDQ before releasing the PHY reset, > without changing the PHY configuration. > > Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com> > --- > .../devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml | 1 + > 1 file changed, 1 insertion(+) Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 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-16 10:55 ` Vinicius Pedrosa 2026-11-27 14:05 ` Manivannan Sadhasivam 2026-11-30 23:22 ` Alastair D'Silva 1 sibling, 2 replies; 6+ messages in thread From: Vinicius Pedrosa @ 2026-11-16 10:55 UTC (permalink / raw) To: Vinod Koul Cc: Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel 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 }, { }, -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 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 1 sibling, 0 replies; 6+ messages in thread From: Manivannan Sadhasivam @ 2026-11-27 14:05 UTC (permalink / raw) To: Vinicius Pedrosa Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On 2026-11-16 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> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> - Mani ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 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 1 sibling, 0 replies; 6+ messages in thread From: Alastair D'Silva @ 2026-11-30 23:22 UTC (permalink / raw) To: Vinicius Pedrosa, Vinod Koul Cc: Neil Armstrong, Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara, Xu Rao, linux-phy, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-30 23:22 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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®