diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c')
| -rw-r--r-- | drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 23 | 
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 6b60582ce8c..cfaf17b70f3 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -24,7 +24,6 @@  #include <linux/ioport.h>  #include <linux/slab.h>  #include <linux/interrupt.h> -#include <linux/init.h>  #include <linux/delay.h>  #include <linux/netdevice.h>  #include <linux/etherdevice.h> @@ -92,6 +91,9 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)  	u16 pkt_len, sc;  	int curidx; +	if (budget <= 0) +		return received; +  	/*  	 * First, grab all of the stats for the incoming packet.  	 * These get messed up if we get called due to a busy condition. @@ -790,10 +792,6 @@ static int fs_init_phy(struct net_device *dev)  	phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,  				iface);  	if (!phydev) { -		phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link, -						   iface); -	} -	if (!phydev) {  		dev_err(&dev->dev, "Could not attach to PHY\n");  		return -ENODEV;  	} @@ -1027,9 +1025,16 @@ static int fs_enet_probe(struct platform_device *ofdev)  	fpi->use_napi = 1;  	fpi->napi_weight = 17;  	fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0); -	if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link", -						  NULL))) -		goto out_free_fpi; +	if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) { +		err = of_phy_register_fixed_link(ofdev->dev.of_node); +		if (err) +			goto out_free_fpi; + +		/* In the case of a fixed PHY, the DT node associated +		 * to the PHY is the Ethernet MAC DT node. +		 */ +		fpi->phy_node = ofdev->dev.of_node; +	}  	if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {  		phy_connection_type = of_get_property(ofdev->dev.of_node, @@ -1083,7 +1088,7 @@ static int fs_enet_probe(struct platform_device *ofdev)  	mac_addr = of_get_mac_address(ofdev->dev.of_node);  	if (mac_addr) -		memcpy(ndev->dev_addr, mac_addr, 6); +		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);  	ret = fep->ops->allocate_bd(ndev);  	if (ret)  | 
