netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Romain Gantois <romain.gantois@bootlin.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Jose Abreu" <joabreu@synopsys.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Clément Léger" <clement.leger@bootlin.com>,
	"Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-renesas-soc@vger.kernel.org,
	"Clark Wang" <xiaoning.wang@nxp.com>
Subject: Re: [PATCH net-next v5 5/7] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on
Date: Mon, 4 Mar 2024 14:34:18 +0000	[thread overview]
Message-ID: <ZeXb6p/RpJj1HRgn@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240301-rxc_bugfix-v5-5-8dac30230050@bootlin.com>

On Fri, Mar 01, 2024 at 04:35:02PM +0100, Romain Gantois wrote:
> There is a reocurring issue with stmmac controllers where the MAC fails to
> initialize its hardware if an RX clock signal isn't provided on the MAC/PHY
> link.
> 
> This causes issues when PHY or PCS devices either go into suspend while
> cutting the RX clock or do not bring the clock signal up early enough for
> the MAC to initialize successfully.
> 
> Set the mac_requires_rxc flag in the stmmac phylink config so that PHY/PCS
> drivers know to keep the RX clock up at all times.
> 
> Reported-by: Clark Wang <xiaoning.wang@nxp.com>
> Link: https://lore.kernel.org/all/20230202081559.3553637-1-xiaoning.wang@nxp.com/
> Reported-by: Clément Léger <clement.leger@bootlin.com>
> Link: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/
> Suggested-by: Russell King <linux@armlinux.org.uk>

This should be:
Co-developed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 79844dbe4258..2290f4808d7e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1218,6 +1218,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
>  	priv->phylink_config.type = PHYLINK_NETDEV;
>  	priv->phylink_config.mac_managed_pm = true;
>  
> +	/* Stmmac always requires an RX clock for hardware initialization */
> +	priv->phylink_config.mac_requires_rxc = true;
> +
>  	mdio_bus_data = priv->plat->mdio_bus_data;
>  	if (mdio_bus_data)
>  		priv->phylink_config.ovr_an_inband =
> @@ -3408,6 +3411,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register)
>  	u32 chan;
>  	int ret;
>  
> +	/* Make sure RX clock is enabled */
> +	if (priv->hw->phylink_pcs)
> +		phylink_pcs_pre_init(priv->phylink, priv->hw->phylink_pcs);
> +
>  	/* DMA initialization and SW reset */
>  	ret = stmmac_init_dma_engine(priv);
>  	if (ret < 0) {
> 
> -- 
> 2.43.2
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2024-03-04 14:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 15:34 [PATCH net-next v5 0/7] Fix missing PHY-to-MAC RX clock Romain Gantois
2024-03-01 15:34 ` [PATCH net-next v5 1/7] net: phylink: add PHY_F_RXC_ALWAYS_ON to PHY dev flags Romain Gantois
2024-03-04 13:36   ` Andrew Lunn
2024-03-04 14:31   ` Russell King (Oracle)
2024-03-04 14:42     ` Romain Gantois
2024-03-01 15:34 ` [PATCH net-next v5 2/7] net: phylink: add rxc_always_on flag to phylink_pcs Romain Gantois
2024-03-04 13:40   ` Andrew Lunn
2024-03-04 14:33   ` Russell King (Oracle)
2024-03-01 15:35 ` [PATCH net-next v5 3/7] net: stmmac: don't rely on lynx_pcs presence to check for a PHY Romain Gantois
2024-03-04 13:41   ` Andrew Lunn
2024-03-01 15:35 ` [PATCH net-next v5 4/7] net: stmmac: Support a generic PCS field in mac_device_info Romain Gantois
2024-03-04 13:43   ` Andrew Lunn
2024-03-01 15:35 ` [PATCH net-next v5 5/7] net: stmmac: Signal to PHY/PCS drivers to keep RX clock on Romain Gantois
2024-03-04 13:43   ` Andrew Lunn
2024-03-04 14:34   ` Russell King (Oracle) [this message]
2024-03-01 15:35 ` [PATCH net-next v5 6/7] net: phy: qcom: at803x: Avoid hibernating if MAC requires RX clock Romain Gantois
2024-03-04 13:44   ` Andrew Lunn
2024-03-04 14:34   ` Russell King (Oracle)
2024-03-01 15:35 ` [PATCH net-next v5 7/7] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Romain Gantois
2024-03-04 13:45   ` Andrew Lunn

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=ZeXb6p/RpJj1HRgn@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=clement.leger@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=romain.gantois@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=xiaoning.wang@nxp.com \
    /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).