From patchwork Tue Feb 14 09:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 56781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2854356wrn; Tue, 14 Feb 2023 01:07:05 -0800 (PST) X-Google-Smtp-Source: AK7set/wMpUWEZiTax7mTuqwpn9P1Q4cGQ+JG6qOrNSzL5ELvgNq9xXkw9uovz0xN6s8vb3ILEOz X-Received: by 2002:a17:906:c401:b0:88d:ba89:1837 with SMTP id u1-20020a170906c40100b0088dba891837mr22539680ejz.8.1676365624935; Tue, 14 Feb 2023 01:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676365624; cv=none; d=google.com; s=arc-20160816; b=Ps+s3hi1a4nyLXfwlYBfNTQfxLjm4Qs+/li0QzpiQhcXPnVm8lphMgcjd2+SZYPPvz fkpAVKNRhw2n2Ni0gsIfNWPl7/gMCq+zrdz46V23wk3wTiA5aYauKR80+KODim8O7p8P f3xIOtkjQVwfZUpm1nVgCr38ebQygJWumkqcHKPwB135+l+HqnkHdzcqZApewuYKw9iR gTSQAzRLcYVNBnQTyh4OJck+GiHk9gYnkndixT4Hyo/4XWBnsk1XyiJTNTWYrdob8J2n D6azmyrpSxh4O2Y3olNFUVKIg09lkyyOoVlcHvmoLuuYqH4TiMnQRL6pdeQNTPjsU9O+ lOIg== 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=tSkKkW3ZW3lcW+dgi2QL3Qu7FY+/UF84ZKwpnMQBSwg=; b=TZVp3F5t76CR2GgShGKBT2zsrdPTO6VJEczBwXmDWB7EM6yC6jVmrs3WGuW9V11Fx5 a6QefbZUXhKybAttkDAbGSeCpQPwkRONaz71iRnh8r3NYEPvOcp0B+VGHlZQWce2GTlD UUETpXetQ8N7M4LyNq8s8Vdq78KpiSjVkHecRUQ/f4FfKKfKVUZgQBaMxtcOOM9nXEAJ zXOBSRXpC4C++Z+aZ50wuiK1Ogb1iodxNW2JxaMXvJej/HZbzC6T5pfaeaegAThZDFCI Hf+pmzSvK6xEuyAMjwNJWn+OJM9cUVuU0ndbIaA8BoRJ28OPiZtpkPRmMOSnYo/PFGBM FIYA== 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 u20-20020a170906109400b008b12d0e083bsi2860754eju.209.2023.02.14.01.06.41; Tue, 14 Feb 2023 01:07:04 -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 S231530AbjBNJD6 (ORCPT + 99 others); Tue, 14 Feb 2023 04:03:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231411AbjBNJD3 (ORCPT ); Tue, 14 Feb 2023 04:03:29 -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 7AC41D527 for ; Tue, 14 Feb 2023 01:03:26 -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 1pRrDa-0004UF-JK; Tue, 14 Feb 2023 10:03: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 1pRrDY-004qDl-Em; Tue, 14 Feb 2023 10:03:17 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pRrDX-008V5e-G2; Tue, 14 Feb 2023 10:03:15 +0100 From: Oleksij Rempel To: Andrew Lunn , "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, Shenwei Wang , Clark Wang , NXP Linux Team Subject: [PATCH net-next v1 1/7] net: phy: add driver specific get/set_eee support Date: Tue, 14 Feb 2023 10:03:08 +0100 Message-Id: <20230214090314.2026067-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230214090314.2026067-1-o.rempel@pengutronix.de> References: <20230214090314.2026067-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?1757796761496496179?= X-GMAIL-MSGID: =?utf-8?q?1757796761496496179?= Not all PHYs can be handled by generic phy_ethtool_get/set_eee() functions. So, add driver specific get/set_eee support. Signed-off-by: Oleksij Rempel --- drivers/net/phy/phy.c | 6 ++++++ include/linux/phy.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 2f1041a7211e..c42df62df302 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1520,6 +1520,9 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data) if (!phydev->drv) return -EIO; + if (phydev->drv->get_eee) + return phydev->drv->get_eee(phydev, data); + return genphy_c45_ethtool_get_eee(phydev, data); } EXPORT_SYMBOL(phy_ethtool_get_eee); @@ -1536,6 +1539,9 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data) if (!phydev->drv) return -EIO; + if (phydev->drv->set_eee) + return phydev->drv->set_eee(phydev, data); + return genphy_c45_ethtool_set_eee(phydev, data); } EXPORT_SYMBOL(phy_ethtool_set_eee); diff --git a/include/linux/phy.h b/include/linux/phy.h index 727bff531a14..6709fbd72e10 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1052,6 +1052,11 @@ struct phy_driver { /** @get_plca_status: Return the current PLCA status info */ int (*get_plca_status)(struct phy_device *dev, struct phy_plca_status *plca_st); + + /** @get_eee: Return the current EEE configuration */ + int (*get_eee)(struct phy_device *phydev, struct ethtool_eee *e); + /** @set_eee: Set the EEE configuration */ + int (*set_eee)(struct phy_device *phydev, struct ethtool_eee *e); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv)