[RFC] Patch to Abstract Ethernet PHY support (using driver model)

Jörn Engel joern at wohnheim.fh-wedel.de
Sat Jan 15 02:49:51 EST 2005


On Fri, 14 January 2005 07:25:18 -0800, Eugene Surovegin wrote:
> On Fri, Jan 14, 2005 at 03:55:18PM +0100, J?rn Engel wrote:
> > Wrt. the proposed PHY lib, I agree.  Didn't even bother to look at the
> > code, it's mere size said enough.
> > 
> > But an abstraction different from drivers/net/mii.c is needed to
> > handle the 5325 chip.  Or, you could have the special cases all over
> > in your code, but that's a) ugly and b) more code.  I used to have
> > such a mess and after doing the proper abstraction, it line count went
> > down.
> 
> Well, I still fail to see what is so _special_ about this chip that it 
> needs "proper abstraction". Could you elaborate, please?
> 
> The way I handled this in my drivers was clean and simple - 
> "there-is-no-PHY". And this wasn't in any case chip-specific and was 
> set up through OCP in board support code. So I'm kinda puzzled what 
> "ugliness and more code" you are talking about.
> 
> We can also make a fake PHY which will always indicate link, will have 
> fixed speed/duplex capabilities and will not support autoneg. If you 
> think this is more elegant, OK, I might even agree with you :).

Exactly.  You need link status, speed and duplex status at the least.
Put query functions for those three into a struct phy_ops or whatever
it may be called and you're done.

Depending on your hardware, you may also need something more
complicated for various fixups, etc.  But it's mostly those three
functions.

> Please, note that wrt current discussion we are interested only in CPU 
> port, not other 5 ports which aren't connected to the CPU at all. This 
> is completely different stuff and yes, if we want to expose them in 
> some way we need another abstraction. But abstraction of switch chips 
> is a big and complex thing - they are very different, and frankly this 
> one you mentioned is quite "feature-challenged" and will not make 
> a good "model" chip IMHO :).

Well, it's one of the few I've had to worry about so far.  I'm a big
non-believer in abstractions I just don't need yet.  The one outlined
above I already needed.

Jörn

-- 
To announce that there must be no criticism of the President, or that we
are to stand by the President, right or wrong, is not only unpatriotic
and servile, but is morally treasonable to the American public.
-- Theodore Roosevelt, Kansas City Star, 1918



More information about the Linuxppc-embedded mailing list