From patchwork Thu Jul 15 13:53:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 95883 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57294A0A0C; Thu, 15 Jul 2021 15:53:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F3D24121B; Thu, 15 Jul 2021 15:53:46 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D623740143 for ; Thu, 15 Jul 2021 15:53:44 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16FDp9Lt020151; Thu, 15 Jul 2021 06:53:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=orbVrBTzt0BRL+fu7oVYvNmCoBKGDyei2Py5yIp8BlE=; b=Nw0TnXaj2aM5LocP4NiGobD4KvR1FaphzZkXpCU+jI4nEcnXU3JPYm+FnfkyjOto+lMn 3gZdkC+Uvmm3cRXZLa7IaVXyzPZU+W5F3zdynp/MFYtF/3neCoO1x+GY6FUxCRCYvZA1 VpJC1Fd5vk3cPTVPA2BrXujCWXuWUzTP2OOHrwrJ8xFL5ScDNi8Cv31jru7UFos3/N3B KC7/c1XYMVossYWIYr9j/k9mY5Yr2YefFsE5uSOTZ6HmWVSIxLVy6wKnT1sFma7lyZoU IzCNLDHwMKLcl2e0w+NxhXxMe8Qlck4bI2Q7JGfViCrL6H+8wi94qji4V2D5z8e0o+ss kA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 39tggc176s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 15 Jul 2021 06:53:41 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 15 Jul 2021 06:53:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 15 Jul 2021 06:53:40 -0700 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id DF00D3F7081; Thu, 15 Jul 2021 06:53:37 -0700 (PDT) From: Tomasz Duszynski To: , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: , Tomasz Duszynski Date: Thu, 15 Jul 2021 08:53:27 -0500 Message-ID: <20210715135330.2541009-2-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210715135330.2541009-1-tduszynski@marvell.com> References: <20210715135330.2541009-1-tduszynski@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 9OYzk8qefqBXR7YjnaaqZpLUkQWUGHlb X-Proofpoint-ORIG-GUID: 9OYzk8qefqBXR7YjnaaqZpLUkQWUGHlb X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-15_07:2021-07-14, 2021-07-15 signatures=0 Subject: [dpdk-dev] [PATCH 1/4] common/cnxk: support reading BPHY CGX/RPM FEC X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Before setting FEC for specific LMAC one needs to know which type is actually supported because it generally differs between modes LMAC operates in (SGMII, SFI, etc.). Signed-off-by: Tomasz Duszynski --- drivers/common/cnxk/roc_bphy_cgx.c | 25 +++++++++++++++++++++++++ drivers/common/cnxk/roc_bphy_cgx.h | 3 +++ drivers/common/cnxk/roc_bphy_cgx_priv.h | 4 ++++ drivers/common/cnxk/version.map | 1 + 4 files changed, 33 insertions(+) diff --git a/drivers/common/cnxk/roc_bphy_cgx.c b/drivers/common/cnxk/roc_bphy_cgx.c index 056a3db47f..467b67686b 100644 --- a/drivers/common/cnxk/roc_bphy_cgx.c +++ b/drivers/common/cnxk/roc_bphy_cgx.c @@ -395,3 +395,28 @@ roc_bphy_cgx_ptp_rx_disable(struct roc_bphy_cgx *roc_cgx, unsigned int lmac) { return roc_bphy_cgx_ptp_rx_ena_dis(roc_cgx, lmac, false); } + +int +roc_bphy_cgx_fec_supported_get(struct roc_bphy_cgx *roc_cgx, unsigned int lmac, + enum roc_bphy_cgx_eth_link_fec *fec) +{ + uint64_t scr1, scr0; + int ret; + + if (!roc_cgx || !fec) + return -EINVAL; + + if (!roc_bphy_cgx_lmac_exists(roc_cgx, lmac)) + return -EINVAL; + + scr1 = FIELD_PREP(SCR1_ETH_CMD_ID, ETH_CMD_GET_SUPPORTED_FEC); + + ret = roc_bphy_cgx_intf_req(roc_cgx, lmac, scr1, &scr0); + if (ret) + return ret; + + scr0 = FIELD_GET(SCR0_ETH_FEC_TYPES_S_FEC, scr0); + *fec = (enum roc_bphy_cgx_eth_link_fec)scr0; + + return 0; +} diff --git a/drivers/common/cnxk/roc_bphy_cgx.h b/drivers/common/cnxk/roc_bphy_cgx.h index 49c35a1e63..9439f88b34 100644 --- a/drivers/common/cnxk/roc_bphy_cgx.h +++ b/drivers/common/cnxk/roc_bphy_cgx.h @@ -115,6 +115,9 @@ __roc_api int roc_bphy_cgx_ptp_rx_enable(struct roc_bphy_cgx *roc_cgx, unsigned int lmac); __roc_api int roc_bphy_cgx_ptp_rx_disable(struct roc_bphy_cgx *roc_cgx, unsigned int lmac); +__roc_api int roc_bphy_cgx_fec_supported_get(struct roc_bphy_cgx *roc_cgx, + unsigned int lmac, + enum roc_bphy_cgx_eth_link_fec *fec); #endif /* _ROC_BPHY_CGX_H_ */ diff --git a/drivers/common/cnxk/roc_bphy_cgx_priv.h b/drivers/common/cnxk/roc_bphy_cgx_priv.h index 71a277fffd..93aa43ef5a 100644 --- a/drivers/common/cnxk/roc_bphy_cgx_priv.h +++ b/drivers/common/cnxk/roc_bphy_cgx_priv.h @@ -66,6 +66,7 @@ enum eth_cmd_id { ETH_CMD_INTERNAL_LBK = 7, ETH_CMD_MODE_CHANGE = 11, /* hot plug support */ ETH_CMD_INTF_SHUTDOWN = 12, + ETH_CMD_GET_SUPPORTED_FEC = 18, ETH_CMD_SET_PTP_MODE = 34, }; @@ -109,6 +110,9 @@ enum eth_cmd_own { #define SCR0_ETH_LNK_STS_S_LMAC_TYPE GENMASK_ULL(35, 28) #define SCR0_ETH_LNK_STS_S_MODE GENMASK_ULL(43, 36) +/* struct eth_fec_types_s */ +#define SCR0_ETH_FEC_TYPES_S_FEC GENMASK_ULL(10, 9) + /* scratchx(1) CSR used for non-secure SW->ATF communication * This CSR acts as a command register */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index e3af48c02e..3b9b283b6e 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -24,6 +24,7 @@ INTERNAL { roc_ae_fpm_put; roc_bphy_cgx_dev_fini; roc_bphy_cgx_dev_init; + roc_bphy_cgx_fec_supported_get; roc_bphy_cgx_get_linkinfo; roc_bphy_cgx_intlbk_disable; roc_bphy_cgx_intlbk_enable;