[PATCH] net: emaclite: adding MDIO and phy lib support

Grant Likely grant.likely at secretlab.ca
Sat Feb 6 07:22:16 EST 2010


On Fri, Feb 5, 2010 at 10:50 AM, John Linn <John.Linn at xilinx.com> wrote:
>> -----Original Message-----
>> From: Grant Likely
>> Sent: Thurs, 4 Feb 2010 11:12:29 AM
>> To: John Linn
>> Subject: FW: [PATCH] net: emaclite: adding MDIO and phy lib support
>>
>> Hi John and Sadanand.  Looks like a good patch, but a few issues to
>> resolve.  Comments below.
>>
>> g.
>
> Somehow I didn't get this message but found it out on the web, so this
> is a contrived version of the message so I could respond :)
>
>>
>> On Wed, Feb 3, 2010 at 5:49 PM, John Linn <john.linn at xxxxxxxxxx>
> wrote:
>> > These changes add MDIO and phy lib support to the driver as the
>> > IP core now supports the MDIO bus.
>> >
>> > The MDIO bus and phy are added as a child to the emaclite in the
> device
>> > tree as illustrated below.
>> >
>> > mdio {
>> >        #address-cells = <1>;
>> >        #size-cells = <0>;
>> >        phy0: phy at 7 {
>> >                reg = <7>;
>>
>> For completeness, phy node need a "compatible" property.
>
> It seems like this is in the device tree only but the driver won't use
> it. So no real affect on the driver unless I'm not synced up with you.

That's right.  That's why I said "for completeness".  This is just an
example phy node, but it is good practice to give accurate examples.
:-)

>> >        /* Set the MAC address in the EmacLite device */
>> > -       xemaclite_set_mac_address(lp, ndev->dev_addr);
>> > +       xemaclite_update_address(lp, ndev->dev_addr);
>> > +
>> > +       /* Check if MDIO is included in the HW */
>> > +       lp->has_mdio = get_bool(ofdev, "xlnx,include-mdio");
>> > +       if (lp->has_mdio) {
>> > +               lp->phy_node = of_parse_phandle(ofdev->node,
> "phy-handle", 0);
>> > +               rc = xemaclite_mdio_setup(lp, &ofdev->dev);
>> > +               if (rc)
>> > +                       dev_warn(&ofdev->dev, "error registering
> MDIO bus\n");
>> > +       }
>>
>> What if the phy is attached to a different MDIO bus (which is
>> completely possible)?  The fetching of phy_node should be performed
>> regardless of whether or not xlnx,include-mdio is set.
>>
>
> So the issue here is that the IP core can be built without any PHY
> interface and MDIO bus.

Right, but just because the *core* doesn't have a phy interface built
in, doesn't mean that the PHY isn't attached to a different MDIO bus
(ie. on another emaclite, or on a gpio driven MDIO bus).  So even if
mdio is configured out, the driver should still handle the case of it
having an valid phy-handle.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.


More information about the Linuxppc-dev mailing list