Netdev List
 help / color / mirror / Atom feed
From: Olliver Schinagl <oliver@schinagl.nl>
To: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>
Cc: inux-kernel@vger.kernel.org,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Olliver Schinagl <oliver@schinagl.nl>
Subject: [PATCH] phy: Add helpers for setting/clearing bits in paged registers
Date: Mon,  5 Sep 2022 00:55:55 +0200	[thread overview]
Message-ID: <20220904225555.1994290-1-oliver@schinagl.nl> (raw)

As we have helpers for setting/clearing bits in PHY registers and MMD
registers, add also helpers to do the same with paged registers.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
 include/linux/phy.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 87638c55d844..6f13dc9b4fe5 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1262,6 +1262,32 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
 	return phy_modify_mmd(phydev, devad, regnum, val, 0);
 }
 
+/**
+ * phy_set_bits_paged - Convenience function for setting bits in a paged register
+ * @phydev: the phy_device struct
+ * @page: the page for the phy
+ * @regnum: register number to write
+ * @val: bits to set
+ */
+static inline int phy_set_bits_paged(struct phy_device *phydev, int page,
+				     u32 regnum, u16 val)
+{
+	return phy_modify_paged(phydev, page, regnum, 0, val);
+}
+
+/**
+ * phy_clear_bits_paged - Convenience function for clearing bits in a paged register
+ * @phydev: the phy_device struct
+ * @page: the page for the phy
+ * @regnum: register number to write
+ * @val: bits to clear
+ */
+static inline int phy_clear_bits_paged(struct phy_device *phydev, int page,
+				       u32 regnum, u16 val)
+{
+	return phy_modify_paged(phydev, page, regnum, val, 0);
+}
+
 /**
  * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
  * @phydev: the phy_device struct
-- 
2.37.2


             reply	other threads:[~2022-09-04 23:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 22:55 Olliver Schinagl [this message]
2022-09-05  0:05 ` [PATCH] phy: Add helpers for setting/clearing bits in paged registers kernel test robot
2022-09-05  1:18 ` kernel test robot
2022-09-09  1:33 ` kernel test robot

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=20220904225555.1994290-1-oliver@schinagl.nl \
    --to=oliver@schinagl.nl \
    --cc=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=inux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /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