Message ID | 20231201100548.12994-1-quic_snehshah@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1009122vqy; Fri, 1 Dec 2023 02:07:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFA4MZ+F8l4gFPYT0H6skzBgHrfLgFhqOgIK+FuwQI0V9szJFsWsGobjG09B5bW4oFNUei5 X-Received: by 2002:a05:6358:10c:b0:16f:eb38:e930 with SMTP id f12-20020a056358010c00b0016feb38e930mr6700784rwa.13.1701425222962; Fri, 01 Dec 2023 02:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701425222; cv=none; d=google.com; s=arc-20160816; b=yd1oLvmpmzB2Q/gyRGfeP/CGSXGwnjHlg2gnj85UEJjk05igHVPgJs/som08eQcPnJ ps0nO93ffueNCFfBbbolaCJLtDpwA15lVwg7+1PCMO6xcaG6lfF2ix4pNkoUxRz2crg9 LlcnwtHwdxkXJabXI2hp5MPRzcb+VtXhPfeAHgFcsS3hJJNuEXlS8BG74IUln0KVdOPG WlEAfqhqtPsovkeqsKXIWVBGRU+YIcQeQSM6lBjk/uBBfolYI2k9JgbjQbFMJU6mpKo4 BwA5AJqYd/D4vntPyfBEp2Sz5AIcIhkDm7YYxKDGTcTnVPSFE4vMG0noOcMibPww26rk uxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=A1EGrq2r/Zjw8fa3aqVFo2FlroFAid1G/BIBvjuO6XE=; fh=1Jy5qpJ7e4FuBmQkVP0GCA4F+wDSel+w4r34NwoYij8=; b=fLSBYZi5DbSKB0YSA6jEdSr15H0qzdIFi1pLOYAOt+hgj1lE7O2j8DNtx2uIHXV0qE 5k+AQKp+t+aUPyAa5M1Ni8LslDA9U/WoQRcsnagYfa97PXowvtYDT5AM2lqAAjxEx5Pl oCq8+ptxFDuUxuMZF9u41OUk7yE6PXq4QbefcS45VQ1QsWtmPQbcPic0YsLkKTvpK2C1 ih4UEdvbBNDjVgg3amlbjouMoO64/aiNoki0sAa18eA4Uvi9pyfzW8xCMMowVUBfRTKA ihjVSqNEOfJQ6redBSarYLCcl5AN8tnab+PtRKWBYQysAleHx7Z7C+XPhB5ajgwauz46 VGGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EolkPQDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z6-20020a63d006000000b005b977eea853si3166450pgf.694.2023.12.01.02.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 02:07:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=EolkPQDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 69211807EDB6; Fri, 1 Dec 2023 02:06:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378124AbjLAKGN (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Fri, 1 Dec 2023 05:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377899AbjLAKGL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 1 Dec 2023 05:06:11 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 442FBB2; Fri, 1 Dec 2023 02:06:18 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B14mDrR030535; Fri, 1 Dec 2023 10:06:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id; s=qcppdkim1; bh=A1EGrq2r/Zjw8fa3aqVFo2FlroFAid1G/BIBvjuO6XE=; b=EolkPQDcG1j3zhat+vvfRdu5KMutWS9ebFOytYPeKH34926T1Fy4QjTwnIXJyUeoKiGG QKzL8mon3wb6igqPzbAHzbVFP9S+YnNyh59iUmBq3xgHziu3s1IArhuzVvEsOZuQk8RO U62qDOJfQ/IMLGqTWHLzlKdDdhWf7/CpdS0vyvWP/OG1y9sQUICF1imGBh/kqcppNnus Uvlh3tpXKg/88lgNWoIl0iI1AUZL2HyEh/1Osm9uyKl9IZGaFLlL+rmz4TszjTz47tiS a5TjpqmBhnyvlh4HdxJ+WuFML4t7Vu09xZasH3yRalVzmIlvTnh9dWt0kRm8wXnT3zGC zQ== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uprhdu3v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Dec 2023 10:06:02 +0000 Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3B1A5urY026649; Fri, 1 Dec 2023 10:05:56 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 3unmf087ye-1; Fri, 01 Dec 2023 10:05:56 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3B1A5uQd026644; Fri, 1 Dec 2023 10:05:56 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-snehshah-hyd.qualcomm.com [10.147.246.35]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 3B1A5ulh026640; Fri, 01 Dec 2023 10:05:56 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2319345) id 6DC595001C3; Fri, 1 Dec 2023 15:35:55 +0530 (+0530) From: Sneh Shah <quic_snehshah@quicinc.com> To: Vinod Koul <vkoul@kernel.org>, Bhupesh Sharma <bhupesh.sharma@linaro.org>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sneh Shah <quic_snehshah@quicinc.com>, kernel@quicinc.com, Andrew Halaney <ahalaney@redhat.com> Subject: [PATCH v2] net: stmmac: update Rx clk divider for 10M SGMII Date: Fri, 1 Dec 2023 15:35:48 +0530 Message-Id: <20231201100548.12994-1-quic_snehshah@quicinc.com> X-Mailer: git-send-email 2.17.1 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: H7GjdgLppbe_t5WTRxU9l3iP1t53Znd7 X-Proofpoint-GUID: H7GjdgLppbe_t5WTRxU9l3iP1t53Znd7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_07,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 impostorscore=0 mlxlogscore=763 clxscore=1015 mlxscore=0 priorityscore=1501 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312010067 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 02:06:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784073654321728240 X-GMAIL-MSGID: 1784073654321728240 |
Series |
[v2] net: stmmac: update Rx clk divider for 10M SGMII
|
|
Commit Message
Sneh Shah
Dec. 1, 2023, 10:05 a.m. UTC
SGMII 10MBPS mode needs RX clock divider to avoid drops in Rx.
Update configure SGMII function with rx clk divider programming.
Fixes: 463120c31c58 ("net: stmmac: dwmac-qcom-ethqos: add support for SGMII")
Signed-off-by: Sneh Shah <quic_snehshah@quicinc.com>
---
v2 changelog:
- Use FIELD_PREP to prepare bifield values in place of GENMASK
- Add fixes tag
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Fri, Dec 01, 2023 at 03:35:48PM +0530, Sneh Shah wrote: > SGMII 10MBPS mode needs RX clock divider to avoid drops in Rx. > Update configure SGMII function with rx clk divider programming. > [PATCH v2] net: stmmac: update Rx clk divider for 10M SGMII It would be better to add "dwmac-qcom-ethqos" prefix to the subject since the patch concerns the Qualcomm Eth MAC only. -Serge(y) > > Fixes: 463120c31c58 ("net: stmmac: dwmac-qcom-ethqos: add support for SGMII") > Signed-off-by: Sneh Shah <quic_snehshah@quicinc.com> > --- > v2 changelog: > - Use FIELD_PREP to prepare bifield values in place of GENMASK > - Add fixes tag > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index d3bf42d0fceb..df6ff8bcdb5c 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -34,6 +34,7 @@ > #define RGMII_CONFIG_LOOPBACK_EN BIT(2) > #define RGMII_CONFIG_PROG_SWAP BIT(1) > #define RGMII_CONFIG_DDR_MODE BIT(0) > +#define RGMII_CONFIG_SGMII_CLK_DVDR GENMASK(18, 10) > > /* SDCC_HC_REG_DLL_CONFIG fields */ > #define SDCC_DLL_CONFIG_DLL_RST BIT(30) > @@ -617,6 +618,9 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > case SPEED_10: > val |= ETHQOS_MAC_CTRL_PORT_SEL; > val &= ~ETHQOS_MAC_CTRL_SPEED_MODE; > + rgmii_updatel(ethqos, RGMII_CONFIG_SGMII_CLK_DVDR, > + FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR, 0x31), > + RGMII_IO_MACRO_CONFIG); > break; > } > > -- > 2.17.1 > >
On Fri, Dec 01, 2023 at 03:35:48PM +0530, Sneh Shah wrote: > SGMII 10MBPS mode needs RX clock divider to avoid drops in Rx. > Update configure SGMII function with rx clk divider programming. > > Fixes: 463120c31c58 ("net: stmmac: dwmac-qcom-ethqos: add support for SGMII") > Signed-off-by: Sneh Shah <quic_snehshah@quicinc.com> Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride I can confirm that without this patch traffic doesn't seem to work when I force things in to SPEED_10 with ethtool (which required another change to this driver in stmmac_ethtool.c to do so, which as far as I understand Sarosh from your group will be upstreaming soon and is an independent issue). I am curious, I expected to see some dropped/errors output in ip link when things weren't working. I guess the sgmii phy in the soc is rejecting these prior to handing them to the mac? Or am I misunderstanding how that works? > --- > v2 changelog: > - Use FIELD_PREP to prepare bifield values in place of GENMASK > - Add fixes tag > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index d3bf42d0fceb..df6ff8bcdb5c 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -34,6 +34,7 @@ > #define RGMII_CONFIG_LOOPBACK_EN BIT(2) > #define RGMII_CONFIG_PROG_SWAP BIT(1) > #define RGMII_CONFIG_DDR_MODE BIT(0) > +#define RGMII_CONFIG_SGMII_CLK_DVDR GENMASK(18, 10) > > /* SDCC_HC_REG_DLL_CONFIG fields */ > #define SDCC_DLL_CONFIG_DLL_RST BIT(30) > @@ -617,6 +618,9 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > case SPEED_10: > val |= ETHQOS_MAC_CTRL_PORT_SEL; > val &= ~ETHQOS_MAC_CTRL_SPEED_MODE; > + rgmii_updatel(ethqos, RGMII_CONFIG_SGMII_CLK_DVDR, > + FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR, 0x31), > + RGMII_IO_MACRO_CONFIG); Russell requested a comment about why you must program this every time, I think it's a good idea too: https://lore.kernel.org/netdev/ZWch7LIqbMEaLRLW@shell.armlinux.org.uk/ Also on my wishlist is making 0x31 less magic, but Santa might not bring that for me :) > break; > } > > -- > 2.17.1 > >
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index d3bf42d0fceb..df6ff8bcdb5c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -34,6 +34,7 @@ #define RGMII_CONFIG_LOOPBACK_EN BIT(2) #define RGMII_CONFIG_PROG_SWAP BIT(1) #define RGMII_CONFIG_DDR_MODE BIT(0) +#define RGMII_CONFIG_SGMII_CLK_DVDR GENMASK(18, 10) /* SDCC_HC_REG_DLL_CONFIG fields */ #define SDCC_DLL_CONFIG_DLL_RST BIT(30) @@ -617,6 +618,9 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) case SPEED_10: val |= ETHQOS_MAC_CTRL_PORT_SEL; val &= ~ETHQOS_MAC_CTRL_SPEED_MODE; + rgmii_updatel(ethqos, RGMII_CONFIG_SGMII_CLK_DVDR, + FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR, 0x31), + RGMII_IO_MACRO_CONFIG); break; }