[PATCH 1/1] net: introduce phylib

Sascha Hauer s.hauer at pengutronix.de
Sun Sep 16 17:01:58 EDT 2012


On Sun, Sep 16, 2012 at 07:54:58PM +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 or not up 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 eth_device *edev),
> +		       u32 flags, phy_interface_t interface)
> +{
> +	struct eth_device *edev = bus->edev;

You should pass in a struct eth_device pointer here instead of getting
it from bus->edev because a struct mii_device can have multiple ethernet
devices. The next step would be to remove the edev member from struct
mii_dev and add it to struct phy_device insted.

BTW no typedefs please. Use enum phy_interface instead.

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