aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Tantilov <emil.s.tantilov@intel.com>2011-04-07 21:24:05 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-04-27 05:12:01 -0400
commit98508c93003d8d24662f32c66dbe4746340c33d4 (patch)
tree53f79a65e4849324fcb6fe5b69104fc30cad65af
parent0665b09f81760c38a882bed65d495a4bd31a5767 (diff)
ixgbe: add LED blink code for x540
Implement blink_led_start and blink_led_stop functions for x540 using the MACC register. Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Evan Swanson <evan.swanson@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c64
1 files changed, 62 insertions, 2 deletions
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index 932394fce439..75c6465db893 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -744,6 +744,66 @@ static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw)
744 IXGBE_WRITE_FLUSH(hw); 744 IXGBE_WRITE_FLUSH(hw);
745} 745}
746 746
747/**
748 * ixgbe_blink_led_start_X540 - Blink LED based on index.
749 * @hw: pointer to hardware structure
750 * @index: led number to blink
751 *
752 * Devices that implement the version 2 interface:
753 * X540
754 **/
755static s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index)
756{
757 u32 macc_reg;
758 u32 ledctl_reg;
759
760 /*
761 * In order for the blink bit in the LED control register
762 * to work, link and speed must be forced in the MAC. We
763 * will reverse this when we stop the blinking.
764 */
765 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
766 macc_reg |= IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS;
767 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
768
769 /* Set the LED to LINK_UP + BLINK. */
770 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
771 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
772 ledctl_reg |= IXGBE_LED_BLINK(index);
773 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
774 IXGBE_WRITE_FLUSH(hw);
775
776 return 0;
777}
778
779/**
780 * ixgbe_blink_led_stop_X540 - Stop blinking LED based on index.
781 * @hw: pointer to hardware structure
782 * @index: led number to stop blinking
783 *
784 * Devices that implement the version 2 interface:
785 * X540
786 **/
787static s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index)
788{
789 u32 macc_reg;
790 u32 ledctl_reg;
791
792 /* Restore the LED to its default value. */
793 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
794 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
795 ledctl_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
796 ledctl_reg &= ~IXGBE_LED_BLINK(index);
797 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
798
799 /* Unforce link and speed in the MAC. */
800 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
801 macc_reg &= ~(IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS);
802 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
803 IXGBE_WRITE_FLUSH(hw);
804
805 return 0;
806}
747static struct ixgbe_mac_operations mac_ops_X540 = { 807static struct ixgbe_mac_operations mac_ops_X540 = {
748 .init_hw = &ixgbe_init_hw_generic, 808 .init_hw = &ixgbe_init_hw_generic,
749 .reset_hw = &ixgbe_reset_hw_X540, 809 .reset_hw = &ixgbe_reset_hw_X540,
@@ -767,8 +827,8 @@ static struct ixgbe_mac_operations mac_ops_X540 = {
767 .get_link_capabilities = &ixgbe_get_copper_link_capabilities_generic, 827 .get_link_capabilities = &ixgbe_get_copper_link_capabilities_generic,
768 .led_on = &ixgbe_led_on_generic, 828 .led_on = &ixgbe_led_on_generic,
769 .led_off = &ixgbe_led_off_generic, 829 .led_off = &ixgbe_led_off_generic,
770 .blink_led_start = &ixgbe_blink_led_start_generic, 830 .blink_led_start = &ixgbe_blink_led_start_X540,
771 .blink_led_stop = &ixgbe_blink_led_stop_generic, 831 .blink_led_stop = &ixgbe_blink_led_stop_X540,
772 .set_rar = &ixgbe_set_rar_generic, 832 .set_rar = &ixgbe_set_rar_generic,
773 .clear_rar = &ixgbe_clear_rar_generic, 833 .clear_rar = &ixgbe_clear_rar_generic,
774 .set_vmdq = &ixgbe_set_vmdq_generic, 834 .set_vmdq = &ixgbe_set_vmdq_generic,