Skip to contentSkip to conversation

mii: miiphy register address width change

PATCH New Chandan Nath 6 participants 15 messages Sep 21, 2011 – Dec 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mii: miiphy register address width change

This patch is added for PHY whose register offset value exceeds 0xFF and cannot be used with "unsigned char" datatype in miiphy_read, miiphy_write and miiphy_register functions. Datatype of register offset is changed to unsigned short instead of unsigned char so that offset value greater then 0xFF can be used.

---
 common/miiphyutil.c |    8 ++++----
 include/miiphy.h    |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
common/miiphyutil.c +4 -4
index 35ad357..68a32fc 100644
@@ -105,9 +105,9 @@ static int legacy_miiphy_write(struct mii_dev *bus, int addr, int devad,
  */
 void miiphy_register(const char *name,
 		      int (*read)(const char *devname, unsigned char addr,
-				   unsigned char reg, unsigned short *value),
+				   unsigned short reg, unsigned short *value),
 		      int (*write)(const char *devname, unsigned char addr,
-				    unsigned char reg, unsigned short value))
+				    unsigned short reg, unsigned short value))
 {
 	struct mii_dev *new_dev;
 	struct legacy_mii_dev *ldev;
@@ -284,7 +284,7 @@ static struct mii_dev *miiphy_get_active_dev(const char *devname)
  * Returns:
  *   0 on success
  */
-int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_read(const char *devname, unsigned char addr, unsigned short reg,
 		 unsigned short *value)
 {
 	struct mii_dev *bus;
@@ -310,7 +310,7 @@ int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
  * Returns:
  *   0 on success
  */
-int miiphy_write(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_write(const char *devname, unsigned char addr, unsigned short reg,
 		  unsigned short value)
 {
 	struct mii_dev *bus;
include/miiphy.h +6 -6
index 7e70cf8..7ce6d14 100644
@@ -42,14 +42,14 @@
 
 struct legacy_mii_dev {
 	int (*read)(const char *devname, unsigned char addr,
-		     unsigned char reg, unsigned short *value);
+		     unsigned short reg, unsigned short *value);
 	int (*write)(const char *devname, unsigned char addr,
-		      unsigned char reg, unsigned short value);
+		      unsigned short reg, unsigned short value);
 };
 
-int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_read(const char *devname, unsigned char addr, unsigned short reg,
 		 unsigned short *value);
-int miiphy_write(const char *devname, unsigned char addr, unsigned char reg,
+int miiphy_write(const char *devname, unsigned char addr, unsigned short reg,
 		  unsigned short value);
 int miiphy_info(const char *devname, unsigned char addr, unsigned int *oui,
 		 unsigned char *model, unsigned char *rev);
@@ -65,9 +65,9 @@ void miiphy_init(void);
 
 void miiphy_register(const char *devname,
 		      int (*read)(const char *devname, unsigned char addr,
-				   unsigned char reg, unsigned short *value),
+				   unsigned short reg, unsigned short *value),
 		      int (*write)(const char *devname, unsigned char addr,
-				    unsigned char reg, unsigned short value));
+				    unsigned short reg, unsigned short value));
 
 int miiphy_set_current_dev(const char *devname);
 const char *miiphy_get_current_dev(void);
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 5 lines · On Wednesday, September 21, 2011 07:10:32 Chandan Nath wrote:

This patch is added for PHY whose register offset value exceeds 0xFF and cannot be used with "unsigned char" datatype in miiphy_read, miiphy_write and miiphy_register functions. Datatype of register offset is changed to unsigned short instead of unsigned char so that offset value greater then 0xFF can be used.

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110921/448e80c9/attachment.pgp

#2 lore raw

PATCH 1/1 mii: miiphy register address width change

Hi Mike,
This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

Regards
Chandan

Quoted 15 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Wednesday, September 21, 2011 7:52 PM
To: u-boot at lists.denx.de
Cc: Kumar Nath, Chandan
Subject: Re: [U-Boot] [PATCH] mii: miiphy register address width change

Quoted 5 lines · On Wednesday, September 21, 2011 07:10:32 Chandan Nath wrote:

