patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Igor Russkikh <Igor.Russkikh@aquantia.com>
To: "stable@dpdk.org" <stable@dpdk.org>,
	"ktraynor@redhat.com" <ktraynor@redhat.com>
Cc: Pavel Belous <Pavel.Belous@aquantia.com>,
	Igor Russkikh <Igor.Russkikh@aquantia.com>,
	Pavel Belous <Pavel.Belous@aquantia.com>
Subject: [dpdk-stable] [PATCH v2 18.11 09/10] net/atlantic: use capability bits to detect eeprom access
Date: Tue, 21 May 2019 08:55:38 +0000	[thread overview]
Message-ID: <c8cb27d48fb95086850263c034a29f3ee17d2444.1558426315.git.igor.russkikh@aquantia.com> (raw)
In-Reply-To: <cover.1558426315.git.igor.russkikh@aquantia.com>

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>
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
 drivers/net/atlantic/atl_types.h                |  2 ++
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h
index 83170856d003..c53d5896902c 100644
--- a/drivers/net/atlantic/atl_types.h
+++ b/drivers/net/atlantic/atl_types.h
@@ -94,6 +94,8 @@ struct aq_hw_s {
 	struct hw_atl_stats_s last_stats;
 	struct aq_stats_s curr_stats;
 
+	u32 caps_lo;
+
 	u64 speed;
 	unsigned int chip_features;
 	u32 fw_ver_actual;
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 9803af614422..171bac46f019 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 {
@@ -62,6 +61,7 @@ static int aq_fw2x_set_state(struct aq_hw_s *self,
 static int aq_fw2x_init(struct aq_hw_s *self)
 {
 	int err = 0;
+	struct hw_aq_atl_utils_mbox mbox;
 
 	/* check 10 times by 1ms */
 	AQ_HW_WAIT_FOR(0U != (self->mbox_addr =
@@ -70,6 +70,12 @@ static int aq_fw2x_init(struct aq_hw_s *self)
 	AQ_HW_WAIT_FOR(0U != (self->rpc_addr =
 		       aq_hw_read_reg(self, HW_ATL_FW2X_MPI_RPC_ADDR)),
 		       1000U, 100U);
+
+	/* Read caps */
+	hw_atl_utils_mpi_read_stats(self, &mbox);
+
+	self->caps_lo = mbox.info.caps_lo;
+
 	return err;
 }
 
@@ -502,7 +508,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;
@@ -580,7 +586,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;
-- 
2.17.1


  parent reply	other threads:[~2019-05-21  8:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  8:55 [dpdk-stable] [PATCH v2 18.11 00/10] Aquantia atlantic bugfixes Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 01/10] net/atlantic: enable broadcast traffic Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 02/10] net/atlantic: extra line at eof Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 03/10] net/atlantic: error handling for mailbox access Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 04/10] net/atlantic: eeprom get/set should consider offset Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 05/10] net/atlantic: fix max eeprom size Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 06/10] net/atlantic: validity check for eeprom dev address Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 07/10] net/atlantic: bad logic with offsets talking with firmware Igor Russkikh
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 08/10] net/atlantic: flow control settings synchronization on rx Igor Russkikh
2019-05-21  8:55 ` Igor Russkikh [this message]
2019-05-21  8:55 ` [dpdk-stable] [PATCH v2 18.11 10/10] net/atlantic: eliminate excessive log levels on Rx/Tx Igor Russkikh
2019-05-21 12:55 ` [dpdk-stable] [PATCH v2 18.11 00/10] Aquantia atlantic bugfixes Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8cb27d48fb95086850263c034a29f3ee17d2444.1558426315.git.igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=Pavel.Belous@aquantia.com \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).