[PATCH 1/3] net: introduce phylib

Sascha Hauer s.hauer at pengutronix.de
Sun Sep 16 05:13:02 EDT 2012


On Sun, Sep 16, 2012 at 11:02:24AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:34 Sun 16 Sep     , Sascha Hauer wrote:
> > On Sun, Sep 16, 2012 at 10:28:13AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 10:11 Sun 16 Sep     , Sascha Hauer wrote:
> > > > On Fri, Sep 14, 2012 at 09:57:04AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > 
> > > > > Adapt phylib from linux
> > > > > 
> > > > > switch all the driver to it
> > > > > 
> > > > > This will allow to have
> > > > >  - phy drivers
> > > > >  - to only connect the phy at then opening of the device
> > > > >  - if the phy is not ready fail on open
> > > > > 
> > > > > Same behaviour as in linux and will allow to share code and simplify porting.
> > > > > 
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > > > > ---
> > > > 
> > > > [...]
> > > > 
> > > >  +
> > > > > +/* Automatically gets and returns the PHY device */
> > > > > +int phy_device_connect(struct mii_device *bus, int addr,
> > > > > +		void (*adjust_link) (struct mii_device *miidev))
> > > > 
> > > > The prototype of adjust_link seems wrong. A mii_device is a mii bus with
> > > > potentially multiple phys. adjust_link should work on the phy_device. With
> > > > the above, when a mii_device has multiple phys, a network driver has no
> > > > way to figure out which phy has an updated link.
> > > > 
> > > > This probably bites Renaud who has a single mii bus for multiple network
> > > > devices.
> > > not really as the phydev have a bus field so will be the same
> > 
> > Renaud has two phys on the same mii bus, so when he is passed a struct
> > mii_device, how can he get a pointer to his network device? He can't.
> as I said just after we should attached the phy to eth_device not mii_device

Once again:

from fec_imx.c:

static void fec_update_linkspeed(struct mii_device *mdev)
{
	struct eth_device *edev = mdev->edev;
	...
}

How will you get a pointer to edev once a mii_device has multiple phys,
potentially connected to different network devices?

> 
> so he will have one phy per eth_device

Yes, but multiple eth_devices per mii_device.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list