aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDon Skidmore <donald.c.skidmore@intel.com>2011-02-24 20:58:04 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-03-03 07:39:37 -0500
commit5e655105e3e19d746f9e95c514b014c11c3d1b6a (patch)
treec2ad547b4479533bb2a3295e0e3b49a27f90b918 /drivers
parent93cb38dc185f31159d1be70ffcc46802312fa537 (diff)
ixgbe: add function pointer for semaphore function
The X540 devices grabs semaphores differently than 82599 and 82598 devices do. They do however also grab them in allot of the same functions. So I'm adding a new MAC operation function pointer to allow us to use the correct function based on our MAC type. I'm also changing all the semaphore calls to use this new function pointer. Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Tested-by: Stephen Ko <stephen.s.ko@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.c8
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c6
6 files changed, 19 insertions, 9 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 8f6205ef4a97..2da629a30531 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -1201,6 +1201,8 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1201 .clear_vfta = &ixgbe_clear_vfta_82598, 1201 .clear_vfta = &ixgbe_clear_vfta_82598,
1202 .set_vfta = &ixgbe_set_vfta_82598, 1202 .set_vfta = &ixgbe_set_vfta_82598,
1203 .fc_enable = &ixgbe_fc_enable_82598, 1203 .fc_enable = &ixgbe_fc_enable_82598,
1204 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
1205 .release_swfw_sync = &ixgbe_release_swfw_sync,
1204}; 1206};
1205 1207
1206static struct ixgbe_eeprom_operations eeprom_ops_82598 = { 1208static struct ixgbe_eeprom_operations eeprom_ops_82598 = {
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 3d40e68b1b89..8f7c6bd341f6 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -112,7 +112,8 @@ static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
112 goto setup_sfp_out; 112 goto setup_sfp_out;
113 113
114 /* PHY config will finish before releasing the semaphore */ 114 /* PHY config will finish before releasing the semaphore */
115 ret_val = ixgbe_acquire_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); 115 ret_val = hw->mac.ops.acquire_swfw_sync(hw,
116 IXGBE_GSSR_MAC_CSR_SM);
116 if (ret_val != 0) { 117 if (ret_val != 0) {
117 ret_val = IXGBE_ERR_SWFW_SYNC; 118 ret_val = IXGBE_ERR_SWFW_SYNC;
118 goto setup_sfp_out; 119 goto setup_sfp_out;
@@ -2044,6 +2045,9 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2044 .setup_sfp = &ixgbe_setup_sfp_modules_82599, 2045 .setup_sfp = &ixgbe_setup_sfp_modules_82599,
2045 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, 2046 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
2046 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing, 2047 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
2048 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
2049 .release_swfw_sync = &ixgbe_release_swfw_sync,
2050
2047}; 2051};
2048 2052
2049static struct ixgbe_eeprom_operations eeprom_ops_82599 = { 2053static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 33f568cff060..bd14ea4d9570 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -745,7 +745,7 @@ static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw)
745 u32 eec; 745 u32 eec;
746 u32 i; 746 u32 i;
747 747
748 if (ixgbe_acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) != 0) 748 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) != 0)
749 status = IXGBE_ERR_SWFW_SYNC; 749 status = IXGBE_ERR_SWFW_SYNC;
750 750
751 if (status == 0) { 751 if (status == 0) {
@@ -768,7 +768,7 @@ static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw)
768 IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); 768 IXGBE_WRITE_REG(hw, IXGBE_EEC, eec);
769 hw_dbg(hw, "Could not acquire EEPROM grant\n"); 769 hw_dbg(hw, "Could not acquire EEPROM grant\n");
770 770
771 ixgbe_release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 771 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
772 status = IXGBE_ERR_EEPROM; 772 status = IXGBE_ERR_EEPROM;
773 } 773 }
774 774
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 16b5f499b6b8..f4569e8f375d 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -205,7 +205,7 @@ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
205 else 205 else
206 gssr = IXGBE_GSSR_PHY0_SM; 206 gssr = IXGBE_GSSR_PHY0_SM;
207 207
208 if (ixgbe_acquire_swfw_sync(hw, gssr) != 0) 208 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != 0)
209 status = IXGBE_ERR_SWFW_SYNC; 209 status = IXGBE_ERR_SWFW_SYNC;
210 210
211 if (status == 0) { 211 if (status == 0) {
@@ -277,7 +277,7 @@ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
277 } 277 }
278 } 278 }
279 279
280 ixgbe_release_swfw_sync(hw, gssr); 280 hw->mac.ops.release_swfw_sync(hw, gssr);
281 } 281 }
282 282
283 return status; 283 return status;
@@ -303,7 +303,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
303 else 303 else
304 gssr = IXGBE_GSSR_PHY0_SM; 304 gssr = IXGBE_GSSR_PHY0_SM;
305 305
306 if (ixgbe_acquire_swfw_sync(hw, gssr) != 0) 306 if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != 0)
307 status = IXGBE_ERR_SWFW_SYNC; 307 status = IXGBE_ERR_SWFW_SYNC;
308 308
309 if (status == 0) { 309 if (status == 0) {
@@ -370,7 +370,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
370 } 370 }
371 } 371 }
372 372
373 ixgbe_release_swfw_sync(hw, gssr); 373 hw->mac.ops.release_swfw_sync(hw, gssr);
374 } 374 }
375 375
376 return status; 376 return status;
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 8e0a2130f42d..e940f23a6441 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2495,6 +2495,8 @@ struct ixgbe_mac_operations {
2495 s32 (*write_analog_reg8)(struct ixgbe_hw*, u32, u8); 2495 s32 (*write_analog_reg8)(struct ixgbe_hw*, u32, u8);
2496 s32 (*setup_sfp)(struct ixgbe_hw *); 2496 s32 (*setup_sfp)(struct ixgbe_hw *);
2497 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); 2497 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32);
2498 s32 (*acquire_swfw_sync)(struct ixgbe_hw *, u16);
2499 void (*release_swfw_sync)(struct ixgbe_hw *, u16);
2498 2500
2499 /* Link */ 2501 /* Link */
2500 void (*disable_tx_laser)(struct ixgbe_hw *); 2502 void (*disable_tx_laser)(struct ixgbe_hw *);
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index 11cb136c0150..eb047736c4cb 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -287,7 +287,7 @@ static s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data)
287{ 287{
288 s32 status; 288 s32 status;
289 289
290 if (ixgbe_acquire_swfw_sync_X540(hw, IXGBE_GSSR_EEP_SM) == 0) 290 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == 0)
291 status = ixgbe_read_eerd_generic(hw, offset, data); 291 status = ixgbe_read_eerd_generic(hw, offset, data);
292 else 292 else
293 status = IXGBE_ERR_SWFW_SYNC; 293 status = IXGBE_ERR_SWFW_SYNC;
@@ -320,7 +320,7 @@ static s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data)
320 (data << IXGBE_EEPROM_RW_REG_DATA) | 320 (data << IXGBE_EEPROM_RW_REG_DATA) |
321 IXGBE_EEPROM_RW_REG_START; 321 IXGBE_EEPROM_RW_REG_START;
322 322
323 if (ixgbe_acquire_swfw_sync_X540(hw, IXGBE_GSSR_EEP_SM) == 0) { 323 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) == 0) {
324 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); 324 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE);
325 if (status != 0) { 325 if (status != 0) {
326 hw_dbg(hw, "Eeprom write EEWR timed out\n"); 326 hw_dbg(hw, "Eeprom write EEWR timed out\n");
@@ -695,6 +695,8 @@ static struct ixgbe_mac_operations mac_ops_X540 = {
695 .setup_sfp = NULL, 695 .setup_sfp = NULL,
696 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, 696 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
697 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing, 697 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
698 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
699 .release_swfw_sync = &ixgbe_release_swfw_sync_X540,
698}; 700};
699 701
700static struct ixgbe_eeprom_operations eeprom_ops_X540 = { 702static struct ixgbe_eeprom_operations eeprom_ops_X540 = {