linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* PHY Howto ?
@ 2006-07-20 17:52 David H. Lynch Jr.
  2006-07-20 18:01 ` Vitaly Bordug
  0 siblings, 1 reply; 4+ messages in thread
From: David H. Lynch Jr. @ 2006-07-20 17:52 UTC (permalink / raw)
  To: linuxppc-embedded

 If I am writing a network MAC driver, for hardware that has a phy
that is already supported, if I provide the appropriate mdio_read() and
mdio_write() calls to access the phy registers, and setup my config to
include phylib and drivers for my specific phy,  what else do I have to
take care of with respect to the phy within my driver ?
	
	Are there some resources, howto's, examples, ... demonstrating 
how to use phylib ?


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

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

* Re: PHY Howto ?
  2006-07-20 17:52 PHY Howto ? David H. Lynch Jr.
@ 2006-07-20 18:01 ` Vitaly Bordug
  2006-07-25  4:05   ` David H. Lynch Jr.
  0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Bordug @ 2006-07-20 18:01 UTC (permalink / raw)
  To: dhlii; +Cc: linuxppc-embedded

On Thu, 20 Jul 2006 13:52:47 -0400
"David H. Lynch Jr." <dhlii@dlasys.net> wrote:

>  If I am writing a network MAC driver, for hardware that has a phy
> that is already supported, if I provide the appropriate mdio_read() and
> mdio_write() calls to access the phy registers, and setup my config to
> include phylib and drivers for my specific phy,  what else do I have to
> take care of with respect to the phy within my driver ?
> 	
> 	Are there some resources, howto's, examples, ... demonstrating 
> how to use phylib ?
There is pretty good writeup in Documentation about your concern, find it at 
Documentation/networking/phy.txt . Live example is obviously drivers/net/gianfar*


-- 
Sincerely, 
Vitaly

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

* Re: PHY Howto ?
  2006-07-20 18:01 ` Vitaly Bordug
@ 2006-07-25  4:05   ` David H. Lynch Jr.
  2006-07-25 19:19     ` Andy Fleming
  0 siblings, 1 reply; 4+ messages in thread
From: David H. Lynch Jr. @ 2006-07-25  4:05 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

Vitaly Bordug wrote:
> On Thu, 20 Jul 2006 13:52:47 -0400
> "David H. Lynch Jr." <dhlii@dlasys.net> wrote:
>
>   
>>  If I am writing a network MAC driver, for hardware that has a phy
>> that is already supported, if I provide the appropriate mdio_read() and
>> mdio_write() calls to access the phy registers, and setup my config to
>> include phylib and drivers for my specific phy,  what else do I have to
>> take care of with respect to the phy within my driver ?
>> 	
>> 	Are there some resources, howto's, examples, ... demonstrating 
>> how to use phylib ?
>>     
> There is pretty good writeup in Documentation about your concern, find it at 
> Documentation/networking/phy.txt . Live example is obviously drivers/net/gianfar*
>
>
>   
    Thanks that proved useful. I am already using gianfar as a reference
- but it is not a NIC I am familiar with.
    And I still have some questions:

          What is the distinction/interaction between phylib and MII
support ?
   
          Are they independent ways of doing something similar ? Or do
they work together.

          To get MII working I need to provide/populate  an mii_if_info
structure and supply register read/write routines.
   
          Since communicating with the PHY is MAC dependent shouldn't I
need to do the same for PHYLIB ?

  
         
   
          


          As I understand it although PHY's are similar, and the same
PHY may be used on different NIC's
          Communications to the PHY typically go through the NIC.
          So my Network driver has to provide routines to read/write the
registers of the PHY, which phylib and the phy driver then use.

      

   


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein


[-- Attachment #2: Type: text/html, Size: 3352 bytes --]

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

* Re: PHY Howto ?
  2006-07-25  4:05   ` David H. Lynch Jr.
@ 2006-07-25 19:19     ` Andy Fleming
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Fleming @ 2006-07-25 19:19 UTC (permalink / raw)
  To: dhlii; +Cc: linuxppc-embedded


On Jul 24, 2006, at 23:05, David H. Lynch Jr. wrote:

> Vitaly Bordug wrote:
>> On Thu, 20 Jul 2006 13:52:47 -0400 "David H. Lynch Jr."  
>> <dhlii@dlasys.net> wrote:
>>> If I am writing a network MAC driver, for hardware that has a phy  
>>> that is already supported, if I provide the appropriate mdio_read 
>>> () and mdio_write() calls to access the phy registers, and setup  
>>> my config to include phylib and drivers for my specific phy, what  
>>> else do I have to take care of with respect to the phy within my  
>>> driver ? Are there some resources, howto's, examples, ...  
>>> demonstrating how to use phylib ?
>> There is pretty good writeup in Documentation about your concern,  
>> find it at Documentation/networking/phy.txt . Live example is  
>> obviously drivers/net/gianfar*
>     Thanks that proved useful. I am already using gianfar as a  
> reference - but it is not a NIC I am familiar with.
>     And I still have some questions:
>
>           What is the distinction/interaction between phylib and  
> MII support ?
>
>           Are they independent ways of doing something similar ? Or  
> do they work together.
>


The MII code is an older interface to PHYs which provided some, but  
not all of the PHY layer's capabilities.  I don't anticipate its  
going away anytime soon, but the PHY layer was designed to replace  
it.  I don't currently know of any reason for a driver to support the  
MII interface, other than legacy reasons (that's not to say there are  
none, but I don't know of them).  The mii_if_info structure is only  
needed if you invoke one of the mii_* functions, the functionalities  
of which are provided by the PHY library.  So I guess my answer is  
that they are independent ways of doing something similar.

There are functions in phy.c to replace the generic mii functions for  
getting and setting speed/duplex values:
phy_ethtool_sset
phy_ethtool_gset

And a function to perform the mii_ioctl commands, which is highly  
discouraged.  It messes around with the PHY behind the scenes,  
leaving the PHY layer out of the loop.


>
>           To get MII working I need to provide/populate  an  
> mii_if_info structure and supply register read/write routines.
>
>           Since communicating with the PHY is MAC dependent  
> shouldn't I need to do the same for PHYLIB ?


Look at drivers/net/gianfar_mii.c.  You need to provide an mii_bus  
structure, which has pointers to read, write, and reset functions.   
It also has power/suspend functions.  Basically, the MDIO hardware on  
your NIC gets treated as a separate device.  It's fairly  
straightforward for your NIC to treat it as part of itself, though.


>
>           As I understand it although PHY's are similar, and the  
> same PHY may be used on different NIC's
>           Communications to the PHY typically go through the NIC.
>           So my Network driver has to provide routines to read/ 
> write the registers of the PHY, which phylib and the phy driver  
> then use.


That's pretty much it.  The same PHY type will be used on different  
NICs.  Hopefully, you don't want to share a PHY between two NICs.   
That's not currently supported.  And I'm not really sure how it would  
work, in truth.  But the driver can be shared for each PHY device.   
And the NIC exposes the MDIO bus as a full bus device.


Andy

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

end of thread, other threads:[~2006-07-25 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-20 17:52 PHY Howto ? David H. Lynch Jr.
2006-07-20 18:01 ` Vitaly Bordug
2006-07-25  4:05   ` David H. Lynch Jr.
2006-07-25 19:19     ` Andy Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).