[PATCH] sky2: speed setting fix

Users report problems w/ auto-negotiation disabled and the link set
to 100/Half or 10/Half. Problems range from poor performance to no
link at all.

The current sky2 code does not set things properly on link up if
autonegotiation is disabled. Plus it does not contemplate a 10Mbit
setting at all. This patch corrects that.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

authored by Stephen Hemminger and committed by Jeff Garzik 6f4c56b2 564f9abb

+30 -1
+30 -1
drivers/net/sky2.c
··· 520 520 521 521 switch (sky2->speed) { 522 522 case SPEED_1000: 523 + reg &= ~GM_GPCR_SPEED_100; 523 524 reg |= GM_GPCR_SPEED_1000; 524 - /* fallthru */ 525 + break; 525 526 case SPEED_100: 527 + reg &= ~GM_GPCR_SPEED_1000; 526 528 reg |= GM_GPCR_SPEED_100; 529 + break; 530 + case SPEED_10: 531 + reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100); 532 + break; 527 533 } 528 534 529 535 if (sky2->duplex == DUPLEX_FULL) ··· 1452 1446 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK); 1453 1447 1454 1448 reg = gma_read16(hw, port, GM_GP_CTRL); 1449 + if (sky2->autoneg == AUTONEG_DISABLE) { 1450 + reg |= GM_GPCR_AU_ALL_DIS; 1451 + 1452 + /* Is write/read necessary? Copied from sky2_mac_init */ 1453 + gma_write16(hw, port, GM_GP_CTRL, reg); 1454 + gma_read16(hw, port, GM_GP_CTRL); 1455 + 1456 + switch (sky2->speed) { 1457 + case SPEED_1000: 1458 + reg &= ~GM_GPCR_SPEED_100; 1459 + reg |= GM_GPCR_SPEED_1000; 1460 + break; 1461 + case SPEED_100: 1462 + reg &= ~GM_GPCR_SPEED_1000; 1463 + reg |= GM_GPCR_SPEED_100; 1464 + break; 1465 + case SPEED_10: 1466 + reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100); 1467 + break; 1468 + } 1469 + } else 1470 + reg &= ~GM_GPCR_AU_ALL_DIS; 1471 + 1455 1472 if (sky2->duplex == DUPLEX_FULL || sky2->autoneg == AUTONEG_ENABLE) 1456 1473 reg |= GM_GPCR_DUP_FULL; 1457 1474