2022-05-09 08:27:26

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v3 0/6] Support mt7531 on BPI-R2 Pro

From: Frank Wunderlich <[email protected]>

This Series add Support for the mt7531 switch on Bananapi R2 Pro board.

This board uses port5 of the switch to conect to the gmac0 of the
rk3568 SoC.

Currently CPU-Port is hardcoded in the mt7530 driver to port 6.

Compared to v1 the reset-Patch was dropped as it was not needed and
CPU-Port-changes are completely rewriten based on suggestions/code from
Vladimir Oltean (many thanks to this).
In DTS Patch i only dropped the status-property that was not
needed/ignored by driver.

Due to the Changes i also made a regression Test on mt7623 bpi-r2 using
mt7530 with cpu-port 6. Tests were done directly (ipv4 config on dsa user
port) and with vlan-aware bridge including vlan that was tagged outgoing
on dsa user port.

Main change is that i now include the binding-changes into the patchset which
i posted separately.

Frank Wunderlich (6):
dt-bindings: net: dsa: convert binding for mediatek switches
net: dsa: mt7530: rework mt7530_hw_vlan_{add,del}
net: dsa: mt7530: rework mt753[01]_setup
net: dsa: mt7530: get cpu-port via dp->cpu_dp instead of constant
dt-bindings: net: dsa: make reset optional and add rgmii-mode to
mt7531
arm64: dts: rockchip: Add mt7531 dsa node to BPI-R2-Pro board

.../bindings/net/dsa/mediatek,mt7530.yaml | 421 ++++++++++++++++++
.../devicetree/bindings/net/dsa/mt7530.txt | 327 --------------
.../boot/dts/rockchip/rk3568-bpi-r2-pro.dts | 48 ++
drivers/net/dsa/mt7530.c | 82 ++--
drivers/net/dsa/mt7530.h | 1 -
5 files changed, 522 insertions(+), 357 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
delete mode 100644 Documentation/devicetree/bindings/net/dsa/mt7530.txt

--
2.25.1



2022-05-09 09:32:01

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v3 4/6] net: dsa: mt7530: get cpu-port via dp->cpu_dp instead of constant

From: Frank Wunderlich <[email protected]>

Replace last occurences of hardcoded cpu-port by cpu_dp member of
dsa_port struct.

Now the constant can be dropped.

Suggested-by: Vladimir Oltean <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
Reviewed-by: Vladimir Oltean <[email protected]>
---
drivers/net/dsa/mt7530.c | 27 ++++++++++++++++++++-------
drivers/net/dsa/mt7530.h | 1 -
2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 144c29f8fefc..8bf27937e577 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1033,6 +1033,7 @@ static int
mt7530_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phy)
{
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct mt7530_priv *priv = ds->priv;

mutex_lock(&priv->reg_mutex);
@@ -1041,7 +1042,11 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
* restore the port matrix if the port is the member of a certain
* bridge.
*/
- priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT));
+ if (dsa_port_is_user(dp)) {
+ struct dsa_port *cpu_dp = dp->cpu_dp;
+
+ priv->ports[port].pm |= PCR_MATRIX(BIT(cpu_dp->index));
+ }
priv->ports[port].enable = true;
mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
priv->ports[port].pm);
@@ -1190,7 +1195,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
struct netlink_ext_ack *extack)
{
struct dsa_port *dp = dsa_to_port(ds, port), *other_dp;
- u32 port_bitmap = BIT(MT7530_CPU_PORT);
+ struct dsa_port *cpu_dp = dp->cpu_dp;
+ u32 port_bitmap = BIT(cpu_dp->index);
struct mt7530_priv *priv = ds->priv;

mutex_lock(&priv->reg_mutex);
@@ -1267,9 +1273,12 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
* the CPU port get out of VLAN filtering mode.
*/
if (all_user_ports_removed) {
- mt7530_write(priv, MT7530_PCR_P(MT7530_CPU_PORT),
+ struct dsa_port *dp = dsa_to_port(ds, port);
+ struct dsa_port *cpu_dp = dp->cpu_dp;
+
+ mt7530_write(priv, MT7530_PCR_P(cpu_dp->index),
PCR_MATRIX(dsa_user_ports(priv->ds)));
- mt7530_write(priv, MT7530_PVC_P(MT7530_CPU_PORT), PORT_SPEC_TAG
+ mt7530_write(priv, MT7530_PVC_P(cpu_dp->index), PORT_SPEC_TAG
| PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
}
}
@@ -1307,6 +1316,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
struct dsa_bridge bridge)
{
struct dsa_port *dp = dsa_to_port(ds, port), *other_dp;
+ struct dsa_port *cpu_dp = dp->cpu_dp;
struct mt7530_priv *priv = ds->priv;

mutex_lock(&priv->reg_mutex);
@@ -1335,8 +1345,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
*/
if (priv->ports[port].enable)
mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
- PCR_MATRIX(BIT(MT7530_CPU_PORT)));
- priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT));
+ PCR_MATRIX(BIT(cpu_dp->index)));
+ priv->ports[port].pm = PCR_MATRIX(BIT(cpu_dp->index));

/* When a port is removed from the bridge, the port would be set up
* back to the default as is at initial boot which is a VLAN-unaware
@@ -1503,6 +1513,9 @@ static int
mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
struct netlink_ext_ack *extack)
{
+ struct dsa_port *dp = dsa_to_port(ds, port);
+ struct dsa_port *cpu_dp = dp->cpu_dp;
+
if (vlan_filtering) {
/* The port is being kept as VLAN-unaware port when bridge is
* set up with vlan_filtering not being set, Otherwise, the
@@ -1510,7 +1523,7 @@ mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
* for becoming a VLAN-aware port.
*/
mt7530_port_set_vlan_aware(ds, port);
- mt7530_port_set_vlan_aware(ds, MT7530_CPU_PORT);
+ mt7530_port_set_vlan_aware(ds, cpu_dp->index);
} else {
mt7530_port_set_vlan_unaware(ds, port);
}
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 91508e2feef9..5895bcfc0f7d 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -8,7 +8,6 @@

#define MT7530_NUM_PORTS 7
#define MT7530_NUM_PHYS 5
-#define MT7530_CPU_PORT 6
#define MT7530_NUM_FDB_RECORDS 2048
#define MT7530_ALL_MEMBERS 0xff

--
2.25.1


2022-06-08 18:18:56

by Frank Wunderlich

[permalink] [raw]
Subject: Aw: [PATCH v3 0/6] Support mt7531 on BPI-R2 Pro

just a gentle ping, is anything missing/wrong?

regards Frank

2022-06-08 18:45:33

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v3 0/6] Support mt7531 on BPI-R2 Pro

On Wed, 8 Jun 2022 19:38:30 +0200 Frank Wunderlich wrote:
> just a gentle ping, is anything missing/wrong?

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#how-can-i-tell-the-status-of-a-patch-i-ve-sent

In your case:

https://patchwork.kernel.org/project/netdevbpf/list/?series=639420&state=*

I haven't double checked but even if the feedback you received was
waved the patch didn't apply when it was posted, so you gotta repost.