Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp996643rwb; Thu, 19 Jan 2023 05:30:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXstSaW3JcIz/dgswWth7E9XoMfw/Mu/UzpuZqt5QcCyrhTiPRG0DQ1PIujE5BOS2lTDqCJS X-Received: by 2002:a17:906:abc6:b0:86c:b710:dacf with SMTP id kq6-20020a170906abc600b0086cb710dacfmr11334538ejb.62.1674135027428; Thu, 19 Jan 2023 05:30:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674135027; cv=none; d=google.com; s=arc-20160816; b=k+MwQX7I998soLqstyvmsEDOf+Y79Rqqs83goTbzgNZhGX1CHECC0BClWfz/q2RYz2 6PXek8Jk2kZli/RVyK+zxTM9/EfhTY9/xXKvZuxgkB7Is0NzXP/SYcJN+wXBRKFXpg4c u5EZQ1kqQfHSOBS0+e5t8GqJrWu42aIJGHs5lY2JRbpOmVjujoErHNEONxKt9oa+6ZYK 1/Cd+pcw0uq7lhH14f1S+raXFhsw+v9TdOm4sT9rUFE276/mJJY8rh3sa8kLpGJC1YaI JI9IrYuKOFp6EDQhtAOsD/woLjtTNmNsTnlWqZHDBqa3GaLN11zuBqb6fud2mPHkImpc fVIg== 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=fzhnUMWC2TSQqTkaSn37DY6TrKyf42Dx9cSUD2F9he4=; b=FJ6CqmjFQLVEN9zFTRd9Ffl9T7vcVQ3tfnvukbGfVPwJcavXsR0bSM0Hqy/WKNUOiJ MgGLl/sWMxXSpBmKDKDCliZ/fQTEyD7dXuE5abCFAnr0IH4wgOcRZ9GqEcn+Vn67w/ol tIUwqbCB3rnNd2uKuiB2f0wiBqy4ke/LogNqniYXXnHak9nhJNTbmnO5pc0FJQkZbj9J ZEW1qUOUaSyvLXtG8HjDfRmXC0tsWLEGX0aZwiluVObn+qa1Nx2BKlTy3oGavOxLtnUD TqAiCBPl+Cl57pWfikRZL01bhoAsMyhf8mP6kpcnsnWyO4BUGMgoxvYgI1FPZC21GAOz hTMw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb13-20020a170907070d00b007a2d966eeccsi17264063ejb.686.2023.01.19.05.30.16; Thu, 19 Jan 2023 05:30: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 S231263AbjASNTM (ORCPT + 44 others); Thu, 19 Jan 2023 08:19:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjASNSg (ORCPT ); Thu, 19 Jan 2023 08:18:36 -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 7C68C6EAD for ; Thu, 19 Jan 2023 05:18:34 -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 1pIUoC-0005u6-SO; Thu, 19 Jan 2023 14:18:24 +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 1pIUoC-0079jQ-7z; Thu, 19 Jan 2023 14:18:24 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pIUoB-00G50u-9V; Thu, 19 Jan 2023 14:18:23 +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 v1 1/4] net: phy: add driver specific get/set_eee support Date: Thu, 19 Jan 2023 14:18:18 +0100 Message-Id: <20230119131821.3832456-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230119131821.3832456-1-o.rempel@pengutronix.de> References: <20230119131821.3832456-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: X-Mailing-List: linux-kernel@vger.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..39ee2628643c 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); + /** @get_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) -- 2.30.2