[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220904225555.1994290-1-oliver@schinagl.nl>
Date: Mon, 5 Sep 2022 00:55:55 +0200
From: Olliver Schinagl <oliver@...inagl.nl>
To: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>
Cc: inux-kernel@...r.kernel.org,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Olliver Schinagl <oliver@...inagl.nl>
Subject: [PATCH] phy: Add helpers for setting/clearing bits in paged registers
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@...inagl.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
Powered by blists - more mailing lists