net: dsa: qca: ar9331: reorder MDIO write sequence
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 3 Aug 2021 06:37:46 +0000 (08:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 11:22:07 +0000 (13:22 +0200)
commitd1f2abe57bc1c9cf2fba49174d6e184e9a7ac924
tree6ff9b78d3aa63a2e2fc47b4e3a7255376fb628e4
parenta45ee8ed0c7df7d459e8134feac9a5287dc9e9c6
net: dsa: qca: ar9331: reorder MDIO write sequence

[ Upstream commit d1a58c013a5837451e3213e7a426d350fa524ead ]

In case of this switch we work with 32bit registers on top of 16bit
bus. Some registers (for example access to forwarding database) have
trigger bit on the first 16bit half of request and the result +
configuration of request in the second half. Without this patch, we would
trigger database operation and overwrite result in one run.

To make it work properly, we should do the second part of transfer
before the first one is done.

So far, this rule seems to work for all registers on this switch.

Fixes: ec6698c272de ("net: dsa: add support for Atheros AR9331 built-in switch")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20210803063746.3600-1-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/qca/ar9331.c