-/* $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>
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;
}
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;
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;
}
-/* $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>
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;
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);