Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3081331rwb; Mon, 16 Jan 2023 03:32:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwD89o0iTVOB8YM+fJCMFWK1wdqkPpf7TOhmW1Fr+R/Ga7f6TU+M6+LVeu3tpn7jEtMBDX X-Received: by 2002:a17:90a:8d05:b0:229:711d:5a27 with SMTP id c5-20020a17090a8d0500b00229711d5a27mr4116440pjo.6.1673868748075; Mon, 16 Jan 2023 03:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673868748; cv=none; d=google.com; s=arc-20160816; b=Uj/obHuQblgKKjfi6x/PRZ20HC/7Z+jrwN4ZWSkcCgu7LXf3Wj3vPJ4RpxTeoFXQf3 C7uc5N8Mf3HqkMg2LzS0mEGxwgM+U7eGc9MQw6pym+A/sD0wPkGuJoDMkYtkvxDS9FJs Xq8Zzn33K4iaLOfQQEQvCF7kGCYSy6afQX2/RAufGKZtMZ5zj0WWxzfk9v2mnIjDqp8Z L2OxBI4QuOEvJSj3ecf3UHtGL0qTR5sjSlL2dJPTFi3KtIsneeFkoRHMq1pswLl3AwB2 LV4vgGElo1ltsSPvXTUComc5BI0ALAPi3fwl3vLn+dbsy/WLz8bss7jKEpC1QQFOx1d5 mKQA== 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=fFLwBp143kB/LSaCSwLfM/ltYrhQ/PI8Cc5ar94b9Ls=; b=oD0fZJhMplQgY96Dj7y54pwurCmctqPR6M5kuC0nqGwphM0gBXvAUO17iJIw++Vkv2 rjJjJtNJ7zYiEnBzot3ZCeUTzDXR9aF97XSZLhRKz4wRNVUDB8crSBKdHdC/VRZiFtx4 j3JP7lqOSXZUR3IkCKndRJT+mKELLqJAClsjSN6DGFeAlUO3JwaU4XjS7MfruVJ5d6jQ S0tfzI4oQJSutvsZvfgwrFfXBqEUypjbW5G8Ah4ZNhFF3lFhiJ9MxWxmoi1lUb6EGeW6 prWFoimP0WqKG1L8Vtui1htwcnn+dMAdMLneuteCLjte/o5g2nlvDvk7ObjM1DvbXGSW Ftwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=AbClFznb; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 22-20020a17090a0c1600b00213ff43fdf1si29967148pjs.185.2023.01.16.03.32.21; Mon, 16 Jan 2023 03:32:28 -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=AbClFznb; 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 S230352AbjAPKhh (ORCPT + 51 others); Mon, 16 Jan 2023 05:37:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbjAPKha (ORCPT ); Mon, 16 Jan 2023 05:37:30 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D20524EEB; Mon, 16 Jan 2023 02:37:28 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9002F1BF21D; Mon, 16 Jan 2023 10:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1673865447; 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=fFLwBp143kB/LSaCSwLfM/ltYrhQ/PI8Cc5ar94b9Ls=; b=AbClFznbfLK1tHwzNMo1ZZTKkPrE2PqxhzA5su3b03jNpwuzLu/LnE7peKBjSobhwUqkG0 9leHb8Mf6zMwXHUR9sXmR9w3a5G944U0VQlffclPECthNy2JLnZRb5BYL9XKSpFzzShZ+N x0IXJEorQS0lKX5X80PtA2mdCXq7am2nU72Yna4/y/ect0DBBT7AkeeUu/pwjFDuFhM9VK DOp/YaUz0Te5BPx3laRY6seLPz1sX/2UY44ZbZbFBYsmPIaomWj/TnxTrS8VHV8cNh59Lm ZK7tDhU/p5gp20ED6TR33ff/aOBIx82bC0pntSwv8RSy7hql4umCa1IOb+xF6Q== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= 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?q?Cl=C3=A9ment=20L=C3=A9ger?= , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min Cc: Thomas Petazzoni , Herve Codina , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , 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 1/6] net: stmmac: add support to use a generic phylink_pcs as PCS Date: Mon, 16 Jan 2023 11:39:21 +0100 Message-Id: <20230116103926.276869-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116103926.276869-1-clement.leger@bootlin.com> References: <20230116103926.276869-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 c6951c976f5d..19459ef15a35 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 5f177ea80725..3e875d4664c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -413,6 +413,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus) } priv->hw->xpcs = xpcs; + priv->hw->phylink_pcs = &xpcs->pcs; break; } -- 2.39.0