aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/tenxpress.c
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2009-01-29 12:49:09 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-30 17:06:29 -0500
commit8b9dc8dd447cfe27c0214761ced22a8e4aa58f5e (patch)
tree2b7eb0523fe541647ca2e78f6c4c0742700c7959 /drivers/net/sfc/tenxpress.c
parent2d18835d65b7433e7e6583f65395f8c01e7874af (diff)
sfc: SFT9001: Fix speed reporting in 1G PHY loopback
Instead of disabling AN in loopback, just prevent restarting AN and override the speed in sft9001_get_settings(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/tenxpress.c')
-rw-r--r--drivers/net/sfc/tenxpress.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index 80c8d6e3131e..bc2833f9cbe4 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -511,7 +511,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
511{ 511{
512 struct tenxpress_phy_data *phy_data = efx->phy_data; 512 struct tenxpress_phy_data *phy_data = efx->phy_data;
513 struct ethtool_cmd ecmd; 513 struct ethtool_cmd ecmd;
514 bool phy_mode_change, loop_reset, loop_toggle, loopback; 514 bool phy_mode_change, loop_reset;
515 515
516 if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) { 516 if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) {
517 phy_data->phy_mode = efx->phy_mode; 517 phy_data->phy_mode = efx->phy_mode;
@@ -522,12 +522,10 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
522 522
523 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL && 523 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL &&
524 phy_data->phy_mode != PHY_MODE_NORMAL); 524 phy_data->phy_mode != PHY_MODE_NORMAL);
525 loopback = LOOPBACK_MASK(efx) & efx->phy_op->loopbacks;
526 loop_toggle = LOOPBACK_CHANGED(phy_data, efx, efx->phy_op->loopbacks);
527 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) || 525 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) ||
528 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY)); 526 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY));
529 527
530 if (loop_reset || loop_toggle || loopback || phy_mode_change) { 528 if (loop_reset || phy_mode_change) {
531 int rc; 529 int rc;
532 530
533 efx->phy_op->get_settings(efx, &ecmd); 531 efx->phy_op->get_settings(efx, &ecmd);
@@ -542,20 +540,6 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
542 falcon_reset_xaui(efx); 540 falcon_reset_xaui(efx);
543 } 541 }
544 542
545 if (efx->phy_type != PHY_TYPE_SFX7101) {
546 /* Only change autoneg once, on coming out or
547 * going into loopback */
548 if (loop_toggle)
549 ecmd.autoneg = !loopback;
550 if (loopback) {
551 ecmd.duplex = DUPLEX_FULL;
552 if (efx->loopback_mode == LOOPBACK_GPHY)
553 ecmd.speed = SPEED_1000;
554 else
555 ecmd.speed = SPEED_10000;
556 }
557 }
558
559 rc = efx->phy_op->set_settings(efx, &ecmd); 543 rc = efx->phy_op->set_settings(efx, &ecmd);
560 WARN_ON(rc); 544 WARN_ON(rc);
561 } 545 }
@@ -813,6 +797,13 @@ static void sft9001_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
813 ecmd->duplex = (reg & (1 << GPHY_DUPLEX_LBN) ? 797 ecmd->duplex = (reg & (1 << GPHY_DUPLEX_LBN) ?
814 DUPLEX_FULL : DUPLEX_HALF); 798 DUPLEX_FULL : DUPLEX_HALF);
815 } 799 }
800
801 /* In loopback, the PHY automatically brings up the correct interface,
802 * but doesn't advertise the correct speed. So override it */
803 if (efx->loopback_mode == LOOPBACK_GPHY)
804 ecmd->speed = SPEED_1000;
805 else if (LOOPBACK_MASK(efx) & SFT9001_LOOPBACKS)
806 ecmd->speed = SPEED_10000;
816} 807}
817 808
818static int sft9001_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 809static int sft9001_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)