From: "Abhishek Chauhan (ABC)" <quic_abchauha@quicinc.com>
To: Sneh Shah <quic_snehshah@quicinc.com>,
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: <kernel@quicinc.com>, Andrew Halaney <ahalaney@redhat.com>
Subject: Re: [PATCH net-next v5] net: stmmac: dwmac-qcom-ethqos: Add support for 2.5G SGMII
Date: Tue, 20 Feb 2024 13:22:19 -0800 [thread overview]
Message-ID: <e3688f73-2040-4cd2-965a-0ed5482aff2d@quicinc.com> (raw)
In-Reply-To: <20240220050735.29507-1-quic_snehshah@quicinc.com>
On 2/19/2024 9:07 PM, Sneh Shah wrote:
> Serdes phy needs to operate at 2500 mode for 2.5G speed and 1000
> mode for 1G/100M/10M speed.
> Added changes to configure serdes phy and mac based on link speed.
> Changing serdes phy speed involves multiple register writes for
> serdes block. To avoid redundant write operations only update serdes
> phy when new speed is different.
> For 2500 speed MAC PCS autoneg needs to disabled. Added changes to
> disable MAC PCS autoneg if ANE parameter is not set.
>
> Signed-off-by: Sneh Shah <quic_snehshah@quicinc.com>
Tested-by: Abhishek Chauhan <quic_abchauha@quicinc.com> # sa8775p-ride
Reviewed-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
> ---
> v5 changelog:
> - Updated commit message with more details on MAC PCS autoneg disable
> v4 changelog:
> - Made cosmetic changes
> v3 changelog:
> - updated commit message
> ---
> v2 changelog:
> - updated stmmac_pcs_ane to support autoneg disable
> - Update serdes speed to 1000 for 100M and 10M also---
> ---
> .../stmicro/stmmac/dwmac-qcom-ethqos.c | 26 +++++++++++++++++++
> .../net/ethernet/stmicro/stmmac/stmmac_pcs.h | 2 ++
> 2 files changed, 28 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 31631e3f89d0..6bbdbb7bef44 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -106,6 +106,7 @@ struct qcom_ethqos {
> struct clk *link_clk;
> struct phy *serdes_phy;
> unsigned int speed;
> + int serdes_speed;
> phy_interface_t phy_mode;
>
> const struct ethqos_emac_por *por;
> @@ -606,19 +607,39 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos)
> */
> static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos)
> {
> + struct net_device *dev = platform_get_drvdata(ethqos->pdev);
> + struct stmmac_priv *priv = netdev_priv(dev);
> int val;
>
> val = readl(ethqos->mac_base + MAC_CTRL_REG);
>
> switch (ethqos->speed) {
> + case SPEED_2500:
> + val &= ~ETHQOS_MAC_CTRL_PORT_SEL;
> + rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
> + RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
> + RGMII_IO_MACRO_CONFIG2);
> + if (ethqos->serdes_speed != SPEED_2500)
> + phy_set_speed(ethqos->serdes_phy, SPEED_2500);
> + ethqos->serdes_speed = SPEED_2500;
> + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
> + break;
> case SPEED_1000:
> val &= ~ETHQOS_MAC_CTRL_PORT_SEL;
> rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
> RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
> RGMII_IO_MACRO_CONFIG2);
> + if (ethqos->serdes_speed != SPEED_1000)
> + phy_set_speed(ethqos->serdes_phy, SPEED_1000);
> + ethqos->serdes_speed = SPEED_1000;
> + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
> break;
> case SPEED_100:
> val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE;
> + if (ethqos->serdes_speed != SPEED_1000)
> + phy_set_speed(ethqos->serdes_phy, SPEED_1000);
> + ethqos->serdes_speed = SPEED_1000;
> + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
> break;
> case SPEED_10:
> val |= ETHQOS_MAC_CTRL_PORT_SEL;
> @@ -627,6 +648,10 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos)
> FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR,
> SGMII_10M_RX_CLK_DVDR),
> RGMII_IO_MACRO_CONFIG);
> + if (ethqos->serdes_speed != SPEED_1000)
> + phy_set_speed(ethqos->serdes_phy, ethqos->speed);
> + ethqos->serdes_speed = SPEED_1000;
> + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
> break;
> }
>
> @@ -799,6 +824,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
> "Failed to get serdes phy\n");
>
> ethqos->speed = SPEED_1000;
> + ethqos->serdes_speed = SPEED_1000;
> ethqos_update_link_clk(ethqos, SPEED_1000);
> ethqos_set_func_clk_en(ethqos);
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
> index aefc121464b5..13a30e6df4c1 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
> @@ -110,6 +110,8 @@ static inline void dwmac_ctrl_ane(void __iomem *ioaddr, u32 reg, bool ane,
> /* Enable and restart the Auto-Negotiation */
> if (ane)
> value |= GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_RAN;
> + else
> + value &= ~GMAC_AN_CTRL_ANE;
>
> /* In case of MAC-2-MAC connection, block is configured to operate
> * according to MAC conf register.
next prev parent reply other threads:[~2024-02-20 21:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 5:07 Sneh Shah
2024-02-20 21:22 ` Abhishek Chauhan (ABC) [this message]
2024-02-23 11:00 ` patchwork-bot+netdevbpf
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=e3688f73-2040-4cd2-965a-0ed5482aff2d@quicinc.com \
--to=quic_abchauha@quicinc.com \
--cc=ahalaney@redhat.com \
--cc=alexandre.torgue@foss.st.com \
--cc=bhupesh.sharma@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=kernel@quicinc.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=quic_snehshah@quicinc.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
all inboxes | Powered by JetHome®