Skip to content

Commit

Permalink
generic: 5.15: qca8k: refresh backport patches
Browse files Browse the repository at this point in the history
Refresh qca8k backport patches for 5.15 kernel.
Vlan_prepare is now dropped and there were some changes
to vlan add/remove functions.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  • Loading branch information
Ansuel authored and dangowrt committed Mar 27, 2022
1 parent fc87789 commit 7829ae4
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 63 deletions.
Expand Up @@ -18,9 +18,11 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index a429c9750add1b..d7bcecbc1c5300 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1433,6 +1433,12 @@ qca8k_phylink_mac_config(struct dsa_swit
@@ -1433,6 +1433,12 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,

qca8k_write(priv, QCA8K_REG_SGMII_CTRL, val);

Expand All @@ -33,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* For qca8327/qca8328/qca8334/qca8338 sgmii is unique and
* falling edge is set writing in the PORT0 PAD reg
*/
@@ -1455,12 +1461,6 @@ qca8k_phylink_mac_config(struct dsa_swit
@@ -1455,12 +1461,6 @@ qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE,
val);

Expand Down
Expand Up @@ -28,6 +28,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index d7bcecbc1c5300..147ca39531a3bb 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1256,8 +1256,12 @@ qca8k_setup(struct dsa_switch *ds)
Expand Down
Expand Up @@ -16,9 +16,11 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index a429c9750add1..bfffc1fb7016d 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -983,7 +983,7 @@ qca8k_parse_port_config(struct qca8k_pri
@@ -983,7 +983,7 @@ qca8k_parse_port_config(struct qca8k_priv *priv)
u32 delay;

/* We have 2 CPU port. Check them */
Expand All @@ -27,3 +29,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Skip every other port */
if (port != 0 && port != 6)
continue;
--
cgit 1.2.3-1.el7

Expand Up @@ -14,6 +14,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.h | 153 ++++++++++++++++++++++++++----------------------
2 files changed, 130 insertions(+), 121 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index bfffc1fb7016d..0eceb9cba2dc8 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -9,6 +9,7 @@
Expand All @@ -24,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include <net/dsa.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
@@ -319,18 +320,18 @@ qca8k_fdb_read(struct qca8k_priv *priv,
@@ -319,18 +320,18 @@ qca8k_fdb_read(struct qca8k_priv *priv, struct qca8k_fdb *fdb)
}

/* vid - 83:72 */
Expand Down Expand Up @@ -52,7 +54,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

return 0;
}
@@ -343,18 +344,18 @@ qca8k_fdb_write(struct qca8k_priv *priv,
@@ -343,18 +344,18 @@ qca8k_fdb_write(struct qca8k_priv *priv, u16 vid, u8 port_mask, const u8 *mac,
int i;

/* vid - 83:72 */
Expand Down Expand Up @@ -80,7 +82,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

/* load the array into the ARL table */
for (i = 0; i < 3; i++)
@@ -372,7 +373,7 @@ qca8k_fdb_access(struct qca8k_priv *priv
@@ -372,7 +373,7 @@ qca8k_fdb_access(struct qca8k_priv *priv, enum qca8k_fdb_cmd cmd, int port)
reg |= cmd;
if (port >= 0) {
reg |= QCA8K_ATU_FUNC_PORT_EN;
Expand All @@ -89,7 +91,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}

/* Write the function register triggering the table access */
@@ -454,7 +455,7 @@ qca8k_vlan_access(struct qca8k_priv *pri
@@ -454,7 +455,7 @@ qca8k_vlan_access(struct qca8k_priv *priv, enum qca8k_vlan_cmd cmd, u16 vid)
/* Set the command and VLAN index */
reg = QCA8K_VTU_FUNC1_BUSY;
reg |= cmd;
Expand All @@ -98,7 +100,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

/* Write the function register triggering the table access */
ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC1, reg);
@@ -500,13 +501,11 @@ qca8k_vlan_add(struct qca8k_priv *priv,
@@ -500,13 +501,11 @@ qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged)
if (ret < 0)
goto out;
reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN;
Expand All @@ -115,7 +117,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
if (ret)
@@ -534,15 +533,13 @@ qca8k_vlan_del(struct qca8k_priv *priv,
@@ -534,15 +533,13 @@ qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid)
ret = qca8k_read(priv, QCA8K_REG_VTU_FUNC0, &reg);
if (ret < 0)
goto out;
Expand All @@ -134,7 +136,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

if ((reg & mask) != mask) {
del = false;
@@ -1014,7 +1011,7 @@ qca8k_parse_port_config(struct qca8k_pri
@@ -1014,7 +1011,7 @@ qca8k_parse_port_config(struct qca8k_priv *priv)
mode == PHY_INTERFACE_MODE_RGMII_TXID)
delay = 1;

Expand All @@ -143,7 +145,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value");
delay = 3;
}
@@ -1030,7 +1027,7 @@ qca8k_parse_port_config(struct qca8k_pri
@@ -1030,7 +1027,7 @@ qca8k_parse_port_config(struct qca8k_priv *priv)
mode == PHY_INTERFACE_MODE_RGMII_RXID)
delay = 2;

Expand Down Expand Up @@ -207,7 +209,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN |
QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN |
QCA8K_PORT_HOL_CTRL1_WRED_EN,
@@ -1269,8 +1264,8 @@ qca8k_setup(struct dsa_switch *ds)
@@ -1265,8 +1260,8 @@ qca8k_setup(struct dsa_switch *ds)
mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) |
QCA8K_GLOBAL_FC_GOL_XOFF_THRES(496);
qca8k_rmw(priv, QCA8K_REG_GLOBAL_FC_THRESH,
Expand All @@ -218,35 +220,34 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
mask);
}

@@ -1918,11 +1913,11 @@ qca8k_port_vlan_filtering(struct dsa_swi
@@ -1912,11 +1907,11 @@ qca8k_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,

if (vlan_filtering) {
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
- QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_MASK,
QCA8K_PORT_LOOKUP_VLAN_MODE_SECURE);
ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
- QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_MASK,
QCA8K_PORT_LOOKUP_VLAN_MODE_SECURE);
} else {
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
- QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_MASK,
QCA8K_PORT_LOOKUP_VLAN_MODE_NONE);
ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
- QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_MASK,
QCA8K_PORT_LOOKUP_VLAN_MODE_NONE);
}

