From patchwork Wed Feb 8 16:41:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 54496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559917wrn; Wed, 8 Feb 2023 08:42:07 -0800 (PST) X-Google-Smtp-Source: AK7set8A7OHnQT8mYr6anHNcQATIv/co10DXPOTbVdfCfuhESb0SscWKNDUE3IQOFQeim/Wq9hdX X-Received: by 2002:a17:90a:f60a:b0:230:9ae4:b5e2 with SMTP id bw10-20020a17090af60a00b002309ae4b5e2mr7132528pjb.0.1675874527365; Wed, 08 Feb 2023 08:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874527; cv=none; d=google.com; s=arc-20160816; b=f/JleN0kGCNuUKyXoDYCqRTe+dTuw0W988bgK5PvgeOWtFtQ1/F50Y37+d4Gf+Is9s 08UjUqMcg/XR/m5FQ8w6QLk73MIoPmQ5hJf+i8jGQSAr0Wm/UPcjEjp/ZC4E9ba4DlhX vUPmbpzpuPAeWE+VEnNDNdqj/qcn0rlUSi5IbhIQ3FrHs5YVlJPkgjOO8ajd/sQHLsPk nIGLjTsAoUqMKG/QfJKkTvxnhiVpr55O1hoSExRzkYRIaTRwUEszql4NNwOWiqmTIDww KsGKeFFpvxjcGWzjzw7NlVCZfEcv8jxJqdGZzxQkJ+mb6MdhykkEGrm2OnSyQ39vn3t9 woKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yjugn/p6DcEUOMbEHX1a3CLJTImoHW8X+UJ8D0m1mfw=; b=jfOiHg9xSXrMx6P5Cz22w2OCl1Q04yU4U1ijMBjcQfR+gkOK4oN4Pw8O5Vs6HoN+0/ I6oIlLCXahqkOGu5a2N3H28/hC6yexl0iO6z/aOPpWDvqfWgNnc4424p9Lmo7I3FDMog d3FgW40zlht/45S1CbLfwhL7HLbEO6ylAciYMt+tEUhqwgK4Ba/+nT+e/m7YF1uQtFo4 7qsF4MUwa0vQv13NXYeOOxyZUwcJUlCyjVSmBqSw+esqC1yY3dd24eV7HEu7APMBKAn3 oJqcVOzpAdRQJieQNA9Sm8KC6dPjfn34El6iqLZG67FSMf9udDcYRdwd2mYvG+eULZMG esfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=efroKWgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a17090a2e8800b0023037066be7si2521941pjd.56.2023.02.08.08.41.55; Wed, 08 Feb 2023 08:42:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=efroKWgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbjBHQkq (ORCPT + 99 others); Wed, 8 Feb 2023 11:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231652AbjBHQke (ORCPT ); Wed, 8 Feb 2023 11:40:34 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4AA38EAF; Wed, 8 Feb 2023 08:40:26 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 32FC71BF20E; Wed, 8 Feb 2023 16:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yjugn/p6DcEUOMbEHX1a3CLJTImoHW8X+UJ8D0m1mfw=; b=efroKWgHalzELppM3opEj7l3QcLSkRRBGsGCaspqY9ATTHmZ070Sce1o0fDTwZOg0IjH59 43J8xqFiYE6DknCU+selyB9+ZbzoHTzhCIuMKrLOWmHfQstNi/xtfjvFanWpP56roTj36J oIFJB7nvvhuTUbAflvNPdRD34qXr/y2k6XZ6Xsw0dyWIlmZvmKrz1ifkb+JU/so6jlTg/9 EM/SP6M/cJaGbD8b/jE/vAIazbzYYt06o61WE2eVOLdiKYJdyk03X8w6cNoop6mJYY4n7M gHGKDe9m8HUCZ4kMjnTq7n8oSRB0VARlvzMAOPwlULIUgEd15xrxMYzwEpGm9g== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , Wong Vee Khee , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min Cc: Thomas Petazzoni , Herve Codina , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Mohammad Athari Bin Ismail , Jon Hunter , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next v2 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS Date: Wed, 8 Feb 2023 17:41:59 +0100 Message-Id: <20230208164203.378153-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281808797513185?= X-GMAIL-MSGID: =?utf-8?q?1757281808797513185?= Currently, the PCS is set based on the presence of the xpcs field. In order to allow supporting other PCS, add a phylink_pcs pcs field to struct mac_device_info which is used in stmmac_mac_select_pcs() to select the correct PCS. Signed-off-by: Clément Léger --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +---- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 6b5d96bced47..79fd67e8ab90 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #if IS_ENABLED(CONFIG_VLAN_8021Q) @@ -518,6 +519,7 @@ struct mac_device_info { const struct stmmac_tc_ops *tc; const struct stmmac_mmc_ops *mmc; struct dw_xpcs *xpcs; + struct phylink_pcs *phylink_pcs; struct mii_regs mii; /* MII register Addresses */ struct mac_link link; void __iomem *pcsr; /* vpointer to device CSRs */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f44e4e4b4f16..9a8721227b17 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -937,10 +937,7 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config, { struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); - if (!priv->hw->xpcs) - return NULL; - - return &priv->hw->xpcs->pcs; + return priv->hw->phylink_pcs; } static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 21aaa2730ac8..68deda5c5fa9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -513,6 +513,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus) } priv->hw->xpcs = xpcs; + priv->hw->phylink_pcs = &xpcs->pcs; break; }