[09/11] net/atlantic: use capability bits to detect eeprom access

Message ID a6bd60972f02da33a3e2fa13b5f1be07b5a8e64c.1556525874.git.igor.russkikh@aquantia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Aquantia atlantic bugfixes |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Igor Russkikh April 29, 2019, 8:20 a.m. UTC
  From: Pavel Belous <pavel.belous@aquantia.com>

Its better to use capability bits FW provides to detect whether
firmware has APIs for EEPROM access.

Before that explicit FW version comparison was used and that may
cause conflicts.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
---
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
index e07ed5e3a8c9..0d24aa99bda0 100644
--- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -34,7 +34,6 @@ 
 #define HAL_ATLANTIC_WOL_FILTERS_COUNT     8
 #define HAL_ATLANTIC_UTILS_FW2X_MSG_WOL    0x0E
 
-#define HW_ATL_FW_FEATURE_EEPROM 0x03010025
 #define HW_ATL_FW_FEATURE_LED 0x03010026
 
 struct fw2x_msg_wol_pattern {
@@ -513,7 +512,7 @@  static int aq_fw2x_get_eeprom(struct aq_hw_s *self, int dev_addr,
 	u32 mpi_opts;
 	int err = 0;
 
-	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
+	if ((self->caps_lo & BIT(CAPS_LO_SMBUS_READ)) == 0)
 		return -EOPNOTSUPP;
 
 	request.msg_id = 0;
@@ -591,7 +590,7 @@  static int aq_fw2x_set_eeprom(struct aq_hw_s *self, int dev_addr,
 	u32 mpi_opts, result = 0;
 	int err = 0;
 
-	if (self->fw_ver_actual < HW_ATL_FW_FEATURE_EEPROM)
+	if ((self->caps_lo & BIT(CAPS_LO_SMBUS_WRITE)) == 0)
 		return -EOPNOTSUPP;
 
 	request.msg_id = 0;