[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f65deb0d-29d1-4820-95e9-f1dd94967957@lunn.ch>
Date: Wed, 23 Jul 2025 16:53:16 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/2] net: stmmac: Return early if invalid in
loongson_dwmac_fix_reset()
On Wed, Jul 23, 2025 at 06:00:55PM +0800, Tiezhu Yang wrote:
> If the MAC controller does not connect to any PHY interface, there is a
> missing clock, then the DMA reset fails.
>
> For this case, the DMA_BUS_MODE_SFT_RESET bit is 1 before software reset,
> just return -EINVAL immediately to avoid waiting for the timeout when the
> DMA reset fails in loongson_dwmac_fix_reset().
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index e1591e6217d4..6d10077666c7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -513,6 +513,9 @@ static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
> {
> u32 value = readl(ioaddr + DMA_BUS_MODE);
>
> + if (value & DMA_BUS_MODE_SFT_RESET)
> + return -EINVAL;
What happens with this return value? Do you get an error message which
gives a hint the PHY clock is missing? Would a netdev_err() make sense
here?
Andrew
Powered by blists - more mailing lists