mirror of
https://github.com/openwrt/openwrt.git
synced 2025-04-11 13:21:36 +00:00
lantiq: Add some gswip patches
This backports some patches for the gswip switch driver. I copied them from this repository: https://github.com/xdarklight/linux/commits/lantiq-gswip-integration-20221022 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> [drop some patches which may break functionality at the moment] Signed-off-by: Martin Schiller <ms@dev.tdt.de>
This commit is contained in:
parent
e79dacd962
commit
783c3aace2
@ -0,0 +1,32 @@
|
||||
From 82ea7c7fb4e90620beba8b6436fc12df2379ef8d Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 10 Oct 2022 16:52:25 +0200
|
||||
Subject: [PATCH 731/768] dt-bindings: net: dsa: lantiq_gswip: Add missing
|
||||
phy-mode and fixed-link
|
||||
|
||||
The CPU port has to specify a phy-mode and either a phy or a fixed-link.
|
||||
Since GSWIP is connected using a SoC internal protocol there's no PHY
|
||||
involved. Add phy-mode = "internal" and a fixed-link to describe the
|
||||
communication between the PMAC (Ethernet controller) and GSWIP switch.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
|
||||
@@ -97,7 +97,13 @@ switch@e108000 {
|
||||
port@6 {
|
||||
reg = <0x6>;
|
||||
label = "cpu";
|
||||
+ phy-mode = "internal";
|
||||
ethernet = <ð0>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
@ -0,0 +1,33 @@
|
||||
From a55b9d802e11baceb35bd312419ad82086065b08 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 10 Oct 2022 16:59:35 +0200
|
||||
Subject: [PATCH 732/768] net: dsa: lantiq_gswip: Only allow phy-mode =
|
||||
"internal" on the CPU port
|
||||
|
||||
Add the CPU port to gswip_xrx200_phylink_get_caps() and
|
||||
gswip_xrx300_phylink_get_caps(). It connects through a SoC-internal bus,
|
||||
so the only allowed phy-mode is PHY_INTERFACE_MODE_INTERNAL.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1513,6 +1513,7 @@ static void gswip_xrx200_phylink_validat
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
+ case 6:
|
||||
if (state->interface != PHY_INTERFACE_MODE_INTERNAL)
|
||||
goto unsupported;
|
||||
break;
|
||||
@@ -1552,6 +1553,7 @@ static void gswip_xrx300_phylink_validat
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
+ case 6:
|
||||
if (state->interface != PHY_INTERFACE_MODE_INTERNAL)
|
||||
goto unsupported;
|
||||
break;
|
@ -0,0 +1,145 @@
|
||||
From 4d3dd68a1c56674ff666d0622b545992fac31754 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Sun, 31 Jul 2022 22:54:52 +0200
|
||||
Subject: [PATCH 733/768] net: dsa: lantiq_gswip: Use dev_err_probe where
|
||||
appropriate
|
||||
|
||||
dev_err_probe() can be used to simplify the existing code. Also it means
|
||||
we get rid of the following warning which is seen whenever the PMAC
|
||||
(Ethernet controller which connects to GSWIP's CPU port) has not been
|
||||
probed yet:
|
||||
gswip 1e108000.switch: dsa switch register failed: -517
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 53 ++++++++++++++++------------------
|
||||
1 file changed, 25 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1939,11 +1939,9 @@ static int gswip_gphy_fw_load(struct gsw
|
||||
msleep(200);
|
||||
|
||||
ret = request_firmware(&fw, gphy_fw->fw_name, dev);
|
||||
- if (ret) {
|
||||
- dev_err(dev, "failed to load firmware: %s, error: %i\n",
|
||||
- gphy_fw->fw_name, ret);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (ret)
|
||||
+ return dev_err_probe(dev, ret, "failed to load firmware: %s\n",
|
||||
+ gphy_fw->fw_name);
|
||||
|
||||
/* GPHY cores need the firmware code in a persistent and contiguous
|
||||
* memory area with a 16 kB boundary aligned start address.
|
||||
@@ -1956,9 +1954,9 @@ static int gswip_gphy_fw_load(struct gsw
|
||||
dev_addr = ALIGN(dma_addr, XRX200_GPHY_FW_ALIGN);
|
||||
memcpy(fw_addr, fw->data, fw->size);
|
||||
} else {
|
||||
- dev_err(dev, "failed to alloc firmware memory\n");
|
||||
release_firmware(fw);
|
||||
- return -ENOMEM;
|
||||
+ return dev_err_probe(dev, -ENOMEM,
|
||||
+ "failed to alloc firmware memory\n");
|
||||
}
|
||||
|
||||
release_firmware(fw);
|
||||
@@ -1985,8 +1983,8 @@ static int gswip_gphy_fw_probe(struct gs
|
||||
|
||||
gphy_fw->clk_gate = devm_clk_get(dev, gphyname);
|
||||
if (IS_ERR(gphy_fw->clk_gate)) {
|
||||
- dev_err(dev, "Failed to lookup gate clock\n");
|
||||
- return PTR_ERR(gphy_fw->clk_gate);
|
||||
+ return dev_err_probe(dev, PTR_ERR(gphy_fw->clk_gate),
|
||||
+ "Failed to lookup gate clock\n");
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(gphy_fw_np, "reg", &gphy_fw->fw_addr_offset);
|
||||
@@ -2006,8 +2004,8 @@ static int gswip_gphy_fw_probe(struct gs
|
||||
gphy_fw->fw_name = priv->gphy_fw_name_cfg->ge_firmware_name;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "Unknown GPHY mode %d\n", gphy_mode);
|
||||
- return -EINVAL;
|
||||
+ return dev_err_probe(dev, -EINVAL, "Unknown GPHY mode %d\n",
|
||||
+ gphy_mode);
|
||||
}
|
||||
|
||||
gphy_fw->reset = of_reset_control_array_get_exclusive(gphy_fw_np);
|
||||
@@ -2060,8 +2058,9 @@ static int gswip_gphy_fw_list(struct gsw
|
||||
priv->gphy_fw_name_cfg = &xrx200a2x_gphy_data;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "unknown GSWIP version: 0x%x", version);
|
||||
- return -ENOENT;
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "unknown GSWIP version: 0x%x",
|
||||
+ version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2069,10 +2068,9 @@ static int gswip_gphy_fw_list(struct gsw
|
||||
if (match && match->data)
|
||||
priv->gphy_fw_name_cfg = match->data;
|
||||
|
||||
- if (!priv->gphy_fw_name_cfg) {
|
||||
- dev_err(dev, "GPHY compatible type not supported");
|
||||
- return -ENOENT;
|
||||
- }
|
||||
+ if (!priv->gphy_fw_name_cfg)
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "GPHY compatible type not supported");
|
||||
|
||||
priv->num_gphy_fw = of_get_available_child_count(gphy_fw_list_np);
|
||||
if (!priv->num_gphy_fw)
|
||||
@@ -2171,8 +2169,8 @@ static int gswip_probe(struct platform_d
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "unknown GSWIP version: 0x%x", version);
|
||||
- return -ENOENT;
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "unknown GSWIP version: 0x%x", version);
|
||||
}
|
||||
|
||||
/* bring up the mdio bus */
|
||||
@@ -2180,10 +2178,9 @@ static int gswip_probe(struct platform_d
|
||||
if (gphy_fw_np) {
|
||||
err = gswip_gphy_fw_list(priv, gphy_fw_np, version);
|
||||
of_node_put(gphy_fw_np);
|
||||
- if (err) {
|
||||
- dev_err(dev, "gphy fw probe failed\n");
|
||||
- return err;
|
||||
- }
|
||||
+ if (err)
|
||||
+ return dev_err_probe(dev, err,
|
||||
+ "gphy fw probe failed\n");
|
||||
}
|
||||
|
||||
/* bring up the mdio bus */
|
||||
@@ -2191,20 +2188,20 @@ static int gswip_probe(struct platform_d
|
||||
if (mdio_np) {
|
||||
err = gswip_mdio(priv, mdio_np);
|
||||
if (err) {
|
||||
- dev_err(dev, "mdio probe failed\n");
|
||||
+ dev_err_probe(dev, err, "mdio probe failed\n");
|
||||
goto put_mdio_node;
|
||||
}
|
||||
}
|
||||
|
||||
err = dsa_register_switch(priv->ds);
|
||||
if (err) {
|
||||
- dev_err(dev, "dsa switch register failed: %i\n", err);
|
||||
+ dev_err_probe(dev, err, "dsa switch registration failed\n");
|
||||
goto mdio_bus;
|
||||
}
|
||||
if (!dsa_is_cpu_port(priv->ds, priv->hw_info->cpu_port)) {
|
||||
- dev_err(dev, "wrong CPU port defined, HW only supports port: %i",
|
||||
- priv->hw_info->cpu_port);
|
||||
- err = -EINVAL;
|
||||
+ err = dev_err_probe(dev, -EINVAL,
|
||||
+ "wrong CPU port defined, HW only supports port: %i",
|
||||
+ priv->hw_info->cpu_port);
|
||||
goto disable_switch;
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 8cf0b680abc157adeec3fb93a10354c470694535 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Thu, 28 Jul 2022 22:37:11 +0200
|
||||
Subject: [PATCH 734/768] net: dsa: lantiq_gswip: Don't manually call
|
||||
gswip_port_enable()
|
||||
|
||||
We don't need to manually call gswip_port_enable() from within
|
||||
gswip_setup() for the CPU port. DSA does this automatically for us.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -874,8 +874,6 @@ static int gswip_setup(struct dsa_switch
|
||||
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
|
||||
- gswip_port_enable(ds, cpu_port, NULL);
|
||||
-
|
||||
ds->configure_vlan_while_not_filtering = false;
|
||||
|
||||
return 0;
|
@ -0,0 +1,70 @@
|
||||
From 54a2f7f2c134738bd3f4ea0a213138d169f2726e Mon Sep 17 00:00:00 2001
|
||||
From: Martin Schiller <ms@dev.tdt.de>
|
||||
Date: Fri, 10 May 2024 13:52:10 +0200
|
||||
Subject: [PATCH] net: dsa: lantiq_gswip: do also enable or disable cpu port
|
||||
|
||||
Before commit 74be4babe72f ("net: dsa: do not enable or disable non user
|
||||
ports"), gswip_port_enable/disable() were also executed for the cpu port
|
||||
in gswip_setup() which disabled the cpu port during initialization.
|
||||
|
||||
Let's restore this by removing the dsa_is_user_port checks. Also, let's
|
||||
clean up the gswip_port_enable() function so that we only have to check
|
||||
for the cpu port once.
|
||||
|
||||
Fixes: 74be4babe72f ("net: dsa: do not enable or disable non user ports")
|
||||
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 24 ++++++++----------------
|
||||
1 file changed, 8 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -671,13 +671,18 @@ static int gswip_port_enable(struct dsa_
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
int err;
|
||||
|
||||
- if (!dsa_is_user_port(ds, port))
|
||||
- return 0;
|
||||
-
|
||||
if (!dsa_is_cpu_port(ds, port)) {
|
||||
+ u32 mdio_phy = 0;
|
||||
+
|
||||
err = gswip_add_single_port_br(priv, port, true);
|
||||
if (err)
|
||||
return err;
|
||||
+
|
||||
+ if (phydev)
|
||||
+ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
|
||||
+
|
||||
+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
|
||||
+ GSWIP_MDIO_PHYp(port));
|
||||
}
|
||||
|
||||
/* RMON Counter Enable for port */
|
||||
@@ -690,16 +695,6 @@ static int gswip_port_enable(struct dsa_
|
||||
gswip_switch_mask(priv, 0, GSWIP_SDMA_PCTRL_EN,
|
||||
GSWIP_SDMA_PCTRLp(port));
|
||||
|
||||
- if (!dsa_is_cpu_port(ds, port)) {
|
||||
- u32 mdio_phy = 0;
|
||||
-
|
||||
- if (phydev)
|
||||
- mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
|
||||
-
|
||||
- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
|
||||
- GSWIP_MDIO_PHYp(port));
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -707,9 +702,6 @@ static void gswip_port_disable(struct ds
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
|
||||
- if (!dsa_is_user_port(ds, port))
|
||||
- return;
|
||||
-
|
||||
gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0,
|
||||
GSWIP_FDMA_PCTRLp(port));
|
||||
gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0,
|
@ -0,0 +1,30 @@
|
||||
From 8ab55ac9678ca1f50f786c84484599dd675c5a9f Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Wed, 18 May 2022 23:53:09 +0200
|
||||
Subject: [PATCH 736/768] net: dsa: lantiq_gswip: Use dsa_is_cpu_port() in
|
||||
gswip_port_change_mtu()
|
||||
|
||||
Make the check for the CPU port in gswip_port_change_mtu() consistent
|
||||
with other areas of the driver by using dsa_is_cpu_port().
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1463,12 +1463,11 @@ static int gswip_port_max_mtu(struct dsa
|
||||
static int gswip_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
- int cpu_port = priv->hw_info->cpu_port;
|
||||
|
||||
/* CPU port always has maximum mtu of user ports, so use it to set
|
||||
* switch frame size, including 8 byte special header.
|
||||
*/
|
||||
- if (port == cpu_port) {
|
||||
+ if (dsa_is_cpu_port(ds, port)) {
|
||||
new_mtu += 8;
|
||||
gswip_switch_w(priv, VLAN_ETH_HLEN + new_mtu + ETH_FCS_LEN,
|
||||
GSWIP_MAC_FLEN);
|
@ -0,0 +1,24 @@
|
||||
From ef98b183d8fc7187a2efcc21c8f54f3cf061d556 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Tue, 17 May 2022 22:39:58 +0200
|
||||
Subject: [PATCH 737/768] net: dsa: lantiq_gswip: Change literal 6 to ETH_ALEN
|
||||
|
||||
The addr variable in gswip_port_fdb_dump() stores a mac address. Use
|
||||
ETH_ALEN to make this consistent across other drivers.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1383,7 +1383,7 @@ static int gswip_port_fdb_dump(struct ds
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
struct gswip_pce_table_entry mac_bridge = {0,};
|
||||
- unsigned char addr[6];
|
||||
+ unsigned char addr[ETH_ALEN];
|
||||
int i;
|
||||
int err;
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 61e9b19f6e6174afa7540f0b468a69bc940b91d4 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 21:23:49 +0200
|
||||
Subject: [PATCH 738/768] net: dsa: lantiq_gswip: Consistently use macros for
|
||||
the mac bridge table
|
||||
|
||||
Introduce a new GSWIP_TABLE_MAC_BRIDGE_PORT macro and use it throughout
|
||||
the driver. Also update GSWIP_TABLE_MAC_BRIDGE_STATIC to use the BIT()
|
||||
macro. This makes the driver code easier to understand.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -236,7 +236,8 @@
|
||||
#define GSWIP_TABLE_ACTIVE_VLAN 0x01
|
||||
#define GSWIP_TABLE_VLAN_MAPPING 0x02
|
||||
#define GSWIP_TABLE_MAC_BRIDGE 0x0b
|
||||
-#define GSWIP_TABLE_MAC_BRIDGE_STATIC 0x01 /* Static not, aging entry */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging entry */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned entries */
|
||||
|
||||
#define XRX200_GPHY_FW_ALIGN (16 * 1024)
|
||||
|
||||
@@ -1279,7 +1280,8 @@ static void gswip_port_fast_age(struct d
|
||||
if (mac_bridge.val[1] & GSWIP_TABLE_MAC_BRIDGE_STATIC)
|
||||
continue;
|
||||
|
||||
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) != port)
|
||||
+ if (port != FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||||
+ mac_bridge.val[0]))
|
||||
continue;
|
||||
|
||||
mac_bridge.valid = false;
|
||||
@@ -1414,7 +1416,8 @@ static int gswip_port_fdb_dump(struct ds
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) {
|
||||
+ if (port == FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||||
+ mac_bridge.val[0])) {
|
||||
err = cb(addr, 0, false, data);
|
||||
if (err)
|
||||
return err;
|
@ -0,0 +1,26 @@
|
||||
From 7a9e185075ababa827d1d3a33b787ad6d718c8ec Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 22:24:24 +0200
|
||||
Subject: [PATCH 739/768] net: dsa: lantiq_gswip: Forbid
|
||||
gswip_add_single_port_br on the CPU port
|
||||
|
||||
Calling gswip_add_single_port_br() with the CPU port would be a bug
|
||||
because then only the CPU port could talk to itself. Add the CPU port to
|
||||
the validation at the beginning of gswip_add_single_port_br().
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -633,7 +633,7 @@ static int gswip_add_single_port_br(stru
|
||||
unsigned int max_ports = priv->hw_info->max_ports;
|
||||
int err;
|
||||
|
||||
- if (port >= max_ports) {
|
||||
+ if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) {
|
||||
dev_err(priv->dev, "single port for %i supported\n", port);
|
||||
return -EIO;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
From 28be6bfb735d851e646abb05b8e24eb6764596f5 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 22:26:20 +0200
|
||||
Subject: [PATCH 740/768] net: dsa: lantiq_gswip: Fix error message in
|
||||
gswip_add_single_port_br()
|
||||
|
||||
The error message is printed when the port cannot be used. Update the
|
||||
error message to reflect that.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -634,7 +634,8 @@ static int gswip_add_single_port_br(stru
|
||||
int err;
|
||||
|
||||
if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) {
|
||||
- dev_err(priv->dev, "single port for %i supported\n", port);
|
||||
+ dev_err(priv->dev, "single port for %i is not supported\n",
|
||||
+ port);
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 45a0371568b1f050d787564875653f41a1f6fb98 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 14:06:40 +0200
|
||||
Subject: [PATCH 741/768] net: dsa: lantiq_gswip: Fix comments in
|
||||
gswip_port_vlan_filtering()
|
||||
|
||||
Update the comments in gswip_port_vlan_filtering() so it's clear that
|
||||
there are two separate cases, one for "tag based VLAN" and another one
|
||||
for "port based VLAN".
|
||||
|
||||
Suggested-by: Martin Schiller <ms@dev.tdt.de>
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -762,7 +762,7 @@ static int gswip_port_vlan_filtering(str
|
||||
}
|
||||
|
||||
if (vlan_filtering) {
|
||||
- /* Use port based VLAN tag */
|
||||
+ /* Use tag based VLAN */
|
||||
gswip_switch_mask(priv,
|
||||
GSWIP_PCE_VCTRL_VSR,
|
||||
GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR |
|
||||
@@ -771,7 +771,7 @@ static int gswip_port_vlan_filtering(str
|
||||
gswip_switch_mask(priv, GSWIP_PCE_PCTRL_0_TVM, 0,
|
||||
GSWIP_PCE_PCTRL_0p(port));
|
||||
} else {
|
||||
- /* Use port based VLAN tag */
|
||||
+ /* Use port based VLAN */
|
||||
gswip_switch_mask(priv,
|
||||
GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR |
|
||||
GSWIP_PCE_VCTRL_VEMR,
|
@ -0,0 +1,33 @@
|
||||
From 4775f9543e691d9a2f5dd9aa5d46c66d37928250 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 14:19:05 +0200
|
||||
Subject: [PATCH 742/768] net: dsa: lantiq_gswip: Add and use a
|
||||
GSWIP_TABLE_MAC_BRIDGE_FID macro
|
||||
|
||||
Only bits [5:0] in mac_bridge.key[3] are reserved for the FID. Add a
|
||||
macro so this becomes obvious when reading the driver code.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -238,6 +238,7 @@
|
||||
#define GSWIP_TABLE_MAC_BRIDGE 0x0b
|
||||
#define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging entry */
|
||||
#define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned entries */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_FID GENMASK(5, 0) /* Filtering identifier */
|
||||
|
||||
#define XRX200_GPHY_FW_ALIGN (16 * 1024)
|
||||
|
||||
@@ -1357,7 +1358,7 @@ static int gswip_port_fdb(struct dsa_swi
|
||||
mac_bridge.key[0] = addr[5] | (addr[4] << 8);
|
||||
mac_bridge.key[1] = addr[3] | (addr[2] << 8);
|
||||
mac_bridge.key[2] = addr[1] | (addr[0] << 8);
|
||||
- mac_bridge.key[3] = fid;
|
||||
+ mac_bridge.key[3] = FIELD_PREP(GSWIP_TABLE_MAC_BRIDGE_FID, fid);
|
||||
mac_bridge.val[0] = add ? BIT(port) : 0; /* port map */
|
||||
mac_bridge.val[1] = GSWIP_TABLE_MAC_BRIDGE_STATIC;
|
||||
mac_bridge.valid = add;
|
@ -0,0 +1,26 @@
|
||||
From 00b5121435ccd4ce54f79179dd9ee3e2610d7dcf Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 16:31:57 +0200
|
||||
Subject: [PATCH 743/768] net: dsa: lantiq_gswip: Improve error message in
|
||||
gswip_port_fdb()
|
||||
|
||||
Print the port which is not found to be part of a bridge so it's easier
|
||||
to investigate the underlying issue.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1349,7 +1349,8 @@ static int gswip_port_fdb(struct dsa_swi
|
||||
}
|
||||
|
||||
if (fid == -1) {
|
||||
- dev_err(priv->dev, "Port not part of a bridge\n");
|
||||
+ dev_err(priv->dev,
|
||||
+ "Port %d is not known to be part of bridge\n", port);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 82ea7c7fb4e90620beba8b6436fc12df2379ef8d Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 10 Oct 2022 16:52:25 +0200
|
||||
Subject: [PATCH 731/768] dt-bindings: net: dsa: lantiq_gswip: Add missing
|
||||
phy-mode and fixed-link
|
||||
|
||||
The CPU port has to specify a phy-mode and either a phy or a fixed-link.
|
||||
Since GSWIP is connected using a SoC internal protocol there's no PHY
|
||||
involved. Add phy-mode = "internal" and a fixed-link to describe the
|
||||
communication between the PMAC (Ethernet controller) and GSWIP switch.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
|
||||
@@ -96,7 +96,13 @@ switch@e108000 {
|
||||
|
||||
port@6 {
|
||||
reg = <0x6>;
|
||||
+ phy-mode = "internal";
|
||||
ethernet = <ð0>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
@ -0,0 +1,33 @@
|
||||
From a55b9d802e11baceb35bd312419ad82086065b08 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 10 Oct 2022 16:59:35 +0200
|
||||
Subject: [PATCH 732/768] net: dsa: lantiq_gswip: Only allow phy-mode =
|
||||
"internal" on the CPU port
|
||||
|
||||
Add the CPU port to gswip_xrx200_phylink_get_caps() and
|
||||
gswip_xrx300_phylink_get_caps(). It connects through a SoC-internal bus,
|
||||
so the only allowed phy-mode is PHY_INTERFACE_MODE_INTERNAL.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1509,6 +1509,7 @@ static void gswip_xrx200_phylink_get_cap
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
+ case 6:
|
||||
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
||||
config->supported_interfaces);
|
||||
break;
|
||||
@@ -1540,6 +1541,7 @@ static void gswip_xrx300_phylink_get_cap
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
+ case 6:
|
||||
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
||||
config->supported_interfaces);
|
||||
break;
|
@ -0,0 +1,145 @@
|
||||
From 4d3dd68a1c56674ff666d0622b545992fac31754 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Sun, 31 Jul 2022 22:54:52 +0200
|
||||
Subject: [PATCH 733/768] net: dsa: lantiq_gswip: Use dev_err_probe where
|
||||
appropriate
|
||||
|
||||
dev_err_probe() can be used to simplify the existing code. Also it means
|
||||
we get rid of the following warning which is seen whenever the PMAC
|
||||
(Ethernet controller which connects to GSWIP's CPU port) has not been
|
||||
probed yet:
|
||||
gswip 1e108000.switch: dsa switch register failed: -517
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 53 ++++++++++++++++------------------
|
||||
1 file changed, 25 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1919,11 +1919,9 @@ static int gswip_gphy_fw_load(struct gsw
|
||||
msleep(200);
|
||||
|
||||
ret = request_firmware(&fw, gphy_fw->fw_name, dev);
|
||||
- if (ret) {
|
||||
- dev_err(dev, "failed to load firmware: %s, error: %i\n",
|
||||
- gphy_fw->fw_name, ret);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (ret)
|
||||
+ return dev_err_probe(dev, ret, "failed to load firmware: %s\n",
|
||||
+ gphy_fw->fw_name);
|
||||
|
||||
/* GPHY cores need the firmware code in a persistent and contiguous
|
||||
* memory area with a 16 kB boundary aligned start address.
|
||||
@@ -1936,9 +1934,9 @@ static int gswip_gphy_fw_load(struct gsw
|
||||
dev_addr = ALIGN(dma_addr, XRX200_GPHY_FW_ALIGN);
|
||||
memcpy(fw_addr, fw->data, fw->size);
|
||||
} else {
|
||||
- dev_err(dev, "failed to alloc firmware memory\n");
|
||||
release_firmware(fw);
|
||||
- return -ENOMEM;
|
||||
+ return dev_err_probe(dev, -ENOMEM,
|
||||
+ "failed to alloc firmware memory\n");
|
||||
}
|
||||
|
||||
release_firmware(fw);
|
||||
@@ -1965,8 +1963,8 @@ static int gswip_gphy_fw_probe(struct gs
|
||||
|
||||
gphy_fw->clk_gate = devm_clk_get(dev, gphyname);
|
||||
if (IS_ERR(gphy_fw->clk_gate)) {
|
||||
- dev_err(dev, "Failed to lookup gate clock\n");
|
||||
- return PTR_ERR(gphy_fw->clk_gate);
|
||||
+ return dev_err_probe(dev, PTR_ERR(gphy_fw->clk_gate),
|
||||
+ "Failed to lookup gate clock\n");
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(gphy_fw_np, "reg", &gphy_fw->fw_addr_offset);
|
||||
@@ -1986,8 +1984,8 @@ static int gswip_gphy_fw_probe(struct gs
|
||||
gphy_fw->fw_name = priv->gphy_fw_name_cfg->ge_firmware_name;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "Unknown GPHY mode %d\n", gphy_mode);
|
||||
- return -EINVAL;
|
||||
+ return dev_err_probe(dev, -EINVAL, "Unknown GPHY mode %d\n",
|
||||
+ gphy_mode);
|
||||
}
|
||||
|
||||
gphy_fw->reset = of_reset_control_array_get_exclusive(gphy_fw_np);
|
||||
@@ -2038,8 +2036,9 @@ static int gswip_gphy_fw_list(struct gsw
|
||||
priv->gphy_fw_name_cfg = &xrx200a2x_gphy_data;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "unknown GSWIP version: 0x%x", version);
|
||||
- return -ENOENT;
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "unknown GSWIP version: 0x%x",
|
||||
+ version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2047,10 +2046,9 @@ static int gswip_gphy_fw_list(struct gsw
|
||||
if (match && match->data)
|
||||
priv->gphy_fw_name_cfg = match->data;
|
||||
|
||||
- if (!priv->gphy_fw_name_cfg) {
|
||||
- dev_err(dev, "GPHY compatible type not supported");
|
||||
- return -ENOENT;
|
||||
- }
|
||||
+ if (!priv->gphy_fw_name_cfg)
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "GPHY compatible type not supported");
|
||||
|
||||
priv->num_gphy_fw = of_get_available_child_count(gphy_fw_list_np);
|
||||
if (!priv->num_gphy_fw)
|
||||
@@ -2150,8 +2148,8 @@ static int gswip_probe(struct platform_d
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
- dev_err(dev, "unknown GSWIP version: 0x%x", version);
|
||||
- return -ENOENT;
|
||||
+ return dev_err_probe(dev, -ENOENT,
|
||||
+ "unknown GSWIP version: 0x%x", version);
|
||||
}
|
||||
|
||||
/* bring up the mdio bus */
|
||||
@@ -2159,10 +2157,9 @@ static int gswip_probe(struct platform_d
|
||||
if (gphy_fw_np) {
|
||||
err = gswip_gphy_fw_list(priv, gphy_fw_np, version);
|
||||
of_node_put(gphy_fw_np);
|
||||
- if (err) {
|
||||
- dev_err(dev, "gphy fw probe failed\n");
|
||||
- return err;
|
||||
- }
|
||||
+ if (err)
|
||||
+ return dev_err_probe(dev, err,
|
||||
+ "gphy fw probe failed\n");
|
||||
}
|
||||
|
||||
/* bring up the mdio bus */
|
||||
@@ -2170,20 +2167,20 @@ static int gswip_probe(struct platform_d
|
||||
if (mdio_np) {
|
||||
err = gswip_mdio(priv, mdio_np);
|
||||
if (err) {
|
||||
- dev_err(dev, "mdio probe failed\n");
|
||||
+ dev_err_probe(dev, err, "mdio probe failed\n");
|
||||
goto put_mdio_node;
|
||||
}
|
||||
}
|
||||
|
||||
err = dsa_register_switch(priv->ds);
|
||||
if (err) {
|
||||
- dev_err(dev, "dsa switch register failed: %i\n", err);
|
||||
+ dev_err_probe(dev, err, "dsa switch registration failed\n");
|
||||
goto mdio_bus;
|
||||
}
|
||||
if (!dsa_is_cpu_port(priv->ds, priv->hw_info->cpu_port)) {
|
||||
- dev_err(dev, "wrong CPU port defined, HW only supports port: %i",
|
||||
- priv->hw_info->cpu_port);
|
||||
- err = -EINVAL;
|
||||
+ err = dev_err_probe(dev, -EINVAL,
|
||||
+ "wrong CPU port defined, HW only supports port: %i",
|
||||
+ priv->hw_info->cpu_port);
|
||||
goto disable_switch;
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 8cf0b680abc157adeec3fb93a10354c470694535 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Thu, 28 Jul 2022 22:37:11 +0200
|
||||
Subject: [PATCH 734/768] net: dsa: lantiq_gswip: Don't manually call
|
||||
gswip_port_enable()
|
||||
|
||||
We don't need to manually call gswip_port_enable() from within
|
||||
gswip_setup() for the CPU port. DSA does this automatically for us.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -891,8 +891,6 @@ static int gswip_setup(struct dsa_switch
|
||||
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
|
||||
- gswip_port_enable(ds, cpu_port, NULL);
|
||||
-
|
||||
ds->configure_vlan_while_not_filtering = false;
|
||||
|
||||
return 0;
|
@ -0,0 +1,70 @@
|
||||
From 54a2f7f2c134738bd3f4ea0a213138d169f2726e Mon Sep 17 00:00:00 2001
|
||||
From: Martin Schiller <ms@dev.tdt.de>
|
||||
Date: Fri, 10 May 2024 13:52:10 +0200
|
||||
Subject: [PATCH] net: dsa: lantiq_gswip: do also enable or disable cpu port
|
||||
|
||||
Before commit 74be4babe72f ("net: dsa: do not enable or disable non user
|
||||
ports"), gswip_port_enable/disable() were also executed for the cpu port
|
||||
in gswip_setup() which disabled the cpu port during initialization.
|
||||
|
||||
Let's restore this by removing the dsa_is_user_port checks. Also, let's
|
||||
clean up the gswip_port_enable() function so that we only have to check
|
||||
for the cpu port once.
|
||||
|
||||
Fixes: 74be4babe72f ("net: dsa: do not enable or disable non user ports")
|
||||
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 24 ++++++++----------------
|
||||
1 file changed, 8 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -688,13 +688,18 @@ static int gswip_port_enable(struct dsa_
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
int err;
|
||||
|
||||
- if (!dsa_is_user_port(ds, port))
|
||||
- return 0;
|
||||
-
|
||||
if (!dsa_is_cpu_port(ds, port)) {
|
||||
+ u32 mdio_phy = 0;
|
||||
+
|
||||
err = gswip_add_single_port_br(priv, port, true);
|
||||
if (err)
|
||||
return err;
|
||||
+
|
||||
+ if (phydev)
|
||||
+ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
|
||||
+
|
||||
+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
|
||||
+ GSWIP_MDIO_PHYp(port));
|
||||
}
|
||||
|
||||
/* RMON Counter Enable for port */
|
||||
@@ -707,16 +712,6 @@ static int gswip_port_enable(struct dsa_
|
||||
gswip_switch_mask(priv, 0, GSWIP_SDMA_PCTRL_EN,
|
||||
GSWIP_SDMA_PCTRLp(port));
|
||||
|
||||
- if (!dsa_is_cpu_port(ds, port)) {
|
||||
- u32 mdio_phy = 0;
|
||||
-
|
||||
- if (phydev)
|
||||
- mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
|
||||
-
|
||||
- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
|
||||
- GSWIP_MDIO_PHYp(port));
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -724,9 +719,6 @@ static void gswip_port_disable(struct ds
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
|
||||
- if (!dsa_is_user_port(ds, port))
|
||||
- return;
|
||||
-
|
||||
gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0,
|
||||
GSWIP_FDMA_PCTRLp(port));
|
||||
gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0,
|
@ -0,0 +1,30 @@
|
||||
From 8ab55ac9678ca1f50f786c84484599dd675c5a9f Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Wed, 18 May 2022 23:53:09 +0200
|
||||
Subject: [PATCH 736/768] net: dsa: lantiq_gswip: Use dsa_is_cpu_port() in
|
||||
gswip_port_change_mtu()
|
||||
|
||||
Make the check for the CPU port in gswip_port_change_mtu() consistent
|
||||
with other areas of the driver by using dsa_is_cpu_port().
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1457,12 +1457,11 @@ static int gswip_port_max_mtu(struct dsa
|
||||
static int gswip_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
- int cpu_port = priv->hw_info->cpu_port;
|
||||
|
||||
/* CPU port always has maximum mtu of user ports, so use it to set
|
||||
* switch frame size, including 8 byte special header.
|
||||
*/
|
||||
- if (port == cpu_port) {
|
||||
+ if (dsa_is_cpu_port(ds, port)) {
|
||||
new_mtu += 8;
|
||||
gswip_switch_w(priv, VLAN_ETH_HLEN + new_mtu + ETH_FCS_LEN,
|
||||
GSWIP_MAC_FLEN);
|
@ -0,0 +1,24 @@
|
||||
From ef98b183d8fc7187a2efcc21c8f54f3cf061d556 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Tue, 17 May 2022 22:39:58 +0200
|
||||
Subject: [PATCH 737/768] net: dsa: lantiq_gswip: Change literal 6 to ETH_ALEN
|
||||
|
||||
The addr variable in gswip_port_fdb_dump() stores a mac address. Use
|
||||
ETH_ALEN to make this consistent across other drivers.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1406,7 +1406,7 @@ static int gswip_port_fdb_dump(struct ds
|
||||
{
|
||||
struct gswip_priv *priv = ds->priv;
|
||||
struct gswip_pce_table_entry mac_bridge = {0,};
|
||||
- unsigned char addr[6];
|
||||
+ unsigned char addr[ETH_ALEN];
|
||||
int i;
|
||||
int err;
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 61e9b19f6e6174afa7540f0b468a69bc940b91d4 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 21:23:49 +0200
|
||||
Subject: [PATCH 738/768] net: dsa: lantiq_gswip: Consistently use macros for
|
||||
the mac bridge table
|
||||
|
||||
Introduce a new GSWIP_TABLE_MAC_BRIDGE_PORT macro and use it throughout
|
||||
the driver. Also update GSWIP_TABLE_MAC_BRIDGE_STATIC to use the BIT()
|
||||
macro. This makes the driver code easier to understand.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -236,7 +236,8 @@
|
||||
#define GSWIP_TABLE_ACTIVE_VLAN 0x01
|
||||
#define GSWIP_TABLE_VLAN_MAPPING 0x02
|
||||
#define GSWIP_TABLE_MAC_BRIDGE 0x0b
|
||||
-#define GSWIP_TABLE_MAC_BRIDGE_STATIC 0x01 /* Static not, aging entry */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging entry */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned entries */
|
||||
|
||||
#define XRX200_GPHY_FW_ALIGN (16 * 1024)
|
||||
|
||||
@@ -1300,7 +1301,8 @@ static void gswip_port_fast_age(struct d
|
||||
if (mac_bridge.val[1] & GSWIP_TABLE_MAC_BRIDGE_STATIC)
|
||||
continue;
|
||||
|
||||
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) != port)
|
||||
+ if (port != FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||||
+ mac_bridge.val[0]))
|
||||
continue;
|
||||
|
||||
mac_bridge.valid = false;
|
||||
@@ -1438,7 +1440,8 @@ static int gswip_port_fdb_dump(struct ds
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) {
|
||||
+ if (port == FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||||
+ mac_bridge.val[0])) {
|
||||
err = cb(addr, 0, false, data);
|
||||
if (err)
|
||||
return err;
|
@ -0,0 +1,26 @@
|
||||
From 7a9e185075ababa827d1d3a33b787ad6d718c8ec Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 22:24:24 +0200
|
||||
Subject: [PATCH 739/768] net: dsa: lantiq_gswip: Forbid
|
||||
gswip_add_single_port_br on the CPU port
|
||||
|
||||
Calling gswip_add_single_port_br() with the CPU port would be a bug
|
||||
because then only the CPU port could talk to itself. Add the CPU port to
|
||||
the validation at the beginning of gswip_add_single_port_br().
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -650,7 +650,7 @@ static int gswip_add_single_port_br(stru
|
||||
unsigned int max_ports = priv->hw_info->max_ports;
|
||||
int err;
|
||||
|
||||
- if (port >= max_ports) {
|
||||
+ if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) {
|
||||
dev_err(priv->dev, "single port for %i supported\n", port);
|
||||
return -EIO;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
From 28be6bfb735d851e646abb05b8e24eb6764596f5 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Mon, 1 Aug 2022 22:26:20 +0200
|
||||
Subject: [PATCH 740/768] net: dsa: lantiq_gswip: Fix error message in
|
||||
gswip_add_single_port_br()
|
||||
|
||||
The error message is printed when the port cannot be used. Update the
|
||||
error message to reflect that.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -651,7 +651,8 @@ static int gswip_add_single_port_br(stru
|
||||
int err;
|
||||
|
||||
if (port >= max_ports || dsa_is_cpu_port(priv->ds, port)) {
|
||||
- dev_err(priv->dev, "single port for %i supported\n", port);
|
||||
+ dev_err(priv->dev, "single port for %i is not supported\n",
|
||||
+ port);
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 45a0371568b1f050d787564875653f41a1f6fb98 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 14:06:40 +0200
|
||||
Subject: [PATCH 741/768] net: dsa: lantiq_gswip: Fix comments in
|
||||
gswip_port_vlan_filtering()
|
||||
|
||||
Update the comments in gswip_port_vlan_filtering() so it's clear that
|
||||
there are two separate cases, one for "tag based VLAN" and another one
|
||||
for "port based VLAN".
|
||||
|
||||
Suggested-by: Martin Schiller <ms@dev.tdt.de>
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -779,7 +779,7 @@ static int gswip_port_vlan_filtering(str
|
||||
}
|
||||
|
||||
if (vlan_filtering) {
|
||||
- /* Use port based VLAN tag */
|
||||
+ /* Use tag based VLAN */
|
||||
gswip_switch_mask(priv,
|
||||
GSWIP_PCE_VCTRL_VSR,
|
||||
GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR |
|
||||
@@ -788,7 +788,7 @@ static int gswip_port_vlan_filtering(str
|
||||
gswip_switch_mask(priv, GSWIP_PCE_PCTRL_0_TVM, 0,
|
||||
GSWIP_PCE_PCTRL_0p(port));
|
||||
} else {
|
||||
- /* Use port based VLAN tag */
|
||||
+ /* Use port based VLAN */
|
||||
gswip_switch_mask(priv,
|
||||
GSWIP_PCE_VCTRL_UVR | GSWIP_PCE_VCTRL_VIMR |
|
||||
GSWIP_PCE_VCTRL_VEMR,
|
@ -0,0 +1,33 @@
|
||||
From 4775f9543e691d9a2f5dd9aa5d46c66d37928250 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 14:19:05 +0200
|
||||
Subject: [PATCH 742/768] net: dsa: lantiq_gswip: Add and use a
|
||||
GSWIP_TABLE_MAC_BRIDGE_FID macro
|
||||
|
||||
Only bits [5:0] in mac_bridge.key[3] are reserved for the FID. Add a
|
||||
macro so this becomes obvious when reading the driver code.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -238,6 +238,7 @@
|
||||
#define GSWIP_TABLE_MAC_BRIDGE 0x0b
|
||||
#define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging entry */
|
||||
#define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned entries */
|
||||
+#define GSWIP_TABLE_MAC_BRIDGE_FID GENMASK(5, 0) /* Filtering identifier */
|
||||
|
||||
#define XRX200_GPHY_FW_ALIGN (16 * 1024)
|
||||
|
||||
@@ -1378,7 +1379,7 @@ static int gswip_port_fdb(struct dsa_swi
|
||||
mac_bridge.key[0] = addr[5] | (addr[4] << 8);
|
||||
mac_bridge.key[1] = addr[3] | (addr[2] << 8);
|
||||
mac_bridge.key[2] = addr[1] | (addr[0] << 8);
|
||||
- mac_bridge.key[3] = fid;
|
||||
+ mac_bridge.key[3] = FIELD_PREP(GSWIP_TABLE_MAC_BRIDGE_FID, fid);
|
||||
mac_bridge.val[0] = add ? BIT(port) : 0; /* port map */
|
||||
mac_bridge.val[1] = GSWIP_TABLE_MAC_BRIDGE_STATIC;
|
||||
mac_bridge.valid = add;
|
@ -0,0 +1,26 @@
|
||||
From 00b5121435ccd4ce54f79179dd9ee3e2610d7dcf Mon Sep 17 00:00:00 2001
|
||||
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
Date: Fri, 14 Oct 2022 16:31:57 +0200
|
||||
Subject: [PATCH 743/768] net: dsa: lantiq_gswip: Improve error message in
|
||||
gswip_port_fdb()
|
||||
|
||||
Print the port which is not found to be part of a bridge so it's easier
|
||||
to investigate the underlying issue.
|
||||
|
||||
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
---
|
||||
drivers/net/dsa/lantiq_gswip.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/lantiq_gswip.c
|
||||
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||||
@@ -1370,7 +1370,8 @@ static int gswip_port_fdb(struct dsa_swi
|
||||
}
|
||||
|
||||
if (fid == -1) {
|
||||
- dev_err(priv->dev, "Port not part of a bridge\n");
|
||||
+ dev_err(priv->dev,
|
||||
+ "Port %d is not known to be part of bridge\n", port);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user