The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/4] phylib: Add Clause 45 read/write functions
@ 2013-11-11 11:04 shh.xie
  2013-11-12 12:30 ` Shaohui Xie
  2013-11-12 21:58 ` Scott Wood
  0 siblings, 2 replies; 7+ messages in thread
From: shh.xie @ 2013-11-11 11:04 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel; +Cc: madalin.bucur, Shruti, Shaohui Xie

From: Andy Fleming

You need an extra parameter to read or write Clause 45 PHYs, so
we need a different API with the extra parameter.

Signed-off-by: Andy Fleming
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 include/linux/phy.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 64ab823..684925a 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -498,6 +498,21 @@ 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)
+{
+	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 +548,24 @@ 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)
+{
+	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] 7+ messages in thread

* RE: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-11 11:04 [PATCH 1/4] phylib: Add Clause 45 read/write functions shh.xie
@ 2013-11-12 12:30 ` Shaohui Xie
  2013-11-12 21:58 ` Scott Wood
  1 sibling, 0 replies; 7+ messages in thread
From: Shaohui Xie @ 2013-11-12 12:30 UTC (permalink / raw)
  To: shh.xie@gmail.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
  Cc: Madalin-Cristian Bucur, Shruti Kanetkar, davem@davemloft.net,
	jg1.han@samsung.com, f.fainelli@gmail.com, peppe.cavallaro@st.com,
	michal.simek@xilinx.com, netdev@vger.kernel.org

Added more people and list.

Best Regards, 
Shaohui Xie


> -----Original Message-----
> From: shh.xie@gmail.com [mailto:shh.xie@gmail.com]
> Sent: Monday, November 11, 2013 7:04 PM
> To: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Cc: Bucur Madalin-Cristian-B32716; Kanetkar Shruti-B44454; Xie Shaohui-B21989
> Subject: [PATCH 1/4] phylib: Add Clause 45 read/write functions
> 
> From: Andy Fleming
> 
> You need an extra parameter to read or write Clause 45 PHYs, so we need a
> different API with the extra parameter.
> 
> Signed-off-by: Andy Fleming
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> ---
>  include/linux/phy.h | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/include/linux/phy.h b/include/linux/phy.h index 64ab823..684925a
> 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -498,6 +498,21 @@ 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) {
> +	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 +548,24 @@ 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)
> +{
> +	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	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-11 11:04 [PATCH 1/4] phylib: Add Clause 45 read/write functions shh.xie
  2013-11-12 12:30 ` Shaohui Xie
@ 2013-11-12 21:58 ` Scott Wood
  2013-11-13  1:51   ` Shaohui Xie
  1 sibling, 1 reply; 7+ messages in thread
From: Scott Wood @ 2013-11-12 21:58 UTC (permalink / raw)
  To: shh.xie; +Cc: linuxppc-dev, linux-kernel, Shruti, Shaohui Xie, madalin.bucur

On Mon, 2013-11-11 at 19:04 +0800, shh.xie@gmail.com wrote:
> From: Andy Fleming
> 
> You need an extra parameter to read or write Clause 45 PHYs, so
> we need a different API with the extra parameter.
> 
> Signed-off-by: Andy Fleming
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>

Why did you remove Andy's e-mail address?  Even though it's no longer
valid, it helps identify which specific person you're talking about.

-Scott




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

* RE: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-12 21:58 ` Scott Wood
@ 2013-11-13  1:51   ` Shaohui Xie
  2013-11-13  1:54     ` Emil Medve
  2013-11-13  1:54     ` Scott Wood
  0 siblings, 2 replies; 7+ messages in thread
From: Shaohui Xie @ 2013-11-13  1:51 UTC (permalink / raw)
  To: Scott Wood, shh.xie@gmail.com
  Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Shruti Kanetkar, Madalin-Cristian Bucur

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1092 bytes --]

> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, November 13, 2013 5:58 AM
> To: shh.xie@gmail.com
> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Kanetkar
> Shruti-B44454; Xie Shaohui-B21989; Bucur Madalin-Cristian-B32716
> Subject: Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
> 
> On Mon, 2013-11-11 at 19:04 +0800, shh.xie@gmail.com wrote:
> > From: Andy Fleming
> >
> > You need an extra parameter to read or write Clause 45 PHYs, so we
> > need a different API with the extra parameter.
> >
> > Signed-off-by: Andy Fleming
> > Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> 
> Why did you remove Andy's e-mail address?  Even though it's no longer valid, it
> helps identify which specific person you're talking about.
> 
[S.H] Andy's e-mail address is not valid and git-send-mail will fail, I have to remove it to make git work.


Best Regards, 
Shaohui Xie
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-13  1:51   ` Shaohui Xie
@ 2013-11-13  1:54     ` Emil Medve
  2013-11-13  1:54     ` Scott Wood
  1 sibling, 0 replies; 7+ messages in thread
From: Emil Medve @ 2013-11-13  1:54 UTC (permalink / raw)
  Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org

Hello Xiao-Hui,


On 11/12/2013 07:51 PM, Shaohui Xie wrote:
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Wednesday, November 13, 2013 5:58 AM
>> To: shh.xie@gmail.com
>> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Kanetkar
>> Shruti-B44454; Xie Shaohui-B21989; Bucur Madalin-Cristian-B32716
>> Subject: Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
>>
>> On Mon, 2013-11-11 at 19:04 +0800, shh.xie@gmail.com wrote:
>>> From: Andy Fleming
>>>
>>> You need an extra parameter to read or write Clause 45 PHYs, so we
>>> need a different API with the extra parameter.
>>>
>>> Signed-off-by: Andy Fleming
>>> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
>>
>> Why did you remove Andy's e-mail address?  Even though it's no longer valid, it
>> helps identify which specific person you're talking about.
>>
> [S.H] Andy's e-mail address is not valid and git-send-mail will fail, I have to remove it to make git work.

Just use Andy's GMail address: afleming@gmail.com


Cheers,


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

* Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-13  1:51   ` Shaohui Xie
  2013-11-13  1:54     ` Emil Medve
@ 2013-11-13  1:54     ` Scott Wood
  2013-11-13  2:01       ` Shaohui Xie
  1 sibling, 1 reply; 7+ messages in thread
From: Scott Wood @ 2013-11-13  1:54 UTC (permalink / raw)
  To: Xie Shaohui-B21989
  Cc: shh.xie@gmail.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Kanetkar Shruti-B44454,
	Bucur Madalin-Cristian-B32716

On Tue, 2013-11-12 at 19:51 -0600, Xie Shaohui-B21989 wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Wednesday, November 13, 2013 5:58 AM
> > To: shh.xie@gmail.com
> > Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Kanetkar
> > Shruti-B44454; Xie Shaohui-B21989; Bucur Madalin-Cristian-B32716
> > Subject: Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
> > 
> > On Mon, 2013-11-11 at 19:04 +0800, shh.xie@gmail.com wrote:
> > > From: Andy Fleming
> > >
> > > You need an extra parameter to read or write Clause 45 PHYs, so we
> > > need a different API with the extra parameter.
> > >
> > > Signed-off-by: Andy Fleming
> > > Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> > 
> > Why did you remove Andy's e-mail address?  Even though it's no longer valid, it
> > helps identify which specific person you're talking about.
> > 
> [S.H] Andy's e-mail address is not valid and git-send-mail will fail, I have to remove it to make git work.

Tell git send-email to not include that address, e.g. using
--suppress-cc, --no-signed-off-by-cc, --suppress-from, etc.

-Scott




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

* RE: [PATCH 1/4] phylib: Add Clause 45 read/write functions
  2013-11-13  1:54     ` Scott Wood
@ 2013-11-13  2:01       ` Shaohui Xie
  0 siblings, 0 replies; 7+ messages in thread
From: Shaohui Xie @ 2013-11-13  2:01 UTC (permalink / raw)
  To: Scott Wood
  Cc: shh.xie@gmail.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Shruti Kanetkar,
	Madalin-Cristian Bucur

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1396 bytes --]

