phy: ath79-usb: support the AR934x+ analog reset
Subsystems (4)
v2 cover phy: ath79-usb: support the AR934x+ analog reset
From AR934x on, the analog part of the ath79 USB PHY has its own reset, which the old platform code handled outside the PHY driver. Patch 1 adds the optional third "phy-analog" reset to the binding, along with AR9340 and QCA9550 compatibles that require it. Patch 2 makes the driver take and sequence that reset.
Changes in v2:
- Send the binding and driver changes together as one series. v1 sent the driver patch alone, so it used a "phy-analog" reset name that the binding on the list did not yet document.
- No code changes.
Claude Code (Claude Opus 5.5) was used while preparing this series. I reviewed and tested every change and take responsibility for it.
Rosen Penev (2):
dt-bindings: phy: qca,ar7100-usb-phy: add AR9340, QCA9550 and the
analog reset
phy: ath79-usb: support the analog reset
.../bindings/phy/qca,ar7100-usb-phy.yaml | 38 ++++++++++++++++++- drivers/phy/qualcomm/phy-ath79-usb.c | 33 ++++++++++++++-- 2 files changed, 67 insertions(+), 4 deletions(-)
Signature · 1 line
2.56.0
PATCH v2 1/2 dt-bindings: phy: qca,ar7100-usb-phy: add AR9340, QCA9550 and the analog reset
From AR934x on, the analog part of the USB PHY has its own reset, which has to be released along with the PHY one. Add it as a third, optional reset, and add compatibles for AR934x and QCA955x, which need it.
--- .../bindings/phy/qca,ar7100-usb-phy.yaml | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/qca,ar7100-usb-phy.yaml +37 -1
@@ -11,8 +11,13 @@ maintainers: properties: compatible: - items: + oneOf: - const: qca,ar7100-usb-phy + - items: + - enum: + - qca,ar9340-usb-phy + - qca,qca9550-usb-phy + - const: qca,ar7100-usb-phy reset-names: description: Names of reset lines in order.
@@ -20,6 +25,7 @@ properties: items: - const: phy - const: suspend-override + - const: phy-analog resets: description: References to the reset controllers.
@@ -27,6 +33,7 @@ properties: items: - description: Reset controller for phy - description: Reset controller for suspend-override + - description: Reset controller for the analog part of the phy '#phy-cells': const: 0
@@ -37,6 +44,27 @@ required: - resets - '#phy-cells' +allOf: + - if: + properties: + compatible: + contains: + enum: + - qca,ar9340-usb-phy + - qca,qca9550-usb-phy + then: + properties: + resets: + minItems: 3 + reset-names: + minItems: 3 + else: + properties: + resets: + maxItems: 2 + reset-names: + maxItems: 2 + additionalProperties: false examples:
@@ -47,3 +75,11 @@ examples: resets = <&rst 4>, <&rst 3>; #phy-cells = <0>; }; + + - | + usb-phy { + compatible = "qca,qca9550-usb-phy", "qca,ar7100-usb-phy"; + reset-names = "phy", "suspend-override", "phy-analog"; + resets = <&rst 4>, <&rst 3>, <&rst 11>; + #phy-cells = <0>; + };
Signature · 1 line
2.56.0
PATCH v2 2/2 phy: ath79-usb: support the analog reset
In reply to Rosen PenevFrom AR934x on, the analog part of the USB PHY has its own reset. The old platform code released it after the PHY reset on AR934x, and left it to the bootloader on QCA955x.
Take it as an optional "phy-analog" reset, release it after the PHY one when powering on, and assert it first when powering off. This is the reset handling OpenWrt has used on its AR934x, QCA955x and QCA956x boards.
--- drivers/phy/qualcomm/phy-ath79-usb.c | 33 +++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/phy/qualcomm/phy-ath79-usb.c +30 -3
@@ -12,6 +12,7 @@struct ath79_usb_phy {struct reset_control *reset; +struct reset_control *analog_reset;/* The suspend override logic is inverted, hence the no prefix * to make the code a bit easier to understand. */
@@ -30,7 +31,19 @@ static int ath79_usb_phy_power_on(struct phy *phy) } err =reset_control_deassert (priv->reset); -if (err && priv->no_suspend_override) +if (err) + goto err_suspend_override; + + err =reset_control_deassert (priv->analog_reset); +if (err) { +reset_control_assert (priv->reset); + goto err_suspend_override; + } + +return 0 ; + +err_suspend_override: +if (priv->no_suspend_override)reset_control_deassert (priv->no_suspend_override);return err;
@@ -41,14 +54,22 @@ static int ath79_usb_phy_power_off(struct phy *phy)struct ath79_usb_phy *priv =phy_get_drvdata (phy);int err =0 ; - err =reset_control_assert (priv->reset); + err =reset_control_assert (priv->analog_reset);if (err)return err; + err =reset_control_assert (priv->reset); +if (err) { +reset_control_deassert (priv->analog_reset); +return err; + } +if (priv->no_suspend_override) { err =reset_control_deassert (priv->no_suspend_override); -if (err) +if (err) {reset_control_deassert (priv->reset); +reset_control_deassert (priv->analog_reset); + } }return err;
@@ -78,6 +99,12 @@ static int ath79_usb_phy_probe(struct platform_device *pdev)if (IS_ERR (priv->no_suspend_override))return PTR_ERR (priv->no_suspend_override); +/* AR934x and later also hold the analog part in reset */ + priv->analog_reset =devm_reset_control_get_optional (&pdev->dev, +"phy-analog" ); +if (IS_ERR (priv->analog_reset)) +return PTR_ERR (priv->analog_reset); + phy =devm_phy_create (&pdev->dev,NULL , &ath79_usb_phy_ops);if (IS_ERR (phy))return PTR_ERR (phy);
Signature · 1 line
2.56.0
Re: [PATCH v2 1/2] dt-bindings: phy: qca,ar7100-usb-phy: add AR9340, QCA9550 and the analog reset
In reply to Rosen PenevQuoted 9 lines · Rosen Penev
Quoted 1 line
From AR934x on, the analog part of the USB PHY has its own reset,
which has to be released along with the PHY one. Add it as a third, optional reset, and add compatibles for AR934x and QCA955x, which need it.
Signed-off-by Rosen Penev <[email protected]>--- .../bindings/phy/qca,ar7100-usb-phy.yaml | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
Best regards,
Krzysztof