diff options
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r-- | drivers/net/spider_net.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index bccae7e5c6ad..477671606273 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1399,6 +1399,8 @@ spider_net_link_reset(struct net_device *netdev) | |||
1399 | spider_net_write_reg(card, SPIDER_NET_GMACINTEN, 0); | 1399 | spider_net_write_reg(card, SPIDER_NET_GMACINTEN, 0); |
1400 | 1400 | ||
1401 | /* reset phy and setup aneg */ | 1401 | /* reset phy and setup aneg */ |
1402 | card->aneg_count = 0; | ||
1403 | card->medium = BCM54XX_COPPER; | ||
1402 | spider_net_setup_aneg(card); | 1404 | spider_net_setup_aneg(card); |
1403 | mod_timer(&card->aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER); | 1405 | mod_timer(&card->aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER); |
1404 | 1406 | ||
@@ -1413,18 +1415,12 @@ spider_net_link_reset(struct net_device *netdev) | |||
1413 | * found when an interrupt is presented | 1415 | * found when an interrupt is presented |
1414 | */ | 1416 | */ |
1415 | static void | 1417 | static void |
1416 | spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg) | 1418 | spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg, |
1419 | u32 error_reg1, u32 error_reg2) | ||
1417 | { | 1420 | { |
1418 | u32 error_reg1, error_reg2; | ||
1419 | u32 i; | 1421 | u32 i; |
1420 | int show_error = 1; | 1422 | int show_error = 1; |
1421 | 1423 | ||
1422 | error_reg1 = spider_net_read_reg(card, SPIDER_NET_GHIINT1STS); | ||
1423 | error_reg2 = spider_net_read_reg(card, SPIDER_NET_GHIINT2STS); | ||
1424 | |||
1425 | error_reg1 &= SPIDER_NET_INT1_MASK_VALUE; | ||
1426 | error_reg2 &= SPIDER_NET_INT2_MASK_VALUE; | ||
1427 | |||
1428 | /* check GHIINT0STS ************************************/ | 1424 | /* check GHIINT0STS ************************************/ |
1429 | if (status_reg) | 1425 | if (status_reg) |
1430 | for (i = 0; i < 32; i++) | 1426 | for (i = 0; i < 32; i++) |
@@ -1654,12 +1650,15 @@ spider_net_interrupt(int irq, void *ptr) | |||
1654 | { | 1650 | { |
1655 | struct net_device *netdev = ptr; | 1651 | struct net_device *netdev = ptr; |
1656 | struct spider_net_card *card = netdev_priv(netdev); | 1652 | struct spider_net_card *card = netdev_priv(netdev); |
1657 | u32 status_reg; | 1653 | u32 status_reg, error_reg1, error_reg2; |
1658 | 1654 | ||
1659 | status_reg = spider_net_read_reg(card, SPIDER_NET_GHIINT0STS); | 1655 | status_reg = spider_net_read_reg(card, SPIDER_NET_GHIINT0STS); |
1660 | status_reg &= SPIDER_NET_INT0_MASK_VALUE; | 1656 | error_reg1 = spider_net_read_reg(card, SPIDER_NET_GHIINT1STS); |
1657 | error_reg2 = spider_net_read_reg(card, SPIDER_NET_GHIINT2STS); | ||
1661 | 1658 | ||
1662 | if (!status_reg) | 1659 | if (!(status_reg & SPIDER_NET_INT0_MASK_VALUE) && |
1660 | !(error_reg1 & SPIDER_NET_INT1_MASK_VALUE) && | ||
1661 | !(error_reg2 & SPIDER_NET_INT2_MASK_VALUE)) | ||
1663 | return IRQ_NONE; | 1662 | return IRQ_NONE; |
1664 | 1663 | ||
1665 | if (status_reg & SPIDER_NET_RXINT ) { | 1664 | if (status_reg & SPIDER_NET_RXINT ) { |
@@ -1674,7 +1673,8 @@ spider_net_interrupt(int irq, void *ptr) | |||
1674 | spider_net_link_reset(netdev); | 1673 | spider_net_link_reset(netdev); |
1675 | 1674 | ||
1676 | if (status_reg & SPIDER_NET_ERRINT ) | 1675 | if (status_reg & SPIDER_NET_ERRINT ) |
1677 | spider_net_handle_error_irq(card, status_reg); | 1676 | spider_net_handle_error_irq(card, status_reg, |
1677 | error_reg1, error_reg2); | ||
1678 | 1678 | ||
1679 | /* clear interrupt sources */ | 1679 | /* clear interrupt sources */ |
1680 | spider_net_write_reg(card, SPIDER_NET_GHIINT0STS, status_reg); | 1680 | spider_net_write_reg(card, SPIDER_NET_GHIINT0STS, status_reg); |
@@ -1982,6 +1982,8 @@ spider_net_open(struct net_device *netdev) | |||
1982 | goto init_firmware_failed; | 1982 | goto init_firmware_failed; |
1983 | 1983 | ||
1984 | /* start probing with copper */ | 1984 | /* start probing with copper */ |
1985 | card->aneg_count = 0; | ||
1986 | card->medium = BCM54XX_COPPER; | ||
1985 | spider_net_setup_aneg(card); | 1987 | spider_net_setup_aneg(card); |
1986 | if (card->phy.def->phy_id) | 1988 | if (card->phy.def->phy_id) |
1987 | mod_timer(&card->aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER); | 1989 | mod_timer(&card->aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER); |
@@ -2043,7 +2045,8 @@ static void spider_net_link_phy(unsigned long data) | |||
2043 | /* if link didn't come up after SPIDER_NET_ANEG_TIMEOUT tries, setup phy again */ | 2045 | /* if link didn't come up after SPIDER_NET_ANEG_TIMEOUT tries, setup phy again */ |
2044 | if (card->aneg_count > SPIDER_NET_ANEG_TIMEOUT) { | 2046 | if (card->aneg_count > SPIDER_NET_ANEG_TIMEOUT) { |
2045 | 2047 | ||
2046 | pr_info("%s: link is down trying to bring it up\n", card->netdev->name); | 2048 | pr_debug("%s: link is down trying to bring it up\n", |
2049 | card->netdev->name); | ||
2047 | 2050 | ||
2048 | switch (card->medium) { | 2051 | switch (card->medium) { |
2049 | case BCM54XX_COPPER: | 2052 | case BCM54XX_COPPER: |
@@ -2094,9 +2097,10 @@ static void spider_net_link_phy(unsigned long data) | |||
2094 | 2097 | ||
2095 | card->aneg_count = 0; | 2098 | card->aneg_count = 0; |
2096 | 2099 | ||
2097 | pr_debug("Found %s with %i Mbps, %s-duplex %sautoneg.\n", | 2100 | pr_info("%s: link up, %i Mbps, %s-duplex %sautoneg.\n", |
2098 | phy->def->name, phy->speed, phy->duplex==1 ? "Full" : "Half", | 2101 | card->netdev->name, phy->speed, |
2099 | phy->autoneg==1 ? "" : "no "); | 2102 | phy->duplex == 1 ? "Full" : "Half", |
2103 | phy->autoneg == 1 ? "" : "no "); | ||
2100 | 2104 | ||
2101 | return; | 2105 | return; |
2102 | } | 2106 | } |