netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dimitri Fedrau <dima.fedrau@gmail.com>
Cc: Dimitri Fedrau <dima.fedrau@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Stefan Eichenberger <eichest@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v7 net-next 07/14] net: phy: marvell-88q2xxx: add suspend / resume ops
Date: Sun, 18 Feb 2024 08:57:44 +0100	[thread overview]
Message-ID: <20240218075753.18067-8-dima.fedrau@gmail.com> (raw)
In-Reply-To: <20240218075753.18067-1-dima.fedrau@gmail.com>

Add suspend/resume ops for Marvell 88Q2xxx devices.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
---
 drivers/net/phy/marvell-88q2xxx.c | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
index 7c7517af346b..8b8275552014 100644
--- a/drivers/net/phy/marvell-88q2xxx.c
+++ b/drivers/net/phy/marvell-88q2xxx.c
@@ -461,6 +461,38 @@ static irqreturn_t mv88q2xxx_handle_interrupt(struct phy_device *phydev)
 	return IRQ_HANDLED;
 }
 
+static int mv88q2xxx_suspend(struct phy_device *phydev)
+{
+	int ret;
+
+	/* Disable PHY interrupts */
+	if (phy_interrupt_is_valid(phydev)) {
+		phydev->interrupts = PHY_INTERRUPT_DISABLED;
+		ret = mv88q2xxx_config_intr(phydev);
+		if (ret)
+			return ret;
+	}
+
+	return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
+				MDIO_CTRL1_LPOWER);
+}
+
+static int mv88q2xxx_resume(struct phy_device *phydev)
+{
+	int ret;
+
+	/* Enable PHY interrupts */
+	if (phy_interrupt_is_valid(phydev)) {
+		phydev->interrupts = PHY_INTERRUPT_ENABLED;
+		ret = mv88q2xxx_config_intr(phydev);
+		if (ret)
+			return ret;
+	}
+
+	return phy_clear_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
+				  MDIO_CTRL1_LPOWER);
+}
+
 static int mv88q222x_soft_reset(struct phy_device *phydev)
 {
 	int ret;
@@ -566,6 +598,8 @@ static struct phy_driver mv88q2xxx_driver[] = {
 		.set_loopback		= genphy_c45_loopback,
 		.get_sqi		= mv88q2xxx_get_sqi,
 		.get_sqi_max		= mv88q2xxx_get_sqi_max,
+		.suspend		= mv88q2xxx_suspend,
+		.resume			= mv88q2xxx_resume,
 	},
 };
 
-- 
2.39.2


  parent reply	other threads:[~2024-02-18  7:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-18  7:57 [PATCH v7 net-next 00/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 01/14] net: phy: Add BaseT1 auto-negotiation constants Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 02/14] net: phy: Support 100/1000BT1 linkmode advertisements Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 03/14] net: phy: c45: detect 100/1000BASE-T1 " Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 04/14] net: phy: marvell-88q2xxx: fix typos Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 05/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 06/14] net: phy: marvell-88q2xxx: add interrupt support for link detection Dimitri Fedrau
2024-02-18  7:57 ` Dimitri Fedrau [this message]
2024-02-18  7:57 ` [PATCH v7 net-next 08/14] net: phy: marvell-88q2xxx: add support for temperature sensor Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 09/14] net: phy: marvell-88q2xxx: add cable test support Dimitri Fedrau
2024-02-18 17:05   ` Andrew Lunn
2024-02-18  7:57 ` [PATCH v7 net-next 10/14] net: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 11/14] net: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 12/14] net: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 13/14] net: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable Dimitri Fedrau
2024-02-18  7:57 ` [PATCH v7 net-next 14/14] net: phy: marvell-88q2xxx: move interrupt configuration Dimitri Fedrau
2024-02-21 23:20 ` [PATCH v7 net-next 00/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240218075753.18067-8-dima.fedrau@gmail.com \
    --to=dima.fedrau@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eichest@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).