[U-Boot] Question: Information regarding MII and PHY

Graeme Russ graeme.russ at gmail.com
Fri Sep 23 02:17:33 CEST 2011


Hi Andy

On Fri, Sep 23, 2011 at 9:36 AM, Andy Fleming <afleming at gmail.com> wrote:
> On Thu, Sep 22, 2011 at 6:27 PM, Graeme Russ <graeme.russ at gmail.com> wrote:

[snip]

>> Is there any documentation on how I should build a new MAC and PHY driver
>> from scratch (i.e. what is the official network driver API)
>
> There's not really any documentation for phylib at the moment, except
> the header files. There aren't a lot of examples for mdio buses at the
> moment, but it's straightforward:
>
> 1) Call mdio_alloc() to create a new bus object
> 2) Fill in the name, then read, write, and reset functions, and set
> bus->priv to whatever context structure you want
> 3) Call mdio_register(bus)
>
> For an example, see drivers/net/fsl_mdio.c
>
> A PHY driver is not much more complicated, and there are many examples.
>
> Then, in the ethernet driver, you will need to call:
>
> phy_connect() to declare the connection between your MAC and the PHY
> phy_config() to initialize the PHY
>
> When the MAC is ready to deal with traffic, you call phy_startup()
>
> When the MAC is being shut down (the close function), you call phy_shutdown()

Thanks for the explanation - I'll have a look tonight

A couple of quick questions regarding network drivers...

1) Was it the case that the Linux phylib was 'tight' enough to bring
   straight into U-Boot, or was a new phylib written for U-Boot?
2) The Linux network driver framework (at least now) is so
   massive that porting a network driver over is practically impossible.
   Is the U-Boot network driver framework similar in any way to the Linux
   framework such that I can take relevant portions of code straight from
   a Linux driver, or is it a case of carefully picking out the relevant
   bits and stitching together a entirely new beast?
3) Any idea what would be one of the most recent network drivers added
   from scratch to U-Boot that would serve as a 'style guide' for my new
   driver?

Thanks and Regards,

Graeme


More information about the U-Boot mailing list