This patch is added for PHY whose register offset value exceeds 0xFF and cannot be used with "unsigned char" datatype in miiphy_read, miiphy_write and miiphy_register functions. Datatype of register offset is changed to unsigned short instead of unsigned char so that offset value greater then 0xFF can be used.

#3 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/1e5e6256/attachment.pgp

#4 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 5 lines · Mike Frysinger
Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

Quoted 7 lines

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.
-mike
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

I think this breaks 10g support. I'm pretty sure Andy made the data type a short for a reason.

- k

#5 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 11 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.

I think this breaks 10g support. I'm pretty sure Andy made the data type a short for a reason.

the data type in mainline is 8bits (char). Chandan is fixing it to be 16bits (short). if 10g breaks with a short, that sounds like a bug in the 10g code we should figure out + fix. Linux is using a short just fine afaict. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/e8895c85/attachment.pgp

#6 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 22 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Thursday, October 20, 2011 7:28 PM
To: Kumar Gala
Cc: Kumar Nath, Chandan; u-boot at lists.denx.de List; Andy Fleming
Subject: Re: [U-Boot] [PATCH] mii: miiphy register address width change

Quoted 3 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 2 lines · Mike Frysinger
Quoted 1 line · Chandan

This patch was acked on September 21, but in latest code base I

could

Quoted 1 line
Quoted 1 line
Quoted 1 line

not find this patch. Is there anything left which I need to take

care

Quoted 1 line
Quoted 1 line
Quoted 1 line

in my patch. If so, please let me know so that this can be picked

up.

Quoted 5 lines
Quoted 3 lines

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.

I think this breaks 10g support. I'm pretty sure Andy made the data

type a

Quoted 8 lines
Quoted 1 line

short for a reason.

the data type in mainline is 8bits (char). Chandan is fixing it to be 16bits
(short). if 10g breaks with a short, that sounds like a bug in the 10g code
we should figure out + fix. Linux is using a short just fine afaict. -mike

Yes, in mainline it is 8 bits (char) not 16 bits (short).

Wolfgang,
can it be picked up for mainline?
- Chandan

#7 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 31 lines · Chandan
Quoted 22 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Thursday, October 20, 2011 7:28 PM
To: Kumar Gala
Cc: Kumar Nath, Chandan; u-boot at lists.denx.de List; Andy Fleming
Subject: Re: [U-Boot] [PATCH] mii: miiphy register address width change

Quoted 3 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 2 lines · Mike Frysinger
Quoted 1 line · Chandan

This patch was acked on September 21, but in latest code base I

could

Quoted 1 line
Quoted 1 line
Quoted 1 line

not find this patch. Is there anything left which I need to take

care

Quoted 1 line
Quoted 1 line
Quoted 1 line

in my patch. If so, please let me know so that this can be picked

up.

Quoted 5 lines
Quoted 3 lines

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.

I think this breaks 10g support. I'm pretty sure Andy made the data

type a

Quoted 8 lines
Quoted 1 line

short for a reason.

the data type in mainline is 8bits (char). Chandan is fixing it to be 16bits
(short). if 10g breaks with a short, that sounds like a bug in the 10g code
we should figure out + fix. Linux is using a short just fine afaict. -mike

Quoted 5 lines

Yes, in mainline it is 8 bits (char) not 16 bits (short).

Wolfgang,
can it be picked up for mainline?
- Chandan

Mainline of what?

- k

#8 lore raw

PATCH 1/1 mii: miiphy register address width change

In reply to Mike Frysinger
Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

i don't merge net patches. ?wolfgang does. ?i don't think there's anything left for you to do.

Quoted 6 lines
Quoted 2 lines

I think this breaks 10g support. ?I'm pretty sure Andy made the data type a short for a reason.

the data type in mainline is 8bits (char). ?Chandan is fixing it to be 16bits (short). ?if 10g breaks with a short, that sounds like a bug in the 10g code we should figure out + fix. ?Linux is using a short just fine afaict.

