diff options
-rw-r--r-- | sys/dev/fdt/if_dwqe_fdt.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/dwqe.c | 16 |
2 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/fdt/if_dwqe_fdt.c b/sys/dev/fdt/if_dwqe_fdt.c index 5d441600db3..0da10556b7d 100644 --- a/sys/dev/fdt/if_dwqe_fdt.c +++ b/sys/dev/fdt/if_dwqe_fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwqe_fdt.c,v 1.9 2023/04/07 22:55:26 dlg Exp $ */ +/* $OpenBSD: if_dwqe_fdt.c,v 1.10 2023/04/22 05:01:44 dlg Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se> @@ -349,17 +349,18 @@ void dwqe_mii_statchg_rk3568_task(void *arg) { struct dwqe_softc *sc = arg; + struct ifnet *ifp = &sc->sc_ac.ac_if; dwqe_mii_statchg(&sc->sc_dev); - switch (IFM_SUBTYPE(sc->sc_mii.mii_media_active)) { - case IFM_10_T: + switch (ifp->if_baudrate) { + case IF_Mbps(10): clock_set_frequency(sc->sc_node, "clk_mac_speed", 2500000); break; - case IFM_100_TX: + case IF_Mbps(100): clock_set_frequency(sc->sc_node, "clk_mac_speed", 25000000); break; - case IFM_1000_T: + case IF_Mbps(1000): clock_set_frequency(sc->sc_node, "clk_mac_speed", 125000000); break; } @@ -377,6 +378,7 @@ void dwqe_mii_statchg_rk3588(struct device *self) { struct dwqe_softc *sc = (void *)self; + struct ifnet *ifp = &sc->sc_ac.ac_if; struct regmap *rm; uint32_t grf; uint32_t gmac_clk_sel = 0; @@ -388,14 +390,14 @@ dwqe_mii_statchg_rk3588(struct device *self) if (rm == NULL) return; - switch (IFM_SUBTYPE(sc->sc_mii.mii_media_active)) { - case IFM_10_T: + switch (ifp->if_baudrate) { + case IF_Mbps(10): gmac_clk_sel = sc->sc_clk_sel_2_5; break; - case IFM_100_TX: + case IF_Mbps(100): gmac_clk_sel = sc->sc_clk_sel_25; break; - case IFM_1000_T: + case IF_Mbps(1000): gmac_clk_sel = sc->sc_clk_sel_125; break; } diff --git a/sys/dev/ic/dwqe.c b/sys/dev/ic/dwqe.c index bcc8b191194..9c9653344d1 100644 --- a/sys/dev/ic/dwqe.c +++ b/sys/dev/ic/dwqe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwqe.c,v 1.4 2023/04/07 08:53:03 kettenis Exp $ */ +/* $OpenBSD: dwqe.c,v 1.5 2023/04/22 05:01:44 dlg Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se> @@ -476,23 +476,21 @@ void dwqe_mii_statchg(struct device *self) { struct dwqe_softc *sc = (void *)self; + struct ifnet *ifp = &sc->sc_ac.ac_if; uint32_t conf; conf = dwqe_read(sc, GMAC_MAC_CONF); conf &= ~(GMAC_MAC_CONF_PS | GMAC_MAC_CONF_FES); - switch (IFM_SUBTYPE(sc->sc_mii.mii_media_active)) { - case IFM_1000_SX: - case IFM_1000_LX: - case IFM_1000_CX: - case IFM_1000_T: + switch (ifp->if_baudrate) { + case IF_Mbps(1000): sc->sc_link = 1; break; - case IFM_100_TX: + case IF_Mbps(100): conf |= GMAC_MAC_CONF_PS | GMAC_MAC_CONF_FES; sc->sc_link = 1; break; - case IFM_10_T: + case IF_Mbps(10): conf |= GMAC_MAC_CONF_PS; sc->sc_link = 1; break; @@ -505,7 +503,7 @@ dwqe_mii_statchg(struct device *self) return; conf &= ~GMAC_MAC_CONF_DM; - if ((sc->sc_mii.mii_media_active & IFM_GMASK) == IFM_FDX) + if (ifp->if_link_state == LINK_STATE_FULL_DUPLEX) conf |= GMAC_MAC_CONF_DM; dwqe_write(sc, GMAC_MAC_CONF, conf); |