[U-Boot] MPC512x FEC/MII

Detlev Zundel dzu at denx.de
Tue Sep 27 17:21:14 CEST 2011


Hi Kolja,

[...]

>> > The PHY is only initialized while a network command (such as dhcp, tftp,
>> > ...) is being executed.
>> 
>> Well, this is actually in line with the U-Boot design principles of
>> initializing a device only if its needed[1].  This principle was
>> disregarded regularly in the past and so it seems kind of naturla that
>> "fixing" it results in changes of behaviour.  We should however fix the
>> fallout rather than going back to violating the principles.
>> 
>> If the mii routines need initializations, then they should ensure that
>> they have been done.
>
> This really is a shame as the mii tools are quite helpful for
> debugging/hardware verification. If the mii-command performs a
> re-initialisation each time they are invoked, they are probably close
> to useless (as one would need several commands to perform certain
> tasks...).

I never said that the mii commands should initialize the phy _every_
time they are called.  All I said was that if they need an init, they
should ensure it has been run - this can also be done only once.

> However I understand this is something that is not quite in the scope
> of a bootloader. As long as an easy workaround is available...

I think this is in the scope of a bootloader - all I want to say is that
we should fix the problems that we encounter getting closer to our own
goals rather than giving up our goals to fix an individual problem.

Actually I believe that the move towards a driver model discussed on the
ML only recently, can solve many of these problems currently handled in
all the sub-modules and can centralize it in a single place.  By then we
would have a "initialized" field for every device and the commands (mii
or net commands) that deal with a net device can ensure that its "init"
method runs if this is not set.

Also with this approach, before booting an operating system, we can
deinitialize all devices again.  Although this sounds somewhat strange,
this was one of the more hard to find bugs that I have seen - an usb
controller happily updating frame counters in RAM while Linux booted...

So maybe the solution to this problem can be reached by helping other
code changes ;)

Cheers
  Detlev

-- 
Progress in  mathematics comes from  repeated acts of generalization.
If mathematics is anything, it is the art of chosing the most elegant
generalization for some abstract pattern.  Thus esthetics is central.
                                     -- Douglas Hofstadter
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list