From: Andrew Halaney <ahalaney@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: agross@kernel.org, andersson@kernel.org,
konrad.dybcio@linaro.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
vkoul@kernel.org, bhupesh.sharma@linaro.org,
mturquette@baylibre.com, sboyd@kernel.org,
peppe.cavallaro@st.com, alexandre.torgue@foss.st.com,
joabreu@synopsys.com, mcoquelin.stm32@gmail.com,
richardcochran@gmail.com, linux@armlinux.org.uk,
veekhee@apple.com, tee.min.tan@linux.intel.com,
mohammad.athari.ismail@intel.com, jonathanh@nvidia.com,
ruppala@nvidia.com, bmasney@redhat.com,
andrey.konovalov@linaro.org, linux-arm-msm@vger.kernel.org,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-clk@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, ncai@quicinc.com,
jsuraj@qti.qualcomm.com, hisunil@quicinc.com,
echanude@redhat.com, Andrew Halaney <ahalaney@redhat.com>
Subject: [PATCH net-next v2 10/12] net: stmmac: dwmac-qcom-ethqos: Respect phy-mode and TX delay
Date: Mon, 20 Mar 2023 17:16:15 -0500 [thread overview]
Message-ID: <20230320221617.236323-11-ahalaney@redhat.com> (raw)
In-Reply-To: <20230320221617.236323-1-ahalaney@redhat.com>
The driver currently sets a MAC TX delay of 2 ns no matter what the
phy-mode is. If the phy-mode indicates the phy is in charge of the
TX delay (rgmii-txid, rgmii-id), don't do it in the MAC.
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
Changes since v1:
* Use a consistent subject prefix with other stmmac changes in series (myself)
.../stmicro/stmmac/dwmac-qcom-ethqos.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 32763566c214..e89937916741 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -279,6 +279,16 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos)
{
+ int phy_mode;
+ int phase_shift;
+
+ /* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */
+ phy_mode = device_get_phy_mode(ðqos->pdev->dev);
+ if (phy_mode == PHY_INTERFACE_MODE_RGMII_ID || phy_mode == PHY_INTERFACE_MODE_RGMII_TXID)
+ phase_shift = 0;
+ else
+ phase_shift = RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN;
+
/* Disable loopback mode */
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN,
0, RGMII_IO_MACRO_CONFIG2);
@@ -300,9 +310,9 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos)
RGMII_CONFIG_PROG_SWAP, RGMII_IO_MACRO_CONFIG);
rgmii_updatel(ethqos, RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL,
0, RGMII_IO_MACRO_CONFIG2);
+
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
- RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
- RGMII_IO_MACRO_CONFIG2);
+ phase_shift, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15,
0, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP,
@@ -336,8 +346,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos)
rgmii_updatel(ethqos, RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL,
0, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
- RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
- RGMII_IO_MACRO_CONFIG2);
+ phase_shift, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG_MAX_SPD_PRG_2,
BIT(6), RGMII_IO_MACRO_CONFIG);
rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15,
@@ -375,7 +384,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos)
rgmii_updatel(ethqos, RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL,
0, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
- 0, RGMII_IO_MACRO_CONFIG2);
+ phase_shift, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG_MAX_SPD_PRG_9,
BIT(12) | GENMASK(9, 8),
RGMII_IO_MACRO_CONFIG);
--
2.39.2
next prev parent reply other threads:[~2023-03-20 22:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 22:16 [PATCH net-next v2 00/12] Add EMAC3 support for sa8540p-ride Andrew Halaney
2023-03-20 22:16 ` [PATCH net-next v2 01/12] dt-bindings: net: snps,dwmac: Update interrupt-names Andrew Halaney
2023-03-21 6:46 ` Krzysztof Kozlowski
2023-03-20 22:16 ` [PATCH net-next v2 02/12] dt-bindings: net: snps,dwmac: Add Qualcomm Ethernet ETHQOS compatibles Andrew Halaney
2023-03-20 22:16 ` [PATCH net-next v2 03/12] dt-bindings: net: qcom,ethqos: Convert bindings to yaml Andrew Halaney
2023-03-21 6:47 ` Krzysztof Kozlowski
2023-03-20 22:16 ` [PATCH net-next v2 04/12] dt-bindings: net: qcom,ethqos: Add Qualcomm sc8280xp compatibles Andrew Halaney
2023-03-21 6:47 ` Krzysztof Kozlowski
2023-03-20 22:16 ` [PATCH net-next v2 05/12] clk: qcom: gcc-sc8280xp: Add EMAC GDSCs Andrew Halaney
2023-03-21 19:33 ` Konrad Dybcio
2023-03-20 22:16 ` [PATCH net-next v2 06/12] arm64: dts: qcom: sc8280xp: Add ethernet nodes Andrew Halaney
2023-03-21 19:33 ` Konrad Dybcio
2023-03-20 22:16 ` [PATCH net-next v2 07/12] arm64: dts: qcom: sa8540p-ride: " Andrew Halaney
2023-03-20 22:16 ` [PATCH net-next v2 08/12] net: stmmac: Remove unnecessary if statement brackets Andrew Halaney
2023-03-20 22:16 ` [PATCH net-next v2 09/12] net: stmmac: Add EMAC3 variant of dwmac4 Andrew Halaney
2023-03-21 3:41 ` Jakub Kicinski
2023-03-21 22:19 ` Andrew Halaney
2023-03-20 22:16 ` Andrew Halaney [this message]
2023-03-21 3:29 ` [PATCH net-next v2 10/12] net: stmmac: dwmac-qcom-ethqos: Respect phy-mode and TX delay Jakub Kicinski
2023-03-20 22:16 ` [PATCH net-next v2 11/12] net: stmmac: dwmac-qcom-ethqos: Use loopback_en for all speeds Andrew Halaney
2023-03-20 22:16 ` [PATCH net-next v2 12/12] net: stmmac: dwmac-qcom-ethqos: Add EMAC3 support Andrew Halaney
2023-03-21 3:28 ` [PATCH net-next v2 00/12] Add EMAC3 support for sa8540p-ride Jakub Kicinski
2023-03-21 18:44 ` Andrew Halaney
2023-03-22 2:44 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230320221617.236323-11-ahalaney@redhat.com \
--to=ahalaney@redhat.com \
--cc=agross@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=andrey.konovalov@linaro.org \
--cc=bhupesh.sharma@linaro.org \
--cc=bmasney@redhat.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=echanude@redhat.com \
--cc=edumazet@google.com \
--cc=hisunil@quicinc.com \
--cc=joabreu@synopsys.com \
--cc=jonathanh@nvidia.com \
--cc=jsuraj@qti.qualcomm.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=mohammad.athari.ismail@intel.com \
--cc=mturquette@baylibre.com \
--cc=ncai@quicinc.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=richardcochran@gmail.com \
--cc=robh+dt@kernel.org \
--cc=ruppala@nvidia.com \
--cc=sboyd@kernel.org \
--cc=tee.min.tan@linux.intel.com \
--cc=veekhee@apple.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).