* [PATCH] [v5] phylib: Add Clause 45 read/write functions
@ 2014-01-08 4:25 shh.xie
2014-01-08 5:56 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: shh.xie @ 2014-01-08 4:25 UTC (permalink / raw)
To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
Cc: Shaohui.Xie, Andy Fleming
From: Andy Fleming <afleming@gmail.com>
Need an extra parameter to read or write Clause 45 PHYs, so
need a different API with the extra parameter.
Signed-off-by: Andy Fleming <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
changes for v5:
revised for opening parenthesis.
include/linux/phy.h | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 48a4dc3..e5eed18 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -498,6 +498,24 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
}
/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ *
+ * Same rules as for phy_read();
+ */
+static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
+{
+ if (!phydev->is_c45)
+ return -EOPNOTSUPP;
+
+ return mdiobus_read(phydev->bus, phydev->addr,
+ MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff));
+}
+
+/**
* phy_write - Convenience function for writing a given PHY register
* @phydev: the phy_device struct
* @regnum: register number to write
@@ -533,6 +551,27 @@ static inline bool phy_is_internal(struct phy_device *phydev)
return phydev->is_internal;
}
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ *
+ * Same rules as for phy_write();
+ */
+static inline int phy_write_mmd(struct phy_device *phydev, int devad,
+ u32 regnum, u16 val)
+{
+ if (!phydev->is_c45)
+ return -EOPNOTSUPP;
+
+ regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff);
+
+ return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
+}
+
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
bool is_c45, struct phy_c45_device_ids *c45_ids);
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
--
1.8.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] [v5] phylib: Add Clause 45 read/write functions
2014-01-08 4:25 [PATCH] [v5] phylib: Add Clause 45 read/write functions shh.xie
@ 2014-01-08 5:56 ` David Miller
2014-01-08 5:58 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-01-08 5:56 UTC (permalink / raw)
To: shh.xie
Cc: jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel,
Shaohui.Xie, afleming
When you are asked to make changes to a patch in a series, you must
repost the entire series, not just the patch which has changed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [v5] phylib: Add Clause 45 read/write functions
2014-01-08 5:56 ` David Miller
@ 2014-01-08 5:58 ` David Miller
2014-01-08 6:04 ` Shaohui Xie
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-01-08 5:58 UTC (permalink / raw)
To: shh.xie
Cc: jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel,
Shaohui.Xie, afleming
From: David Miller <davem@davemloft.net>
Date: Wed, 08 Jan 2014 00:56:14 -0500 (EST)
>
> When you are asked to make changes to a patch in a series, you must
> repost the entire series, not just the patch which has changed.
Nevermind I see that you did this, you just messed up the Subject
line for this patch by not providing the patch number there.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] [v5] phylib: Add Clause 45 read/write functions
2014-01-08 5:58 ` David Miller
@ 2014-01-08 6:04 ` Shaohui Xie
0 siblings, 0 replies; 4+ messages in thread
From: Shaohui Xie @ 2014-01-08 6:04 UTC (permalink / raw)
To: David Miller, shh.xie@gmail.com
Cc: jg1.han@samsung.com, mugunthanvnm@ti.com, f.fainelli@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
afleming@gmail.com
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, January 08, 2014 1:58 PM
> To: shh.xie@gmail.com
> Cc: jg1.han@samsung.com; mugunthanvnm@ti.com; f.fainelli@gmail.com;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Xie Shaohui-B21989;
> afleming@gmail.com
> Subject: Re: [PATCH] [v5] phylib: Add Clause 45 read/write functions
>
> From: David Miller <davem@davemloft.net>
> Date: Wed, 08 Jan 2014 00:56:14 -0500 (EST)
>
> >
> > When you are asked to make changes to a patch in a series, you must
> > repost the entire series, not just the patch which has changed.
>
> Nevermind I see that you did this, you just messed up the Subject line
> for this patch by not providing the patch number there.
>
[S.H] Oh.. Sorry!
Do I need to resend the entire series? :(
Thanks!
Shaohui Xie
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-08 6:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-08 4:25 [PATCH] [v5] phylib: Add Clause 45 read/write functions shh.xie
2014-01-08 5:56 ` David Miller
2014-01-08 5:58 ` David Miller
2014-01-08 6:04 ` Shaohui Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox