Message ID | 20230206135050.3237952-4-o.rempel@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2245273wrn; Mon, 6 Feb 2023 05:52:27 -0800 (PST) X-Google-Smtp-Source: AK7set+9rsSUh8VC0BBUsWi+69uM341U1YY0ZSn8LIoZwNyLVjPJQJ/g3NF88kS63gxK6/8WcwqP X-Received: by 2002:a17:906:4713:b0:87b:d597:1fd5 with SMTP id y19-20020a170906471300b0087bd5971fd5mr23903656ejq.75.1675691547337; Mon, 06 Feb 2023 05:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675691547; cv=none; d=google.com; s=arc-20160816; b=vunSTY8I+7tqZnXt1u+nY0PM5FRdhwD8tnRHnf1leDF7I4Ovt8hl8LJEqzoIoSq6Rp bkfpvSVPsCyTLVNKDf87plexu+F9nLxObl+DW2AO0QvwQwpBUZbo2bGiZOC0mb6ojnx3 93Z3XNhgByYyykqEh04Jn1BwQJJ7cCML/a5P8qIRJb+gRFfb1eIdEi7h3DEcJDcLk5Js /eB67mIEjNKCCuwmVlnCGL2wTR1bUGemicu1RR+z4DNptSiNNdXYi8fGipl5XIHWLxPW xPA3enjZVTN1AzrBy8DUMbtmrXGFYj1vHZPgaSgjE00OYccyQYL/C5EtNnq/u4SMqexm XxJg== 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; bh=VrNIZhObWFffSaz6qA5EC8lbyltED8PNsmg8NodNWdk=; b=ioB+srlMpDEX6eO5nr/Wn6EAAkXXCHN1XgU9fmLX5qW5QCiVbJa/4ehY8UeG6ZvV6Y DWrPr0diBIbJ0+zERedbI55Dhx+6gIerd/egS9H6qtUHeoXs5GjZ48YN2iOq+oamp9Km xaPFtQqF0e8P0scv2SLfSEiOCky4rcO8AnbnfhunIv2c5jS71TwyZ9bhgADgHywuHZf+ IQVU1T6MWRsuPmSuBR1GPB211Jyu4zyxLcHYcVAE/Ey83kPjAeCICTbdmYsqHQNrZQVn a0RByb/X34UPfiI43Wdu9grEMfn4hV/LYi1A7B/T9aCAqZFXix1AIXScGgHVTU5KdZ1h oCHg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uj39-20020a170907c9a700b0088aba792feesi12846009ejc.238.2023.02.06.05.52.02; Mon, 06 Feb 2023 05:52:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjBFNva (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Mon, 6 Feb 2023 08:51:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjBFNvW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Feb 2023 08:51:22 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 299F81F934 for <linux-kernel@vger.kernel.org>; Mon, 6 Feb 2023 05:51:03 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <ore@pengutronix.de>) id 1pP1tX-0007Da-4e; Mon, 06 Feb 2023 14:50:55 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1pP1tT-0034dB-Ng; Mon, 06 Feb 2023 14:50:52 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1pP1tU-00DaO8-3M; Mon, 06 Feb 2023 14:50:52 +0100 From: Oleksij Rempel <o.rempel@pengutronix.de> To: Woojung Huh <woojung.huh@microchip.com>, UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>, Vivien Didelot <vivien.didelot@gmail.com>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Wei Fang <wei.fang@nxp.com>, Heiner Kallweit <hkallweit1@gmail.com> Cc: Oleksij Rempel <o.rempel@pengutronix.de>, kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com, intel-wired-lan@lists.osuosl.org Subject: [PATCH net-next v5 03/23] net: phy: micrel: add ksz9477_get_features() Date: Mon, 6 Feb 2023 14:50:30 +0100 Message-Id: <20230206135050.3237952-4-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206135050.3237952-1-o.rempel@pengutronix.de> References: <20230206135050.3237952-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: <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?1757089940077336862?= X-GMAIL-MSGID: =?utf-8?q?1757089940077336862?= |
Series |
net: add EEE support for KSZ9477 and AR8035 with i.MX6
|
|
Commit Message
Oleksij Rempel
Feb. 6, 2023, 1:50 p.m. UTC
KSZ8563R, which has same PHYID as KSZ9477 family, will change "EEE control
and capability 1" (Register 3.20) content depending on configuration of
"EEE advertisement 1" (Register 7.60). Changes on the 7.60 will affect
3.20 register.
So, instead of depending on register 3.20, driver should set supported_eee.
Proper supported_eee configuration is needed to make use of generic
PHY c45 set/get_eee functions provided by next patches.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/phy/micrel.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
Comments
On Mon, Feb 06, 2023 at 02:50:30PM +0100, Oleksij Rempel wrote: > KSZ8563R, which has same PHYID as KSZ9477 family, will change "EEE control > and capability 1" (Register 3.20) content depending on configuration of > "EEE advertisement 1" (Register 7.60). Changes on the 7.60 will affect > 3.20 register. > > So, instead of depending on register 3.20, driver should set supported_eee. > > Proper supported_eee configuration is needed to make use of generic > PHY c45 set/get_eee functions provided by next patches. > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index d5b80c31ab91..41eb8df6bfb9 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1370,6 +1370,26 @@ static int ksz9131_config_aneg(struct phy_device *phydev) return genphy_config_aneg(phydev); } +static int ksz9477_get_features(struct phy_device *phydev) +{ + int ret; + + ret = genphy_read_abilities(phydev); + if (ret) + return ret; + + /* The "EEE control and capability 1" (Register 3.20) seems to be + * influenced by the "EEE advertisement 1" (Register 7.60). Changes + * on the 7.60 will affect 3.20. So, we need to construct our own list + * of caps. + * KSZ8563R should have 100BaseTX/Full only. + */ + linkmode_and(phydev->supported_eee, phydev->supported, + PHY_EEE_CAP1_FEATURES); + + return 0; +} + #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06 #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX BIT(6) #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED BIT(4) @@ -3422,6 +3442,7 @@ static struct phy_driver ksphy_driver[] = { .handle_interrupt = kszphy_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, + .get_features = ksz9477_get_features, } }; module_phy_driver(ksphy_driver);