From patchwork Mon Jan 29 22:49:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13536476 X-Patchwork-Delegate: kuba@kernel.org Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 5E6A14F5ED; Mon, 29 Jan 2024 22:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706568623; cv=none; b=oeFdK0gyHJLOpkCYj5fxu6cAu+T1wLy5OIhqqGGyyPt4t1rVTXOWUOxG9tkcDyVuCyCmR36KxNydSg06mswcRR01P7hwD9NTYDgqvImCn5cYrlOEdAbuPs6InmD5jAdnydoL6vI5DSbZxSEh4iTZ2+H4HlBBpPEOQptD/oMjE9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706568623; c=relaxed/simple; bh=QwxS36Fs8KqCf1UAhmxBRh7I0VEHIgeYiJUVvMVZB/0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gL+zb41wW47rMnd2Dbf0OZuh4rCiH77ObeuBsqU8vi5d8FpjujZV9K/AwXk5GAp34luBkeT5rnxa04/PDoB/PDFA/V/xZlRjZV1+CIoivII9QF5BYfGL6vn0MPTichf4L0LJUngfhIuaMa+CZZouYiIDlOWU9kYjOLxXB33LuKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=40T+yWrj; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="40T+yWrj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Content-Disposition:In-Reply-To:References; bh=VYGzllOGvsjuYhCTcQrDKGQ3L1G9SFVv1wvxvFjxSl8=; b=40T+yWrjWmC5mKVLzfuiXcDjFd BwwTepL9JzLGZ5rGVLj1U+zOqwCKWRpAnNFFHdazCEkWtCtS1Cy88PScoLLsA1GNmg5ECoUkhQT3F te+TJ5Vffdl2bVZa8lfL4qq81ODmAt4tK5HDIJ+xmD8sqeQ3JzEFmTOCGTt+V5ZcKxh0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rUaS9-006QPA-Jr; Mon, 29 Jan 2024 23:50:09 +0100 From: Andrew Lunn To: netdev-maintainers , , , Cc: Vladimir Oltean , netdev , Andrew Lunn , stable@vger.kernel.org, Tim Menninger Subject: [PATCH net v2] net: dsa: mv88e6xxx: Fix failed probe due to unsupported C45 reads Date: Mon, 29 Jan 2024 23:49:48 +0100 Message-Id: <20240129224948.1531452-1-andrew@lunn.ch> X-Mailer: git-send-email 2.37.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Not all mv88e6xxx device support C45 read/write operations. Those which do not return -EOPNOTSUPP. However, when phylib scans the bus, it considers this fatal, and the probe of the MDIO bus fails, which in term causes the mv88e6xxx probe as a whole to fail. When there is no device on the bus for a given address, the pull up resistor on the data line results in the read returning 0xffff. The phylib core code understands this when scanning for devices on the bus. C45 allows multiple devices to be supported at one address, so phylib will perform a few reads at each address, so although thought not the most efficient solution, it is a way to avoid fatal errors. Make use of this as a minimal fix for stable to fix the probing problems. Follow up patches will rework how C45 operates to make it similar to C22 which considers -ENODEV as a none-fatal, and swap mv88e6xxx to using this. Cc: stable@vger.kernel.org Fixes: 743a19e38d02 ("net: dsa: mv88e6xxx: Separate C22 and C45 transactions") Reported-by: Tim Menninger Signed-off-by: Andrew Lunn --- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 383b3c4d6f59..614cabb5c1b0 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3659,7 +3659,7 @@ static int mv88e6xxx_mdio_read_c45(struct mii_bus *bus, int phy, int devad, int err; if (!chip->info->ops->phy_read_c45) - return -EOPNOTSUPP; + return 0xffff; mv88e6xxx_reg_lock(chip); err = chip->info->ops->phy_read_c45(chip, bus, phy, devad, reg, &val);