Actually, there's some confusion, here. The function being updated by this patch isn't part of phylib. It's part of the legacy miiphy code. I don't think there's any reason to update it. If you are writing a new driver with 10G support (which would, admittedly, require a 16-bit register argument), then don't use miiphy_register. Call mdio_register, and register proper phylib support. The mii command isn't capable of dealing with Clause-45 MDIO transactions, anyway (no devad)

Andy

#9 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 19 lines · On Thursday 20 October 2011 17:45:33 Andy Fleming wrote:
Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

i don't merge net patches. wolfgang does. i don't think there's anything left for you to do.

Quoted 7 lines
Quoted 2 lines

I think this breaks 10g support. I'm pretty sure Andy made the data type a short for a reason.

the data type in mainline is 8bits (char). Chandan is fixing it to be 16bits (short). if 10g breaks with a short, that sounds like a bug in the 10g code we should figure out + fix. Linux is using a short just fine afaict.

Quoted 8 lines

Actually, there's some confusion, here. The function being updated by this patch isn't part of phylib. It's part of the legacy miiphy code. I don't think there's any reason to update it. If you are writing a new driver with 10G support (which would, admittedly, require a 16-bit register argument), then don't use miiphy_register. Call mdio_register, and register proper phylib support. The mii command isn't capable of dealing with Clause-45 MDIO transactions, anyway (no devad)

so the patch is correct, but we don't want to merge it because we don't want to encourage the old miiphy interface ? and leaving it broken forces people to migrate to the new phy layer ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/42c67471/attachment.pgp

#10 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 29 lines · Mike Frysinger
Quoted 19 lines · On Thursday 20 October 2011 17:45:33 Andy Fleming wrote:
Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Chandan

This patch was acked on September 21, but in latest code base I could not find this patch. Is there anything left which I need to take care in my patch. If so, please let me know so that this can be picked up.

i don't merge net patches. ?wolfgang does. ?i don't think there's anything left for you to do.

Quoted 7 lines
Quoted 2 lines

I think this breaks 10g support. ?I'm pretty sure Andy made the data type a short for a reason.

the data type in mainline is 8bits (char). ?Chandan is fixing it to be 16bits (short). ?if 10g breaks with a short, that sounds like a bug in the 10g code we should figure out + fix. ?Linux is using a short just fine afaict.

Quoted 8 lines

Actually, there's some confusion, here. The function being updated by this patch isn't part of phylib. It's part of the legacy miiphy code. I don't think there's any reason to update it. If you are writing a new driver with 10G support (which would, admittedly, require a 16-bit register argument), then don't use miiphy_register. Call mdio_register, and register proper phylib support. The mii command isn't capable of dealing with Clause-45 MDIO transactions, anyway (no devad)

Quoted 3 lines

so the patch is correct, but we don't want to merge it because we don't want to encourage the old miiphy interface ? ?and leaving it broken forces people to migrate to the new phy layer ?

I don't think the patch is correct or incorrect. It attempts to update the miiphy_* API to support larger register offsets. I'm suggesting that we shouldn't change the legacy API to support new features. There's no way to specify via miiphy_write that you want to write to a register with a 16-bit register offset, because there's no way to specify which device to write.

So I'm not saying we shouldn't apply this patch. I'm questioning why it was written in a hope that we can discourage new use of the old API. I'm also not convinced the patch helps anything.

Andy

#11 lore raw

PATCH 1/1 mii: miiphy register address width change

Quoted 65 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Andy Fleming
Sent: Friday, October 21, 2011 4:24 AM
To: Mike Frysinger
Cc: u-boot at lists.denx.de List; Andy Fleming; Kumar Gala
Subject: Re: [U-Boot] [PATCH] mii: miiphy register address width change

Quoted 2 lines · Mike Frysinger
Quoted 1 line · On Thursday 20 October 2011 17:45:33 Andy Fleming wrote:

On Thu, Oct 20, 2011 at 8:58 AM, Mike Frysinger <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines · On Thursday 20 October 2011 09:55:34 Kumar Gala wrote:
Quoted 3 lines · Mike Frysinger
Quoted 2 lines · Chandan
Quoted 1 line

This patch was acked on September 21, but in latest code base

I could

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

not find this patch. Is there anything left which I need to

take care

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in my patch. If so, please let me know so that this can be

