aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorPJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>2009-04-08 09:20:31 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-11 04:43:12 -0400
commit87c1201708381c2791caa78a2caf217778633277 (patch)
treebefc0d49e977c162cba5d1ec2996be25342afe96 /drivers/net/ixgbe
parentd543103a0c75edc0a7a08dfd796de67466a15dfb (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')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c59
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c40
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c55
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h3
4 files changed, 62 insertions, 95 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index de4db0dc7879..4791238c3f6e 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -885,61 +885,6 @@ static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
885} 885}
886 886
887/** 887/**
888 * ixgbe_blink_led_start_82598 - Blink LED based on index.
889 * @hw: pointer to hardware structure
890 * @index: led number to blink
891 **/
892static s32 ixgbe_blink_led_start_82598(struct ixgbe_hw *hw, u32 index)
893{
894 ixgbe_link_speed speed = 0;
895 bool link_up = 0;
896 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
897 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
898
899 /*
900 * Link must be up to auto-blink the LEDs on the 82598EB MAC;
901 * force it if link is down.
902 */
903 hw->mac.ops.check_link(hw, &speed, &link_up, false);
904
905 if (!link_up) {
906 autoc_reg |= IXGBE_AUTOC_FLU;
907 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
908 msleep(10);
909 }
910
911 led_reg &= ~IXGBE_LED_MODE_MASK(index);
912 led_reg |= IXGBE_LED_BLINK(index);
913 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
914 IXGBE_WRITE_FLUSH(hw);
915
916 return 0;
917}
918
919/**
920 * ixgbe_blink_led_stop_82598 - Stop blinking LED based on index.
921 * @hw: pointer to hardware structure
922 * @index: led number to stop blinking
923 **/
924static s32 ixgbe_blink_led_stop_82598(struct ixgbe_hw *hw, u32 index)
925{
926 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
927 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
928
929 autoc_reg &= ~IXGBE_AUTOC_FLU;
930 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
931 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
932
933 led_reg &= ~IXGBE_LED_MODE_MASK(index);
934 led_reg &= ~IXGBE_LED_BLINK(index);
935 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
936 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
937 IXGBE_WRITE_FLUSH(hw);
938
939 return 0;
940}
941
942/**
943 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register 888 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
944 * @hw: pointer to hardware structure 889 * @hw: pointer to hardware structure
945 * @reg: analog register to read 890 * @reg: analog register to read
@@ -1128,8 +1073,8 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1128 .get_link_capabilities = &ixgbe_get_link_capabilities_82598, 1073 .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
1129 .led_on = &ixgbe_led_on_generic, 1074 .led_on = &ixgbe_led_on_generic,
1130 .led_off = &ixgbe_led_off_generic, 1075 .led_off = &ixgbe_led_off_generic,
1131 .blink_led_start = &ixgbe_blink_led_start_82598, 1076 .blink_led_start = &ixgbe_blink_led_start_generic,
1132 .blink_led_stop = &ixgbe_blink_led_stop_82598, 1077 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1133 .set_rar = &ixgbe_set_rar_generic, 1078 .set_rar = &ixgbe_set_rar_generic,
1134 .clear_rar = &ixgbe_clear_rar_generic, 1079 .clear_rar = &ixgbe_clear_rar_generic,
1135 .set_vmdq = &ixgbe_set_vmdq_82598, 1080 .set_vmdq = &ixgbe_set_vmdq_82598,
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index beae7e012609..29771fbaa42d 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -68,8 +68,6 @@ s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, 68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan,
69 u32 vind, bool vlan_on); 69 u32 vind, bool vlan_on);
70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw); 70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw);
71s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index);
72s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index);
73s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw); 71s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw);
74s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val); 72s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val);
75s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val); 73s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val);
@@ -991,40 +989,6 @@ s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
991} 989}
992 990
993/** 991/**
994 * ixgbe_blink_led_start_82599 - Blink LED based on index.
995 * @hw: pointer to hardware structure
996 * @index: led number to blink
997 **/
998s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index)
999{
1000 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1001
1002 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1003 led_reg |= IXGBE_LED_BLINK(index);
1004 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1005 IXGBE_WRITE_FLUSH(hw);
1006
1007 return 0;
1008}
1009
1010/**
1011 * ixgbe_blink_led_stop_82599 - Stop blinking LED based on index.
1012 * @hw: pointer to hardware structure
1013 * @index: led number to stop blinking
1014 **/
1015s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index)
1016{
1017 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1018
1019 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1020 led_reg &= ~IXGBE_LED_BLINK(index);
1021 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1022 IXGBE_WRITE_FLUSH(hw);
1023
1024 return 0;
1025}
1026
1027/**
1028 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array 992 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
1029 * @hw: pointer to hardware structure 993 * @hw: pointer to hardware structure
1030 **/ 994 **/
@@ -1243,8 +1207,8 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
1243 .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 1207 .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
1244 .led_on = &ixgbe_led_on_generic, 1208 .led_on = &ixgbe_led_on_generic,
1245 .led_off = &ixgbe_led_off_generic, 1209 .led_off = &ixgbe_led_off_generic,
1246 .blink_led_start = &ixgbe_blink_led_start_82599, 1210 .blink_led_start = &ixgbe_blink_led_start_generic,
1247 .blink_led_stop = &ixgbe_blink_led_stop_82599, 1211 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1248 .set_rar = &ixgbe_set_rar_generic, 1212 .set_rar = &ixgbe_set_rar_generic,
1249 .clear_rar = &ixgbe_clear_rar_generic, 1213 .clear_rar = &ixgbe_clear_rar_generic,
1250 .set_vmdq = &ixgbe_set_vmdq_82599, 1214 .set_vmdq = &ixgbe_set_vmdq_82599,
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 **/
2080s32 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 **/
2112s32 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}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 24f73e719c3f..dd260890ad0a 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -76,6 +76,9 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val); 76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val);
77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val); 77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val);
78 78
79s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
80s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
81
79#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 82#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
80 83
81#ifndef writeq 84#ifndef writeq