Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B248FA3740 for ; Thu, 27 Oct 2022 13:12:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234425AbiJ0NMf (ORCPT ); Thu, 27 Oct 2022 09:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236101AbiJ0NLv (ORCPT ); Thu, 27 Oct 2022 09:11:51 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01EA7786F1 for ; Thu, 27 Oct 2022 06:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0SHl2/Tf5+E3hJQsavoW5pAz+OylafQ4Wg/oQ1E55oA=; b=eZsMcFNUKbAnnNoAMDsrLQi5G2 RtFBb3px3Gc90kn9K/juzJKdxACKtox1Qk80bAvkaTaq/AtRqmpa9kPTHB9cIG86EKYzk2s+Q7Mi0 1LWliid+3DEKvD5HbrxN7Z0rRaA9JlrvD1PxyyOZsEfSkNvsnlnCFyWGbhmgD4U1E6sXzR7w/iFAZ 5PKnka8hnoIfdWPj0pC8ztvJncUUeyLhz7MBlh8WcVx0XLXMHAJ3lBc1Kzn2ZAirTBfogXlEgUI4R HM/MNdbfBvAH1UKPpVSKNSfw7vsdIkRIkOxqGV5avgaNnf9efl728DqJf7uDhhiyD7TgC1J9WUfYC eNu04axw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:33350 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oo2fH-0006zf-43; Thu, 27 Oct 2022 14:11:19 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oo2fG-00HF8Q-Fd; Thu, 27 Oct 2022 14:11:18 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski , Frank Wunderlich Cc: Eric Dumazet , Felix Fietkau , John Crispin , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Mark Lee , Matthias Brugger , netdev@vger.kernel.org, Paolo Abeni , Sean Wang Subject: [PATCH net-next 09/11] net: mtk_eth_soc: add advertisement programming MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 27 Oct 2022 14:11:18 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Program the advertisement into the mtk PCS block. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/mediatek/mtk_sgmii.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c index c590d5847e2e..1f6e58cba162 100644 --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -70,16 +70,27 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, { struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs); unsigned int rgc3; + int advertise; + bool changed; if (interface == PHY_INTERFACE_MODE_2500BASEX) rgc3 = RG_PHY_SPEED_3_125G; else rgc3 = 0; + advertise = phylink_mii_c22_pcs_encode_advertisement(interface, + advertising); + if (advertise < 0) + return advertise; + /* Configure the underlying interface speed */ regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3, RG_PHY_SPEED_3_125G, rgc3); + /* Update the advertisement, noting whether it has changed */ + regmap_update_bits_check(mpcs->regmap, SGMSYS_PCS_ADVERTISE, + SGMII_ADVERTISE, advertise, &changed); + /* Setup SGMIISYS with the determined property */ if (interface != PHY_INTERFACE_MODE_SGMII) mtk_pcs_setup_mode_force(mpcs, interface); @@ -90,7 +101,7 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, SGMII_PHYA_PWD, 0); - return 0; + return changed; } static void mtk_pcs_restart_an(struct phylink_pcs *pcs) -- 2.30.2