picked up.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

i don't merge net patches. ?wolfgang does. ?i don't think

there's

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

anything left for you to do.

I think this breaks 10g support. ?I'm pretty sure Andy made the

data

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

type a short for a reason.

the data type in mainline is 8bits (char). ?Chandan is fixing it

to be

Quoted 1 line
Quoted 1 line
Quoted 1 line

16bits (short). ?if 10g breaks with a short, that sounds like a

bug in

Quoted 1 line
Quoted 1 line
Quoted 1 line

the 10g code we should figure out + fix. ?Linux is using a short

just

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

fine afaict.

Actually, there's some confusion, here. The function being updated

by

Quoted 1 line
Quoted 1 line

this patch isn't part of phylib. It's part of the legacy miiphy

code.

Quoted 2 lines
Quoted 2 lines

I don't think there's any reason to update it. If you are writing a new driver with 10G support (which would, admittedly, require a 16-

bit

Quoted 3 lines
Quoted 3 lines

register argument), then don't use miiphy_register. Call mdio_register, and register proper phylib support. The mii command isn't capable of dealing with Clause-45 MDIO transactions, anyway

(no

Quoted 3 lines
Quoted 1 line

devad)

so the patch is correct, but we don't want to merge it because we

don't want

Quoted 1 line

to encourage the old miiphy interface ? ?and leaving it broken forces

people

Quoted 1 line

to migrate to the new phy layer ?

I don't think the patch is correct or incorrect. It attempts to update the miiphy_* API to support larger register offsets. I'm suggesting that we shouldn't change the legacy API to support new features. There's no way to specify via miiphy_write that you want to write to a register with a 16-bit register offset, because there's no way to specify which device to write.

Quoted 5 lines

So I'm not saying we shouldn't apply this patch. I'm questioning why it was written in a hope that we can discourage new use of the old API. I'm also not convinced the patch helps anything.

Andy

This patch was written to support PHY register whose address width is greater than 8 bit. It was not written for 10 gig support.

- Chandan

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#12 lore raw

PATCH 1/1 mii: miiphy register address width change

Dear "Kumar Nath, Chandan",

Quoted 8 lines · In message <[email protected]> you…
Quoted 8 lines

I don't think the patch is correct or incorrect. It attempts to update the miiphy_* API to support larger register offsets. I'm suggesting that we shouldn't change the legacy API to support new features. There's no way to specify via miiphy_write that you want to write to a register with a 16-bit register offset, because there's no way to specify which device to write.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

So I'm not saying we shouldn't apply this patch. I'm questioning why it was written in a hope that we can discourage new use of the old API. I'm also not convinced the patch helps anything.

Quoted 1 line

Andy

This patch was written to support PHY register whose address width is great> er than 8 bit. It was not written for 10 gig support.

The question remains: Why are you still using the old deprecated legacy API instead of the new one?

You will need really good reasons to convince me.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Save energy:  Drive a smaller shell.
#13 lore raw

PATCH 1/1 mii: miiphy register address width change

In reply to Andy Fleming
Quoted 3 lines · On Thursday 20 October 2011 18:53:37 Andy Fleming wrote:

So I'm not saying we shouldn't apply this patch. I'm questioning why it was written in a hope that we can discourage new use of the old API. I'm also not convinced the patch helps anything.

can you update the feature removal file and add some comment warnings to the relevant files then ?

i think #warning might be too big of a problem atm due to how many people are still using the old API ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111030/d6f1c42a/attachment.pgp

#14 lore raw

PATCH 1/1 mii: miiphy register address width change

In reply to Chandan Nath

Dear Chandan Nath,

Quoted 11 lines · In message <[email protected]> you wrote:

This patch is added for PHY whose register offset value exceeds 0xFF and cannot be used with "unsigned char" datatype in miiphy_read, miiphy_write and miiphy_register functions. Datatype of register offset is changed to unsigned short instead of unsigned char so that offset value greater then 0xFF can be used.

---
 common/miiphyutil.c |    8 ++++----
 include/miiphy.h    |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No one can guarantee the actions of another.
	-- Spock, "Day of the Dove", stardate unknown