Accessng phy registers

Andy Fleming afleming at freescale.com
Wed Mar 28 02:37:41 EST 2007


On Mar 26, 2007, at 15:55, DI BACCO ANTONIO - technolabs wrote:

>
> I saw that both in phy,c and mii.c (linux 2.6.19) there is support  
> to handle ioctls to read PHY registers. Why? And what should be  
> used from a user application? I have both CONFIG_MII and  
> CONFIG_PHYLIB set to y.


mii.c provides some generic support for reading and writing PHYs and  
reporting their status.  Many drivers provide support for the MII  
ioctl.  The PHY Lib provides somewhat more robust support for PHYs,  
allowing for PHY-specific drivers, and sharing PHY access between  
multiple controllers (useful for embedded applications).  The PHY Lib  
provides its own mii ioctl implementation so that you can support the  
mii ioctl while using the PHY Lib.  The two don't conflict, nor are  
they completely redundant, but there is a lot of overlap.

As for user applications...I'm not sure what's best, here.  The PHY  
Lib doesn't provide its own mechanism, currently, for manipulating  
PHYs from user space.  The mii ioctl provides the necessary  
functionality, and if your ethernet driver supports it, then that  
will work.  The PHY Lib's mii ioctl implementation isn't well tested,  
and if you aren't using the extra functionality, there's no reason to  
use the PHY Lib.




More information about the Linuxppc-embedded mailing list