mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 07:22:33 +00:00
9e86e0b33b
Changelogs: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.67 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.68 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.69 Upstreamed patches: target/linux/generic/backport-6.1/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch [1] target/linux/generic/backport-6.1/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch [2] target/linux/generic/backport-6.1/790-48-STABLE-net-dsa-mt7530-trap-link-local-frames-regardless-of-.patch [3] target/linux/generic/backport-6.1/790-50-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch [4] target/linux/generic/backport-6.1/790-16-v6.4-net-dsa-mt7530-set-all-CPU-ports-in-MT7531_CPU_PMAP.patch [5] target/linux/generic/backport-6.1/790-46-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch [6] target/linux/generic/backport-6.1/790-47-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch [7] target/linux/mediatek/patches-6.1/220-v6.3-clk-mediatek-clk-gate-Propagate-struct-device-with-m.patch [8] target/linux/mediatek/patches-6.1/222-v6.3-clk-mediatek-clk-mtk-Propagate-struct-device-for-com.patch [9] target/linux/mediatek/patches-6.1/223-v6.3-clk-mediatek-clk-mux-Propagate-struct-device-for-mtk.patch [10] target/linux/mediatek/patches-6.1/226-v6.3-clk-mediatek-clk-mtk-Extend-mtk_clk_simple_probe.patch [11] Symbol changes: MITIGATION_SPECTRE_BHI (new) [12] SPECTRE_BHI_{ON,OFF} (deprecated) [12] References: [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=8bf7c76a2a207ca2b4cfda0a279192adf27678d7 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=f1c3c61701a0b12f4906152c1626a5de580ea3d2 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=19643bf8c9b5bb5eea5163bf2f6a3eee6fb5b99b [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=e86c9db58eba290e858e2bb80efcde9e3973a5ef [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=013c787d231188a6408e2991150d3c9bf9a2aa0b [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=41a004ffba9b1fd8a5a7128ebd0dfa3ed39c3316 [7] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=7d51db455ca03e5270cc585a75a674abd063fa6c [8] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=082b831488a41257b7ac7ffa1d80a0b60d98394d [9] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=6f5f72a684a2823f21efbfd20c7e4b528c44a781 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=a4fe8813a7868ba5867e42e60de7a2b8baac30ff [11] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=c1d87d56af063c87961511ee25f6b07a5676d27d [12] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=d844df110084ef8bd950a52194865f3f63b561ca Signed-off-by: Shiji Yang <yangshiji66@qq.com>
274 lines
7.0 KiB
Diff
274 lines
7.0 KiB
Diff
From 504d39cbda402df3e6fd123d040520393b6a6297 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Golle <daniel@makrotopia.org>
|
|
Date: Mon, 3 Apr 2023 02:18:16 +0100
|
|
Subject: [PATCH 08/48] net: dsa: mt7530: introduce mutex helpers
|
|
|
|
As the MDIO bus lock only needs to be involved if actually operating
|
|
on an MDIO-connected switch we will need to skip locking for built-in
|
|
switches which are accessed via MMIO.
|
|
Create helper functions which simplify that upcoming change.
|
|
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/dsa/mt7530.c | 73 ++++++++++++++++++++--------------------
|
|
1 file changed, 36 insertions(+), 37 deletions(-)
|
|
|
|
--- a/drivers/net/dsa/mt7530.c
|
|
+++ b/drivers/net/dsa/mt7530.c
|
|
@@ -143,31 +143,40 @@ err:
|
|
}
|
|
|
|
static void
|
|
-core_write(struct mt7530_priv *priv, u32 reg, u32 val)
|
|
+mt7530_mutex_lock(struct mt7530_priv *priv)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
+ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+}
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+static void
|
|
+mt7530_mutex_unlock(struct mt7530_priv *priv)
|
|
+{
|
|
+ mutex_unlock(&priv->bus->mdio_lock);
|
|
+}
|
|
+
|
|
+static void
|
|
+core_write(struct mt7530_priv *priv, u32 reg, u32 val)
|
|
+{
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
}
|
|
|
|
static void
|
|
core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
u32 val;
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
val = core_read_mmd_indirect(priv, reg, MDIO_MMD_VEND2);
|
|
val &= ~mask;
|
|
val |= set;
|
|
core_write_mmd_indirect(priv, reg, MDIO_MMD_VEND2, val);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
}
|
|
|
|
static void
|
|
@@ -264,13 +273,11 @@ mt7530_mii_read(struct mt7530_priv *priv
|
|
static void
|
|
mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
-
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
mt7530_mii_write(priv, reg, val);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
}
|
|
|
|
static u32
|
|
@@ -282,14 +289,13 @@ _mt7530_unlocked_read(struct mt7530_dumm
|
|
static u32
|
|
_mt7530_read(struct mt7530_dummy_poll *p)
|
|
{
|
|
- struct mii_bus *bus = p->priv->bus;
|
|
u32 val;
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(p->priv);
|
|
|
|
val = mt7530_mii_read(p->priv, p->reg);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(p->priv);
|
|
|
|
return val;
|
|
}
|
|
@@ -307,13 +313,11 @@ static void
|
|
mt7530_rmw(struct mt7530_priv *priv, u32 reg,
|
|
u32 mask, u32 set)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
-
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
regmap_update_bits(priv->regmap, reg, mask, set);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
}
|
|
|
|
static void
|
|
@@ -659,14 +663,13 @@ static int
|
|
mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad,
|
|
int regnum)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
struct mt7530_dummy_poll p;
|
|
u32 reg, val;
|
|
int ret;
|
|
|
|
INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC);
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val,
|
|
!(val & MT7531_PHY_ACS_ST), 20, 100000);
|
|
@@ -699,7 +702,7 @@ mt7531_ind_c45_phy_read(struct mt7530_pr
|
|
|
|
ret = val & MT7531_MDIO_RW_DATA_MASK;
|
|
out:
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
return ret;
|
|
}
|
|
@@ -708,14 +711,13 @@ static int
|
|
mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad,
|
|
int regnum, u32 data)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
struct mt7530_dummy_poll p;
|
|
u32 val, reg;
|
|
int ret;
|
|
|
|
INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC);
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val,
|
|
!(val & MT7531_PHY_ACS_ST), 20, 100000);
|
|
@@ -747,7 +749,7 @@ mt7531_ind_c45_phy_write(struct mt7530_p
|
|
}
|
|
|
|
out:
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
return ret;
|
|
}
|
|
@@ -755,14 +757,13 @@ out:
|
|
static int
|
|
mt7531_ind_c22_phy_read(struct mt7530_priv *priv, int port, int regnum)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
struct mt7530_dummy_poll p;
|
|
int ret;
|
|
u32 val;
|
|
|
|
INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC);
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
ret = readx_poll_timeout(_mt7530_unlocked_read, &p, val,
|
|
!(val & MT7531_PHY_ACS_ST), 20, 100000);
|
|
@@ -785,7 +786,7 @@ mt7531_ind_c22_phy_read(struct mt7530_pr
|
|
|
|
ret = val & MT7531_MDIO_RW_DATA_MASK;
|
|
out:
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
return ret;
|
|
}
|
|
@@ -794,14 +795,13 @@ static int
|
|
mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum,
|
|
u16 data)
|
|
{
|
|
- struct mii_bus *bus = priv->bus;
|
|
struct mt7530_dummy_poll p;
|
|
int ret;
|
|
u32 reg;
|
|
|
|
INIT_MT7530_DUMMY_POLL(&p, priv, MT7531_PHY_IAC);
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
ret = readx_poll_timeout(_mt7530_unlocked_read, &p, reg,
|
|
!(reg & MT7531_PHY_ACS_ST), 20, 100000);
|
|
@@ -823,7 +823,7 @@ mt7531_ind_c22_phy_write(struct mt7530_p
|
|
}
|
|
|
|
out:
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
return ret;
|
|
}
|
|
@@ -1343,7 +1343,6 @@ static int
|
|
mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
|
{
|
|
struct mt7530_priv *priv = ds->priv;
|
|
- struct mii_bus *bus = priv->bus;
|
|
int length;
|
|
u32 val;
|
|
|
|
@@ -1354,7 +1353,7 @@ mt7530_port_change_mtu(struct dsa_switch
|
|
if (!dsa_is_cpu_port(ds, port))
|
|
return 0;
|
|
|
|
- mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
|
|
val = mt7530_mii_read(priv, MT7530_GMACCR);
|
|
val &= ~MAX_RX_PKT_LEN_MASK;
|
|
@@ -1375,7 +1374,7 @@ mt7530_port_change_mtu(struct dsa_switch
|
|
|
|
mt7530_mii_write(priv, MT7530_GMACCR, val);
|
|
|
|
- mutex_unlock(&bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
return 0;
|
|
}
|
|
@@ -2176,10 +2175,10 @@ mt7530_irq_thread_fn(int irq, void *dev_
|
|
u32 val;
|
|
int p;
|
|
|
|
- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
val = mt7530_mii_read(priv, MT7530_SYS_INT_STS);
|
|
mt7530_mii_write(priv, MT7530_SYS_INT_STS, val);
|
|
- mutex_unlock(&priv->bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
|
|
for (p = 0; p < MT7530_NUM_PHYS; p++) {
|
|
if (BIT(p) & val) {
|
|
@@ -2215,7 +2214,7 @@ mt7530_irq_bus_lock(struct irq_data *d)
|
|
{
|
|
struct mt7530_priv *priv = irq_data_get_irq_chip_data(d);
|
|
|
|
- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
|
|
+ mt7530_mutex_lock(priv);
|
|
}
|
|
|
|
static void
|
|
@@ -2224,7 +2223,7 @@ mt7530_irq_bus_sync_unlock(struct irq_da
|
|
struct mt7530_priv *priv = irq_data_get_irq_chip_data(d);
|
|
|
|
mt7530_mii_write(priv, MT7530_SYS_INT_EN, priv->irq_enable);
|
|
- mutex_unlock(&priv->bus->mdio_lock);
|
|
+ mt7530_mutex_unlock(priv);
|
|
}
|
|
|
|
static struct irq_chip mt7530_irq_chip = {
|