From: Charles Perry Date: Tue, 24 Feb 2026 20:28:53 +0000 (-0800) Subject: net: macb: add support for reporting SGMII inband link status X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f44b2acc5a111471d8a3ae0e809bd419c0237e0;p=thirdparty%2Fkernel%2Flinux.git net: macb: add support for reporting SGMII inband link status This makes it possible to use in-band autonegotiation with SGMII. If using a device tree, this can be done by adding the managed = "in-band-status" property to the gem node. Signed-off-by: Charles Perry Link: https://patch.msgid.link/20260224202854.112813-3-charles.perry@microchip.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index fc26e70e23d42..8c192d65eeeb0 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -560,7 +560,12 @@ static int macb_usx_pcs_config(struct phylink_pcs *pcs, static void macb_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode, struct phylink_link_state *state) { - state->link = 0; + struct macb *bp = container_of(pcs, struct macb, phylink_sgmii_pcs); + u16 bmsr, lpa; + + bmsr = gem_readl(bp, PCSSTS); + lpa = gem_readl(bp, PCSANLPBASE); + phylink_mii_c22_pcs_decode_state(state, neg_mode, bmsr, lpa); } static void macb_pcs_an_restart(struct phylink_pcs *pcs)