From patchwork Thu Feb 9 09:51:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 54831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp240052wrn; Thu, 9 Feb 2023 01:52:35 -0800 (PST) X-Google-Smtp-Source: AK7set+GALtUodyFiK+4Jy7shj0K/filfnEAjxaszIuXeVjkS30yeKAYPtpMf8e+JyG3fP6J02yK X-Received: by 2002:a50:d75b:0:b0:4ab:1ea8:9584 with SMTP id i27-20020a50d75b000000b004ab1ea89584mr847780edj.36.1675936355568; Thu, 09 Feb 2023 01:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675936355; cv=none; d=google.com; s=arc-20160816; b=ocqoFLSAmB4ENT4y91fZkfYQtRUbkamqJAyGVZ+7o7nWiP7Hut2cORGB1JNohcoGIG VUwr6pC9qpni7emvhleT++rOlFGnYjpYmFR8u9HnlDGkf6/Sieoh/Pwww1cnNoFtZBUW Ic2Q00cnIrdta3cYKpuRVEfsHQHMtlbjf7rYSn/hRAJrf5AYfTG83KN2PIuRLoKtkQmi k6H/qBRaSygQKjo4PPHJ1sKydscWgkxJTC1Pak6pP4W7TjlMFILWXaxsZW6T88bQrGby Gatm7O2nSsay50y4ln/m8pf9n90+O5SqCAsEimOd0CsyfM7qKpfhHFYxHrsjT8kol8nV Oniw== 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=fPwhN3xOKQo6UVhI5mw2EdIrn9+i0dY5+ElWiwOjY1Q=; b=nHMKQvy1CRPZ/hD0fITa9UmHnAN7TjvPx1vmXa4yahNLHHHG567sOg/d0adGxvD+p7 LTZEPDocvPCa6DAR0yeyG7PuFWhWcjeIGClTslrMWeu05jHh+HkwHgBmbu9dlMLP7W3H BeFwIBb+DPG9U7kl80QV3yYAw9euPFfl8hrl+l8b0CWG3suacZfLZl0Gh605xrCBRTeG L6yhRF3Ec6OE8tNq1nesFcrcFnWD0qok7MNSWdkxWpZFekRlRr0ar4624X+iiN6OixaB XOo4AR1pKcgs6N4L9Ksil7Eh0xT8IMVEbSvvuL5QayMpjCH1tUGyRxxZZ+Gpjvz7J698 xfyw== 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 um6-20020a170907cb0600b0088da09e62d6si1795899ejc.538.2023.02.09.01.52.12; Thu, 09 Feb 2023 01:52:35 -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 S230325AbjBIJvq (ORCPT + 99 others); Thu, 9 Feb 2023 04:51:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbjBIJva (ORCPT ); Thu, 9 Feb 2023 04:51:30 -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 CE75D3C287 for ; Thu, 9 Feb 2023 01:51:27 -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 ) id 1pQ3aH-0005eO-N8; Thu, 09 Feb 2023 10:51:18 +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 ) id 1pQ3aE-003i7k-M4; Thu, 09 Feb 2023 10:51:15 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pQ3aF-001Wqv-1h; Thu, 09 Feb 2023 10:51:15 +0100 From: Oleksij Rempel To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wei Fang , Heiner Kallweit Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v7 3/9] net: phy: micrel: add ksz9477_get_features() Date: Thu, 9 Feb 2023 10:51:07 +0100 Message-Id: <20230209095113.364524-4-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230209095113.364524-1-o.rempel@pengutronix.de> References: <20230209095113.364524-1-o.rempel@pengutronix.de> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757346639869086412?= X-GMAIL-MSGID: =?utf-8?q?1757346639869086412?= 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 Reviewed-by: Andrew Lunn --- drivers/net/phy/micrel.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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);