summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2023-02-27 09:59:47 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2023-02-27 09:59:47 +0000
commit50d86981a8ae98b859b8fae3a9aebf251027bed8 (patch)
tree98b25859944edcd2fbf4f363a14078313b6fab46 /sys
parentdb7128f9a26a8c9e208060a0538e628b6681f2bc (diff)
Pass MII flags depending on the phy mode specified in the device tree.
With this, the WAN port on the Turris Omnia works. tested on Turris MOX by kettenis@ ok patrick@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/if_mvneta.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/fdt/if_mvneta.c b/sys/dev/fdt/if_mvneta.c
index 9ee7a9c5ab0..9d0a321bea3 100644
--- a/sys/dev/fdt/if_mvneta.c
+++ b/sys/dev/fdt/if_mvneta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mvneta.c,v 1.27 2022/07/19 21:49:22 jmatthew Exp $ */
+/* $OpenBSD: if_mvneta.c,v 1.28 2023/02/27 09:59:46 jmatthew Exp $ */
/* $NetBSD: if_mvneta.c,v 1.41 2015/04/15 10:15:40 hsuenaga Exp $ */
/*
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
@@ -742,6 +742,7 @@ mvneta_attach_deferred(struct device *self)
{
struct mvneta_softc *sc = (struct mvneta_softc *) self;
struct ifnet *ifp = &sc->sc_ac.ac_if;
+ int mii_flags = 0;
if (!sc->sc_fixed_link) {
sc->sc_mdio = mii_byphandle(sc->sc_phy);
@@ -750,8 +751,22 @@ mvneta_attach_deferred(struct device *self)
return;
}
+ switch (sc->sc_phy_mode) {
+ case PHY_MODE_1000BASEX:
+ mii_flags |= MIIF_IS_1000X;
+ break;
+ case PHY_MODE_SGMII:
+ mii_flags |= MIIF_SGMII;
+ break;
+ case PHY_MODE_RGMII_ID:
+ mii_flags |= MIIF_RXID | MIIF_TXID;
+ break;
+ default:
+ break;
+ }
+
mii_attach(self, &sc->sc_mii, 0xffffffff, sc->sc_phyloc,
- MII_OFFSET_ANY, 0);
+ MII_OFFSET_ANY, mii_flags);
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
printf("%s: no PHY found!\n", self->dv_xname);
ifmedia_add(&sc->sc_mii.mii_media,