Message ID | 20230412074850.41260-1-maxime.chevallier@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp145856vqo; Wed, 12 Apr 2023 01:00:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ax7mdYQpNIlltl+5CT3Y1LSzz1A3uRx1wPvdrHg3n0HmOYhvbGVwz9f7RFTc2jSJhqUHQT X-Received: by 2002:a17:90a:7e08:b0:237:ae98:a47f with SMTP id i8-20020a17090a7e0800b00237ae98a47fmr2303375pjl.1.1681286442557; Wed, 12 Apr 2023 01:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681286442; cv=none; d=google.com; s=arc-20160816; b=sXFi1rwtfk9RrAl1qnfSg6u69f40k3rJw8pKmK83fw2e/NOm/5kUjLsMYAzQsWJMSB 8oT/9Br5zdLPLEStHSCOmgPGp6sHuO2G2d/Vdg+uGoRyt2nGd3Upm8t2LuBIoB7Ii8py jZMSAl4mJjOPZvnlFOVkiLXQzVgX7J0u9GyWPbM688RsUweWSJZa8bq50Rsxu6neAY+G kgOBOaBb+PXBMb7d0C6L/kw95to1s4ojS6x3g0faS3l/5b50xzTaE14icB85ZUKtV/r1 E90OlkiDnsVOODc08uIWdeTcP6BL0Lug4RRNU3ogxd6/uuecZOamzuA7U5kOewZ1wS3P SjNg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CO47OM0miczfYcaLLJYgDjAY1lPzp2g2IISvLCCABNc=; b=n0r7IYkGWUdd1JdT/niK8I71zBAXnJ3OTyHbkEb62BxNeR+6xYSpTxS2TI6NZqQCJw rd3Mf0mf8tmLoM/0ZXUn1IHVNbnz41uwBQBfadhabwR2jXvL90uQhVh5MV+wsFaBOQNN J7539LHIz1FTADKdnZ33lFw9kvanIOSe6/iFqoRpBsRdyM9yAOP36x3oTwFkm0Je6Lsg lZnE3g+rIMrhMsSBYehQ53JNCCgMbQKhGAQrzdVvwOxaLiqfDoR2VacBau/sDKaKK4w9 9pUxp9Ft8MmvjhBuJMbQj2vmWpQumoiNqCOU5VKzSemorjOKXhuQwSKsPuKfAy4MOdht yiFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=P8YtNKGx; 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 s140-20020a632c92000000b00513f070aa0dsi16022385pgs.655.2023.04.12.01.00.30; Wed, 12 Apr 2023 01:00:42 -0700 (PDT) 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=P8YtNKGx; 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 S229893AbjDLHtE (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Wed, 12 Apr 2023 03:49:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbjDLHtA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Apr 2023 03:49:00 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A40B455BB; Wed, 12 Apr 2023 00:48:58 -0700 (PDT) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7F04B4000E; Wed, 12 Apr 2023 07:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681285737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=CO47OM0miczfYcaLLJYgDjAY1lPzp2g2IISvLCCABNc=; b=P8YtNKGxa0ZteNm/HSo7UkplEN7TLavuugUsieYDZskuQgqyp6Ja97SogaYUcP2L8xSyBG qiB/c+iO6BHoZmha1EkOU0nqyUpXBxcNyrVIm+j68l6aFYhGAQIq5T/BZYDkwheVp5W10/ y4RuDXZUDf6yt2VcIIE0b1c2OknnwFY0Z9wEbvxXWkc4R+xTWGIe6YL+H6WqYTpvO2Op5a iMZjWcf0D1BVml4jZC3DDEcJYEiFl5z4579iaC6aYCuqEv2ouvvYHFoWgex6ybiOoF5HVj OewvemiOr+4AaS6Xgh1XopLYg0nWkiqCk9GDyQuGjq2XrR5v4d9hhFJozmGOhA== From: Maxime Chevallier <maxime.chevallier@bootlin.com> To: davem@davemloft.net, Sit Michael Wei Hong <michael.wei.hong.sit@intel.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, "linux-stm32 @ st-md-mailman . stormreply . com" <linux-stm32@st-md-mailman.stormreply.com>, "alexis . lothore @ bootlin . com" <alexis.lothore@bootlin.com> Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Florian Fainelli <f.fainelli@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, linux-arm-kernel@lists.infradead.org Subject: [PATCH net] net: phylink: check for SFP bus presence in phylink_expects_phy Date: Wed, 12 Apr 2023 09:48:50 +0200 Message-Id: <20230412074850.41260-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762956613166361749?= X-GMAIL-MSGID: =?utf-8?q?1762956613166361749?= |
Series |
[net] net: phylink: check for SFP bus presence in phylink_expects_phy
|
|
Commit Message
Maxime Chevallier
April 12, 2023, 7:48 a.m. UTC
When an SFP bus is present, we don't expect a PHY to be attached
directly from the MAC driver, it will be handled by phylink at SFP
attach time.
Fixes: 653a180957a8 ("net: phylink: add phylink_expects_phy() method")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
This was tested on dwmac_socfpga, following discussion here [1]
[1] : https://lore.kernel.org/netdev/PH0PR11MB758766370DD16A5107B1FAB69D9B9@PH0PR11MB7587.namprd11.prod.outlook.com/
drivers/net/phy/phylink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Wed, Apr 12, 2023 at 09:48:50AM +0200, Maxime Chevallier wrote: > When an SFP bus is present, we don't expect a PHY to be attached > directly from the MAC driver, it will be handled by phylink at SFP > attach time. If we have a SFP, then phylink should be configured for in-band mode. Maybe fix the firmware description instead?
Hello Russell, On Wed, 12 Apr 2023 08:51:21 +0100 "Russell King (Oracle)" <linux@armlinux.org.uk> wrote: > On Wed, Apr 12, 2023 at 09:48:50AM +0200, Maxime Chevallier wrote: > > When an SFP bus is present, we don't expect a PHY to be attached > > directly from the MAC driver, it will be handled by phylink at SFP > > attach time. > > If we have a SFP, then phylink should be configured for in-band mode. > Maybe fix the firmware description instead? > The DT used on that platform has the following configuration : [...] &gmac1 { status = "okay"; phy-mode = "sgmii"; managed = "in-band-status"; sfp = <&sfp>; [...] } Here phylink_expects_phy() returns true because although we use in-band management, the link mode is set to sgmii, and phylink_expects_phy() checks if we are in in-band mode AND 802.3z. As we have an SFP and the link mode will be changed according to the module we plug-in, there should be no problem switching phy-mode to "1000BaseX", so I'm perfectly fine with this solution. However, is it semantically correct to use sgmii here ? If so, it may be a bit counter-intuitive to have to set the mode to 1000BaseX just so that the phylink_expects_phy() check passes ? Thanks for the quick reply, Maxime
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index a4111f1be375..334018f1028d 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1594,7 +1594,8 @@ EXPORT_SYMBOL_GPL(phylink_destroy); */ bool phylink_expects_phy(struct phylink *pl) { - if (pl->cfg_link_an_mode == MLO_AN_FIXED || + if (pl->sfp_bus || + pl->cfg_link_an_mode == MLO_AN_FIXED || (pl->cfg_link_an_mode == MLO_AN_INBAND && phy_interface_mode_is_8023z(pl->link_config.interface))) return false;