mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: phy: Add phy_(set|clear)_bits_mmd()
@ 2023-09-20 11:22 Sascha Hauer
  2023-09-20 11:22 ` [PATCH 2/2] net: phy: dp83867: Sync with Linux Sascha Hauer
  2023-09-20 12:04 ` [PATCH 1/2] net: phy: Add phy_(set|clear)_bits_mmd() Marco Felsch
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-09-20 11:22 UTC (permalink / raw)
  To: Barebox List

Provide phy_set_bits_mmd() and phy_clear_bits() for easier code adoption
from the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/linux/phy.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index bb728dfaf8..d68ee5665a 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -422,6 +422,34 @@ int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum,
 int phy_modify_mmd_changed(struct phy_device *phydev, int devad, u32 regnum,
 			   u16 mask, u16 set);
 
+/**
+ * phy_set_bits_mmd - Convenience function for setting bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to set
+ */
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
+		u32 regnum, u16 val)
+{
+	return phy_modify_mmd(phydev, devad, regnum, 0, val);
+}
+
+/**
+ * phy_clear_bits_mmd - Convenience function for clearing bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to clear
+ */
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
+		u32 regnum, u16 val)
+{
+	return phy_modify_mmd(phydev, devad, regnum, val, 0);
+}
+
 static inline bool phy_acquired(struct phy_device *phydev)
 {
 	return phydev && phydev->bus && slice_acquired(&phydev->bus->slice);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-20 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 11:22 [PATCH 1/2] net: phy: Add phy_(set|clear)_bits_mmd() Sascha Hauer
2023-09-20 11:22 ` [PATCH 2/2] net: phy: dp83867: Sync with Linux Sascha Hauer
2023-09-20 12:04 ` [PATCH 1/2] net: phy: Add phy_(set|clear)_bits_mmd() Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox