[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1664326724-1415-4-git-send-email-michael.chan@broadcom.com>
Date: Tue, 27 Sep 2022 20:58:41 -0400
From: Michael Chan <michael.chan@...adcom.com>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, kuba@...nel.org, edumazet@...gle.com,
pabeni@...hat.com, gospo@...adcom.com, vikas.gupta@...adcom.com
Subject: [PATCH net-next 3/6] bnxt_en: Add bank parameter to bnxt_read_sfp_module_eeprom_info()
From: Vikas Gupta <vikas.gupta@...adcom.com>
Newer firmware supports the bank number parameter in the
HWRM_PORT_PHY_I2C_READ command. Modify the function to pass in
the optional bank number for eeprom. Existing callers will not use the
new bank number. It will be used in subsequent patches.
Signed-off-by: Vikas Gupta <vikas.gupta@...adcom.com>
Signed-off-by: Michael Chan <michael.chan@...adcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 +
.../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 ++++++++++++-------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index c54f8c9ab3ad..0209f7caf490 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -2116,6 +2116,7 @@ struct bnxt {
#define BNXT_PHY_FL_NO_FCS PORT_PHY_QCAPS_RESP_FLAGS_NO_FCS
#define BNXT_PHY_FL_NO_PAUSE (PORT_PHY_QCAPS_RESP_FLAGS2_PAUSE_UNSUPPORTED << 8)
#define BNXT_PHY_FL_NO_PFC (PORT_PHY_QCAPS_RESP_FLAGS2_PFC_UNSUPPORTED << 8)
+#define BNXT_PHY_FL_BANK_SEL (PORT_PHY_QCAPS_RESP_FLAGS2_BANK_ADDR_SUPPORTED << 8)
u8 num_tests;
struct bnxt_test_info *test_info;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 6596dca94c3d..1c8a92fa2f2c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -3146,7 +3146,8 @@ static int bnxt_get_eee(struct net_device *dev, struct ethtool_eee *edata)
}
static int bnxt_read_sfp_module_eeprom_info(struct bnxt *bp, u16 i2c_addr,
- u16 page_number, u16 start_addr,
+ u16 page_number, u8 bank,
+ bool bank_sel_en, u16 start_addr,
u16 data_length, u8 *buf)
{
struct hwrm_port_phy_i2c_read_output *output;
@@ -3168,8 +3169,11 @@ static int bnxt_read_sfp_module_eeprom_info(struct bnxt *bp, u16 i2c_addr,
data_length -= xfer_size;
req->page_offset = cpu_to_le16(start_addr + byte_offset);
req->data_length = xfer_size;
- req->enables = cpu_to_le32(start_addr + byte_offset ?
- PORT_PHY_I2C_READ_REQ_ENABLES_PAGE_OFFSET : 0);
+ req->bank_number = bank;
+ req->enables = cpu_to_le32((start_addr + byte_offset ?
+ PORT_PHY_I2C_READ_REQ_ENABLES_PAGE_OFFSET : 0) |
+ (bank_sel_en ?
+ PORT_PHY_I2C_READ_REQ_ENABLES_BANK_NUMBER : 0));
rc = hwrm_req_send(bp, req);
if (!rc)
memcpy(buf + byte_offset, output->data, xfer_size);
@@ -3199,8 +3203,8 @@ static int bnxt_get_module_info(struct net_device *dev,
if (bp->hwrm_spec_code < 0x10202)
return -EOPNOTSUPP;
- rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0,
- SFF_DIAG_SUPPORT_OFFSET + 1,
+ rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0, false,
+ 0, SFF_DIAG_SUPPORT_OFFSET + 1,
data);
if (!rc) {
u8 module_id = data[0];
@@ -3244,8 +3248,8 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
u8 max_pages = 2;
int rc = 0;
- rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0,
- SFF_DIAG_SUPPORT_OFFSET + 1,
+ rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0, false,
+ 0, SFF_DIAG_SUPPORT_OFFSET + 1,
module_info);
if (rc)
return rc;
@@ -3261,7 +3265,8 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
case SFF_MODULE_ID_QSFP28: {
u8 opt_pages;
- rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0,
+ rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0, 0,
+ false,
SFF8636_OPT_PAGES_OFFSET,
1, &opt_pages);
if (rc)
@@ -3330,7 +3335,8 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
if (pg_addr[page]) {
rc = bnxt_read_sfp_module_eeprom_info(bp, pg_addr[page],
- raw_page, offset,
+ raw_page, 0,
+ false, offset,
chunk, data);
if (rc)
return rc;
--
2.18.1
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)
Powered by blists - more mailing lists