mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
ec8c837eab
Manually rebased: Removed upstreamed: backport-5.15/743-v6.3-0005-net-dsa-b53-mmap-fix-device-tree-support.patch[1] backport-5.15/743-v6.3-0006-net-dsa-tag_brcm-legacy-fix-daisy-chained-switches.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.105&id=9bbb3d3f218f1cf51f57a43cf8fd63b05be1b821 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.105&id=48f52431af9980582b6faa32ff8b581edb10486c Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia <therealgraysky@proton.me>
76 lines
2.3 KiB
Diff
76 lines
2.3 KiB
Diff
From 1f0dfd443eea7fc3e818e96f7c8264913ba41859 Mon Sep 17 00:00:00 2001
|
|
From: Frank Wunderlich <frank-w@public-files.de>
|
|
Date: Fri, 10 Jun 2022 19:05:38 +0200
|
|
Subject: [PATCH 12/13] net: dsa: mt7530: rework mt753[01]_setup
|
|
|
|
Enumerate available cpu-ports instead of using hardcoded constant.
|
|
|
|
Suggested-by: Vladimir Oltean <olteanv@gmail.com>
|
|
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
|
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/dsa/mt7530.c | 25 +++++++++++++++++++++----
|
|
1 file changed, 21 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/net/dsa/mt7530.c
|
|
+++ b/drivers/net/dsa/mt7530.c
|
|
@@ -2101,11 +2101,12 @@ static int
|
|
mt7530_setup(struct dsa_switch *ds)
|
|
{
|
|
struct mt7530_priv *priv = ds->priv;
|
|
+ struct device_node *dn = NULL;
|
|
struct device_node *phy_node;
|
|
struct device_node *mac_np;
|
|
struct mt7530_dummy_poll p;
|
|
phy_interface_t interface;
|
|
- struct device_node *dn;
|
|
+ struct dsa_port *cpu_dp;
|
|
u32 id, val;
|
|
int ret, i;
|
|
|
|
@@ -2113,7 +2114,19 @@ mt7530_setup(struct dsa_switch *ds)
|
|
* controller also is the container for two GMACs nodes representing
|
|
* as two netdev instances.
|
|
*/
|
|
- dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent;
|
|
+ dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
|
+ dn = cpu_dp->master->dev.of_node->parent;
|
|
+ /* It doesn't matter which CPU port is found first,
|
|
+ * their masters should share the same parent OF node
|
|
+ */
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if (!dn) {
|
|
+ dev_err(ds->dev, "parent OF node of DSA master not found");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
ds->assisted_learning_on_cpu_port = true;
|
|
ds->mtu_enforcement_ingress = true;
|
|
|
|
@@ -2286,6 +2299,7 @@ mt7531_setup(struct dsa_switch *ds)
|
|
{
|
|
struct mt7530_priv *priv = ds->priv;
|
|
struct mt7530_dummy_poll p;
|
|
+ struct dsa_port *cpu_dp;
|
|
u32 val, id;
|
|
int ret, i;
|
|
|
|
@@ -2360,8 +2374,11 @@ mt7531_setup(struct dsa_switch *ds)
|
|
CORE_PLL_GROUP4, val);
|
|
|
|
/* BPDU to CPU port */
|
|
- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
|
- BIT(MT7530_CPU_PORT));
|
|
+ dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
|
+ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
|
+ BIT(cpu_dp->index));
|
|
+ break;
|
|
+ }
|
|
mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
|
|
MT753X_BPDU_CPU_ONLY);
|
|
|