[PATCH 09/14] net: Rework gianfar driver to use of_mdio infrastructure.

Grant Likely grant.likely at secretlab.ca
Sat Apr 18 16:34:05 EST 2009


On Wed, Apr 15, 2009 at 5:01 PM, Andy Fleming <afleming at freescale.com> wrote:
>
> On Mar 31, 2009, at 3:27 AM, Grant Likely wrote:
>
>> From: Grant Likely <grant.likely at secretlab.ca>
>>
>> This patch simplifies the driver by making use of more common code.
>>
>> Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
>> ---
>>
>> drivers/net/gianfar.c |  103
>> ++++++++++++++++++-------------------------------
>> drivers/net/gianfar.h |    3 +
>> 2 files changed, 40 insertions(+), 66 deletions(-)
>>
>>
>> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
>> index 65f5587..c22eba9 100644
>> @@ -699,23 +657,38 @@ static int init_phy(struct net_device *dev)
>>
>>
>> +       if (priv->tbi_node) {
>> +               priv->tbiphy = of_phy_connect(dev, priv->tbi_node,
>> &adjust_link,
>> +                                             0, interface);
>> +               if (!priv->tbiphy) {
>> +                       dev_err(&dev->dev, "error: Could not attach to
>> TBI\n");
>> +                       goto err_tbiphy;
>> +               }
>> +       }
>
> I don't believe we need this.  Certainly, the current code doesn't do
> anything like this.  The TBI node is a special internal PHY used to manage
> SGMII/TBI links.

Actually, it does.  gianfar_of_init() used to parse the tbi-handle,
and I've replaced that code with a call to of_parse_phandle() in init
and an of_phy_connect() in init_phy() to get a pointer to the TBI
phy_device.  However, you are completely right that calling
of_phy_connect() is entirely the wrong thing to do on the TBI phy.  It
should be retrieving the pointer to the phydevice without actually
connecting to it (which forces the phy_driver probe and starts the
state machine).  I need to fix this.

g.

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



More information about the Linuxppc-dev mailing list