diff options
author | PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com> | 2009-04-08 09:20:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-11 04:43:12 -0400 |
commit | 87c1201708381c2791caa78a2caf217778633277 (patch) | |
tree | befc0d49e977c162cba5d1ec2996be25342afe96 /drivers/net/ixgbe/ixgbe_common.c | |
parent | d543103a0c75edc0a7a08dfd796de67466a15dfb (diff) |
ixgbe: Move the LED blink code to common, since 82599 also uses it
The LED blink code is common for 82599 as well. It should be moved to
ixgbe_common.c so both devices can use it, and not have it duplicated.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_common.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 63ab6671d08e..5567519676d5 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -2071,3 +2071,58 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) | |||
2071 | 2071 | ||
2072 | return 0; | 2072 | return 0; |
2073 | } | 2073 | } |
2074 | |||
2075 | /** | ||
2076 | * ixgbe_blink_led_start_generic - Blink LED based on index. | ||
2077 | * @hw: pointer to hardware structure | ||
2078 | * @index: led number to blink | ||
2079 | **/ | ||
2080 | s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) | ||
2081 | { | ||
2082 | ixgbe_link_speed speed = 0; | ||
2083 | bool link_up = 0; | ||
2084 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | ||
2085 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | ||
2086 | |||
2087 | /* | ||
2088 | * Link must be up to auto-blink the LEDs; | ||
2089 | * Force it if link is down. | ||
2090 | */ | ||
2091 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | ||
2092 | |||
2093 | if (!link_up) { | ||
2094 | autoc_reg |= IXGBE_AUTOC_FLU; | ||
2095 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | ||
2096 | msleep(10); | ||
2097 | } | ||
2098 | |||
2099 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | ||
2100 | led_reg |= IXGBE_LED_BLINK(index); | ||
2101 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | ||
2102 | IXGBE_WRITE_FLUSH(hw); | ||
2103 | |||
2104 | return 0; | ||
2105 | } | ||
2106 | |||
2107 | /** | ||
2108 | * ixgbe_blink_led_stop_generic - Stop blinking LED based on index. | ||
2109 | * @hw: pointer to hardware structure | ||
2110 | * @index: led number to stop blinking | ||
2111 | **/ | ||
2112 | s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) | ||
2113 | { | ||
2114 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | ||
2115 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | ||
2116 | |||
2117 | autoc_reg &= ~IXGBE_AUTOC_FLU; | ||
2118 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; | ||
2119 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | ||
2120 | |||
2121 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | ||
2122 | led_reg &= ~IXGBE_LED_BLINK(index); | ||
2123 | led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index); | ||
2124 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | ||
2125 | IXGBE_WRITE_FLUSH(hw); | ||
2126 | |||
2127 | return 0; | ||
2128 | } | ||