Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2025 03:01:17 GMT
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 67fb9dc457ee - main - mii: Change e1000phy (Marvell 88E1000) PHYs to disable power down / isolate
Message-ID:  <202505010301.54131HQR078854@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=67fb9dc457eee048768fe467228c394154cc28f9

commit 67fb9dc457eee048768fe467228c394154cc28f9
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2025-04-25 03:21:50 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2025-05-01 03:00:56 +0000

    mii: Change e1000phy (Marvell 88E1000) PHYs to disable power down / isolate
    
    The reset sequence doesn't clear the power down / isolate bits during
    power up and configuration.  Change that to make sure things are
    consistent.
    
    If the PHY is initialised by something external (eg a bootloader,
    config EEPROM driving a switch chip, etc) which sets the power down
    and/or isolate bits in E1000_CR, then the reset path wouldn't
    undo it and the PHY will look permanently down.  Even when we
    configure autonegotiate or statically nail the port up, it's still
    not coming out of the power mode.
    
    Differential Revision:  https://reviews.freebsd.org/D50045
---
 sys/dev/mii/e1000phy.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/dev/mii/e1000phy.c b/sys/dev/mii/e1000phy.c
index e978c043d72a..050e9db71577 100644
--- a/sys/dev/mii/e1000phy.c
+++ b/sys/dev/mii/e1000phy.c
@@ -185,6 +185,11 @@ e1000phy_reset(struct mii_softc *sc)
 {
 	uint16_t reg, page;
 
+	/* Undo power-down / isolate */
+	reg = PHY_READ(sc, E1000_CR);
+	reg &= ~(E1000_CR_ISOLATE | E1000_CR_POWER_DOWN);
+	PHY_WRITE(sc, E1000_CR, reg);
+
 	reg = PHY_READ(sc, E1000_SCR);
 	if ((sc->mii_flags & MIIF_HAVEFIBER) != 0) {
 		reg &= ~E1000_SCR_AUTO_X_MODE;
@@ -353,6 +358,8 @@ e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 
 		reg = PHY_READ(sc, E1000_CR);
 		reg &= ~E1000_CR_AUTO_NEG_ENABLE;
+		/* Undo power-down / isolate */
+		reg &= ~(E1000_CR_ISOLATE | E1000_CR_POWER_DOWN);
 		PHY_WRITE(sc, E1000_CR, reg | E1000_CR_RESET);
 
 		if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505010301.54131HQR078854>