git: da6252a6a099 - main - dwc: Support phy mode MII

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 09:02:09 UTC
The branch main has been updated by manu:

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

commit da6252a6a099e6253207b69960e6762ce3cca0f8
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-02-22 08:58:36 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-02-22 09:01:56 +0000

    dwc: Support phy mode MII
    
    Some board use dwc phy in MII mode, so do not fail to attach if this is
    the case.
    Only rockchip code uses the phy mode to program some custom syscon register.
    
    PR:     260848
    MFC after:      1 week
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 sys/dev/dwc/if_dwc.c | 11 +++++++----
 sys/dev/dwc/if_dwc.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index 8bc0c0e7b6c3..e2bdf9965f84 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -1573,11 +1573,14 @@ dwc_attach(device_t dev)
 	case MII_CONTYPE_RGMII_ID:
 	case MII_CONTYPE_RGMII_RXID:
 	case MII_CONTYPE_RGMII_TXID:
-			sc->phy_mode = PHY_MODE_RGMII;
-			break;
+		sc->phy_mode = PHY_MODE_RGMII;
+		break;
 	case MII_CONTYPE_RMII:
-			sc->phy_mode = PHY_MODE_RMII;
-			break;
+		sc->phy_mode = PHY_MODE_RMII;
+		break;
+	case MII_CONTYPE_MII:
+		sc->phy_mode = PHY_MODE_MII;
+		break;
 	default:
 		device_printf(dev, "Unsupported MII type\n");
 		return (ENXIO);
diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/if_dwc.h
index d475974fcff9..d8c10258388a 100644
--- a/sys/dev/dwc/if_dwc.h
+++ b/sys/dev/dwc/if_dwc.h
@@ -40,6 +40,7 @@
 #define	PHY_MODE_UNKNOWN	0x0
 #define	PHY_MODE_RMII		0x1
 #define	PHY_MODE_RGMII		0x2
+#define	PHY_MODE_MII		0x3
 
 #define	MAC_CONFIGURATION	0x0
 #define	 CONF_JD		(1 << 22)	/* jabber timer disable */