From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76082348877; Fri, 21 Nov 2025 13:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732644; cv=none; b=YIrcjwx2vW+P54wVDr/BWee1P7s2PhNyXir5iI1N2fMN655nfUZ+GMbxOCCSRN2WrNXaQIKBUZ9iGFXOw9H4yk0b/hUqwciGhHMEdgB+MwnarKB1/oy+LctIbCvsQTHsFAGOn8wWiCB34E0uvbQIwswf6Xh/i6T5CiMhqGVgKKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732644; c=relaxed/simple; bh=Tm00xrpjZAKMvCcozkxWloK40X47z2VMJaY2aERrdTc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TiLtLZrF3ms3RUVfeGxXrBTVVtbibIjlC+HJlIxRyrzfvdA3w6vAyGCE8p0GnxVIuL/a7twgt2mMO9kytLmKvBh8KfCX5ae5HsFAg7E5P5XIQ98+4BtqJL+XQIaPdpPJZmp1C/7jvSXFK1Urq/6IcX3/bXu/nLcxtDUcFB808kA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TWkKvxPe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TWkKvxPe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFA6FC4CEF1; Fri, 21 Nov 2025 13:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732644; bh=Tm00xrpjZAKMvCcozkxWloK40X47z2VMJaY2aERrdTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWkKvxPetiKYpl8nkAigigUTo2FCp4mXSHbkqBGRetNqYfFpwf5FIXSLKjbPgxHoE aWKrer0oiYaB9Kui3OEjKYgnK4edncIfOdbrCFgk+WJbg165Rsoi0cSLC+coX/ONID AsRGInmTRI0MJuxwj2jZWgYwJHE77l/SKBZU9Rhk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Colin Foster , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 193/529] smsc911x: add second read of EEPROM mac when possible corruption seen Date: Fri, 21 Nov 2025 14:08:12 +0100 Message-ID: <20251121130237.884069522@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Foster [ Upstream commit 69777753a8919b0b8313c856e707e1d1fe5ced85 ] When the EEPROM MAC is read by way of ADDRH, it can return all 0s the first time. Subsequent reads succeed. This is fully reproduceable on the Phytec PCM049 SOM. Re-read the ADDRH when this behaviour is observed, in an attempt to correctly apply the EEPROM MAC address. Signed-off-by: Colin Foster Link: https://patch.msgid.link/20250903132610.966787-1-colin.foster@in-advantage.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/smsc/smsc911x.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index cb590db625e83..90a8eb517033e 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2162,10 +2162,20 @@ static const struct net_device_ops smsc911x_netdev_ops = { static void smsc911x_read_mac_address(struct net_device *dev) { struct smsc911x_data *pdata = netdev_priv(dev); - u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); - u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL); + u32 mac_high16, mac_low32; u8 addr[ETH_ALEN]; + mac_high16 = smsc911x_mac_read(pdata, ADDRH); + mac_low32 = smsc911x_mac_read(pdata, ADDRL); + + /* The first mac_read in some setups can incorrectly read 0. Re-read it + * to get the full MAC if this is observed. + */ + if (mac_high16 == 0) { + SMSC_TRACE(pdata, probe, "Re-read MAC ADDRH\n"); + mac_high16 = smsc911x_mac_read(pdata, ADDRH); + } + addr[0] = (u8)(mac_low32); addr[1] = (u8)(mac_low32 >> 8); addr[2] = (u8)(mac_low32 >> 16); -- 2.51.0