]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
net: eqos: set TWT timer value to 21usec
authorNarayan Reddy <narayanr@nvidia.com>
Tue, 13 Sep 2016 19:31:52 +0000 (01:01 +0530)
committerBhadram Varka <vbhadram@nvidia.com>
Fri, 16 Dec 2016 19:09:17 +0000 (00:39 +0530)
The MAC cannot start the transmission until the
wake-up time specified for the PHY expires.
This wake-up time is suppose to be auto-negotiated
and to be programmed in TWT timer. Since we don't
have any PHY register to read the value,we use 21usec
as default value for BRCM PHY as per the data sheet.

Bug 200233029

Change-Id: Ib3a23fa8303e59aed76c7a5085646e661b39cf24
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: http://git-master/r/1220069
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/net/ethernet/nvidia/eqos/eee.c

index c516bb53d0f1ec22686410a92bbba5917d7da2fb..68c8c6f9a7f1a3bf8b299df3b3731137bd0cff1b 100644 (file)
@@ -45,7 +45,7 @@
  * @brief: Driver functions.
  */
 #include "yheader.h"
-
+#include <linux/brcmphy.h>
 void eqos_enable_eee_mode(struct eqos_prv_data *pdata)
 {
        struct tx_ring *ptx_ring = NULL;
@@ -363,6 +363,7 @@ bool eqos_eee_init(struct eqos_prv_data *pdata)
 {
        struct hw_if_struct *hw_if = &(pdata->hw_if);
        bool ret = false;
+       int twt_timer = EQOS_DEFAULT_LPI_TWT_TIMER;
 
        DBGPR_EEE("-->eqos_eee_init\n");
 
@@ -380,9 +381,15 @@ bool eqos_eee_init(struct eqos_prv_data *pdata)
                        pdata->eee_ctrl_timer.expires =
                                EQOS_LPI_TIMER(EQOS_DEFAULT_LPI_TIMER);
                        add_timer(&pdata->eee_ctrl_timer);
-
-                       hw_if->set_eee_timer(EQOS_DEFAULT_LPI_LS_TIMER,
-                               EQOS_DEFAULT_LPI_TWT_TIMER);
+                       if (((pdata->phydev->phy_id & ~0xF) == PHY_ID_BCM89610) ||
+                               ((pdata->phydev->phy_id & ~0xF) == PHY_ID_BCM50610)) {
+                               /* For BRCM PHY set TWT timer to 21usec */
+                               twt_timer = 0x15;
+                       } else {
+                               DBGPR_EEE("Please program corresponding TWT timer value\
+                                               for non BRCM PHY accordingly \n");
+                       }
+                       hw_if->set_eee_timer(EQOS_DEFAULT_LPI_LS_TIMER, twt_timer);
                        if (pdata->use_lpi_tx_automate)
                                hw_if->set_lpi_tx_automate();
                } else {