From patchwork Thu Aug 24 13:38:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13364183 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D89EC6FA8F for ; Thu, 24 Aug 2023 13:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: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-Owner; bh=28p55mu5zX81yeUMsWKv6V8suKSr9UuNBHnw5VCwVK0=; b=hrg3deqjmCURaW Sme2UpySNfVSYlRy/+53B4iKvAqNgniLUp0T/PCIyttIfuo++g7KdDmcGpoGzRdMO1NvYGKuDKKVX 33041mt0CSSEk1r6+VghrTYMIkVLBEvbFEazxsaJK+XNWGyyAAroi4j1zFSxhth0feEekAS1irxDS 4HbW1kGpu9mCkVBiAWyvksmfOggEhwKG7O/6cId4Db7nKD1FsPO2aSk2w1uZn1PfQCLO9uhnZSm9l Thi3IBtHJMYWHXlIdCFyVbBLOKPWvY2RrWnlUINbKIZbu6cMCjnvK5TKQ8mF5K/IFg5VTjjrlo07n 102aGAtS3j+GovzcXM4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZAXh-0039uR-0l; Thu, 24 Aug 2023 13:38:33 +0000 Received: from [2001:4d48:ad52:32c8:5054:ff:fe00:142] (helo=pandora.armlinux.org.uk) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZAXZ-0039r8-28 for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 13:38:27 +0000 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=gSPuoQfwVLrPWrtdJC+nSwuuoMMWAeEQDe33DPw00Bc=; b=fTKDnLGMDrXuViUJfVKRSCOcn7 H6Nx/ATRq5UkwDcsVi5GcKAcYaKiJGqVOASuY6+ZZLRghjHoPXxoIewiKneOS64vTTZ1lnfJLycWQ Tjf29rwMbzZjF6sjn25EjI0kG9mYQreM1wgPPUZDYZuy8IqspAtSz70B1R5YXiVcKVnx3QXTWXcex ZcBGVKhc1O6QRqarNzdLQBCquKFs/pe9JJ6/KyRfzEk7RVd6RCq1gH9fBQKbK+aDQLjf5OosT+tpQ tBUKlGtaz/ib3n+RaTGD7vNrC08ksrJlVtJas25yzwQQK27HdDBCx9BGBFK8WVEHnscY2MaC62mds HUJp20ZQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38116 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.96) (envelope-from ) id 1qZAXS-0004DO-36; Thu, 24 Aug 2023 14:38:18 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qZAXT-005pUD-Aj; Thu, 24 Aug 2023 14:38:19 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Alexandre Torgue , Jose Abreu Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Feiyang Chen , Heiner Kallweit , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 06/10] net: stmmac: provide stmmac_mac_phylink_get_caps() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 24 Aug 2023 14:38:19 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_063825_699990_4C6AC931 X-CRM114-Status: GOOD ( 11.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow MACs to provide their own capabilities via the MAC operations struct. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 238f17c50a1e..b95d3e137813 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -300,6 +300,8 @@ struct stmmac_est; struct stmmac_ops { /* MAC core initialization */ void (*core_init)(struct mac_device_info *hw, struct net_device *dev); + /* Get phylink capabilities */ + void (*phylink_get_caps)(struct stmmac_priv *priv); /* Enable the MAC RX/TX */ void (*set_mac)(void __iomem *ioaddr, bool enable); /* Enable and verify that the IPC module is supported */ @@ -419,6 +421,8 @@ struct stmmac_ops { #define stmmac_core_init(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, core_init, __args) +#define stmmac_mac_phylink_get_caps(__priv) \ + stmmac_do_void_callback(__priv, mac, phylink_get_caps, __priv) #define stmmac_mac_set(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_mac, __args) #define stmmac_rx_ipc(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 30a085f2b8fa..a9cf6aecdddf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1224,6 +1224,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000; + /* Get the MAC specific capabilities */ + stmmac_mac_phylink_get_caps(priv); + if (priv->plat->has_gmac4) { priv->phylink_config.mac_capabilities |= MAC_2500FD; } else if (priv->plat->has_xgmac) {