1 From 54d4147a121cec5004a673a58572da346e4458f8 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 3 Apr 2023 02:19:28 +0100
4 Subject: [PATCH 15/16] net: dsa: mt7530: skip locking if MDIO bus isn't
7 As MT7530 and MT7531 internally use 32-bit wide registers, each access
8 to any register of the switch requires several operations on the MDIO
9 bus. Hence if there is congruent access, e.g. due to PCS or PHY
10 polling, this can mess up and interfere with another ongoing register
13 However, the MDIO bus mutex is only relevant for MDIO-connected
14 switches. Prepare switches which have there registers directly mapped
15 into the SoCs register space via MMIO which do not require such
16 locking. There we can simply use regmap's default locking mechanism.
18 Hence guard mutex operations to only be performed in case of MDIO
21 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
22 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
23 Signed-off-by: David S. Miller <davem@davemloft.net>
25 drivers/net/dsa/mt7530.c | 6 ++++--
26 1 file changed, 4 insertions(+), 2 deletions(-)
28 --- a/drivers/net/dsa/mt7530.c
29 +++ b/drivers/net/dsa/mt7530.c
30 @@ -144,13 +144,15 @@ err:
32 mt7530_mutex_lock(struct mt7530_priv *priv)
34 - mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
36 + mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
40 mt7530_mutex_unlock(struct mt7530_priv *priv)
42 - mutex_unlock(&priv->bus->mdio_lock);
44 + mutex_unlock(&priv->bus->mdio_lock);