@@ -1953,11 +1948,9 @@ qca8k_port_vlan_add(struct dsa_switch *d
dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
@@ -1940,10 +1935,9 @@ qca8k_port_vlan_add(struct dsa_switch *ds, int port,
}

if (pvid) {
- int shift = 16 * (port % 2);
-
qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
- 0xfff << shift,
- vlan->vid_end << shift);
+ QCA8K_EGREES_VLAN_PORT_MASK(port),
+ QCA8K_EGREES_VLAN_PORT(port, vlan->vid_end));
qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port),
QCA8K_PORT_VLAN_CVID(vlan->vid_end) |
QCA8K_PORT_VLAN_SVID(vlan->vid_end));
@@ -2050,7 +2043,7 @@ static int qca8k_read_switch_id(struct q
ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
- 0xfff << shift, vlan->vid << shift);
+ QCA8K_EGREES_VLAN_PORT_MASK(port),
+ QCA8K_EGREES_VLAN_PORT(port, vlan->vid));
if (ret)
return ret;

@@ -2037,7 +2031,7 @@ static int qca8k_read_switch_id(struct qca8k_priv *priv)
if (ret < 0)
return -ENODEV;

Expand All @@ -255,7 +256,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (id != data->id) {
dev_err(priv->dev, "Switch id detected %x but expected %x", id, data->id);
return -ENODEV;
@@ -2059,7 +2052,7 @@ static int qca8k_read_switch_id(struct q
@@ -2046,7 +2040,7 @@ static int qca8k_read_switch_id(struct qca8k_priv *priv)
priv->switch_id = id;

/* Save revision to communicate to the internal PHY driver */
Expand All @@ -264,6 +265,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>

return 0;
}
diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
index 128b8cf85e080..085885275398b 100644
--- a/drivers/net/dsa/qca8k.h
+++ b/drivers/net/dsa/qca8k.h
@@ -30,9 +30,9 @@
Expand Down Expand Up @@ -506,3 +509,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#define QCA8K_EGRESS_VLAN(x) (0x0c70 + (4 * (x / 2)))

/* L3 registers */
--
cgit 1.2.3-1.el7

Expand Up @@ -12,6 +12,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 0eceb9cba2dc8..ae02043a52079 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1086,8 +1086,6 @@ qca8k_setup(struct dsa_switch *ds)
Expand All @@ -23,3 +25,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Start by setting up the register mapping */
priv->regmap = devm_regmap_init(ds->dev, NULL, priv,
&qca8k_regmap_config);
--
cgit 1.2.3-1.el7

Expand Up @@ -14,6 +14,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index ae02043a52079..f63a432916360 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1086,12 +1086,6 @@ qca8k_setup(struct dsa_switch *ds)
Expand All @@ -29,7 +31,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
ret = qca8k_setup_mdio_bus(priv);
if (ret)
return ret;
@@ -2085,6 +2079,14 @@ qca8k_sw_probe(struct mdio_device *mdiod
@@ -2073,6 +2067,14 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
gpiod_set_value_cansleep(priv->reset_gpio, 0);
}

Expand All @@ -44,3 +46,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Check the detected switch id */
ret = qca8k_read_switch_id(priv);
if (ret)
--
cgit 1.2.3-1.el7

Expand Up @@ -23,6 +23,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c | 107 +++++++++++++++++++++---------------------------
1 file changed, 47 insertions(+), 60 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index f63a432916360..d64a9af186beb 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -10,6 +10,7 @@
Expand All @@ -33,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include <net/dsa.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
@@ -152,6 +153,25 @@ qca8k_set_page(struct mii_bus *bus, u16
@@ -152,6 +153,25 @@ qca8k_set_page(struct mii_bus *bus, u16 page)
static int
qca8k_read(struct qca8k_priv *priv, u32 reg, u32 *val)
{
Expand Down Expand Up @@ -116,7 +118,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
static const struct regmap_range qca8k_readable_ranges[] = {
regmap_reg_range(0x0000, 0x00e4), /* Global control */
regmap_reg_range(0x0100, 0x0168), /* EEE control */
@@ -282,26 +276,19 @@ static struct regmap_config qca8k_regmap
@@ -282,26 +276,19 @@ static struct regmap_config qca8k_regmap_config = {
.max_register = 0x16ac, /* end MIB - Port6 range */
.reg_read = qca8k_regmap_read,
.reg_write = qca8k_regmap_write,
Expand Down Expand Up @@ -166,7 +168,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (ret)
goto exit;

@@ -597,9 +584,9 @@ qca8k_port_set_status(struct qca8k_priv
@@ -597,9 +584,9 @@ qca8k_port_set_status(struct qca8k_priv *priv, int port, int enable)
mask |= QCA8K_PORT_STATUS_LINK_AUTO;

if (enable)
Expand All @@ -178,7 +180,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}

static u32
@@ -861,8 +848,8 @@ qca8k_setup_mdio_bus(struct qca8k_priv *
@@ -861,8 +848,8 @@ qca8k_setup_mdio_bus(struct qca8k_priv *priv)
* a dt-overlay and driver reload changed the configuration
*/

Expand Down Expand Up @@ -221,7 +223,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (ret)
return ret;

@@ -1745,9 +1732,9 @@ qca8k_port_bridge_join(struct dsa_switch
@@ -1741,9 +1728,9 @@ qca8k_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *br)
/* Add this port to the portvlan mask of the other ports
* in the bridge
*/
Expand All @@ -234,7 +236,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (ret)
return ret;
if (i != port)
@@ -1777,9 +1764,9 @@ qca8k_port_bridge_leave(struct dsa_switc
@@ -1773,9 +1760,9 @@ qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br)
/* Remove this port to the portvlan mask of the other ports
* in the bridge
*/
Expand All @@ -247,3 +249,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}

/* Set the cpu port to be the only one in the portvlan mask of
--
cgit 1.2.3-1.el7

Expand Up @@ -17,9 +17,11 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.h | 4 ++++
2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index d64a9af186beb..bedaaa6b9a1df 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -70,6 +70,8 @@ static const struct qca8k_mib_desc ar832
@@ -70,6 +70,8 @@ static const struct qca8k_mib_desc ar8327_mib[] = {
MIB_DESC(1, 0x9c, "TxExcDefer"),
MIB_DESC(1, 0xa0, "TxDefer"),
MIB_DESC(1, 0xa4, "TxLateCol"),
Expand All @@ -28,7 +30,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
};

/* The 32bit switch registers are accessed indirectly. To achieve this we need
@@ -1605,12 +1607,16 @@ qca8k_phylink_mac_link_up(struct dsa_swi
@@ -1601,12 +1603,16 @@ qca8k_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode,
static void
qca8k_get_strings(struct dsa_switch *ds, int port, u32 stringset, uint8_t *data)
{
Expand All @@ -46,7 +48,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
strncpy(data + i * ETH_GSTRING_LEN, ar8327_mib[i].name,
ETH_GSTRING_LEN);
}
@@ -1620,12 +1626,15 @@ qca8k_get_ethtool_stats(struct dsa_switc
@@ -1616,12 +1622,15 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
uint64_t *data)
{
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
Expand All @@ -63,7 +65,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
mib = &ar8327_mib[i];
reg = QCA8K_PORT_MIB_COUNTER(port) + mib->offset;

@@ -1648,10 +1657,15 @@ qca8k_get_ethtool_stats(struct dsa_switc
@@ -1644,10 +1653,15 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
static int
qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset)
{
Expand All @@ -80,7 +82,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}

static int
@@ -2146,14 +2160,17 @@ static SIMPLE_DEV_PM_OPS(qca8k_pm_ops,
@@ -2150,14 +2164,17 @@ static SIMPLE_DEV_PM_OPS(qca8k_pm_ops,
static const struct qca8k_match_data qca8327 = {
.id = QCA8K_ID_QCA8327,
.reduced_package = true,
Expand All @@ -98,6 +100,8 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
};

static const struct of_device_id qca8k_of_match[] = {
diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
index 085885275398b..91c94dfc9789d 100644
--- a/drivers/net/dsa/qca8k.h
+++ b/drivers/net/dsa/qca8k.h
@@ -21,6 +21,9 @@
Expand All @@ -118,3 +122,6 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
};

enum {
--
cgit 1.2.3-1.el7

0 comments on commit 7829ae4

Please sign in to comment.