> On Tue, 2013-11-12 at 19:51 -0600, Xie Shaohui-B21989 wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Wednesday, November 13, 2013 5:58 AM
> > > To: shh.xie@gmail.com
> > > Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
> > > Kanetkar Shruti-B44454; Xie Shaohui-B21989; Bucur
> > > Madalin-Cristian-B32716
> > > Subject: Re: [PATCH 1/4] phylib: Add Clause 45 read/write functions
> > >
> > > On Mon, 2013-11-11 at 19:04 +0800, shh.xie@gmail.com wrote:
> > > > From: Andy Fleming
> > > >
> > > > You need an extra parameter to read or write Clause 45 PHYs, so we
> > > > need a different API with the extra parameter.
> > > >
> > > > Signed-off-by: Andy Fleming
> > > > Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> > >
> > > Why did you remove Andy's e-mail address?  Even though it's no
> > > longer valid, it helps identify which specific person you're talking about.
> > >
> > [S.H] Andy's e-mail address is not valid and git-send-mail will fail, I have
> to remove it to make git work.
> 
> Tell git send-email to not include that address, e.g. using --suppress-cc, --no-
> signed-off-by-cc, --suppress-from, etc.
> 
[S.H] OK. Thank you!


Best Regards, 
Shaohui Xie
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2013-11-13  2:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 11:04 [PATCH 1/4] phylib: Add Clause 45 read/write functions shh.xie
2013-11-12 12:30 ` Shaohui Xie
2013-11-12 21:58 ` Scott Wood
2013-11-13  1:51   ` Shaohui Xie
2013-11-13  1:54     ` Emil Medve
2013-11-13  1:54     ` Scott Wood
2013-11-13  2:01       ` Shaohui Xie

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