diff options
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac/emac-phy.c')
| -rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac-phy.c | 75 | 
1 files changed, 4 insertions, 71 deletions
| diff --git a/drivers/net/ethernet/qualcomm/emac/emac-phy.c b/drivers/net/ethernet/qualcomm/emac/emac-phy.c index 441c19366489..18461fcb9815 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-phy.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-phy.c @@ -13,15 +13,11 @@  /* Qualcomm Technologies, Inc. EMAC PHY Controller driver.   */ -#include <linux/module.h> -#include <linux/of.h> -#include <linux/of_net.h>  #include <linux/of_mdio.h>  #include <linux/phy.h>  #include <linux/iopoll.h>  #include <linux/acpi.h>  #include "emac.h" -#include "emac-mac.h"  /* EMAC base register offsets */  #define EMAC_MDIO_CTRL                                        0x001414 @@ -52,62 +48,10 @@  #define MDIO_WAIT_TIMES                                           1000 -#define EMAC_LINK_SPEED_DEFAULT (\ -		EMAC_LINK_SPEED_10_HALF  |\ -		EMAC_LINK_SPEED_10_FULL  |\ -		EMAC_LINK_SPEED_100_HALF |\ -		EMAC_LINK_SPEED_100_FULL |\ -		EMAC_LINK_SPEED_1GB_FULL) - -/** - * emac_phy_mdio_autopoll_disable() - disable mdio autopoll - * @adpt: the emac adapter - * - * The autopoll feature takes over the MDIO bus.  In order for - * the PHY driver to be able to talk to the PHY over the MDIO - * bus, we need to temporarily disable the autopoll feature. - */ -static int emac_phy_mdio_autopoll_disable(struct emac_adapter *adpt) -{ -	u32 val; - -	/* disable autopoll */ -	emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, MDIO_AP_EN, 0); - -	/* wait for any mdio polling to complete */ -	if (!readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, val, -				!(val & MDIO_BUSY), 100, MDIO_WAIT_TIMES * 100)) -		return 0; - -	/* failed to disable; ensure it is enabled before returning */ -	emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN); - -	return -EBUSY; -} - -/** - * emac_phy_mdio_autopoll_disable() - disable mdio autopoll - * @adpt: the emac adapter - * - * The EMAC has the ability to poll the external PHY on the MDIO - * bus for link state changes.  This eliminates the need for the - * driver to poll the phy.  If if the link state does change, - * the EMAC issues an interrupt on behalf of the PHY. - */ -static void emac_phy_mdio_autopoll_enable(struct emac_adapter *adpt) -{ -	emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN); -} -  static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)  {  	struct emac_adapter *adpt = bus->priv;  	u32 reg; -	int ret; - -	ret = emac_phy_mdio_autopoll_disable(adpt); -	if (ret) -		return ret;  	emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK,  			  (addr << PHY_ADDR_SHFT)); @@ -122,24 +66,15 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)  	if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,  			       !(reg & (MDIO_START | MDIO_BUSY)),  			       100, MDIO_WAIT_TIMES * 100)) -		ret = -EIO; -	else -		ret = (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; +		return -EIO; -	emac_phy_mdio_autopoll_enable(adpt); - -	return ret; +	return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK;  }  static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)  {  	struct emac_adapter *adpt = bus->priv;  	u32 reg; -	int ret; - -	ret = emac_phy_mdio_autopoll_disable(adpt); -	if (ret) -		return ret;  	emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK,  			  (addr << PHY_ADDR_SHFT)); @@ -155,11 +90,9 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)  	if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,  			       !(reg & (MDIO_START | MDIO_BUSY)), 100,  			       MDIO_WAIT_TIMES * 100)) -		ret = -EIO; +		return -EIO; -	emac_phy_mdio_autopoll_enable(adpt); - -	return ret; +	return 0;  }  /* Configure the MDIO bus and connect the external PHY */ |