Skip to content

Commit

Permalink
net: phy: at803x: Disable phy delay for RGMII mode
Browse files Browse the repository at this point in the history
For RGMII mode, phy delay should be disabled. Add this case along
with disable delay routines.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
vinodkoul authored and davem330 committed Jan 23, 2019
1 parent 83c177a commit cd28d1d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions drivers/net/phy/at803x.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg,
return phy_write(phydev, AT803X_DEBUG_DATA, val);
}

static inline int at803x_enable_rx_delay(struct phy_device *phydev)
static inline int at803x_disable_rx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0,
AT803X_DEBUG_RX_CLK_DLY_EN);
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
AT803X_DEBUG_RX_CLK_DLY_EN, 0);
}

static inline int at803x_enable_tx_delay(struct phy_device *phydev)
static inline int at803x_disable_tx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0,
AT803X_DEBUG_TX_CLK_DLY_EN);
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5,
AT803X_DEBUG_TX_CLK_DLY_EN, 0);
}

/* save relevant PHY registers to private copy */
Expand Down Expand Up @@ -256,15 +256,17 @@ static int at803x_config_init(struct phy_device *phydev)
return ret;

if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
ret = at803x_enable_rx_delay(phydev);
phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII) {
ret = at803x_disable_rx_delay(phydev);
if (ret < 0)
return ret;
}

if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
ret = at803x_enable_tx_delay(phydev);
phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII) {
ret = at803x_disable_tx_delay(phydev);
if (ret < 0)
return ret;
}
Expand Down

0 comments on commit cd28d1d

Please sign in to comment.