Re: [PATCH 5/5] net: make mpc5200 fec driver use of_mdio infrastructure
From: Grant Likely <hidden>
Date: 2009-03-19 04:35:33
Also in:
lkml, netdev
On Tue, Mar 10, 2009 at 2:29 PM, Anton Vorontsov [off-list ref] wrote:
On Tue, Mar 10, 2009 at 01:48:26PM -0600, Grant Likely wrote:quoted
Regardless, I think all the drivers should be using common code for obtaining the phy_device from the device tree.Not necessary `struct phy_device'. All we need is some common routine for translating PHY's "mdio_node->full_name + phy id" to phy_bus_id.
This only works if the network driver knows how the MDIO bus is named. The current code assumes that the MDIO bus name is the register address, but this is a driver implementation detail and MDIO bus drivers can deviate from this. What about MDIO busses that don't have a reg property? For example, fs_enet/mii-bitbang.c sets the bus name to "CPM2 Bitbanged MII". There is no one-size-fits-all way to figure out the phy bus id from the ethernet driver side of things. The sure and simple way to guarantee a match between the PHY device node and the phy_device is to use the PHY device_node pointer itself as the search key. I concede that my first attempt at this was overly complex, but I've reworked the code and I think it makes thinks considerably simpler. I'll post a new series tomorrow. I've got patches to make the ucc_eth, gianfar and fs_enet drivers to use the device_node method also. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.