From: Pawel Dembicki <paweldembicki@gmail.com>
To: netdev@vger.kernel.org
Cc: Pawel Dembicki <paweldembicki@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH net 6/6] net: phy: vitesse: repair vsc73xx autonegotiation
Date: Fri, 2 Aug 2024 10:04:03 +0200 [thread overview]
Message-ID: <20240802080403.739509-7-paweldembicki@gmail.com> (raw)
In-Reply-To: <20240802080403.739509-1-paweldembicki@gmail.com>
When the vsc73xx mdio bus work properly, the generic autonegotiation
configuration works well.
Vsc73xx have auto MDI-X disabled by default in forced mode. This commit
enables it.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
---
This patch came from net-next series[0].
Changes since net-next:
- rebased to netdev/main only
[0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/
---
drivers/net/phy/vitesse.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 897b979ec03c..19b7bf189be5 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -60,6 +60,11 @@
/* Vitesse Extended Page Access Register */
#define MII_VSC82X4_EXT_PAGE_ACCESS 0x1f
+/* VSC73XX PHY_BYPASS_CTRL register*/
+#define MII_VSC73XX_PHY_BYPASS_CTRL MII_DCOUNTER
+#define MII_PBC_FORCED_SPEED_AUTO_MDIX_DIS BIT(7)
+#define MII_VSC73XX_PBC_AUTO_NP_EXCHANGE_DIS BIT(1)
+
/* Vitesse VSC8601 Extended PHY Control Register 1 */
#define MII_VSC8601_EPHY_CTL 0x17
#define MII_VSC8601_EPHY_CTL_RGMII_SKEW (1 << 8)
@@ -239,12 +244,20 @@ static int vsc739x_config_init(struct phy_device *phydev)
static int vsc73xx_config_aneg(struct phy_device *phydev)
{
- /* The VSC73xx switches does not like to be instructed to
- * do autonegotiation in any way, it prefers that you just go
- * with the power-on/reset defaults. Writing some registers will
- * just make autonegotiation permanently fail.
- */
- return 0;
+ int ret;
+
+ /* Enable Auto MDI-X in forced 10/100 mode */
+ if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) {
+ ret = genphy_setup_forced(phydev);
+
+ if (ret < 0) /* error */
+ return ret;
+
+ return phy_clear_bits(phydev, MII_VSC73XX_PHY_BYPASS_CTRL,
+ MII_PBC_FORCED_SPEED_AUTO_MDIX_DIS);
+ }
+
+ return genphy_config_aneg(phydev);
}
/* This adds a skew for both TX and RX clocks, so the skew should only be
--
2.34.1
next prev parent reply other threads:[~2024-08-02 8:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 8:03 [PATCH net 0/6] net: dsa: vsc73xx: fix MDIO bus access and PHY operations Pawel Dembicki
2024-08-02 8:03 ` [PATCH net 1/6] net: dsa: vsc73xx: fix port MAC configuration in full duplex mode Pawel Dembicki
2024-08-02 20:58 ` Linus Walleij
2024-08-02 21:54 ` Florian Fainelli
2024-08-02 23:12 ` Andrew Lunn
2024-08-02 8:03 ` [PATCH net 2/6] net: dsa: vsc73xx: pass value in phy_write operation Pawel Dembicki
2024-08-02 20:59 ` Linus Walleij
2024-08-02 21:02 ` Linus Walleij
2024-08-02 21:53 ` Florian Fainelli
2024-08-02 8:04 ` [PATCH net 3/6] net: dsa: vsc73xx: use defined values in phy operations Pawel Dembicki
2024-08-02 21:03 ` Linus Walleij
2024-08-02 21:57 ` Florian Fainelli
2024-08-02 22:15 ` Vladimir Oltean
2024-08-04 23:08 ` Paweł Dembicki
2024-08-02 8:04 ` [PATCH net 4/6] net: dsa: vsc73xx: check busy flag in MDIO operations Pawel Dembicki
2024-08-02 21:04 ` Linus Walleij
2024-08-02 21:54 ` Florian Fainelli
2024-08-02 8:04 ` [PATCH net 5/6] net: dsa: vsc73xx: allow phy resetting Pawel Dembicki
2024-08-02 13:01 ` Russell King (Oracle)
2024-08-02 21:07 ` Linus Walleij
2024-08-02 21:55 ` Florian Fainelli
2024-08-02 8:04 ` Pawel Dembicki [this message]
2024-08-02 13:03 ` [PATCH net 6/6] net: phy: vitesse: repair vsc73xx autonegotiation Russell King (Oracle)
2024-08-02 20:40 ` Paweł Dembicki
2024-08-02 21:08 ` Linus Walleij
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=20240802080403.739509-7-paweldembicki@gmail.com \
--to=paweldembicki@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®