aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_common.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-04-16 20:35:26 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-16 20:35:26 -0400
commita54bfa40fd16aeb90bc556189221576f746f8567 (patch)
tree176bb7a99ffab5f42f0dd4e9671f335be3f3efa0 /drivers/net/ixgbe/ixgbe_common.c
parentfe957c40ec5e2763b9977c565beab3bde3aaf85b (diff)
parent134ffb4cad92a6aa534e55a9be145bca780a32c1 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_common.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 2d4af5d2d3f7..5f2ee34e9d1d 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -2074,3 +2074,58 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval)
2074 2074
2075 return 0; 2075 return 0;
2076} 2076}
2077
2078/**
2079 * ixgbe_blink_led_start_generic - Blink LED based on index.
2080 * @hw: pointer to hardware structure
2081 * @index: led number to blink
2082 **/
2083s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
2084{
2085 ixgbe_link_speed speed = 0;
2086 bool link_up = 0;
2087 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2088 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2089
2090 /*
2091 * Link must be up to auto-blink the LEDs;
2092 * Force it if link is down.
2093 */
2094 hw->mac.ops.check_link(hw, &speed, &link_up, false);
2095
2096 if (!link_up) {
2097 autoc_reg |= IXGBE_AUTOC_FLU;
2098 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2099 msleep(10);
2100 }
2101
2102 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2103 led_reg |= IXGBE_LED_BLINK(index);
2104 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2105 IXGBE_WRITE_FLUSH(hw);
2106
2107 return 0;
2108}
2109
2110/**
2111 * ixgbe_blink_led_stop_generic - Stop blinking LED based on index.
2112 * @hw: pointer to hardware structure
2113 * @index: led number to stop blinking
2114 **/
2115s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
2116{
2117 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2118 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2119
2120 autoc_reg &= ~IXGBE_AUTOC_FLU;
2121 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2122 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2123
2124 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2125 led_reg &= ~IXGBE_LED_BLINK(index);
2126 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
2127 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2128 IXGBE_WRITE_FLUSH(hw);
2129
2130 return 0;
2131}