[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGVrzcZL7w8vRQ6-3NEqLK3VFHa-c1BMUVoaWSKmD2RXRedMCw@mail.gmail.com>
Date: Wed, 7 May 2014 10:26:14 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Daniel Mack <zonque@...il.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Mugunthan V N <mugunthanvnm@...com>
Subject: Re: [PATCH] net: mdio: of_mdio: check for already registered phy
before creating new instances
Hi Daniel,
2014-05-07 9:01 GMT-07:00 Daniel Mack <zonque@...il.com>:
> (+ Mugunthan V N)
>
> Hi Florian,
>
> On 05/07/2014 02:55 AM, Florian Fainelli wrote:
>> 2014-05-06 8:21 GMT-07:00 Daniel Mack <zonque@...il.com>:
>>> In of_mdiobus_register_phy(), check if the phy with the given address is
>>> already registered within the mii bus before calling phy_device_create()
>>> or get_phy_device().
>>
>> I am not exactly sure how you could be in that sort of situation.
>> of_mdiobus_register() handles two different cases at the moment:
>>
>> 1) PHY child nodes have a valid 'reg' property, and this property is
>> used to register the PHY at the given address
>> 2) if a PHY child node does not have a valid 'reg' property, which
>> will trigger an auto-scan and then we iterate through all 32 addresses
>> of the bus, we skip over PHYs that are already registered
>>
>>>
>>> This allows us to augment auto-probed phy devices with extra information
>>> via DT. Without this patch, a second instance of the phydev is created
>>> unnecessarily.
>>
>> Which piece of code is doing the auto-probing in your case? One of the
>> very first things that of_mdiobus_register() does is set the PHY mask
>> to 0xffffffff to prevent the default PHY probing method to trigger,
>> since we are using information from the Device Tree right after that.
>
> Ah, ok. So what happens here is that of_mdiobus_register() sets the
> phy_mask to ~0, but mdiobus_register() calls bus->reset(), which resets
> the mask to ffffffef in my case. bus->reset is davinci_mdio_reset() in
> my case.
I see, something similar exists with TI's CPMAC driver too, where the
MDIO bus can tell you which MDIO slave is alive.
>
> Is the davinci mdio driver doing anything wrong by touching
> bus->phy_mask?
Not really, I think it is valid to do this as part of the
mdiobus_reset() callback. This worked much better with non-DT
configurations because nothing would override the phy_mask.
> Another solution would be to split mdiobus_register() and
> create a mdiobus_register_noscan() or something, and then call that from
> of_mdiobus_register().
That, or have a specific MDIO bus controller node boolean property
such as "mdio-bus-autoscan" or something similar which will tell
of_mdiobus_register() not to override the phy_mask since the MDIO bus
controller is capable of auto-detecting the PHYs present.
This should not be too controversial as we should really be describing
a feature of the hardware here.
What do you think?
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists