]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: macb: add support for reporting SGMII inband link status
authorCharles Perry <charles.perry@microchip.com>
Tue, 24 Feb 2026 20:28:53 +0000 (12:28 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Feb 2026 03:19:24 +0000 (19:19 -0800)
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 <charles.perry@microchip.com>
Link: https://patch.msgid.link/20260224202854.112813-3-charles.perry@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/cadence/macb_main.c

index fc26e70e23d42f9afca2c4f85d5e165e66a6df24..8c192d65eeeb01535e2f6c1c341361b553e524fd 100644 (file)
@@ -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)