git: 57e8eddc52b9 - main - lan867xphy: Add silicon rev D0 configuration

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 14:24:53 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=57e8eddc52b9a5adfda6b5c907a2c84967dcc257

commit 57e8eddc52b9a5adfda6b5c907a2c84967dcc257
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-11-06 18:02:07 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-11-13 14:23:26 +0000

    lan867xphy: Add silicon rev D0 configuration
    
    Apply hardware revision D0 configuration from Microchip AN1699
    (Revision G).  The LSCTL (0x0012) write is deferred until link state
    reporting is implemented.
    
    Sponsored by:   The FreeBSD Foundation
    Sponsored by:   Microchip (Hardware)
    Differential Revision: https://reviews.freebsd.org/D61269
---
 sys/dev/mii/lan867xphy.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mii/lan867xphy.c b/sys/dev/mii/lan867xphy.c
index 10b9f341d507..71bf24abbd05 100644
--- a/sys/dev/mii/lan867xphy.c
+++ b/sys/dev/mii/lan867xphy.c
@@ -10,7 +10,6 @@
  * This driver is sufficient for basic connectivity with CSMA/CD.
  *
  * TODO:
- * - Revision-specific configuration for D0 silicon
  * - PHY-Level Collision Avoidance (PLCA) configuration
  * - Sleep mode (C2, D0 and later)
  * - Topology discovery (D0 and later)
@@ -48,6 +47,7 @@
 
 /* Silicon revisions. */
 #define	LAN867X_REV_C2			5
+#define	LAN867X_REV_D0			6
 
 struct lan867x_cfg_fixup {
 	uint16_t address;
@@ -161,6 +161,32 @@ lan867xphy_config_revc(struct mii_softc *sc)
 	    nitems(lan867x_cfgdata_revc_part2));
 }
 
+/*
+ * Hardware revision D0 configuration parameters.
+ *
+ * From Microchip AN1699 LAN8670/1/2 Configuration Application Note
+ * (Revision G, October 2025).
+ */
+static const struct lan867x_cfg_fixup lan867x_cfgdata_revd[] = {
+	{ 0x0037, 0x0800 },
+	{ 0x008a, 0xbfc0 },
+	{ 0x0118, 0x029c },
+	{ 0x00d6, 0x1001 },
+	{ 0x0082, 0x001c },
+	/* Per AN1699, write 0x00fd twice with different values. */
+	{ 0x00fd, 0x0c0b },
+	{ 0x00fd, 0x8c07 },
+	{ 0x0091, 0x9660 },
+	/* 0x0012 (LSCTL) to be added along with link state reporting. */
+};
+
+static void
+lan867xphy_config_revd(struct mii_softc *sc)
+{
+	lan867xphy_config(sc, lan867x_cfgdata_revd,
+	    nitems(lan867x_cfgdata_revd));
+}
+
 static int lan867x_probe(device_t);
 static int lan867x_attach(device_t);
 
@@ -202,6 +228,9 @@ lan867xphy_reset(struct mii_softc *sc)
 	case LAN867X_REV_C2:
 		lan867xphy_config_revc(sc);
 		break;
+	case LAN867X_REV_D0:
+		lan867xphy_config_revd(sc);
+		break;
 	}
 
 	/* XXX apply PLCA settings */
@@ -247,6 +276,7 @@ lan867x_attach(device_t dev)
 
 	switch (sc->mii_mpd_rev) {
 	case LAN867X_REV_C2:
+	case LAN867X_REV_D0:
 		break;
 	default:
 		device_printf(dev,