The branch stable/12 has been updated by mhorne:

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

commit 9c6bcc94c875d10e3cd30b24d4854c62d4bc6ab9
Author:     Emmanuel Vadot <[email protected]>
AuthorDate: 2022-02-22 08:58:36 +0000
Commit:     Mitchell Horne <[email protected]>
CommitDate: 2022-08-11 17:55:09 +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
    
    (cherry picked from commit da6252a6a099e6253207b69960e6762ce3cca0f8)
---
 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 1b0d5e97417f..06eb6bb47649 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -1450,11 +1450,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 045072abe611..005a6f1ad684 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 
*/

Reply via email to