From patchwork Fri Jan 20 09:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 13109483 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3EF4C05027 for ; Fri, 20 Jan 2023 09:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230283AbjATJVm (ORCPT ); Fri, 20 Jan 2023 04:21:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjATJVf (ORCPT ); Fri, 20 Jan 2023 04:21:35 -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 90A979D2B5 for ; Fri, 20 Jan 2023 01:21:11 -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 1pIna3-0002yL-Dz; Fri, 20 Jan 2023 10:21:03 +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 1pIna2-007L93-3U; Fri, 20 Jan 2023 10:21:02 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pIna0-001STi-UG; Fri, 20 Jan 2023 10:21:00 +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 Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v2 1/4] net: phy: add driver specific get/set_eee support Date: Fri, 20 Jan 2023 10:20:56 +0100 Message-Id: <20230120092059.347734-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230120092059.347734-1-o.rempel@pengutronix.de> References: <20230120092059.347734-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: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 3378ca4f49b6..57e125a99414 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1583,6 +1583,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); + /* Get Supported EEE */ val = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); if (val < 0) @@ -1622,6 +1625,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); + /* Get Supported EEE */ cap = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); if (cap < 0) diff --git a/include/linux/phy.h b/include/linux/phy.h index b3cf1e08e880..9ad6c3f5c865 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1055,6 +1055,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)