Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796251813; b=Oa95x0S72aXnaOSmgd+dyI3/RbXemNqOLsoQ/uX/n+jR2W9X1nkhjn1wtpYu4J9MwQ7U e16BE3DtlM/dHBqYrDc1+HvneK18MHlUEajQGVe90ERPO79l3+SFX8kw2YohzHPCF/vXa B5grJj/Es9RE5YENseO2HsGkr/IspDz5DCYV8NY2oE00iD2st2hw06yvZVmI1Qy4sxw8O rA23nE3ZiufyrRZ9lhjVtJURqWGPIWzPteEoVy/btKQkgrM/hkNUqUki20RPhIaHIGwon L6Q6uHeLHEpUt4lIDixhNUUGunLw9NLCAP9L/AhfOtSrgQUGnXXxA/uXObVuwQXwCNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796251813; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=1lLBA6BaxcKCWNCpqn1Ea1AvG0sQeIyUMuc4idnvsdA=; b=q29e0jFxpCketFtMwpj1Q7MTlurs7ZIM6mrgHnbv4FA3S3P/GI3/TymKypCaKHUhPS9z evmHrxGA91nnKgI/lMbLJodUWnBj01lzuteLvIBhHJVaseF4cr3y5QatR2+nJJddyIhqI xXl4D6olKvPEyjjFNUr9LW+WgSEcaMXrOZmZD0OkPNBThx7sE6/vD8jI6gkbighig8C4j ePGYv5K/7EFRUwcrFN1cQxR9vuqSsnpTohth9tCHx3kHCgUZirt6c/ZWTvrzVlMABs2qZ PEOXIZMqm07z/C+vjRI2Yduj/TdRYzdGUd2h9qmuWnZHS/r4rTK9EtVzkyDu0rpniPg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pHODuw9g; arc=none smtp.remote-ip=74.125.82.42 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A060C60A2600 for ; Wed, 2 Dec 2026 22:50:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A060C60A2600 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pHODuw9g Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-14394530ec6so9627380c88.1 for ; Wed, 02 Dec 2026 14:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796251812; x=1796856612; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1lLBA6BaxcKCWNCpqn1Ea1AvG0sQeIyUMuc4idnvsdA=; b=pHODuw9grpGUjP+pzA7/axtKsyWn2n8FD8KWcCNZ7QZnP+xpwmUB3lTvsemlUnE2JX OOxhEIMRcoXk80Cw6h5yeMtcZO8hknqBuMiHC99CMHAYcgPKSW2u8GVlRw60NPPOJliC 6St7RebbZl/x1WV9W8tuJatnZBvS86ALilrSUY3aaNNp3ACYgi+R05ASxYjhsY4QplME ktjX0GZW1LmBbq7Ud7fgDEiVbmrdOCpqPWHrp0Gr9p0kf2N1bQe2/85McdHcbdu1CpSq gr6QQBBl4vZ+qYx5KNolZwclwCCGortCEZPSZMb64tid4nXf3bADLe4zs2GylWvMDJnh VO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796251812; x=1796856612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=1lLBA6BaxcKCWNCpqn1Ea1AvG0sQeIyUMuc4idnvsdA=; b=bmBBIDa1Z0UYFIGECtcDlegKrhJIv/hX1MJ7hXZecCLj7+8r96ggOdQXTBcVB1orr0 uS0g4EAgMXDFbqazOE5NMUTMHlqF7wB9BFzVFL+E9pDByyYiq/SOnidbqVryLOpRp/d/ gIX/KOC+Mp5PLwUqXdG85+ExFWzcyyw6XnqOiQytdC7f6K3/91Wtz4iCrcNm0zcnlflQ CoGoFxI8GBZvJhU0mOQ15nu1DO0Bb3PXnTKi8edzD5YBr7nC21nvK13cAbK9vXL9AD+I o/R58FexqwenELGCf1q2n93AfC6Rs++zlsXduTLUglDDK+z1kjIhcx8aL/5DHlh2e1CH gVkw== X-Forwarded-Encrypted: i=1; AL+hErGKWl1Xp60Ot1dmofH1v7OJWa6P2qDjCuVvAlJUa3bHvrbTLhAQLJbD3SyOK1AHpLrDws7SF+TlRUyEg4Y=@vger.kernel.org X-Gm-Message-State: APuU4Z/HcN4WPzqvIkgxcX0hs+I8inDXMPsFNcDsHHoFgae3imc5MWe+ ksi7INsHoApzGPC8220fOnDbj9CczOt8q+5HTWalnQPmJ8hbAYdWEEPj X-Gm-Gg: AZFdTZe+NOfkOcXMCxepxYKxs9QXy78G0zOeUdWCxf9fEznpUB2w+F8+Yv+pGNlAOgo UWE3SqYLt53vt6LOEB7bOxx5iBhQbSU0sjxdJNhhtDSNllvv4uhDU4hjwbk3KMNTEQsFpBxO0Dj N6htH+0TweqFqQ8jv5rzyvl6uTGn2USN6oX8drYCIyrpVLyIUijaqnS91ORaZFdeMaPtiyeGOpk YW63G+d/18did6ZPTrWCobir9s/F99MgaZPHrj5RCOQIbDGrjmx/6eN7iJOi1SNuKArIrVh/NXt 46iu/R/dVYTfa8hd1kEhQIZkQZ/e58dd9KT/kJtTxcNE4kZmizNC45h2zhEtKxRZ+Ax/K/m2mS+ HOL8tCgaEXX6GHBHCA4BUJwQxTLT2PzuBpIx15TKE35B5tgT79VXIeCFu4SXfowHouHyDsWRh0V B401qFjnM9Xf5+3T2a6bAU+LcPOdvS1+5I+lnR91cPaYpHlphENfWZmCiBoPyU0x/m9fjqDQ7Hj 9ATX5lbw8RKq/gOKRj4JI6kSAmyN4H9S9dvoW5IL7SxL2L6bz8bcFMwSO6Bb70UcNxxKiz13y1o HwEXlpfV5W2flum0sFmKggpP5ybUMklFAY1otdMB9ApIMzOg2w== X-Received: by 2002:a05:7022:f509:b0:1a4:4194:fc04 with SMTP id a92af1059eb24-1b5568e4322mr43579476c88.28.1796251811607; Wed, 02 Dec 2026 14:50:11 -0800 (PST) Received: from eldorado ([2600:8802:b00:1f88:d294:66ff:fe95:a98e]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b55684c85fsm151770048c88.14.2026.12.02.14.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 14:50:10 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Simon Horman , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Jijie Shao , Runyu Xiao , David Yang , Herbert Valerio Riedel , Danny Kukawka , Mugunthan V N , Sebastian Hesselbarth , linux-kernel@vger.kernel.org (open list), Manuel Lauss Subject: [PATCH net v5 04/10] net: au1000: report MDIO transaction timeouts Date: Wed, 2 Dec 2026 14:49:51 -0800 Message-ID: <20261202224957.3043478-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261202224957.3043478-1-f.fainelli@gmail.com> References: <20261202224957.3043478-1-f.fainelli@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The MDIO write callback reports success even if the controller stays busy and no write is issued. Propagate timeout errors and wait for write completion so failure of the final transaction is reported to phylib as well. Return ETIMEDOUT for read timeouts too. Use readl_poll_timeout() for write completion with a 20 microsecond sleep interval and a 20 millisecond timeout. The MDIO callback runs in sleepable context, so avoid adding millisecond busy-waits for completion. Fixes: 0638dec01e89 ("[PATCH] net: au1000_eth: PHY framework conversion") Signed-off-by: Florian Fainelli Reviewed-by: Simon Horman --- drivers/net/ethernet/amd/au1000_eth.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index 7063f9e5bc7c..1935b1d4b173 100644 --- a/drivers/net/ethernet/amd/au1000_eth.c +++ b/drivers/net/ethernet/amd/au1000_eth.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -278,7 +279,7 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg) mdelay(1); if (--timedout == 0) { netdev_err(dev, "read_MII busy timeout!!\n"); - return -1; + return -ETIMEDOUT; } } @@ -292,26 +293,27 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg) mdelay(1); if (--timedout == 0) { netdev_err(dev, "mdio_read busy timeout!!\n"); - return -1; + return -ETIMEDOUT; } } return readl(mii_data_reg); } -static void au1000_mdio_write(struct net_device *dev, int phy_addr, - int reg, u16 value) +static int au1000_mdio_write(struct net_device *dev, int phy_addr, + int reg, u16 value) { struct au1000_private *aup = netdev_priv(dev); u32 *const mii_control_reg = &aup->mac->mii_control; u32 *const mii_data_reg = &aup->mac->mii_data; u32 timedout = 20; u32 mii_control; + int ret; while (readl(mii_control_reg) & MAC_MII_BUSY) { mdelay(1); if (--timedout == 0) { netdev_err(dev, "mdio_write busy timeout!!\n"); - return; + return -ETIMEDOUT; } } @@ -320,6 +322,13 @@ static void au1000_mdio_write(struct net_device *dev, int phy_addr, writel(value, mii_data_reg); writel(mii_control, mii_control_reg); + + ret = readl_poll_timeout(mii_control_reg, mii_control, + !(mii_control & MAC_MII_BUSY), 20, 20000); + if (ret) + netdev_err(dev, "mdio_write completion timeout\n"); + + return ret; } static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) @@ -344,8 +353,7 @@ static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, */ au1000_enable_mac(dev, 0); - au1000_mdio_write(dev, phy_addr, regnum, value); - return 0; + return au1000_mdio_write(dev, phy_addr, regnum, value); } static int au1000_mdiobus_reset(struct mii_bus *bus) -- 2.53.0