diff options
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/common.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 68 |
2 files changed, 34 insertions, 38 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 7788fbe44f0a..95176979b2d2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -297,8 +297,8 @@ struct dma_features { | |||
297 | #define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */ | 297 | #define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */ |
298 | 298 | ||
299 | /* Default LPI timers */ | 299 | /* Default LPI timers */ |
300 | #define STMMAC_DEFAULT_LIT_LS_TIMER 0x3E8 | 300 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 |
301 | #define STMMAC_DEFAULT_TWT_LS_TIMER 0x0 | 301 | #define STMMAC_DEFAULT_TWT_LS 0x0 |
302 | 302 | ||
303 | #define STMMAC_CHAIN_MODE 0x1 | 303 | #define STMMAC_CHAIN_MODE 0x1 |
304 | #define STMMAC_RING_MODE 0x2 | 304 | #define STMMAC_RING_MODE 0x2 |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 618446ae1ec1..e9eab29db7be 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -130,7 +130,7 @@ static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | | |||
130 | static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; | 130 | static int eee_timer = STMMAC_DEFAULT_LPI_TIMER; |
131 | module_param(eee_timer, int, S_IRUGO | S_IWUSR); | 131 | module_param(eee_timer, int, S_IRUGO | S_IWUSR); |
132 | MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); | 132 | MODULE_PARM_DESC(eee_timer, "LPI tx expiration time in msec"); |
133 | #define STMMAC_LPI_TIMER(x) (jiffies + msecs_to_jiffies(x)) | 133 | #define STMMAC_LPI_T(x) (jiffies + msecs_to_jiffies(x)) |
134 | 134 | ||
135 | /* By default the driver will use the ring mode to manage tx and rx descriptors | 135 | /* By default the driver will use the ring mode to manage tx and rx descriptors |
136 | * but passing this value so user can force to use the chain instead of the ring | 136 | * but passing this value so user can force to use the chain instead of the ring |
@@ -288,7 +288,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) | |||
288 | struct stmmac_priv *priv = (struct stmmac_priv *)arg; | 288 | struct stmmac_priv *priv = (struct stmmac_priv *)arg; |
289 | 289 | ||
290 | stmmac_enable_eee_mode(priv); | 290 | stmmac_enable_eee_mode(priv); |
291 | mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_TIMER(eee_timer)); | 291 | mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer)); |
292 | } | 292 | } |
293 | 293 | ||
294 | /** | 294 | /** |
@@ -304,22 +304,34 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
304 | { | 304 | { |
305 | bool ret = false; | 305 | bool ret = false; |
306 | 306 | ||
307 | /* Using PCS we cannot dial with the phy registers at this stage | ||
308 | * so we do not support extra feature like EEE. | ||
309 | */ | ||
310 | if ((priv->pcs == STMMAC_PCS_RGMII) || (priv->pcs == STMMAC_PCS_TBI) || | ||
311 | (priv->pcs == STMMAC_PCS_RTBI)) | ||
312 | goto out; | ||
313 | |||
307 | /* MAC core supports the EEE feature. */ | 314 | /* MAC core supports the EEE feature. */ |
308 | if (priv->dma_cap.eee) { | 315 | if (priv->dma_cap.eee) { |
309 | /* Check if the PHY supports EEE */ | 316 | /* Check if the PHY supports EEE */ |
310 | if (phy_init_eee(priv->phydev, 1)) | 317 | if (phy_init_eee(priv->phydev, 1)) |
311 | goto out; | 318 | goto out; |
312 | 319 | ||
313 | priv->eee_active = 1; | 320 | if (!priv->eee_active) { |
314 | init_timer(&priv->eee_ctrl_timer); | 321 | priv->eee_active = 1; |
315 | priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer; | 322 | init_timer(&priv->eee_ctrl_timer); |
316 | priv->eee_ctrl_timer.data = (unsigned long)priv; | 323 | priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer; |
317 | priv->eee_ctrl_timer.expires = STMMAC_LPI_TIMER(eee_timer); | 324 | priv->eee_ctrl_timer.data = (unsigned long)priv; |
318 | add_timer(&priv->eee_ctrl_timer); | 325 | priv->eee_ctrl_timer.expires = STMMAC_LPI_T(eee_timer); |
319 | 326 | add_timer(&priv->eee_ctrl_timer); | |
320 | priv->hw->mac->set_eee_timer(priv->ioaddr, | 327 | |
321 | STMMAC_DEFAULT_LIT_LS_TIMER, | 328 | priv->hw->mac->set_eee_timer(priv->ioaddr, |
322 | priv->tx_lpi_timer); | 329 | STMMAC_DEFAULT_LIT_LS, |
330 | priv->tx_lpi_timer); | ||
331 | } else | ||
332 | /* Set HW EEE according to the speed */ | ||
333 | priv->hw->mac->set_eee_pls(priv->ioaddr, | ||
334 | priv->phydev->link); | ||
323 | 335 | ||
324 | pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); | 336 | pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); |
325 | 337 | ||
@@ -329,20 +341,6 @@ out: | |||
329 | return ret; | 341 | return ret; |
330 | } | 342 | } |
331 | 343 | ||
332 | /** | ||
333 | * stmmac_eee_adjust: adjust HW EEE according to the speed | ||
334 | * @priv: driver private structure | ||
335 | * Description: | ||
336 | * When the EEE has been already initialised we have to | ||
337 | * modify the PLS bit in the LPI ctrl & status reg according | ||
338 | * to the PHY link status. For this reason. | ||
339 | */ | ||
340 | static void stmmac_eee_adjust(struct stmmac_priv *priv) | ||
341 | { | ||
342 | if (priv->eee_enabled) | ||
343 | priv->hw->mac->set_eee_pls(priv->ioaddr, priv->phydev->link); | ||
344 | } | ||
345 | |||
346 | /* stmmac_get_tx_hwtstamp: get HW TX timestamps | 344 | /* stmmac_get_tx_hwtstamp: get HW TX timestamps |
347 | * @priv: driver private structure | 345 | * @priv: driver private structure |
348 | * @entry : descriptor index to be used. | 346 | * @entry : descriptor index to be used. |
@@ -769,7 +767,10 @@ static void stmmac_adjust_link(struct net_device *dev) | |||
769 | if (new_state && netif_msg_link(priv)) | 767 | if (new_state && netif_msg_link(priv)) |
770 | phy_print_status(phydev); | 768 | phy_print_status(phydev); |
771 | 769 | ||
772 | stmmac_eee_adjust(priv); | 770 | /* At this stage, it could be needed to setup the EEE or adjust some |
771 | * MAC related HW registers. | ||
772 | */ | ||
773 | priv->eee_enabled = stmmac_eee_init(priv); | ||
773 | 774 | ||
774 | spin_unlock_irqrestore(&priv->lock, flags); | 775 | spin_unlock_irqrestore(&priv->lock, flags); |
775 | 776 | ||
@@ -1277,7 +1278,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) | |||
1277 | 1278 | ||
1278 | if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) { | 1279 | if ((priv->eee_enabled) && (!priv->tx_path_in_lpi_mode)) { |
1279 | stmmac_enable_eee_mode(priv); | 1280 | stmmac_enable_eee_mode(priv); |
1280 | mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_TIMER(eee_timer)); | 1281 | mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer)); |
1281 | } | 1282 | } |
1282 | spin_unlock(&priv->tx_lock); | 1283 | spin_unlock(&priv->tx_lock); |
1283 | } | 1284 | } |
@@ -1671,14 +1672,9 @@ static int stmmac_open(struct net_device *dev) | |||
1671 | if (priv->phydev) | 1672 | if (priv->phydev) |
1672 | phy_start(priv->phydev); | 1673 | phy_start(priv->phydev); |
1673 | 1674 | ||
1674 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS_TIMER; | 1675 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; |
1675 | 1676 | ||
1676 | /* Using PCS we cannot dial with the phy registers at this stage | 1677 | priv->eee_enabled = stmmac_eee_init(priv); |
1677 | * so we do not support extra feature like EEE. | ||
1678 | */ | ||
1679 | if (priv->pcs != STMMAC_PCS_RGMII && priv->pcs != STMMAC_PCS_TBI && | ||
1680 | priv->pcs != STMMAC_PCS_RTBI) | ||
1681 | priv->eee_enabled = stmmac_eee_init(priv); | ||
1682 | 1678 | ||
1683 | stmmac_init_tx_coalesce(priv); | 1679 | stmmac_init_tx_coalesce(priv); |
1684 | 1680 | ||
@@ -1899,7 +1895,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1899 | 1895 | ||
1900 | #ifdef STMMAC_XMIT_DEBUG | 1896 | #ifdef STMMAC_XMIT_DEBUG |
1901 | if (netif_msg_pktdata(priv)) { | 1897 | if (netif_msg_pktdata(priv)) { |
1902 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d" | 1898 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d", |
1903 | __func__, (priv->cur_tx % txsize), | 1899 | __func__, (priv->cur_tx % txsize), |
1904 | (priv->dirty_tx % txsize), entry, first, nfrags); | 1900 | (priv->dirty_tx % txsize), entry, first, nfrags); |
1905 | if (priv->extend_desc) | 1901 | if (priv->extend_desc) |