Skip to contentSkip to conversation

phy: atheros: ar8035: Fix clock output calculation

PATCH New Fabio Estevam 3 participants 4 messages Jun 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: atheros: ar8035: Fix clock output calculation

The "qca,clk-out-frequency" is calculated incorrectly for AR8035 due to incorrect masking of priv->clk_25m_reg and priv->clk_25m_mask.

This same issue has been already fixed in the kernel by:

commit b1f4c209d84057b6d40b939b6e4404854271d797

Author: Oleksij Rempel <[email protected]>
Date:   Wed Apr 1 11:57:32 2020 +0200

net: phy: at803x: fix clock sink configuration on ATH8030 and ATH8035

The masks in priv->clk_25m_reg and priv->clk_25m_mask are one-bits-set for the values that comprise the fields, not zero-bits-set.

This patch fixes the clock frequency configuration for ATH8030 and ATH8035 Atheros PHYs by removing the erroneous "~".

To reproduce this bug, configure the PHY with the device tree binding "qca,clk-out-frequency" and remove the machine specific PHY fixups.

Fixes 2f664823a47021 ("net: phy: at803x: add device tree binding")

Apply the same fix in the U-Boot driver.

Tested on a i.MX6 Hummingboard.

---
 drivers/net/phy/atheros.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/phy/atheros.c +3 -4
index 13f7275d17..f922fecd6b 100644
@@ -275,11 +275,10 @@ static int ar803x_of_init(struct phy_device *phydev)
 		 * Fixup for the AR8035 which only has two bits. The two
 		 * remaining bits map to the same frequencies.
 		 */
-		if (phydev->drv->uid == AR8035_PHY_ID) {
-			u16 clear = AR803x_CLK_25M_MASK & AR8035_CLK_25M_MASK;
 
-			priv->clk_25m_mask &= ~clear;
-			priv->clk_25m_reg &= ~clear;
+		if (phydev->drv->uid == AR8035_PHY_ID) {
+			priv->clk_25m_reg &= AR8035_CLK_25M_MASK;
+			priv->clk_25m_mask &= AR8035_CLK_25M_MASK;
 		}
 	}
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 phy: atheros: ar8035: Fix clock output calculation

Am 18. Juni 2020 05:08:59 MESZ schrieb Fabio Estevam <[email protected]>:

Quoted 27 lines

The "qca,clk-out-frequency" is calculated incorrectly for AR8035 due to incorrect masking of priv->clk_25m_reg and priv->clk_25m_mask.

This same issue has been already fixed in the kernel by:

commit b1f4c209d84057b6d40b939b6e4404854271d797

Author: Oleksij Rempel <[email protected]>
Date:   Wed Apr 1 11:57:32 2020 +0200

net: phy: at803x: fix clock sink configuration on ATH8030 and ATH8035

The masks in priv->clk_25m_reg and priv->clk_25m_mask are one-bits-set
for the values that comprise the fields, not zero-bits-set.

This patch fixes the clock frequency configuration for ATH8030 and ATH8035 Atheros PHYs by removing the erroneous "~".

To reproduce this bug, configure the PHY with the device tree binding
"qca,clk-out-frequency" and remove the machine specific PHY fixups.

Fixes 2f664823a47021 ("net: phy: at803x: add device tree binding")
Quoted 6 lines

Apply the same fix in the U-Boot driver.

Tested on a i.MX6 Hummingboard.

-michael

#2 lore raw

PATCH 1/1 phy: atheros: ar8035: Fix clock output calculation

In reply to Fabio Estevam
Quoted 27 lines · Fabio Estevam

The "qca,clk-out-frequency" is calculated incorrectly for AR8035 due to incorrect masking of priv->clk_25m_reg and priv->clk_25m_mask.

This same issue has been already fixed in the kernel by:

commit b1f4c209d84057b6d40b939b6e4404854271d797

Author: Oleksij Rempel <[email protected]>
Date:   Wed Apr 1 11:57:32 2020 +0200

net: phy: at803x: fix clock sink configuration on ATH8030 and ATH8035

The masks in priv->clk_25m_reg and priv->clk_25m_mask are one-bits-set for the values that comprise the fields, not zero-bits-set.

This patch fixes the clock frequency configuration for ATH8030 and ATH8035 Atheros PHYs by removing the erroneous "~".

To reproduce this bug, configure the PHY with the device tree binding "qca,clk-out-frequency" and remove the machine specific PHY fixups.

Fixes 2f664823a47021 ("net: phy: at803x: add device tree binding")
Quoted 6 lines

Apply the same fix in the U-Boot driver.

Tested on a i.MX6 Hummingboard.

What else do I need with this to test it myself? This alone doesn't do it (but I'm not surprised) and adding the 2 DM_ETH patches you sent to convert the platform still gives the "Could not get PHY for FEC0: addr 0" error message. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200618/4d8eccfe/attachment.sig>
#3 lore raw

PATCH 1/1 phy: atheros: ar8035: Fix clock output calculation

Hi Tom,

Quoted 4 lines · Tom Rini

What else do I need with this to test it myself? This alone doesn't do it (but I'm not surprised) and adding the 2 DM_ETH patches you sent to convert the platform still gives the "Could not get PHY for FEC0: addr 0" error message. Thanks!

I will submit later today the complete series for you to test.