All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: pcs: xpcs: introduce xpcs_modify() helper function
@ 2021-09-28  4:19 Wong Vee Khee
  2021-09-28  4:19 ` Wong Vee Khee
  2021-09-28  4:19 ` [PATCH net-next 2/2] net: pcs: xpcs: fix incorrect CL37 AN sequence Wong Vee Khee
  0 siblings, 2 replies; 7+ messages in thread
From: Wong Vee Khee @ 2021-09-28  4:19 UTC (permalink / raw)
  To: Andrew Lunn, Jose Abreu, Heiner Kallweit, Russell King,
	David S . Miller, Jakub Kicinski
  Cc: netdev, linux-kernel, Vladimir Oltean, Wong Vee Khee

In some cases we need to call mdiobus_modify() to avoid calling
mdiobus_write() when it is not required.

Introduce a xpcs_modify() helper function that allow us to call
mdiobus_modify() in the pcs-xpcs module.

Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
 drivers/net/pcs/pcs-xpcs.c | 9 +++++++++
 drivers/net/pcs/pcs-xpcs.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index fb0a83dc09ac..da8c81d25edd 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -191,6 +191,15 @@ int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val)
 	return mdiobus_write(bus, addr, reg_addr, val);
 }
 
+int xpcs_modify(struct dw_xpcs *xpcs, int dev, u32 reg, u16 mask, u16 set)
+{
+	u32 reg_addr = mdiobus_c45_addr(dev, reg);
+	struct mii_bus *bus = xpcs->mdiodev->bus;
+	int addr = xpcs->mdiodev->addr;
+
+	return mdiobus_modify(bus, addr, reg_addr, mask, set);
+}
+
 static int xpcs_read_vendor(struct dw_xpcs *xpcs, int dev, u32 reg)
 {
 	return xpcs_read(xpcs, dev, DW_VENDOR | reg);
diff --git a/drivers/net/pcs/pcs-xpcs.h b/drivers/net/pcs/pcs-xpcs.h
index 35651d32a224..fdb870333395 100644
--- a/drivers/net/pcs/pcs-xpcs.h
+++ b/drivers/net/pcs/pcs-xpcs.h
@@ -109,6 +109,7 @@
 
 int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg);
 int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val);
+int xpcs_modify(struct dw_xpcs *xpcs, int dev, u32 reg, u16 mask, u16 set);
 
 int nxp_sja1105_sgmii_pma_config(struct dw_xpcs *xpcs);
 int nxp_sja1110_sgmii_pma_config(struct dw_xpcs *xpcs);
-- 
2.25.1


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

end of thread, other threads:[~2021-09-29 11:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28  4:19 [PATCH net-next 1/2] net: pcs: xpcs: introduce xpcs_modify() helper function Wong Vee Khee
2021-09-28  4:19 ` Wong Vee Khee
2021-09-28  4:19 ` [PATCH net-next 2/2] net: pcs: xpcs: fix incorrect CL37 AN sequence Wong Vee Khee
2021-09-28 10:27   ` Vladimir Oltean
2021-09-29 11:45     ` Wong Vee Khee
2021-09-28 10:41   ` Vladimir Oltean
2021-09-29 11:46     ` Wong Vee Khee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.