[U-Boot] MII - Incorrect type specified for offset addr

Hi,
We have an upcoming SOC with Ethernet controller which has registers with offsets crossing 0x110. In order to access these registers, we use miiphy_read() & miiphy_write() api provided by Standard u-boot mii phy util code (common/miiphyutil.c).
However the syntax of miiphy_read() & miiphy_write() is as below
int miiphy_read (char *devname, unsigned char addr, unsigned char reg, unsigned short *value);
int miiphy_write (char *devname, unsigned char addr, unsigned char reg, unsigned short value);
Here the "reg" argument is of type "unsigned char" which limits the offset to a max of 0xff. In linux, they are using u32 as type.
Right now we have modified the type to short and using it.
Is this correct? If yes, can we send a patch for the same? If not, what is the alternative?
Thanks & Regards Gururaja

On Monday, July 25, 2011 01:50:29 Hebbar, Gururaja wrote:
We have an upcoming SOC with Ethernet controller which has registers with offsets crossing 0x110. In order to access these registers, we use miiphy_read() & miiphy_write() api provided by Standard u-boot mii phy util code (common/miiphyutil.c).
However the syntax of miiphy_read() & miiphy_write() is as below
int miiphy_read (char *devname, unsigned char addr, unsigned char reg, unsigned short *value);
int miiphy_write (char *devname, unsigned char addr, unsigned char reg, unsigned short value);
Here the "reg" argument is of type "unsigned char" which limits the offset to a max of 0xff. In linux, they are using u32 as type.
Right now we have modified the type to short and using it.
Is this correct? If yes, can we send a patch for the same? If not, what is the alternative?
yes, it should get changed to a u16. feel free to post a patch for it. -mike

I know I'm a bit late to this, but this doesn't sound right. MII isn't a very flexible protocol. The registers have to fit in 5 bits. In order for larger values to be used, you would need to be using clause 45 of MDIO, which requires not just 16-bit register offsets, but an additional argument (device address). There is currently support for clause 45 in the newer U-Boot PHY Lib code.
On Mon, Jul 25, 2011 at 12:50 AM, Hebbar, Gururaja gururaja.hebbar@ti.com wrote:
Hi,
We have an upcoming SOC with Ethernet controller which has registers with offsets crossing 0x110. In order to access these registers, we use miiphy_read() & miiphy_write() api provided by Standard u-boot mii phy util code (common/miiphyutil.c).
However the syntax of miiphy_read() & miiphy_write() is as below
int miiphy_read (char *devname, unsigned char addr, unsigned char reg, unsigned short *value);
int miiphy_write (char *devname, unsigned char addr, unsigned char reg, unsigned short value);
Here the "reg" argument is of type "unsigned char" which limits the offset to a max of 0xff. In linux, they are using u32 as type.
Right now we have modified the type to short and using it.
Is this correct? If yes, can we send a patch for the same? If not, what is the alternative?
Thanks & Regards Gururaja
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Wednesday, August 10, 2011 19:23:07 Andy Fleming wrote:
I know I'm a bit late to this, but this doesn't sound right. MII isn't a very flexible protocol. The registers have to fit in 5 bits. In order for larger values to be used, you would need to be using clause 45 of MDIO, which requires not just 16-bit register offsets, but an additional argument (device address). There is currently support for clause 45 in the newer U-Boot PHY Lib code.
it isnt uncommon for implementations to extend the spec -mike
participants (3)
-
Andy Fleming
-
Hebbar, Gururaja
-
Mike Frysinger