diff options
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r-- | drivers/net/e100.c | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 8e2eab4e7c75..e336c7937f05 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -593,7 +593,6 @@ struct nic { | |||
593 | enum phy phy; | 593 | enum phy phy; |
594 | struct params params; | 594 | struct params params; |
595 | struct timer_list watchdog; | 595 | struct timer_list watchdog; |
596 | struct timer_list blink_timer; | ||
597 | struct mii_if_info mii; | 596 | struct mii_if_info mii; |
598 | struct work_struct tx_timeout_task; | 597 | struct work_struct tx_timeout_task; |
599 | enum loopback loopback; | 598 | enum loopback loopback; |
@@ -618,7 +617,6 @@ struct nic { | |||
618 | u32 rx_tco_frames; | 617 | u32 rx_tco_frames; |
619 | u32 rx_over_length_errors; | 618 | u32 rx_over_length_errors; |
620 | 619 | ||
621 | u16 leds; | ||
622 | u16 eeprom_wc; | 620 | u16 eeprom_wc; |
623 | __le16 eeprom[256]; | 621 | __le16 eeprom[256]; |
624 | spinlock_t mdio_lock; | 622 | spinlock_t mdio_lock; |
@@ -1512,7 +1510,7 @@ static int e100_phy_init(struct nic *nic) | |||
1512 | 1510 | ||
1513 | static int e100_hw_init(struct nic *nic) | 1511 | static int e100_hw_init(struct nic *nic) |
1514 | { | 1512 | { |
1515 | int err; | 1513 | int err = 0; |
1516 | 1514 | ||
1517 | e100_hw_reset(nic); | 1515 | e100_hw_reset(nic); |
1518 | 1516 | ||
@@ -1668,7 +1666,8 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex) | |||
1668 | static void e100_watchdog(unsigned long data) | 1666 | static void e100_watchdog(unsigned long data) |
1669 | { | 1667 | { |
1670 | struct nic *nic = (struct nic *)data; | 1668 | struct nic *nic = (struct nic *)data; |
1671 | struct ethtool_cmd cmd; | 1669 | struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET }; |
1670 | u32 speed; | ||
1672 | 1671 | ||
1673 | netif_printk(nic, timer, KERN_DEBUG, nic->netdev, | 1672 | netif_printk(nic, timer, KERN_DEBUG, nic->netdev, |
1674 | "right now = %ld\n", jiffies); | 1673 | "right now = %ld\n", jiffies); |
@@ -1676,10 +1675,11 @@ static void e100_watchdog(unsigned long data) | |||
1676 | /* mii library handles link maintenance tasks */ | 1675 | /* mii library handles link maintenance tasks */ |
1677 | 1676 | ||
1678 | mii_ethtool_gset(&nic->mii, &cmd); | 1677 | mii_ethtool_gset(&nic->mii, &cmd); |
1678 | speed = ethtool_cmd_speed(&cmd); | ||
1679 | 1679 | ||
1680 | if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { | 1680 | if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { |
1681 | netdev_info(nic->netdev, "NIC Link is Up %u Mbps %s Duplex\n", | 1681 | netdev_info(nic->netdev, "NIC Link is Up %u Mbps %s Duplex\n", |
1682 | cmd.speed == SPEED_100 ? 100 : 10, | 1682 | speed == SPEED_100 ? 100 : 10, |
1683 | cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); | 1683 | cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); |
1684 | } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { | 1684 | } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { |
1685 | netdev_info(nic->netdev, "NIC Link is Down\n"); | 1685 | netdev_info(nic->netdev, "NIC Link is Down\n"); |
@@ -1698,13 +1698,13 @@ static void e100_watchdog(unsigned long data) | |||
1698 | spin_unlock_irq(&nic->cmd_lock); | 1698 | spin_unlock_irq(&nic->cmd_lock); |
1699 | 1699 | ||
1700 | e100_update_stats(nic); | 1700 | e100_update_stats(nic); |
1701 | e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex); | 1701 | e100_adjust_adaptive_ifs(nic, speed, cmd.duplex); |
1702 | 1702 | ||
1703 | if (nic->mac <= mac_82557_D100_C) | 1703 | if (nic->mac <= mac_82557_D100_C) |
1704 | /* Issue a multicast command to workaround a 557 lock up */ | 1704 | /* Issue a multicast command to workaround a 557 lock up */ |
1705 | e100_set_multicast_list(nic->netdev); | 1705 | e100_set_multicast_list(nic->netdev); |
1706 | 1706 | ||
1707 | if (nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF) | 1707 | if (nic->flags & ich && speed == SPEED_10 && cmd.duplex == DUPLEX_HALF) |
1708 | /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */ | 1708 | /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */ |
1709 | nic->flags |= ich_10h_workaround; | 1709 | nic->flags |= ich_10h_workaround; |
1710 | else | 1710 | else |
@@ -2215,10 +2215,10 @@ static int e100_change_mtu(struct net_device *netdev, int new_mtu) | |||
2215 | static int e100_asf(struct nic *nic) | 2215 | static int e100_asf(struct nic *nic) |
2216 | { | 2216 | { |
2217 | /* ASF can be enabled from eeprom */ | 2217 | /* ASF can be enabled from eeprom */ |
2218 | return((nic->pdev->device >= 0x1050) && (nic->pdev->device <= 0x1057) && | 2218 | return (nic->pdev->device >= 0x1050) && (nic->pdev->device <= 0x1057) && |
2219 | (nic->eeprom[eeprom_config_asf] & eeprom_asf) && | 2219 | (nic->eeprom[eeprom_config_asf] & eeprom_asf) && |
2220 | !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && | 2220 | !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && |
2221 | ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE)); | 2221 | ((nic->eeprom[eeprom_smbus_addr] & 0xFF) != 0xFE); |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | static int e100_up(struct nic *nic) | 2224 | static int e100_up(struct nic *nic) |
@@ -2351,30 +2351,6 @@ err_clean_rx: | |||
2351 | #define E100_82552_LED_OVERRIDE 0x19 | 2351 | #define E100_82552_LED_OVERRIDE 0x19 |
2352 | #define E100_82552_LED_ON 0x000F /* LEDTX and LED_RX both on */ | 2352 | #define E100_82552_LED_ON 0x000F /* LEDTX and LED_RX both on */ |
2353 | #define E100_82552_LED_OFF 0x000A /* LEDTX and LED_RX both off */ | 2353 | #define E100_82552_LED_OFF 0x000A /* LEDTX and LED_RX both off */ |
2354 | static void e100_blink_led(unsigned long data) | ||
2355 | { | ||
2356 | struct nic *nic = (struct nic *)data; | ||
2357 | enum led_state { | ||
2358 | led_on = 0x01, | ||
2359 | led_off = 0x04, | ||
2360 | led_on_559 = 0x05, | ||
2361 | led_on_557 = 0x07, | ||
2362 | }; | ||
2363 | u16 led_reg = MII_LED_CONTROL; | ||
2364 | |||
2365 | if (nic->phy == phy_82552_v) { | ||
2366 | led_reg = E100_82552_LED_OVERRIDE; | ||
2367 | |||
2368 | nic->leds = (nic->leds == E100_82552_LED_ON) ? | ||
2369 | E100_82552_LED_OFF : E100_82552_LED_ON; | ||
2370 | } else { | ||
2371 | nic->leds = (nic->leds & led_on) ? led_off : | ||
2372 | (nic->mac < mac_82559_D101M) ? led_on_557 : | ||
2373 | led_on_559; | ||
2374 | } | ||
2375 | mdio_write(nic->netdev, nic->mii.phy_id, led_reg, nic->leds); | ||
2376 | mod_timer(&nic->blink_timer, jiffies + HZ / 4); | ||
2377 | } | ||
2378 | 2354 | ||
2379 | static int e100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | 2355 | static int e100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) |
2380 | { | 2356 | { |
@@ -2598,19 +2574,38 @@ static void e100_diag_test(struct net_device *netdev, | |||
2598 | msleep_interruptible(4 * 1000); | 2574 | msleep_interruptible(4 * 1000); |
2599 | } | 2575 | } |
2600 | 2576 | ||
2601 | static int e100_phys_id(struct net_device *netdev, u32 data) | 2577 | static int e100_set_phys_id(struct net_device *netdev, |
2578 | enum ethtool_phys_id_state state) | ||
2602 | { | 2579 | { |
2603 | struct nic *nic = netdev_priv(netdev); | 2580 | struct nic *nic = netdev_priv(netdev); |
2581 | enum led_state { | ||
2582 | led_on = 0x01, | ||
2583 | led_off = 0x04, | ||
2584 | led_on_559 = 0x05, | ||
2585 | led_on_557 = 0x07, | ||
2586 | }; | ||
2604 | u16 led_reg = (nic->phy == phy_82552_v) ? E100_82552_LED_OVERRIDE : | 2587 | u16 led_reg = (nic->phy == phy_82552_v) ? E100_82552_LED_OVERRIDE : |
2605 | MII_LED_CONTROL; | 2588 | MII_LED_CONTROL; |
2589 | u16 leds = 0; | ||
2606 | 2590 | ||
2607 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 2591 | switch (state) { |
2608 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); | 2592 | case ETHTOOL_ID_ACTIVE: |
2609 | mod_timer(&nic->blink_timer, jiffies); | 2593 | return 2; |
2610 | msleep_interruptible(data * 1000); | 2594 | |
2611 | del_timer_sync(&nic->blink_timer); | 2595 | case ETHTOOL_ID_ON: |
2612 | mdio_write(netdev, nic->mii.phy_id, led_reg, 0); | 2596 | leds = (nic->phy == phy_82552_v) ? E100_82552_LED_ON : |
2597 | (nic->mac < mac_82559_D101M) ? led_on_557 : led_on_559; | ||
2598 | break; | ||
2599 | |||
2600 | case ETHTOOL_ID_OFF: | ||
2601 | leds = (nic->phy == phy_82552_v) ? E100_82552_LED_OFF : led_off; | ||
2602 | break; | ||
2603 | |||
2604 | case ETHTOOL_ID_INACTIVE: | ||
2605 | break; | ||
2606 | } | ||
2613 | 2607 | ||
2608 | mdio_write(netdev, nic->mii.phy_id, led_reg, leds); | ||
2614 | return 0; | 2609 | return 0; |
2615 | } | 2610 | } |
2616 | 2611 | ||
@@ -2691,7 +2686,7 @@ static const struct ethtool_ops e100_ethtool_ops = { | |||
2691 | .set_ringparam = e100_set_ringparam, | 2686 | .set_ringparam = e100_set_ringparam, |
2692 | .self_test = e100_diag_test, | 2687 | .self_test = e100_diag_test, |
2693 | .get_strings = e100_get_strings, | 2688 | .get_strings = e100_get_strings, |
2694 | .phys_id = e100_phys_id, | 2689 | .set_phys_id = e100_set_phys_id, |
2695 | .get_ethtool_stats = e100_get_ethtool_stats, | 2690 | .get_ethtool_stats = e100_get_ethtool_stats, |
2696 | .get_sset_count = e100_get_sset_count, | 2691 | .get_sset_count = e100_get_sset_count, |
2697 | }; | 2692 | }; |
@@ -2832,9 +2827,6 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2832 | init_timer(&nic->watchdog); | 2827 | init_timer(&nic->watchdog); |
2833 | nic->watchdog.function = e100_watchdog; | 2828 | nic->watchdog.function = e100_watchdog; |
2834 | nic->watchdog.data = (unsigned long)nic; | 2829 | nic->watchdog.data = (unsigned long)nic; |
2835 | init_timer(&nic->blink_timer); | ||
2836 | nic->blink_timer.function = e100_blink_led; | ||
2837 | nic->blink_timer.data = (unsigned long)nic; | ||
2838 | 2830 | ||
2839 | INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); | 2831 | INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); |
2840 | 2832 | ||