From patchwork Thu Feb 9 15:16:28 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: 54996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp392955wrn; Thu, 9 Feb 2023 07:17:19 -0800 (PST) X-Google-Smtp-Source: AK7set8N1oE1iHJtgGeRtiHHAb/+L5qSeOYd24yrzHiZS45QHNl5QhZz0yZRQiK0h82DRpOCHwmT X-Received: by 2002:a17:90a:1d3:b0:22b:f622:56ae with SMTP id 19-20020a17090a01d300b0022bf62256aemr13519468pjd.23.1675955839165; Thu, 09 Feb 2023 07:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955839; cv=none; d=google.com; s=arc-20160816; b=qdpFeoqrB6hr2RJHPqdIbnVLdYM/MELhqik6z4JCFAihvvh3SDwZV083fgW3kpQXOO KvSXMiBtx9lae6+uuzpXMhz0yttbXx2TZf2WGOa2rGrGc32K7H1toUyxuj4mL5kEFtIB pml5NxlwlXEk3hGol49XYmwXZkSXh7JJjItmZPq6gEFXWwhwG5g/fMWz/jVm6PulaVq9 qPtPuCQSe7bP8ZaVLXQbgh3dUF4ttQdTxWeENiBx1+7HxvLVeQCHlYSBNiHMCSgDXrVr 9Jx+L1ekImYHyPjn9N0kOVA07vHlxayAEG4d+wR3Qai0v3UZI2fVh9EOzvgvrvYty9mP B8bg== 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=0/M2zt/YgT1gpOPr3snRzVSPDNIoI7YdPqn4xUESW0Q9mbWhUkkvtTDmdqJDudUyeY W0z9JFYIhqfSQnNOEABNh5bIvIzVOOdFV0ztkasZej7JjrDoDOm1vWeO1hoTxUCHZu6n nC17nCH32RetW1t/z03YBv1sKzRqRYxHN9+0eGw2cVR9paeoEX4SpimwTCKb0iLSi3Za vDxzneGeMLghQM/E3X50y7CSX1DA01d/IO60Kikkzfevy5srYqKut1KALrF0lXilb3k1 XlESHnlzzxxp7V3SCEJrYi92ZQJUhn5GCZdVX0wFEqSlPk3AusBTfIdW4Gk72XHHzazF tfkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lKZ2nYUF; 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 n27-20020a63721b000000b004f1437ceb14si2085853pgc.287.2023.02.09.07.17.05; Thu, 09 Feb 2023 07:17:19 -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=lKZ2nYUF; 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 S230339AbjBIPOj (ORCPT + 99 others); Thu, 9 Feb 2023 10:14:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjBIPOa (ORCPT ); Thu, 9 Feb 2023 10:14:30 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444C4611CB; Thu, 9 Feb 2023 07:14:26 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9550310000C; Thu, 9 Feb 2023 15:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955665; 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=lKZ2nYUFG+sfm0B1kVvVz/Pea80cNIURQMKuOcVwF0SMYgysSylfXLPJjtUHnpaM0dPPVI 9+ZZhA5UvEesDjwz+PeAFVo+kw286G8Kp5PetEIZsKRcM3hvfRMkZCDO2kbvs++eAiYjuq 9GcsueMKLn1HRrdi65zW1hhP/32XMml3NiRKBrTRR6GGoXUKkYoXewpRsAXYS+7tp/Jxhq EuLnrzLJ73I6A3z44mdWPW/O4/jDAbjz18PcsqpY8rWr5HF5MN5pGkzifQHJLhuD9O48Ca ysyeUUvS5kxRxblehTsIYZY4j79cjBpWddIMc1/3r9K+QHeu489Ac2PEjgxs8w== 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 v3 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS Date: Thu, 9 Feb 2023 16:16:28 +0100 Message-Id: <20230209151632.275883-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230209151632.275883-1-clement.leger@bootlin.com> References: <20230209151632.275883-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, RCVD_IN_MSPIKE_H2,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?1757367069909671634?= X-GMAIL-MSGID: =?utf-8?q?1757367069909671634?= 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; }