aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2012-09-10 01:51:08 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 16:40:29 -0400
commit26964bb72afd0310c17750c002eebbf022db3b19 (patch)
treeaf6bfc6d279603fcd9e01bafe82eec0aa2cfe527 /drivers/net
parentf6b6eb696889b65dea83aa097dac94342540c16a (diff)
bnx2x: use native EEE instead of auto-greeen
This patch enables boards with 54618SE phys and a sufficiently new firmware to use native EEE instead of auto-greeen. Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c105
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h13
3 files changed, 73 insertions, 46 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 839ddd2519d3..c660afdbdf56 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -1584,6 +1584,16 @@ static void bnx2x_umac_enable(struct link_params *params,
1584 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val); 1584 REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val);
1585 udelay(50); 1585 udelay(50);
1586 1586
1587 /* Configure UMAC for EEE */
1588 if (vars->eee_status & SHMEM_EEE_ADV_STATUS_MASK) {
1589 DP(NETIF_MSG_LINK, "configured UMAC for EEE\n");
1590 REG_WR(bp, umac_base + UMAC_REG_UMAC_EEE_CTRL,
1591 UMAC_UMAC_EEE_CTRL_REG_EEE_EN);
1592 REG_WR(bp, umac_base + UMAC_REG_EEE_WAKE_TIMER, 0x11);
1593 } else {
1594 REG_WR(bp, umac_base + UMAC_REG_UMAC_EEE_CTRL, 0x0);
1595 }
1596
1587 /* Set MAC address for source TX Pause/PFC frames (under SW reset) */ 1597 /* Set MAC address for source TX Pause/PFC frames (under SW reset) */
1588 REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0, 1598 REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0,
1589 ((params->mac_addr[2] << 24) | 1599 ((params->mac_addr[2] << 24) |
@@ -4263,6 +4273,8 @@ static void bnx2x_warpcore_set_sgmii_speed(struct bnx2x_phy *phy,
4263 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, 4273 bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4264 MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13)); 4274 MDIO_WC_REG_RX66_CONTROL, val16 & ~(3<<13));
4265 4275
4276 bnx2x_warpcore_set_lpi_passthrough(phy, params);
4277
4266 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) { 4278 if (always_autoneg || phy->req_line_speed == SPEED_AUTO_NEG) {
4267 /* SGMII Autoneg */ 4279 /* SGMII Autoneg */
4268 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, 4280 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
@@ -10792,28 +10804,52 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy,
10792 DP(NETIF_MSG_LINK, "Setting 10M force\n"); 10804 DP(NETIF_MSG_LINK, "Setting 10M force\n");
10793 } 10805 }
10794 10806
10795 /* Check if we should turn on Auto-GrEEEn */ 10807 if ((phy->flags & FLAGS_EEE) && bnx2x_eee_has_cap(params)) {
10796 bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_PHYID_LSB, &temp); 10808 int rc;
10797 if (temp == MDIO_REG_GPHY_ID_54618SE) { 10809
10798 if (params->feature_config_flags & 10810 bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS,
10799 FEATURE_CONFIG_AUTOGREEEN_ENABLED) { 10811 MDIO_REG_GPHY_EXP_ACCESS_TOP |
10800 temp = 6; 10812 MDIO_REG_GPHY_EXP_TOP_2K_BUF);
10801 DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n"); 10813 bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, &temp);
10814 temp &= 0xfffe;
10815 bnx2x_cl22_write(bp, phy, MDIO_REG_GPHY_EXP_ACCESS_GATE, temp);
10816
10817 rc = bnx2x_eee_initial_config(params, vars, SHMEM_EEE_1G_ADV);
10818 if (rc) {
10819 DP(NETIF_MSG_LINK, "Failed to configure EEE timers\n");
10820 bnx2x_eee_disable(phy, params, vars);
10821 } else if ((params->eee_mode & EEE_MODE_ADV_LPI) &&
10822 (phy->req_duplex == DUPLEX_FULL) &&
10823 (bnx2x_eee_calc_timer(params) ||
10824 !(params->eee_mode & EEE_MODE_ENABLE_LPI))) {
10825 /* Need to advertise EEE only when requested,
10826 * and either no LPI assertion was requested,
10827 * or it was requested and a valid timer was set.
10828 * Also notice full duplex is required for EEE.
10829 */
10830 bnx2x_eee_advertise(phy, params, vars,
10831 SHMEM_EEE_1G_ADV);
10802 } else { 10832 } else {
10803 temp = 0; 10833 DP(NETIF_MSG_LINK, "Don't Advertise 1GBase-T EEE\n");
10804 DP(NETIF_MSG_LINK, "Disabling Auto-GrEEEn\n"); 10834 bnx2x_eee_disable(phy, params, vars);
10835 }
10836 } else {
10837 vars->eee_status &= ~SHMEM_EEE_1G_ADV <<
10838 SHMEM_EEE_SUPPORTED_SHIFT;
10839
10840 if (phy->flags & FLAGS_EEE) {
10841 /* Handle legacy auto-grEEEn */
10842 if (params->feature_config_flags &
10843 FEATURE_CONFIG_AUTOGREEEN_ENABLED) {
10844 temp = 6;
10845 DP(NETIF_MSG_LINK, "Enabling Auto-GrEEEn\n");
10846 } else {
10847 temp = 0;
10848 DP(NETIF_MSG_LINK, "Don't Adv. EEE\n");
10849 }
10850 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
10851 MDIO_AN_REG_EEE_ADV, temp);
10805 } 10852 }
10806 bnx2x_cl22_write(bp, phy,
10807 MDIO_REG_GPHY_CL45_ADDR_REG, MDIO_AN_DEVAD);
10808 bnx2x_cl22_write(bp, phy,
10809 MDIO_REG_GPHY_CL45_DATA_REG,
10810 MDIO_REG_GPHY_EEE_ADV);
10811 bnx2x_cl22_write(bp, phy,
10812 MDIO_REG_GPHY_CL45_ADDR_REG,
10813 (0x1 << 14) | MDIO_AN_DEVAD);
10814 bnx2x_cl22_write(bp, phy,
10815 MDIO_REG_GPHY_CL45_DATA_REG,
10816 temp);
10817 } 10853 }
10818 10854
10819 bnx2x_cl22_write(bp, phy, 10855 bnx2x_cl22_write(bp, phy,
@@ -10960,29 +10996,6 @@ static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy,
10960 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n", 10996 DP(NETIF_MSG_LINK, "BCM54618SE: link speed is %d\n",
10961 vars->line_speed); 10997 vars->line_speed);
10962 10998
10963 /* Report whether EEE is resolved. */
10964 bnx2x_cl22_read(bp, phy, MDIO_REG_GPHY_PHYID_LSB, &val);
10965 if (val == MDIO_REG_GPHY_ID_54618SE) {
10966 if (vars->link_status &
10967 LINK_STATUS_AUTO_NEGOTIATE_COMPLETE)
10968 val = 0;
10969 else {
10970 bnx2x_cl22_write(bp, phy,
10971 MDIO_REG_GPHY_CL45_ADDR_REG,
10972 MDIO_AN_DEVAD);
10973 bnx2x_cl22_write(bp, phy,
10974 MDIO_REG_GPHY_CL45_DATA_REG,
10975 MDIO_REG_GPHY_EEE_RESOLVED);
10976 bnx2x_cl22_write(bp, phy,
10977 MDIO_REG_GPHY_CL45_ADDR_REG,
10978 (0x1 << 14) | MDIO_AN_DEVAD);
10979 bnx2x_cl22_read(bp, phy,
10980 MDIO_REG_GPHY_CL45_DATA_REG,
10981 &val);
10982 }
10983 DP(NETIF_MSG_LINK, "EEE resolution: 0x%x\n", val);
10984 }
10985
10986 bnx2x_ext_phy_resolve_fc(phy, params, vars); 10999 bnx2x_ext_phy_resolve_fc(phy, params, vars);
10987 11000
10988 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { 11001 if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) {
@@ -11012,6 +11025,10 @@ static u8 bnx2x_54618se_read_status(struct bnx2x_phy *phy,
11012 if (val & (1<<11)) 11025 if (val & (1<<11))
11013 vars->link_status |= 11026 vars->link_status |=
11014 LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE; 11027 LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE;
11028
11029 if ((phy->flags & FLAGS_EEE) &&
11030 bnx2x_eee_has_cap(params))
11031 bnx2x_eee_an_resolve(phy, params, vars);
11015 } 11032 }
11016 } 11033 }
11017 return link_up; 11034 return link_up;
@@ -11925,6 +11942,8 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp,
11925 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616: 11942 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54616:
11926 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE: 11943 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE:
11927 *phy = phy_54618se; 11944 *phy = phy_54618se;
11945 if (phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE)
11946 phy->flags |= FLAGS_EEE;
11928 break; 11947 break;
11929 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 11948 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
11930 *phy = phy_7101; 11949 *phy = phy_7101;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
index 3967aa85fc09..360ecf9e0739 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
@@ -155,6 +155,7 @@ struct bnx2x_phy {
155#define FLAGS_DUMMY_READ (1<<9) 155#define FLAGS_DUMMY_READ (1<<9)
156#define FLAGS_MDC_MDIO_WA_B0 (1<<10) 156#define FLAGS_MDC_MDIO_WA_B0 (1<<10)
157#define FLAGS_TX_ERROR_CHECK (1<<12) 157#define FLAGS_TX_ERROR_CHECK (1<<12)
158#define FLAGS_EEE (1<<13)
158 159
159 /* preemphasis values for the rx side */ 160 /* preemphasis values for the rx side */
160 u16 rx_preemphasis[4]; 161 u16 rx_preemphasis[4];
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
index d32293fcc81c..1b1999d34c71 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
@@ -4949,6 +4949,10 @@
4949#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13) 4949#define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13)
4950#define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0) 4950#define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0)
4951#define UMAC_REG_COMMAND_CONFIG 0x8 4951#define UMAC_REG_COMMAND_CONFIG 0x8
4952/* [RW 16] This is the duration for which MAC must wait to go back to ACTIVE
4953 * state from LPI state when it receives packet for transmission. The
4954 * decrement unit is 1 micro-second. */
4955#define UMAC_REG_EEE_WAKE_TIMER 0x6c
4952/* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers 4956/* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers
4953 * to bit 17 of the MAC address etc. */ 4957 * to bit 17 of the MAC address etc. */
4954#define UMAC_REG_MAC_ADDR0 0xc 4958#define UMAC_REG_MAC_ADDR0 0xc
@@ -4958,6 +4962,8 @@
4958/* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive 4962/* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive
4959 * logic to check frames. */ 4963 * logic to check frames. */
4960#define UMAC_REG_MAXFR 0x14 4964#define UMAC_REG_MAXFR 0x14
4965#define UMAC_REG_UMAC_EEE_CTRL 0x64
4966#define UMAC_UMAC_EEE_CTRL_REG_EEE_EN (0x1<<3)
4961/* [RW 8] The event id for aggregated interrupt 0 */ 4967/* [RW 8] The event id for aggregated interrupt 0 */
4962#define USDM_REG_AGG_INT_EVENT_0 0xc4038 4968#define USDM_REG_AGG_INT_EVENT_0 0xc4038
4963#define USDM_REG_AGG_INT_EVENT_1 0xc403c 4969#define USDM_REG_AGG_INT_EVENT_1 0xc403c
@@ -7161,10 +7167,11 @@ Theotherbitsarereservedandshouldbezero*/
7161#define MDIO_REG_GPHY_ID_54618SE 0x5cd5 7167#define MDIO_REG_GPHY_ID_54618SE 0x5cd5
7162#define MDIO_REG_GPHY_CL45_ADDR_REG 0xd 7168#define MDIO_REG_GPHY_CL45_ADDR_REG 0xd
7163#define MDIO_REG_GPHY_CL45_DATA_REG 0xe 7169#define MDIO_REG_GPHY_CL45_DATA_REG 0xe
7164#define MDIO_REG_GPHY_EEE_ADV 0x3c
7165#define MDIO_REG_GPHY_EEE_1G (0x1 << 2)
7166#define MDIO_REG_GPHY_EEE_100 (0x1 << 1)
7167#define MDIO_REG_GPHY_EEE_RESOLVED 0x803e 7170#define MDIO_REG_GPHY_EEE_RESOLVED 0x803e
7171#define MDIO_REG_GPHY_EXP_ACCESS_GATE 0x15
7172#define MDIO_REG_GPHY_EXP_ACCESS 0x17
7173#define MDIO_REG_GPHY_EXP_ACCESS_TOP 0xd00
7174#define MDIO_REG_GPHY_EXP_TOP_2K_BUF 0x40
7168#define MDIO_REG_GPHY_AUX_STATUS 0x19 7175#define MDIO_REG_GPHY_AUX_STATUS 0x19
7169#define MDIO_REG_INTR_STATUS 0x1a 7176#define MDIO_REG_INTR_STATUS 0x1a
7170#define MDIO_REG_INTR_MASK 0x1b 7177#define MDIO_REG_INTR_MASK 0x1b