Commit 2bb71b69 authored by David S. Miller's avatar David S. Miller

Merge branch 'stmmac-eee'

Giuseppe Cavallaro says:

====================
stmmac EEE fixes

This is a subset of patches to provide some fixes for the EEE support inside the
driver.
Patches have been tested on boards EEE capable plugged on switch w/ w/o EEE
support.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 38ab1fa9 71965352
...@@ -220,10 +220,10 @@ enum dma_irq_status { ...@@ -220,10 +220,10 @@ enum dma_irq_status {
handle_tx = 0x8, handle_tx = 0x8,
}; };
#define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 1) #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 0)
#define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 2) #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 1)
#define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 3) #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 2)
#define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 4) #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 3)
#define CORE_PCS_ANE_COMPLETE (1 << 5) #define CORE_PCS_ANE_COMPLETE (1 << 5)
#define CORE_PCS_LINK_STATUS (1 << 6) #define CORE_PCS_LINK_STATUS (1 << 6)
...@@ -287,7 +287,7 @@ struct dma_features { ...@@ -287,7 +287,7 @@ struct dma_features {
/* Default LPI timers */ /* Default LPI timers */
#define STMMAC_DEFAULT_LIT_LS 0x3E8 #define STMMAC_DEFAULT_LIT_LS 0x3E8
#define STMMAC_DEFAULT_TWT_LS 0x0 #define STMMAC_DEFAULT_TWT_LS 0x1E
#define STMMAC_CHAIN_MODE 0x1 #define STMMAC_CHAIN_MODE 0x1
#define STMMAC_RING_MODE 0x2 #define STMMAC_RING_MODE 0x2
......
...@@ -275,6 +275,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) ...@@ -275,6 +275,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
*/ */
bool stmmac_eee_init(struct stmmac_priv *priv) bool stmmac_eee_init(struct stmmac_priv *priv)
{ {
char *phy_bus_name = priv->plat->phy_bus_name;
bool ret = false; bool ret = false;
/* Using PCS we cannot dial with the phy registers at this stage /* Using PCS we cannot dial with the phy registers at this stage
...@@ -284,6 +285,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) ...@@ -284,6 +285,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
(priv->pcs == STMMAC_PCS_RTBI)) (priv->pcs == STMMAC_PCS_RTBI))
goto out; goto out;
/* Never init EEE in case of a switch is attached */
if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
goto out;
/* MAC core supports the EEE feature. */ /* MAC core supports the EEE feature. */
if (priv->dma_cap.eee) { if (priv->dma_cap.eee) {
int tx_lpi_timer = priv->tx_lpi_timer; int tx_lpi_timer = priv->tx_lpi_timer;
...@@ -316,10 +321,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv) ...@@ -316,10 +321,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
priv->hw->mac->set_eee_timer(priv->hw, priv->hw->mac->set_eee_timer(priv->hw,
STMMAC_DEFAULT_LIT_LS, STMMAC_DEFAULT_LIT_LS,
tx_lpi_timer); tx_lpi_timer);
} else }
/* Set HW EEE according to the speed */ /* Set HW EEE according to the speed */
priv->hw->mac->set_eee_pls(priv->hw, priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link);
priv->phydev->link);
pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); pr_debug("stmmac: Energy-Efficient Ethernet initialized\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment