From nobody Fri Apr 17 00:17:58 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0013F33A010; Tue, 24 Feb 2026 20:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771964990; cv=none; b=KOXZeMf3NiSUJNPRsu7kaMN5s+0F3hLJnxhsR2WsRAVNgsliAEXtk1ZMYDa6wPj37LmFsOPHo75wSmuvDyTOv9GlOX+qf3VBf/szcxFC2sDa3g9XIOqeyBAz9hyNz6MlSJiNK1/jzw7lbafp7oBw1YRiBLqIuXCnCEOO0+o8HEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771964990; c=relaxed/simple; bh=1VEm0arbUZfxX0v/fT6FqQBpqJKnwvcYGvUGlchmwxo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y97r6vVdjg6CIuL2gP5ZyhKca9T650XJAciCI70l7GEWI49bxhF62n3B3SVRFyK2hPj03aSAvD0udb+4Z0xDvKrx4DXVvU0BvrMPoM3Y8PPaVNulckeHcj68DlFUyFsckzlY9eLXdTT+HBVFFVAsGAxtwcYBmmpS0nZZWwy+LJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=lCo6yPtQ; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="lCo6yPtQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1771964987; x=1803500987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1VEm0arbUZfxX0v/fT6FqQBpqJKnwvcYGvUGlchmwxo=; b=lCo6yPtQOpCE0XNolJDqT5+bRSDsDpYYjln4TUfzOhQBm8rETf+E1jYg I7mMqEXDdFCdk0RqNJwZ5/DDJj53rFDs0blOHIWKE1OcH0sXGjjfSqaCR 5cQa1GheacooHhhgLOMhO+56XOt3Mi3uXISCOliDKVIrWLQEpE6VV7nZT eFiGwOePv4ZAyubeRCA9k883y1cQZ8kHTMspfc82ZxeCADYmjHE0447Wd W8Nn+yiplUMjIapn3MpdLlFk4JFBGNadm0n6D2cN6gXdSnRaufz0F0Gx0 zYqevSOBEt/7yE/1SyuZ+OLr5T2v/6hhOlLVMFYVb2el9sFHh6Ai28tkL w==; X-CSE-ConnectionGUID: CU6nEk3VSSKbTSpVLGI17Q== X-CSE-MsgGUID: cIybErY6RLa4XitBa8VsTQ== X-IronPort-AV: E=Sophos;i="6.21,309,1763449200"; d="scan'208";a="54233071" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2026 13:29:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.35; Tue, 24 Feb 2026 13:29:30 -0700 Received: from bby-cbu-swbuild03.eng.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 24 Feb 2026 13:29:28 -0700 From: Charles Perry To: CC: Charles Perry , Sean Anderson , Nicolas Ferre , Claudiu Beznea , Andrew Lunn , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Russell King , Subject: [PATCH net-next v2 1/3] net: macb: fix SGMII with inband aneg disabled Date: Tue, 24 Feb 2026 12:28:52 -0800 Message-ID: <20260224202854.112813-2-charles.perry@microchip.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260224202854.112813-1-charles.perry@microchip.com> References: <20260224202854.112813-1-charles.perry@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make it possible to connect a PHY which does not use inband autoneg to a gem MAC using phylink's information. The previous implementation relied on whether or not the link was a fixed-link to disable SGMII autoneg. This commit extend this to all link which are not configured for inband autonegotiation. Signed-off-by: Charles Perry --- Notes: Changes in v2: * Move my notes to the cover letter * Remove the spinlock in macb_pcs_config * Keep the comment about the PCSSEL register drivers/net/ethernet/cadence/macb_main.c | 36 +++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index f72270a39d25..f4250e76cef0 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -574,6 +574,26 @@ static int macb_pcs_config(struct phylink_pcs *pcs, const unsigned long *advertising, bool permit_pause_to_mac) { + struct macb *bp =3D container_of(pcs, struct macb, phylink_sgmii_pcs); + u32 old, new; + + old =3D gem_readl(bp, PCSANADV); + new =3D phylink_mii_c22_pcs_encode_advertisement(interface, advertising); + if (new !=3D -EINVAL && old !=3D new) + gem_writel(bp, PCSANADV, new); + + /* Disable AN if it's not to be used, enable otherwise. + * Must be written after PCSSEL is set in NCFGR which is done in + * macb_mac_config(), otherwise writes will not take effect. + */ + old =3D gem_readl(bp, PCSCNTRL); + if (neg_mode =3D=3D PHYLINK_PCS_NEG_INBAND_ENABLED) + new =3D old | BMCR_ANENABLE; + else + new =3D old & ~BMCR_ANENABLE; + if (old !=3D new) + gem_writel(bp, PCSCNTRL, new); + return 0; } =20 @@ -628,22 +648,6 @@ static void macb_mac_config(struct phylink_config *con= fig, unsigned int mode, if (old_ncr ^ ncr) macb_or_gem_writel(bp, NCR, ncr); =20 - /* Disable AN for SGMII fixed link configuration, enable otherwise. - * Must be written after PCSSEL is set in NCFGR, - * otherwise writes will not take effect. - */ - if (macb_is_gem(bp) && state->interface =3D=3D PHY_INTERFACE_MODE_SGMII) { - u32 pcsctrl, old_pcsctrl; - - old_pcsctrl =3D gem_readl(bp, PCSCNTRL); - if (mode =3D=3D MLO_AN_FIXED) - pcsctrl =3D old_pcsctrl & ~GEM_BIT(PCSAUTONEG); - else - pcsctrl =3D old_pcsctrl | GEM_BIT(PCSAUTONEG); - if (old_pcsctrl !=3D pcsctrl) - gem_writel(bp, PCSCNTRL, pcsctrl); - } - spin_unlock_irqrestore(&bp->lock, flags); } =20 --=20 2.47.3 From nobody Fri Apr 17 00:17:58 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACD9034CDD; Tue, 24 Feb 2026 20:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771964996; cv=none; b=ZwtnMQkmTnawVBMe0A4UKVBw/pxLt1i1/0qJC0nJEF6MKzCXJaecNBKJLaNJSrgjDb0C+Bgq3LQGWUdVTHw9w6iZN1G9xFNHgfPOtq7AEfNDY0N3qE5T0GL7Xn0mi3Xlzoqy+dqFFHxtJkma2a66ia1upx7VXnMtIcdT2IgFk2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771964996; c=relaxed/simple; bh=JYrKBiLiuP7chA3VIle2cWQufy5LUnFCNtHJLGMMsTM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MWdQsbcQ/NWxJuVLOw1q81BV91NkYm+0ZzX0EqeG3D54TF4MB1ayClBwMsy16DB3BjIDm8tB37wZbPhmNXHMchnkjaQ4fVzkXIMRFFFW65WnMX6TtDKzGXIqRw2sG0Vw+8zrxG+n2ThNSKeFc1zlhcoI/Bg/dSQH6S/LQdBHNTE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=BCvCyUhT; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="BCvCyUhT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1771964996; x=1803500996; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JYrKBiLiuP7chA3VIle2cWQufy5LUnFCNtHJLGMMsTM=; b=BCvCyUhTUWtAHI6uPgypxCYQOT4hY33E/kJ7xhurkzCr0jgtPjTLszGv rIzoBzw120hHNTKc7q9EsAjho9jrTFgQhZcsPtKXDaYRy8KzFcea5NhfT UvFt0O5LsoWH0J24giTOtSjCG6P/k8vcnqUkvcPGAoj+FXIqa0Krd7FCA 8eIuywAtPiclPR5Oo2+W0SRn61+4AjZz1SvV5UCDsC4fL2kmPw+aXh8md J1rC9IV4EafQmY1HdFvsdXqA+0/3ahOZcFe2mhMXZX+sDW4GTWbCgTWPA pDMeDiqU/GpHW+/+CpirDq8JkDs9rzbLlzHuLUQMjpSVikJclzRsrsn5i w==; X-CSE-ConnectionGUID: q8IE9EiCRpeM7ZzmGaO9hg== X-CSE-MsgGUID: 0jgpgC3WRwCaJijj4ru4FQ== X-IronPort-AV: E=Sophos;i="6.21,309,1763449200"; d="scan'208";a="53802224" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 24 Feb 2026 13:29:55 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Tue, 24 Feb 2026 13:29:34 -0700 Received: from bby-cbu-swbuild03.eng.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 24 Feb 2026 13:29:33 -0700 From: Charles Perry To: CC: Charles Perry , Sean Anderson , Nicolas Ferre , Claudiu Beznea , Andrew Lunn , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Russell King , Subject: [PATCH net-next v2 2/3] net: macb: add support for reporting SGMII inband link status Date: Tue, 24 Feb 2026 12:28:53 -0800 Message-ID: <20260224202854.112813-3-charles.perry@microchip.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260224202854.112813-1-charles.perry@microchip.com> References: <20260224202854.112813-1-charles.perry@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This makes it possible to use in-band autonegotiation with SGMII. If using a device tree, this can be done by adding the managed =3D "in-band-status" property to the gem node. Signed-off-by: Charles Perry --- Notes: Changes in v2: * Move my notes to the cover letter drivers/net/ethernet/cadence/macb_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index f4250e76cef0..f6efc1bb88b6 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_m= ode, struct phylink_link_state *state) { - state->link =3D 0; + struct macb *bp =3D container_of(pcs, struct macb, phylink_sgmii_pcs); + u16 bmsr, lpa; + + bmsr =3D gem_readl(bp, PCSSTS); + lpa =3D gem_readl(bp, PCSANLPBASE); + phylink_mii_c22_pcs_decode_state(state, neg_mode, bmsr, lpa); } =20 static void macb_pcs_an_restart(struct phylink_pcs *pcs) --=20 2.47.3 From nobody Fri Apr 17 00:17:58 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F199826A0C7; Tue, 24 Feb 2026 20:30:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771965011; cv=none; b=AWoJZhEvDj3yqeyGUNSL6lOmCWbSuFuYMooQavCnau1CzUaLwxsRbZw676Cde9+geBPze/MaB8WixjC0XrImfsTkU8Nk6Z/oGrs0YMKPX0xQrGBkCcZhto3aOJvyWAWDyEd+UVltzG1Lq+vG5ce7PfvRGGvpCG8kF7pL9CzFtW4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771965011; c=relaxed/simple; bh=TARXgZXOLNs/wKtKFtya9KuH14skr0xMIwnTFQdfIYc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WQhBb6BzpBIWBVrTmcsIWhLJCj2U7vNMIXTccFZKki3vo7I+EZIuyvEm4tzxdhfZftznaRHDy4+rt53SChYUJLQhFajdwmMlSD1egmoAyp22yvF5Idb56zgDbU2lQ9egfHRYgBz13jr0+YGD+sGe8oLoMdxTFOozn8KOoqSFG28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=2pTsFz/w; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="2pTsFz/w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1771965008; x=1803501008; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TARXgZXOLNs/wKtKFtya9KuH14skr0xMIwnTFQdfIYc=; b=2pTsFz/wTVTQksCjplYr5CYqiez76CHCEeCCCUwI8DgPBkGDVQWW7AjO q+JnMis814AHjTVGYfP9v4MhbClGJKT2foXoaLjkn6qNdqJx0M9+FwMRV yl967veNEyVKuWOAFsa1/mr+I7SoywjuJX+VIuOjPLp4lUZ0fGUdgcAyi KAzDP0pjJcJjqOsCaxriXeSl4vcIE0e6BsQPhfqPDchZLi4homi8rMjBh Dnzw4sYTVLFSSROB7mmGqDWX2uEvZ68MoLKv3MzrgWU1rTiUB1FnIP7LX x37t4tPXItsq/xwSWER03oQKIllSR2oPT9tx/rAcqzfbXoRD9bchPjmmj w==; X-CSE-ConnectionGUID: nyoYymsUQturxNWE5RLEfQ== X-CSE-MsgGUID: bW+eUffBSIWUhODcyvYB9g== X-IronPort-AV: E=Sophos;i="6.21,309,1763449200"; d="scan'208";a="53070978" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2026 13:30:07 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.35; Tue, 24 Feb 2026 13:29:38 -0700 Received: from bby-cbu-swbuild03.eng.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Tue, 24 Feb 2026 13:29:37 -0700 From: Charles Perry To: CC: Charles Perry , Sean Anderson , Nicolas Ferre , Claudiu Beznea , Andrew Lunn , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Russell King , Subject: [PATCH net-next v2 3/3] net: macb: add the .pcs_inband_caps() callback for SGMII Date: Tue, 24 Feb 2026 12:28:54 -0800 Message-ID: <20260224202854.112813-4-charles.perry@microchip.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260224202854.112813-1-charles.perry@microchip.com> References: <20260224202854.112813-1-charles.perry@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In SGMII mode, GEM can work with or without inband autonegotiation. Signed-off-by: Charles Perry --- Notes: Changes in v2: * Added this patch drivers/net/ethernet/cadence/macb_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index f6efc1bb88b6..4b1fe3beaa17 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -557,6 +557,12 @@ static int macb_usx_pcs_config(struct phylink_pcs *pcs, return 0; } =20 +static unsigned int macb_pcs_inband_caps(struct phylink_pcs *pcs, + phy_interface_t interface) +{ + return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; +} + static void macb_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_m= ode, struct phylink_link_state *state) { @@ -609,6 +615,7 @@ static const struct phylink_pcs_ops macb_phylink_usx_pc= s_ops =3D { }; =20 static const struct phylink_pcs_ops macb_phylink_pcs_ops =3D { + .pcs_inband_caps =3D macb_pcs_inband_caps, .pcs_get_state =3D macb_pcs_get_state, .pcs_an_restart =3D macb_pcs_an_restart, .pcs_config =3D macb_pcs_config, --=20 2.47.3