From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/2] net: phy: Add phy_(set|clear)_bits_mmd()
Date: Wed, 20 Sep 2023 13:22:51 +0200 [thread overview]
Message-ID: <20230920112252.2782897-1-s.hauer@pengutronix.de> (raw)
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
next reply other threads:[~2023-09-20 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 11:22 Sascha Hauer [this message]
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
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=20230920112252.2782897-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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