Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10483855rwp; Thu, 20 Jul 2023 23:07:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlEToZkLEw+cMPC+Tk7XYcELvzt9QxYI87RaSgoRj5UfVppWyLXzRps0HL2/CYo94CbdnKPE X-Received: by 2002:a05:6a20:a126:b0:126:8b2d:4462 with SMTP id q38-20020a056a20a12600b001268b2d4462mr2203491pzk.24.1689919634811; Thu, 20 Jul 2023 23:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689919634; cv=none; d=google.com; s=arc-20160816; b=KhC/O18+ObElfF9imG8u7MP94HZyk90LrAA75YcIXrWO+NDt1h0tXXgClJY6IUA1Sc QMJ+4aSfv69CklGokFA2UnTsbQYq0c9X03aDglbY5m8q+RzmYNs5R7EYx1KXqVa6Q4rp zF3B9fpVNtKJnPyK1IvzKhlNwmsOHDfyOKkCjR1AYSrRKecO0XLSxxsVuRhcNTKSbode oHxT9WQ8WIiQJcLai+X/lw+sfj6x+XiYQndagSNwh1n2cV8eILSrpNdypSUhaJzuOdBA Qar2ONqe4bYuONbK8FZ9v1Vg5+FZYakYm/W4zg4JhuVQyLgarXsEbDnV2/XVBk1t06j2 gH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3Wj6FWZ2eQePlwJzwtPrT1FwF370uWCxqOs6c1GQoAE=; fh=qv6R2IaILI1S1xEIxOZzAcF4rN0hGtVsF9kjKc0mAD0=; b=kIWp9vS8JuEUjzhV5Umxj2QwuzZzF/yUUobnbY7wlMODlHsUKWKmA7De/E4pjWb1ot on9ai52IgxTUY7Dg+Erytpe86TGp4T88yCU4BeZYb7GHCwqcXHPKL3WVD7uh24uEHo6U dq8WWjtLK/auPNfXxhmTnKoZ1sDdlotAQaeudXRpp/SwH/zT4q68UdzSJINzFwYzBsLB PYuQ0fPPUisgOm2Y5yc0CV7fu6u+HNZDhPADzlO9kN4Sf55TYk74f+DxJpTHkiR4JZi8 LLr0+PC60uRcBN2A4UIKamBuPLGQdnNcMnRj2mOKWa4zjgApoLVK5N0iCb4MZ55Z59Cb kg4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=p6MmXsC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs65-20020a632844000000b0055c8d01ad16si2237736pgb.265.2023.07.20.23.07.01; Thu, 20 Jul 2023 23:07:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=p6MmXsC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjGUGAu (ORCPT + 99 others); Fri, 21 Jul 2023 02:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjGUGAp (ORCPT ); Fri, 21 Jul 2023 02:00:45 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DF30E62; Thu, 20 Jul 2023 23:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1689919245; x=1721455245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pDx+xIc1pKw69N9rcGWkTVyLaxLMsH85HpuhblKYyE4=; b=p6MmXsC8fVtcYPzIIwpmdiHfoBu+92jb+l4ppVMeZXDcaiUkpiqLJaj+ 4nBkdcFewSTqQTb12vomUMXdP4DgkQ4khU2ILkHRrukHcZNguBFIO/wb5 zran0cThTWzfWMPXzfxM9QWFqirtjmIC0cDeffHSjol4euM4Y3V0v5BkJ NBryNKvi5pIBXCwbjksUXC15gFtiDzwaV1O87DVSWwnKoXcgG7EQhYldz LhXXEBPPWg/yc1WPOOKy63aQyEYMeebpj3SSafXSc4XfJkTHzy4Qnb0mQ wDFBIO51U4q/dxFqHm1MpggRzIeDyn/ZXBc2DcwiNAsksHBW4W4/Dli/K A==; X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="225102735" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jul 2023 23:00:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 20 Jul 2023 23:00:43 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Thu, 20 Jul 2023 23:00:41 -0700 From: Raju Lakkaraju To: CC: , , , , , , Subject: [PATCH net-next 3/7] net: lan743x: Add SFP support check flag Date: Fri, 21 Jul 2023 11:30:15 +0530 Message-ID: <20230721060019.2737-4-Raju.Lakkaraju@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721060019.2737-1-Raju.Lakkaraju@microchip.com> References: <20230721060019.2737-1-Raju.Lakkaraju@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCI11x1x chip support the Pluggable module (SFP) depend on Board requirement. SFP support information programmed in EEPROM. Flag "is_sfp_support_en" update on "STRAP" register. Signed-off-by: Raju Lakkaraju --- drivers/net/ethernet/microchip/lan743x_main.c | 10 ++++++++++ drivers/net/ethernet/microchip/lan743x_main.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index e8dd272a591a..822576b088a9 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -52,6 +52,11 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter) adapter->is_sgmii_en = true; else adapter->is_sgmii_en = false; + + if ((strap & STRAP_SFP_USE_EN_) && (strap & STRAP_SFP_EN_)) + adapter->is_sfp_support_en = true; + else + adapter->is_sfp_support_en = false; } else { chip_rev = lan743x_csr_read(adapter, FPGA_REV); if (chip_rev) { @@ -63,8 +68,12 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter) adapter->is_sgmii_en = false; } } + netif_dbg(adapter, drv, adapter->netdev, "SGMII I/F %sable\n", adapter->is_sgmii_en ? "En" : "Dis"); + netif_dbg(adapter, drv, adapter->netdev, + "SFP support %sable\n", adapter->is_sfp_support_en ? + "En" : "Dis"); } static bool is_pci11x1x_chip(struct lan743x_adapter *adapter) @@ -3408,6 +3417,7 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev, NETIF_MSG_LINK | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN | NETIF_MSG_TX_QUEUED; netdev->max_mtu = LAN743X_MAX_FRAME_SIZE; + adapter->is_sfp_support_en = false; of_get_mac_address(pdev->dev.of_node, adapter->mac_address); diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h index 0cd3fe71dfad..3889bb20a524 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.h +++ b/drivers/net/ethernet/microchip/lan743x_main.h @@ -34,6 +34,8 @@ #define STRAP_READ (0x0C) #define STRAP_READ_USE_SGMII_EN_ BIT(22) +#define STRAP_SFP_USE_EN_ BIT(31) +#define STRAP_SFP_EN_ BIT(15) #define STRAP_READ_SGMII_EN_ BIT(6) #define STRAP_READ_SGMII_REFCLK_ BIT(5) #define STRAP_READ_SGMII_2_5G_ BIT(4) @@ -1038,6 +1040,7 @@ struct lan743x_adapter { u8 max_tx_channels; u8 used_tx_channels; u8 max_vector_count; + bool is_sfp_support_en; #define LAN743X_ADAPTER_FLAG_OTP BIT(0) u32 flags; -- 2.25.1