]> git.ipfire.org Git - thirdparty/linux.git/commit
net: dsa: mt7530: error out on failed reads in ATC/VTCR command polling
authorDaniel Golle <daniel@makrotopia.org>
Tue, 28 Jul 2026 04:52:21 +0000 (05:52 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jul 2026 00:30:14 +0000 (17:30 -0700)
commited9adac35b8fac635f40e28461505e2e5b6c8fcc
treefa96bd3f94d52d93f4a4aafefe1ce391ff67211f
parentb4ce102b2cd88424c5860fbbb20b9eb343a93bf4
net: dsa: mt7530: error out on failed reads in ATC/VTCR command polling

mt7530_fdb_cmd() and mt7530_vlan_cmd() poll the command register
through a helper which returns 0 when the underlying read fails. A
failed bus transaction thus clears ATC_BUSY/VTCR_BUSY and is treated
as successful command completion, and the subsequent ATC_INVALID and
VTCR_INVALID checks are defeated the same way.

Poll using regmap_read_poll_timeout(), which stops on read errors and
propagates them, and check the completion status read as well. Take
the MDIO bus lock across the sequence as the switch regmap is set up
with locking disabled.

Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
Fixes: 83163f7dca56 ("net: dsa: mediatek: add VLAN support for MT7530")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/eea1d8f15c54375b3770c23e09fb3217df487169.1785213071.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mt7530.c