From patchwork Wed Sep 28 00:58:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12991531 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 756EDC54EE9 for ; Wed, 28 Sep 2022 00:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232366AbiI1A73 (ORCPT ); Tue, 27 Sep 2022 20:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbiI1A7R (ORCPT ); Tue, 27 Sep 2022 20:59:17 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC356133CB9 for ; Tue, 27 Sep 2022 17:59:16 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id d1so7323957qvs.0 for ; Tue, 27 Sep 2022 17:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date; bh=YiOiyM1L1O+Ly/EJcn4Ens4K01PieDn8TFMxXwOUKx0=; b=Tnmh3uYTW4ujUoaTIz2HGJENzKdshu/JYlE6B7sDmW+QS6Ipn+jH+oovAsmoGq7/Bi Nt/KQsT/wmNI90mXqi3at294+4jOQOx9yFRqvBQpySSK80yrEkbC+iGp2Tv1W7g2UsDJ vBadMEAGYm2WnGXnGjtVYqJaPDJAqzyL4KgjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date; bh=YiOiyM1L1O+Ly/EJcn4Ens4K01PieDn8TFMxXwOUKx0=; b=DPbsG4Wo9w6eY1LjZCKjihPJfJ5JF10swZqW86SvI8fg06kAKrU7a+IZMaBPZiDOkq kfA+c74/LFeLX2BSX3jJ1qyYT/4xEUvJAOaiYJ7zjYW6qViDgm0b7ORl7BWJ2gI1Pgo2 kXoJ1BoefOu1vHOg0bebzIhgfNImZieMD5JgqbPxZ+/s6GyQAQLZy9v6lThlcyyWaZvr QjqceaoAHBP135fzeMdsZkhXrq8WRDNtlW51ygbGzdATWhefWcT6d5hM6uU57Q7p/MN9 kLRBd6j9FG0r2wD8K3+E7WjLjgDmueK3onNY/b85H6hhRobQMOhUL8e1kuheQswL0sM2 wdwQ== X-Gm-Message-State: ACrzQf2djVAjFIfI1QcQnRMN7LuTdqb+8g6kzweFcF96lWsv7nWeAE3N g03LnrAEMLqZ8MYi0HCfICRgfA== X-Google-Smtp-Source: AMsMyM4uYzg1tmfKueiTD8Bthel8ou1zBEODj7yT8D2qR7BJPKBk11Vo401Bh+pW5kDwPpM8DwKv8g== X-Received: by 2002:a05:6214:19e7:b0:4aa:216f:5ab5 with SMTP id q7-20020a05621419e700b004aa216f5ab5mr23598655qvc.66.1664326755446; Tue, 27 Sep 2022 17:59:15 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i11-20020a05620a248b00b006cbb8ca04f8sm2078668qkn.40.2022.09.27.17.59.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2022 17:59:14 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, gospo@broadcom.com, vikas.gupta@broadcom.com Subject: [PATCH net-next 3/6] bnxt_en: Add bank parameter to bnxt_read_sfp_module_eeprom_info() Date: Tue, 27 Sep 2022 20:58:41 -0400 Message-Id: <1664326724-1415-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1664326724-1415-1-git-send-email-michael.chan@broadcom.com> References: <1664326724-1415-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vikas Gupta 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 Signed-off-by: Michael Chan --- 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;