Commit cf7ed221 authored by Akeem G. Abodunrin's avatar Akeem G. Abodunrin Committed by Jeff Kirsher

igb: Changed LEDs blink mechanism to include designs using cathode

This patch addresses the changes needed to make LEDs work properly with
negative logic. This implementation uses LED Invert bit to reverse the
logic issue that occurred when LEDs are driven by cathode. Keep LEDs
blinking for SerDes devices. Also made changes to magic number and the
for loop to reduce number of shifts.
Signed-off-by: default avatarAkeem G Abodunrin <akeem.g.abodunrin@intel.com>
Tested-by: default avatarJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 6c1d8b96
...@@ -270,8 +270,10 @@ ...@@ -270,8 +270,10 @@
#define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX #define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX
/* LED Control */ /* LED Control */
#define E1000_LEDCTL_LED0_MODE_SHIFT 0 #define E1000_LEDCTL_LED0_MODE_SHIFT 0
#define E1000_LEDCTL_LED0_BLINK 0x00000080 #define E1000_LEDCTL_LED0_BLINK 0x00000080
#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F
#define E1000_LEDCTL_LED0_IVRT 0x00000040
#define E1000_LEDCTL_MODE_LED_ON 0xE #define E1000_LEDCTL_MODE_LED_ON 0xE
#define E1000_LEDCTL_MODE_LED_OFF 0xF #define E1000_LEDCTL_MODE_LED_OFF 0xF
......
...@@ -1406,15 +1406,34 @@ s32 igb_blink_led(struct e1000_hw *hw) ...@@ -1406,15 +1406,34 @@ s32 igb_blink_led(struct e1000_hw *hw)
u32 ledctl_blink = 0; u32 ledctl_blink = 0;
u32 i; u32 i;
/* set the blink bit for each LED that's "on" (0x0E) if (hw->phy.media_type == e1000_media_type_fiber) {
* in ledctl_mode2 /* always blink LED0 for PCI-E fiber */
*/ ledctl_blink = E1000_LEDCTL_LED0_BLINK |
ledctl_blink = hw->mac.ledctl_mode2; (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT);
for (i = 0; i < 4; i++) } else {
if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) == /* Set the blink bit for each LED that's "on" (0x0E)
E1000_LEDCTL_MODE_LED_ON) * (or "off" if inverted) in ledctl_mode2. The blink
ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << * logic in hardware only works when mode is set to "on"
(i * 8)); * so it must be changed accordingly when the mode is
* "off" and inverted.
*/
ledctl_blink = hw->mac.ledctl_mode2;
for (i = 0; i < 32; i += 8) {
u32 mode = (hw->mac.ledctl_mode2 >> i) &
E1000_LEDCTL_LED0_MODE_MASK;
u32 led_default = hw->mac.ledctl_default >> i;
if ((!(led_default & E1000_LEDCTL_LED0_IVRT) &&
(mode == E1000_LEDCTL_MODE_LED_ON)) ||
((led_default & E1000_LEDCTL_LED0_IVRT) &&
(mode == E1000_LEDCTL_MODE_LED_OFF))) {
ledctl_blink &=
~(E1000_LEDCTL_LED0_MODE_MASK << i);
ledctl_blink |= (E1000_LEDCTL_LED0_BLINK |
E1000_LEDCTL_MODE_LED_ON) << i;
}
}
}
wr32(E1000_LEDCTL, ledctl_blink); wr32(E1000_LEDCTL, ledctl_blink);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment