diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/e1000.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ich8lan.c | 21 |
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index 7877b9c26ed..9fe18d1d53d 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | |||
@@ -469,6 +469,7 @@ struct e1000_info { | |||
469 | enum e1000_state_t { | 469 | enum e1000_state_t { |
470 | __E1000_TESTING, | 470 | __E1000_TESTING, |
471 | __E1000_RESETTING, | 471 | __E1000_RESETTING, |
472 | __E1000_ACCESS_SHARED_RESOURCE, | ||
472 | __E1000_DOWN | 473 | __E1000_DOWN |
473 | }; | 474 | }; |
474 | 475 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 4f709749dbc..6a17c62cb86 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -852,8 +852,6 @@ static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) | |||
852 | mutex_unlock(&nvm_mutex); | 852 | mutex_unlock(&nvm_mutex); |
853 | } | 853 | } |
854 | 854 | ||
855 | static DEFINE_MUTEX(swflag_mutex); | ||
856 | |||
857 | /** | 855 | /** |
858 | * e1000_acquire_swflag_ich8lan - Acquire software control flag | 856 | * e1000_acquire_swflag_ich8lan - Acquire software control flag |
859 | * @hw: pointer to the HW structure | 857 | * @hw: pointer to the HW structure |
@@ -866,7 +864,12 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
866 | u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; | 864 | u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; |
867 | s32 ret_val = 0; | 865 | s32 ret_val = 0; |
868 | 866 | ||
869 | mutex_lock(&swflag_mutex); | 867 | if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE, |
868 | &hw->adapter->state)) { | ||
869 | WARN(1, "e1000e: %s: contention for Phy access\n", | ||
870 | hw->adapter->netdev->name); | ||
871 | return -E1000_ERR_PHY; | ||
872 | } | ||
870 | 873 | ||
871 | while (timeout) { | 874 | while (timeout) { |
872 | extcnf_ctrl = er32(EXTCNF_CTRL); | 875 | extcnf_ctrl = er32(EXTCNF_CTRL); |
@@ -878,7 +881,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
878 | } | 881 | } |
879 | 882 | ||
880 | if (!timeout) { | 883 | if (!timeout) { |
881 | e_dbg("SW/FW/HW has locked the resource for too long.\n"); | 884 | e_dbg("SW has already locked the resource.\n"); |
882 | ret_val = -E1000_ERR_CONFIG; | 885 | ret_val = -E1000_ERR_CONFIG; |
883 | goto out; | 886 | goto out; |
884 | } | 887 | } |
@@ -898,7 +901,9 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
898 | } | 901 | } |
899 | 902 | ||
900 | if (!timeout) { | 903 | if (!timeout) { |
901 | e_dbg("Failed to acquire the semaphore.\n"); | 904 | e_dbg("Failed to acquire the semaphore, FW or HW has it: " |
905 | "FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n", | ||
906 | er32(FWSM), extcnf_ctrl); | ||
902 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 907 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
903 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 908 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
904 | ret_val = -E1000_ERR_CONFIG; | 909 | ret_val = -E1000_ERR_CONFIG; |
@@ -907,7 +912,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
907 | 912 | ||
908 | out: | 913 | out: |
909 | if (ret_val) | 914 | if (ret_val) |
910 | mutex_unlock(&swflag_mutex); | 915 | clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state); |
911 | 916 | ||
912 | return ret_val; | 917 | return ret_val; |
913 | } | 918 | } |
@@ -932,7 +937,7 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | |||
932 | e_dbg("Semaphore unexpectedly released by sw/fw/hw\n"); | 937 | e_dbg("Semaphore unexpectedly released by sw/fw/hw\n"); |
933 | } | 938 | } |
934 | 939 | ||
935 | mutex_unlock(&swflag_mutex); | 940 | clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state); |
936 | } | 941 | } |
937 | 942 | ||
938 | /** | 943 | /** |
@@ -3139,7 +3144,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
3139 | msleep(20); | 3144 | msleep(20); |
3140 | 3145 | ||
3141 | if (!ret_val) | 3146 | if (!ret_val) |
3142 | mutex_unlock(&swflag_mutex); | 3147 | clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state); |
3143 | 3148 | ||
3144 | if (ctrl & E1000_CTRL_PHY_RST) { | 3149 | if (ctrl & E1000_CTRL_PHY_RST) { |
3145 | ret_val = hw->phy.ops.get_cfg_done(hw); | 3150 | ret_val = hw->phy.ops.get_cfg_done(hw); |