Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2180845rdb; Tue, 20 Feb 2024 22:23:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXD2Ub6ADrNsFuOCwGYT87hEpYf8jYKPq7FD+Yw9loPvrjLOCahYVCNX7cp3SOWydEBB4PMQS9Zz6hjv5ELbL29xuya81Dh5XBTDvf8WA== X-Google-Smtp-Source: AGHT+IGxgU+hOV4CcGuinDGpxSLkuUTDuMjDz3jH8tn7PaWa1PUcuh/OFsswkaJY7W1AtCNJRp/n X-Received: by 2002:a25:6905:0:b0:dcd:1b8f:e6d3 with SMTP id e5-20020a256905000000b00dcd1b8fe6d3mr17283031ybc.48.1708496585126; Tue, 20 Feb 2024 22:23:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708496585; cv=pass; d=google.com; s=arc-20160816; b=rzUTZw3KHKKdX1f2rphIZBPwTZYtPPA30d8404q32pn8Trk3c8wOAHZamMVVYpjlI/ uDBfQD2c5FQz5Y4DPQaIwZKuPo7JIKCABqqHN2/a+HunlAm6LSo074bi4RRume0JM68Z n5qmZZM68UwFLNQszLC8Js21P8bMZ+MFa3VOGbqBHKWqu2nzw7sHRywpNRNHNisY2/ZS yNeZFHBYbYwkYX3KpO7NoEKmLYDtlr5on5Ol/V2G8diM/f3LvIZEwcPgAjdb+MiT7Hrj HGdPKCJNkY5k48SMLEDwatQsEh8XRciFszguomoA1Bt4g47dsX/H2KmiyaAjHNmu/9T2 jFZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=mO2dX0jqQmd0w6RQE2oG0EwpP1wMIxiyGI1NlvmN72c=; fh=Ie8Lg/4B6LRJEAkd22XcdyKITG9FXA4PEPaBJgtxF+0=; b=Al8LceLoLDmdThXNOOrKDLTg2R0axWca/5giFWEh1sTbKalp+QshIrefOL+kotI1Gd QeEv3XlED3Xnkqdf+8MHzqw/Y2xjOW+aqSycsPjHe85uqqTmsRhhH5qXS+WDap9EOglx tBiXkur35EPB85Sgl8/lJGZp1j1DeftWSktJXZWTe3n9QI2rfJ8sd0fBOPx9RQcIKBHJ r2lLNynEJGRQFFk2X3NrT3w/2lB5q9PnonTI1GpE4u2ZNN67UWP5hXPJauT0c/WJy/VD 9GwKle/+1gQPQRnfWs2uvwkggMW7hMO0k6Iip5vUR4OGJgAkDCywPhPp8Trr0Z+N4les ruzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-74142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74142-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lp14-20020a056a003d4e00b006e1361cbf3asi9315pfb.338.2024.02.20.22.23.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 22:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-74142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74142-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E3D9FB2462F for ; Wed, 21 Feb 2024 06:22:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B23513AC30; Wed, 21 Feb 2024 06:21:23 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B8533A1BB for ; Wed, 21 Feb 2024 06:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708496483; cv=none; b=bA1BfaRGMr5CizwJMZ00d2uaBzFpiAQur3oaVSMir737f4mZSFiFdzs4gXEyLK7qMeYrJZaoOLRa8jZeEmgL6PxnUFcAu1GgbX3vPnRULAQd9GonNM+j3rf8AQwhgHn6XdOfNwG7SltkQeoUMzSsgPLIYbsIYZQPoTlRKmHKwvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708496483; c=relaxed/simple; bh=b8qRZ3SFNTI1GkXavMUvTi/U7wZfWW89yvF8PDL0uU0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rnX03hSjj+bOhMeZnn4C+95pIguLigzN+4LbAUYXfxDWOBGCojHlBMDCpFBV4Tjc7wtlY+wbhGEvr9dtdpxO9gMG28zfiVgFuiPRM8WGNpga//jB2U5v3YxTvDZAjUc2SNLAeqsAR4j9M7tgFfXa0+Yq8n8uaxxFMV8jIHGrBdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcfyh-00010U-4Y; Wed, 21 Feb 2024 07:21:11 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rcfye-001zFH-PO; Wed, 21 Feb 2024 07:21:08 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rcfye-003Gac-2D; Wed, 21 Feb 2024 07:21:08 +0100 From: Oleksij Rempel To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King 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 v5 6/8] net: phy: Add phy_support_eee() indicating MAC support EEE Date: Wed, 21 Feb 2024 07:21:05 +0100 Message-Id: <20240221062107.778661-7-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240221062107.778661-1-o.rempel@pengutronix.de> References: <20240221062107.778661-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org From: Andrew Lunn In order for EEE to operate, both the MAC and the PHY need to support it, similar to how pause works. Copy the pause concept and add the call phy_support_eee() which the MAC makes after connecting the PHY to indicate it supports EEE. phylib will then advertise EEE when auto-neg is performed. Signed-off-by: Andrew Lunn Signed-off-by: Oleksij Rempel --- drivers/net/phy/phy_device.c | 18 ++++++++++++++++++ include/linux/phy.h | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 2eefee970851..269d3c7f0849 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2910,6 +2910,24 @@ void phy_advertise_eee_all(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(phy_advertise_eee_all); +/** + * phy_support_eee - Enable support of EEE + * @phydev: target phy_device struct + * + * Description: Called by the MAC to indicate is supports Energy + * Efficient Ethernet. This should be called before phy_start() in + * order that EEE is negotiated when the link comes up as part of + * phy_start(). EEE is enabled by default when the hardware supports + * it. + */ +void phy_support_eee(struct phy_device *phydev) +{ + linkmode_copy(phydev->advertising_eee, phydev->supported_eee); + phydev->eee_cfg.tx_lpi_enabled = true; + phydev->eee_cfg.eee_enabled = true; +} +EXPORT_SYMBOL(phy_support_eee); + /** * phy_support_sym_pause - Enable support of symmetrical pause * @phydev: target phy_device struct diff --git a/include/linux/phy.h b/include/linux/phy.h index 356916695a26..b6c5dee143d1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -706,7 +706,7 @@ struct phy_device { __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising); /* used with phy_speed_down */ __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old); - /* used for eee validation */ + /* used for eee validation and configuration*/ __ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee); __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising_eee); bool eee_enabled; @@ -1973,6 +1973,7 @@ void phy_advertise_supported(struct phy_device *phydev); void phy_advertise_eee_all(struct phy_device *phydev); void phy_support_sym_pause(struct phy_device *phydev); void phy_support_asym_pause(struct phy_device *phydev); +void phy_support_eee(struct phy_device *phydev); void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, bool autoneg); void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx); -- 2.39.2