Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-09-30 21:40:13 +08:00
commit 022923f55b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
53 changed files with 3658 additions and 476 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd PKG_NAME:=hostapd
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git

View File

@ -0,0 +1,34 @@
From d387e34fec407f881fdf165b5d7ec128ebff362f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 19 Sep 2023 14:47:20 +0200
Subject: [PATCH] net: sfp: add quirk for Fiberstone GPON-ONU-34-20BI
Fiberstone GPON-ONU-34-20B can operate at 2500base-X, but report 1.2GBd
NRZ in their EEPROM.
The module also require the ignore tx fault fixup similar to Huawei MA5671A
as it gets disabled on error messages with serial redirection enabled.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20230919124720.8210-1-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/phy/sfp.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -368,6 +368,13 @@ static const struct sfp_quirk sfp_quirks
.modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_long_startup,
}, {
+ // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd
+ // NRZ in their EEPROM
+ .vendor = "FS",
+ .part = "GPON-ONU-34-20BI",
+ .modes = sfp_quirk_2500basex,
+ .fixup = sfp_fixup_ignore_tx_fault,
+ }, {
.vendor = "HALNy",
.part = "HL-GSFP",
.fixup = sfp_fixup_halny_gsfp,

View File

@ -0,0 +1,32 @@
From d387e34fec407f881fdf165b5d7ec128ebff362f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 19 Sep 2023 14:47:20 +0200
Subject: [PATCH] net: sfp: add quirk for Fiberstone GPON-ONU-34-20BI
Fiberstone GPON-ONU-34-20B can operate at 2500base-X, but report 1.2GBd
NRZ in their EEPROM.
The module also require the ignore tx fault fixup similar to Huawei MA5671A
as it gets disabled on error messages with serial redirection enabled.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20230919124720.8210-1-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/phy/sfp.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -393,6 +393,11 @@ static const struct sfp_quirk sfp_quirks
SFP_QUIRK("ALCATELLUCENT", "3FE46541AA", sfp_quirk_2500basex,
sfp_fixup_long_startup),
+ // Fiberstore GPON-ONU-34-20BI can operate at 2500base-X, but report 1.2GBd
+ // NRZ in their EEPROM
+ SFP_QUIRK("FS", "GPON-ONU-34-20BI", sfp_quirk_2500basex,
+ sfp_fixup_ignore_tx_fault),
+
SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp),
// HG MXPD-483II-F 2.5G supports 2500Base-X, but incorrectly reports

View File

@ -0,0 +1,63 @@
From e03cea60c3db8c6b011cc36ecef9281dff8377f3 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 25 Jan 2023 21:35:16 +0100
Subject: [PATCH] net: dsa: qca8k: add QCA8K_ATU_TABLE_SIZE define for fdb
access
Add and use QCA8K_ATU_TABLE_SIZE instead of hardcoding the ATU size with
a pure number and using sizeof on the array.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/dsa/qca/qca8k-common.c | 10 ++++++----
drivers/net/dsa/qca/qca8k.h | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -150,11 +150,12 @@ static int qca8k_busy_wait(struct qca8k_
static int qca8k_fdb_read(struct qca8k_priv *priv, struct qca8k_fdb *fdb)
{
- u32 reg[3];
+ u32 reg[QCA8K_ATU_TABLE_SIZE];
int ret;
/* load the ARL table into an array */
- ret = qca8k_bulk_read(priv, QCA8K_REG_ATU_DATA0, reg, sizeof(reg));
+ ret = qca8k_bulk_read(priv, QCA8K_REG_ATU_DATA0, reg,
+ QCA8K_ATU_TABLE_SIZE * sizeof(u32));
if (ret)
return ret;
@@ -178,7 +179,7 @@ static int qca8k_fdb_read(struct qca8k_p
static void qca8k_fdb_write(struct qca8k_priv *priv, u16 vid, u8 port_mask,
const u8 *mac, u8 aging)
{
- u32 reg[3] = { 0 };
+ u32 reg[QCA8K_ATU_TABLE_SIZE] = { 0 };
/* vid - 83:72 */
reg[2] = FIELD_PREP(QCA8K_ATU_VID_MASK, vid);
@@ -195,7 +196,8 @@ static void qca8k_fdb_write(struct qca8k
reg[0] |= FIELD_PREP(QCA8K_ATU_ADDR5_MASK, mac[5]);
/* load the array into the ARL table */
- qca8k_bulk_write(priv, QCA8K_REG_ATU_DATA0, reg, sizeof(reg));
+ qca8k_bulk_write(priv, QCA8K_REG_ATU_DATA0, reg,
+ QCA8K_ATU_TABLE_SIZE * sizeof(u32));
}
static int qca8k_fdb_access(struct qca8k_priv *priv, enum qca8k_fdb_cmd cmd,
--- a/drivers/net/dsa/qca/qca8k.h
+++ b/drivers/net/dsa/qca/qca8k.h
@@ -148,6 +148,8 @@
#define QCA8K_REG_IPV4_PRI_ADDR_MASK 0x474
/* Lookup registers */
+#define QCA8K_ATU_TABLE_SIZE 3 /* 12 bytes wide table / sizeof(u32) */
+
#define QCA8K_REG_ATU_DATA0 0x600
#define QCA8K_ATU_ADDR2_MASK GENMASK(31, 24)
#define QCA8K_ATU_ADDR3_MASK GENMASK(23, 16)

View File

@ -0,0 +1,261 @@
From c766e077d927e1775902c18827205ea2ade3a35d Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 25 Jan 2023 21:35:17 +0100
Subject: [PATCH] net: dsa: qca8k: convert to regmap read/write API
Convert qca8k to regmap read/write bulk API. The mgmt eth can write up
to 32 bytes of data at times. Currently we use a custom function to do
it but regmap now supports declaration of read/write bulk even without a
bus.
Drop the custom function and rework the regmap function to this new
implementation.
Rework the qca8k_fdb_read/write function to use the new
regmap_bulk_read/write as the old qca8k_bulk_read/write are now dropped.
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 92 ++++++++++++++++++++++++------
drivers/net/dsa/qca/qca8k-common.c | 47 ++-------------
drivers/net/dsa/qca/qca8k.h | 3 -
3 files changed, 77 insertions(+), 65 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -425,16 +425,12 @@ qca8k_regmap_update_bits_eth(struct qca8
}
static int
-qca8k_regmap_read(void *ctx, uint32_t reg, uint32_t *val)
+qca8k_read_mii(struct qca8k_priv *priv, uint32_t reg, uint32_t *val)
{
- struct qca8k_priv *priv = (struct qca8k_priv *)ctx;
struct mii_bus *bus = priv->bus;
u16 r1, r2, page;
int ret;
- if (!qca8k_read_eth(priv, reg, val, sizeof(*val)))
- return 0;
-
qca8k_split_addr(reg, &r1, &r2, &page);
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
@@ -451,16 +447,12 @@ exit:
}
static int
-qca8k_regmap_write(void *ctx, uint32_t reg, uint32_t val)
+qca8k_write_mii(struct qca8k_priv *priv, uint32_t reg, uint32_t val)
{
- struct qca8k_priv *priv = (struct qca8k_priv *)ctx;
struct mii_bus *bus = priv->bus;
u16 r1, r2, page;
int ret;
- if (!qca8k_write_eth(priv, reg, &val, sizeof(val)))
- return 0;
-
qca8k_split_addr(reg, &r1, &r2, &page);
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
@@ -477,17 +469,14 @@ exit:
}
static int
-qca8k_regmap_update_bits(void *ctx, uint32_t reg, uint32_t mask, uint32_t write_val)
+qca8k_regmap_update_bits_mii(struct qca8k_priv *priv, uint32_t reg,
+ uint32_t mask, uint32_t write_val)
{
- struct qca8k_priv *priv = (struct qca8k_priv *)ctx;
struct mii_bus *bus = priv->bus;
u16 r1, r2, page;
u32 val;
int ret;
- if (!qca8k_regmap_update_bits_eth(priv, reg, mask, write_val))
- return 0;
-
qca8k_split_addr(reg, &r1, &r2, &page);
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
@@ -510,17 +499,84 @@ exit:
return ret;
}
+static int
+qca8k_bulk_read(void *ctx, const void *reg_buf, size_t reg_len,
+ void *val_buf, size_t val_len)
+{
+ int i, count = val_len / sizeof(u32), ret;
+ u32 reg = *(u32 *)reg_buf & U16_MAX;
+ struct qca8k_priv *priv = ctx;
+
+ if (priv->mgmt_master &&
+ !qca8k_read_eth(priv, reg, val_buf, val_len))
+ return 0;
+
+ /* loop count times and increment reg of 4 */
+ for (i = 0; i < count; i++, reg += sizeof(u32)) {
+ ret = qca8k_read_mii(priv, reg, val_buf + i);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int
+qca8k_bulk_gather_write(void *ctx, const void *reg_buf, size_t reg_len,
+ const void *val_buf, size_t val_len)
+{
+ int i, count = val_len / sizeof(u32), ret;
+ u32 reg = *(u32 *)reg_buf & U16_MAX;
+ struct qca8k_priv *priv = ctx;
+ u32 *val = (u32 *)val_buf;
+
+ if (priv->mgmt_master &&
+ !qca8k_write_eth(priv, reg, val, val_len))
+ return 0;
+
+ /* loop count times, increment reg of 4 and increment val ptr to
+ * the next value
+ */
+ for (i = 0; i < count; i++, reg += sizeof(u32), val++) {
+ ret = qca8k_write_mii(priv, reg, *val);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int
+qca8k_bulk_write(void *ctx, const void *data, size_t bytes)
+{
+ return qca8k_bulk_gather_write(ctx, data, sizeof(u16), data + sizeof(u16),
+ bytes - sizeof(u16));
+}
+
+static int
+qca8k_regmap_update_bits(void *ctx, uint32_t reg, uint32_t mask, uint32_t write_val)
+{
+ struct qca8k_priv *priv = ctx;
+
+ if (!qca8k_regmap_update_bits_eth(priv, reg, mask, write_val))
+ return 0;
+
+ return qca8k_regmap_update_bits_mii(priv, reg, mask, write_val);
+}
+
static struct regmap_config qca8k_regmap_config = {
.reg_bits = 16,
.val_bits = 32,
.reg_stride = 4,
.max_register = 0x16ac, /* end MIB - Port6 range */
- .reg_read = qca8k_regmap_read,
- .reg_write = qca8k_regmap_write,
+ .read = qca8k_bulk_read,
+ .write = qca8k_bulk_write,
.reg_update_bits = qca8k_regmap_update_bits,
.rd_table = &qca8k_readable_table,
.disable_locking = true, /* Locking is handled by qca8k read/write */
.cache_type = REGCACHE_NONE, /* Explicitly disable CACHE */
+ .max_raw_read = 32, /* mgmt eth can read/write up to 8 registers at time */
+ .max_raw_write = 32,
};
static int
@@ -2091,8 +2147,6 @@ static SIMPLE_DEV_PM_OPS(qca8k_pm_ops,
static const struct qca8k_info_ops qca8xxx_ops = {
.autocast_mib = qca8k_get_ethtool_stats_eth,
- .read_eth = qca8k_read_eth,
- .write_eth = qca8k_write_eth,
};
static const struct qca8k_match_data qca8327 = {
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -101,45 +101,6 @@ const struct regmap_access_table qca8k_r
.n_yes_ranges = ARRAY_SIZE(qca8k_readable_ranges),
};
-/* TODO: remove these extra ops when we can support regmap bulk read/write */
-static int qca8k_bulk_read(struct qca8k_priv *priv, u32 reg, u32 *val, int len)
-{
- int i, count = len / sizeof(u32), ret;
-
- if (priv->mgmt_master && priv->info->ops->read_eth &&
- !priv->info->ops->read_eth(priv, reg, val, len))
- return 0;
-
- for (i = 0; i < count; i++) {
- ret = regmap_read(priv->regmap, reg + (i * 4), val + i);
- if (ret < 0)
- return ret;
- }
-
- return 0;
-}
-
-/* TODO: remove these extra ops when we can support regmap bulk read/write */
-static int qca8k_bulk_write(struct qca8k_priv *priv, u32 reg, u32 *val, int len)
-{
- int i, count = len / sizeof(u32), ret;
- u32 tmp;
-
- if (priv->mgmt_master && priv->info->ops->write_eth &&
- !priv->info->ops->write_eth(priv, reg, val, len))
- return 0;
-
- for (i = 0; i < count; i++) {
- tmp = val[i];
-
- ret = regmap_write(priv->regmap, reg + (i * 4), tmp);
- if (ret < 0)
- return ret;
- }
-
- return 0;
-}
-
static int qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask)
{
u32 val;
@@ -154,8 +115,8 @@ static int qca8k_fdb_read(struct qca8k_p
int ret;
/* load the ARL table into an array */
- ret = qca8k_bulk_read(priv, QCA8K_REG_ATU_DATA0, reg,
- QCA8K_ATU_TABLE_SIZE * sizeof(u32));
+ ret = regmap_bulk_read(priv->regmap, QCA8K_REG_ATU_DATA0, reg,
+ QCA8K_ATU_TABLE_SIZE);
if (ret)
return ret;
@@ -196,8 +157,8 @@ static void qca8k_fdb_write(struct qca8k
reg[0] |= FIELD_PREP(QCA8K_ATU_ADDR5_MASK, mac[5]);
/* load the array into the ARL table */
- qca8k_bulk_write(priv, QCA8K_REG_ATU_DATA0, reg,
- QCA8K_ATU_TABLE_SIZE * sizeof(u32));
+ regmap_bulk_write(priv->regmap, QCA8K_REG_ATU_DATA0, reg,
+ QCA8K_ATU_TABLE_SIZE);
}
static int qca8k_fdb_access(struct qca8k_priv *priv, enum qca8k_fdb_cmd cmd,
--- a/drivers/net/dsa/qca/qca8k.h
+++ b/drivers/net/dsa/qca/qca8k.h
@@ -330,9 +330,6 @@ struct qca8k_priv;
struct qca8k_info_ops {
int (*autocast_mib)(struct dsa_switch *ds, int port, u64 *data);
- /* TODO: remove these extra ops when we can support regmap bulk read/write */
- int (*read_eth)(struct qca8k_priv *priv, u32 reg, u32 *val, int len);
- int (*write_eth)(struct qca8k_priv *priv, u32 reg, u32 *val, int len);
};
struct qca8k_match_data {

View File

@ -0,0 +1,78 @@
From 2c39dd025da489cf87d26469d9f5ff19715324a0 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 24 Jul 2023 05:25:28 +0200
Subject: [PATCH 1/4] net: dsa: qca8k: enable use_single_write for qca8xxx
The qca8xxx switch supports 2 way to write reg values, a slow way using
mdio and a fast way by sending specially crafted mgmt packet to
read/write reg.
The fast way can support up to 32 bytes of data as eth packet are used
to send/receive.
This correctly works for almost the entire regmap of the switch but with
the use of some kernel selftests for dsa drivers it was found a funny
and interesting hw defect/limitation.
For some specific reg, bulk write won't work and will result in writing
only part of the requested regs resulting in half data written. This was
especially hard to track and discover due to the total strangeness of
the problem and also by the specific regs where this occurs.
This occurs in the specific regs of the ATU table, where multiple entry
needs to be written to compose the entire entry.
It was discovered that with a bulk write of 12 bytes on
QCA8K_REG_ATU_DATA0 only QCA8K_REG_ATU_DATA0 and QCA8K_REG_ATU_DATA2
were written, but QCA8K_REG_ATU_DATA1 was always zero.
Tcpdump was used to make sure the specially crafted packet was correct
and this was confirmed.
The problem was hard to track as the lack of QCA8K_REG_ATU_DATA1
resulted in an entry somehow possible as the first bytes of the mac
address are set in QCA8K_REG_ATU_DATA0 and the entry type is set in
QCA8K_REG_ATU_DATA2.
Funlly enough writing QCA8K_REG_ATU_DATA1 results in the same problem
with QCA8K_REG_ATU_DATA2 empty and QCA8K_REG_ATU_DATA1 and
QCA8K_REG_ATU_FUNC correctly written.
A speculation on the problem might be that there are some kind of
indirection internally when accessing these regs and they can't be
accessed all together, due to the fact that it's really a table mapped
somewhere in the switch SRAM.
Even more funny is the fact that every other reg was tested with all
kind of combination and they are not affected by this problem. Read
operation was also tested and always worked so it's not affected by this
problem.
The problem is not present if we limit writing a single reg at times.
To handle this hardware defect, enable use_single_write so that bulk
api can correctly split the write in multiple different operation
effectively reverting to a non-bulk write.
Cc: Mark Brown <broonie@kernel.org>
Fixes: c766e077d927 ("net: dsa: qca8k: convert to regmap read/write API")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -575,8 +575,11 @@ static struct regmap_config qca8k_regmap
.rd_table = &qca8k_readable_table,
.disable_locking = true, /* Locking is handled by qca8k read/write */
.cache_type = REGCACHE_NONE, /* Explicitly disable CACHE */
- .max_raw_read = 32, /* mgmt eth can read/write up to 8 registers at time */
- .max_raw_write = 32,
+ .max_raw_read = 32, /* mgmt eth can read up to 8 registers at time */
+ /* ATU regs suffer from a bug where some data are not correctly
+ * written. Disable bulk write to correctly write ATU entry.
+ */
+ .use_single_write = true,
};
static int

View File

@ -0,0 +1,146 @@
From 23cfc7172e5297d0bee49ac6f6f8248d1cf0820d Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sun, 30 Jul 2023 09:41:10 +0200
Subject: [PATCH 1/4] net: dsa: qca8k: make learning configurable and keep off
if standalone
Address learning should initially be turned off by the driver for port
operation in standalone mode, then the DSA core handles changes to it
via ds->ops->port_bridge_flags().
Currently this is not the case for qca8k where learning is enabled
unconditionally in qca8k_setup for every user port.
Handle ports configured in standalone mode by making the learning
configurable and not enabling it by default.
Implement .port_pre_bridge_flags and .port_bridge_flags dsa ops to
enable learning for bridge that request it and tweak
.port_stp_state_set to correctly disable learning when port is
configured in standalone mode.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230730074113.21889-2-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 7 +++--
drivers/net/dsa/qca/qca8k-common.c | 48 ++++++++++++++++++++++++++++++
drivers/net/dsa/qca/qca8k.h | 6 ++++
3 files changed, 58 insertions(+), 3 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1883,9 +1883,8 @@ qca8k_setup(struct dsa_switch *ds)
if (ret)
return ret;
- /* Enable ARP Auto-learning by default */
- ret = regmap_set_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(i),
- QCA8K_PORT_LOOKUP_LEARN);
+ ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(i),
+ QCA8K_PORT_LOOKUP_LEARN);
if (ret)
return ret;
@@ -1991,6 +1990,8 @@ static const struct dsa_switch_ops qca8k
.port_change_mtu = qca8k_port_change_mtu,
.port_max_mtu = qca8k_port_max_mtu,
.port_stp_state_set = qca8k_port_stp_state_set,
+ .port_pre_bridge_flags = qca8k_port_pre_bridge_flags,
+ .port_bridge_flags = qca8k_port_bridge_flags,
.port_bridge_join = qca8k_port_bridge_join,
.port_bridge_leave = qca8k_port_bridge_leave,
.port_fast_age = qca8k_port_fast_age,
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -565,9 +565,26 @@ int qca8k_get_mac_eee(struct dsa_switch
return 0;
}
+static int qca8k_port_configure_learning(struct dsa_switch *ds, int port,
+ bool learning)
+{
+ struct qca8k_priv *priv = ds->priv;
+
+ if (learning)
+ return regmap_set_bits(priv->regmap,
+ QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_LEARN);
+ else
+ return regmap_clear_bits(priv->regmap,
+ QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_LEARN);
+}
+
void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
{
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct qca8k_priv *priv = ds->priv;
+ bool learning = false;
u32 stp_state;
switch (state) {
@@ -582,8 +599,11 @@ void qca8k_port_stp_state_set(struct dsa
break;
case BR_STATE_LEARNING:
stp_state = QCA8K_PORT_LOOKUP_STATE_LEARNING;
+ learning = dp->learning;
break;
case BR_STATE_FORWARDING:
+ learning = dp->learning;
+ fallthrough;
default:
stp_state = QCA8K_PORT_LOOKUP_STATE_FORWARD;
break;
@@ -591,6 +611,34 @@ void qca8k_port_stp_state_set(struct dsa
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
QCA8K_PORT_LOOKUP_STATE_MASK, stp_state);
+
+ qca8k_port_configure_learning(ds, port, learning);
+}
+
+int qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port,
+ struct switchdev_brport_flags flags,
+ struct netlink_ext_ack *extack)
+{
+ if (flags.mask & ~BR_LEARNING)
+ return -EINVAL;
+
+ return 0;
+}
+
+int qca8k_port_bridge_flags(struct dsa_switch *ds, int port,
+ struct switchdev_brport_flags flags,
+ struct netlink_ext_ack *extack)
+{
+ int ret;
+
+ if (flags.mask & BR_LEARNING) {
+ ret = qca8k_port_configure_learning(ds, port,
+ flags.val & BR_LEARNING);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
--- a/drivers/net/dsa/qca/qca8k.h
+++ b/drivers/net/dsa/qca/qca8k.h
@@ -448,6 +448,12 @@ int qca8k_get_mac_eee(struct dsa_switch
/* Common bridge function */
void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);
+int qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port,
+ struct switchdev_brport_flags flags,
+ struct netlink_ext_ack *extack);
+int qca8k_port_bridge_flags(struct dsa_switch *ds, int port,
+ struct switchdev_brport_flags flags,
+ struct netlink_ext_ack *extack);
int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
struct dsa_bridge bridge,
bool *tx_fwd_offload,

View File

@ -0,0 +1,53 @@
From 18e8feae4a807994e4906d659116d249bfecd4c5 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sun, 30 Jul 2023 09:41:11 +0200
Subject: [PATCH 2/4] net: dsa: qca8k: limit user ports access to the first CPU
port on setup
In preparation for multi-CPU support, set CPU port LOOKUP MEMBER outside
the port loop and setup the LOOKUP MEMBER mask for user ports only to
the first CPU port.
This is to handle flooding condition where every CPU port is set as
target and prevent packet duplication for unknown frames from user ports.
Secondary CPU port LOOKUP MEMBER mask will be setup later when
port_change_master will be implemented.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20230730074113.21889-3-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1863,18 +1863,16 @@ qca8k_setup(struct dsa_switch *ds)
if (ret)
return ret;
+ /* CPU port gets connected to all user ports of the switch */
+ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port),
+ QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
+ if (ret)
+ return ret;
+
/* Setup connection between CPU port & user ports
* Configure specific switch configuration for ports
*/
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
- /* CPU port gets connected to all user ports of the switch */
- if (dsa_is_cpu_port(ds, i)) {
- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
- QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
- if (ret)
- return ret;
- }
-
/* Individual user ports get connected to CPU port only */
if (dsa_is_user_port(ds, i)) {
ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),

View File

@ -0,0 +1,111 @@
From a9108b0712bf018dc69020864b21485b71b17dfc Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sun, 30 Jul 2023 09:41:12 +0200
Subject: [PATCH 3/4] net: dsa: qca8k: move qca8xxx hol fixup to separate
function
Move qca8xxx hol fixup to separate function to tidy things up and to
permit using a more efficent loop in future patch.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230730074113.21889-4-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 78 +++++++++++++++++---------------
1 file changed, 42 insertions(+), 36 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1773,6 +1773,46 @@ static int qca8k_connect_tag_protocol(st
return 0;
}
+static void qca8k_setup_hol_fixup(struct qca8k_priv *priv, int port)
+{
+ u32 mask;
+
+ switch (port) {
+ /* The 2 CPU port and port 5 requires some different
+ * priority than any other ports.
+ */
+ case 0:
+ case 5:
+ case 6:
+ mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x4) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x4) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI4(0x6) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI5(0x8) |
+ QCA8K_PORT_HOL_CTRL0_EG_PORT(0x1e);
+ break;
+ default:
+ mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x6) |
+ QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x8) |
+ QCA8K_PORT_HOL_CTRL0_EG_PORT(0x19);
+ }
+ regmap_write(priv->regmap, QCA8K_REG_PORT_HOL_CTRL0(port), mask);
+
+ mask = QCA8K_PORT_HOL_CTRL1_ING(0x6) |
+ QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN |
+ QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN |
+ QCA8K_PORT_HOL_CTRL1_WRED_EN;
+ regmap_update_bits(priv->regmap, QCA8K_REG_PORT_HOL_CTRL1(port),
+ QCA8K_PORT_HOL_CTRL1_ING_BUF_MASK |
+ QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN |
+ QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN |
+ QCA8K_PORT_HOL_CTRL1_WRED_EN,
+ mask);
+}
+
static int
qca8k_setup(struct dsa_switch *ds)
{
@@ -1908,42 +1948,8 @@ qca8k_setup(struct dsa_switch *ds)
* missing settings to improve switch stability under load condition.
* This problem is limited to qca8337 and other qca8k switch are not affected.
*/
- if (priv->switch_id == QCA8K_ID_QCA8337) {
- switch (i) {
- /* The 2 CPU port and port 5 requires some different
- * priority than any other ports.
- */
- case 0:
- case 5:
- case 6:
- mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x4) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x4) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI4(0x6) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI5(0x8) |
- QCA8K_PORT_HOL_CTRL0_EG_PORT(0x1e);
- break;
- default:
- mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x6) |
- QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x8) |
- QCA8K_PORT_HOL_CTRL0_EG_PORT(0x19);
- }
- qca8k_write(priv, QCA8K_REG_PORT_HOL_CTRL0(i), mask);
-
- mask = QCA8K_PORT_HOL_CTRL1_ING(0x6) |
- QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN |
- QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN |
- QCA8K_PORT_HOL_CTRL1_WRED_EN;
- qca8k_rmw(priv, QCA8K_REG_PORT_HOL_CTRL1(i),
- QCA8K_PORT_HOL_CTRL1_ING_BUF_MASK |
- QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN |
- QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN |
- QCA8K_PORT_HOL_CTRL1_WRED_EN,
- mask);
- }
+ if (priv->switch_id == QCA8K_ID_QCA8337)
+ qca8k_setup_hol_fixup(priv, i);
}
/* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */

View File

@ -0,0 +1,158 @@
From 01e6f8ad8d26ced14b0cf288c42e55d03a7c5070 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sun, 30 Jul 2023 09:41:13 +0200
Subject: [PATCH 4/4] net: dsa: qca8k: use dsa_for_each macro instead of for
loop
Convert for loop to dsa_for_each macro to save some redundant write on
unconnected/unused port and tidy things up.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230730074113.21889-5-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 107 ++++++++++++++++---------------
1 file changed, 54 insertions(+), 53 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1817,7 +1817,8 @@ static int
qca8k_setup(struct dsa_switch *ds)
{
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
- int cpu_port, ret, i;
+ struct dsa_port *dp;
+ int cpu_port, ret;
u32 mask;
cpu_port = qca8k_find_cpu_port(ds);
@@ -1868,27 +1869,27 @@ qca8k_setup(struct dsa_switch *ds)
dev_warn(priv->dev, "mib init failed");
/* Initial setup of all ports */
- for (i = 0; i < QCA8K_NUM_PORTS; i++) {
+ dsa_switch_for_each_port(dp, ds) {
/* Disable forwarding by default on all ports */
- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
+ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(dp->index),
QCA8K_PORT_LOOKUP_MEMBER, 0);
if (ret)
return ret;
+ }
- /* Enable QCA header mode on all cpu ports */
- if (dsa_is_cpu_port(ds, i)) {
- ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(i),
- FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) |
- FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL));
- if (ret) {
- dev_err(priv->dev, "failed enabling QCA header mode");
- return ret;
- }
+ /* Disable MAC by default on all user ports */
+ dsa_switch_for_each_user_port(dp, ds)
+ qca8k_port_set_status(priv, dp->index, 0);
+
+ /* Enable QCA header mode on all cpu ports */
+ dsa_switch_for_each_cpu_port(dp, ds) {
+ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(dp->index),
+ FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) |
+ FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL));
+ if (ret) {
+ dev_err(priv->dev, "failed enabling QCA header mode on port %d", dp->index);
+ return ret;
}
-
- /* Disable MAC by default on all user ports */
- if (dsa_is_user_port(ds, i))
- qca8k_port_set_status(priv, i, 0);
}
/* Forward all unknown frames to CPU port for Linux processing
@@ -1910,48 +1911,48 @@ qca8k_setup(struct dsa_switch *ds)
return ret;
/* Setup connection between CPU port & user ports
- * Configure specific switch configuration for ports
+ * Individual user ports get connected to CPU port only
*/
- for (i = 0; i < QCA8K_NUM_PORTS; i++) {
- /* Individual user ports get connected to CPU port only */
- if (dsa_is_user_port(ds, i)) {
- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
- QCA8K_PORT_LOOKUP_MEMBER,
- BIT(cpu_port));
- if (ret)
- return ret;
-
- ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(i),
- QCA8K_PORT_LOOKUP_LEARN);
- if (ret)
- return ret;
-
- /* For port based vlans to work we need to set the
- * default egress vid
- */
- ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(i),
- QCA8K_EGREES_VLAN_PORT_MASK(i),
- QCA8K_EGREES_VLAN_PORT(i, QCA8K_PORT_VID_DEF));
- if (ret)
- return ret;
-
- ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(i),
- QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) |
- QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF));
- if (ret)
- return ret;
- }
+ dsa_switch_for_each_user_port(dp, ds) {
+ u8 port = dp->index;
- /* The port 5 of the qca8337 have some problem in flood condition. The
- * original legacy driver had some specific buffer and priority settings
- * for the different port suggested by the QCA switch team. Add this
- * missing settings to improve switch stability under load condition.
- * This problem is limited to qca8337 and other qca8k switch are not affected.
+ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_MEMBER,
+ BIT(cpu_port));
+ if (ret)
+ return ret;
+
+ ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_LEARN);
+ if (ret)
+ return ret;
+
+ /* For port based vlans to work we need to set the
+ * default egress vid
*/
- if (priv->switch_id == QCA8K_ID_QCA8337)
- qca8k_setup_hol_fixup(priv, i);
+ ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
+ QCA8K_EGREES_VLAN_PORT_MASK(port),
+ QCA8K_EGREES_VLAN_PORT(port, QCA8K_PORT_VID_DEF));
+ if (ret)
+ return ret;
+
+ ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port),
+ QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) |
+ QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF));
+ if (ret)
+ return ret;
}
+ /* The port 5 of the qca8337 have some problem in flood condition. The
+ * original legacy driver had some specific buffer and priority settings
+ * for the different port suggested by the QCA switch team. Add this
+ * missing settings to improve switch stability under load condition.
+ * This problem is limited to qca8337 and other qca8k switch are not affected.
+ */
+ if (priv->switch_id == QCA8K_ID_QCA8337)
+ dsa_switch_for_each_available_port(dp, ds)
+ qca8k_setup_hol_fixup(priv, dp->index);
+
/* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */
if (priv->switch_id == QCA8K_ID_QCA8327) {
mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) |

View File

@ -20,7 +20,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/dsa/qca/qca8k-8xxx.c --- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -719,21 +719,6 @@ err_clear_skb: @@ -778,21 +778,6 @@ err_clear_skb:
return ret; return ret;
} }
@ -44,7 +44,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
{ {
--- a/drivers/net/dsa/qca/qca8k.h --- a/drivers/net/dsa/qca/qca8k.h
+++ b/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h
@@ -422,6 +422,20 @@ struct qca8k_fdb { @@ -421,6 +421,20 @@ struct qca8k_fdb {
u8 mac[6]; u8 mac[6];
}; };

View File

@ -71,7 +71,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
static void static void
qca8k_split_addr(u32 regaddr, u16 *r1, u16 *r2, u16 *page) qca8k_split_addr(u32 regaddr, u16 *r1, u16 *r2, u16 *page)
@@ -1729,6 +1730,10 @@ qca8k_setup(struct dsa_switch *ds) @@ -1829,6 +1830,10 @@ qca8k_setup(struct dsa_switch *ds)
if (ret) if (ret)
return ret; return ret;
@ -386,7 +386,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#define QCA8K_GOL_MAC_ADDR0 0x60 #define QCA8K_GOL_MAC_ADDR0 0x60
#define QCA8K_GOL_MAC_ADDR1 0x64 #define QCA8K_GOL_MAC_ADDR1 0x64
#define QCA8K_MAX_FRAME_SIZE 0x78 #define QCA8K_MAX_FRAME_SIZE 0x78
@@ -383,6 +429,19 @@ struct qca8k_pcs { @@ -382,6 +428,19 @@ struct qca8k_pcs {
int port; int port;
}; };
@ -406,7 +406,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
struct qca8k_priv { struct qca8k_priv {
u8 switch_id; u8 switch_id;
u8 switch_revision; u8 switch_revision;
@@ -407,6 +466,7 @@ struct qca8k_priv { @@ -406,6 +465,7 @@ struct qca8k_priv {
struct qca8k_pcs pcs_port_0; struct qca8k_pcs pcs_port_0;
struct qca8k_pcs pcs_port_6; struct qca8k_pcs pcs_port_6;
const struct qca8k_match_data *info; const struct qca8k_match_data *info;

View File

@ -26,7 +26,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -383,6 +383,11 @@ static const struct sfp_quirk sfp_quirks @@ -390,6 +390,11 @@ static const struct sfp_quirk sfp_quirks
.modes = sfp_quirk_2500basex, .modes = sfp_quirk_2500basex,
.fixup = sfp_fixup_ignore_tx_fault, .fixup = sfp_fixup_ignore_tx_fault,
}, { }, {
@ -38,7 +38,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
// Lantech 8330-262D-E can operate at 2500base-X, but // Lantech 8330-262D-E can operate at 2500base-X, but
// incorrectly report 2500MBd NRZ in their EEPROM // incorrectly report 2500MBd NRZ in their EEPROM
.vendor = "Lantech", .vendor = "Lantech",
@@ -2312,7 +2317,8 @@ static void sfp_sm_main(struct sfp *sfp, @@ -2319,7 +2324,8 @@ static void sfp_sm_main(struct sfp *sfp,
* or t_start_up, so assume there is a fault. * or t_start_up, so assume there is a fault.
*/ */
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
@ -48,7 +48,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done: init_done:
sfp->sm_phy_retries = R_PHY_RETRY; sfp->sm_phy_retries = R_PHY_RETRY;
@@ -2535,10 +2541,12 @@ static void sfp_check_state(struct sfp * @@ -2542,10 +2548,12 @@ static void sfp_check_state(struct sfp *
mutex_lock(&sfp->st_mutex); mutex_lock(&sfp->st_mutex);
state = sfp_get_state(sfp); state = sfp_get_state(sfp);
changed = state ^ sfp->state; changed = state ^ sfp->state;

View File

@ -26,7 +26,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -404,6 +404,9 @@ static const struct sfp_quirk sfp_quirks @@ -409,6 +409,9 @@ static const struct sfp_quirk sfp_quirks
SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex, SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
sfp_fixup_ignore_tx_fault), sfp_fixup_ignore_tx_fault),
@ -36,7 +36,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
// Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report
// 2500MBd NRZ in their EEPROM // 2500MBd NRZ in their EEPROM
SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex), SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
@@ -2339,7 +2342,8 @@ static void sfp_sm_main(struct sfp *sfp, @@ -2344,7 +2347,8 @@ static void sfp_sm_main(struct sfp *sfp,
* or t_start_up, so assume there is a fault. * or t_start_up, so assume there is a fault.
*/ */
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT, sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
@ -46,7 +46,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) { } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done: init_done:
/* Create mdiobus and start trying for PHY */ /* Create mdiobus and start trying for PHY */
@@ -2568,10 +2572,12 @@ static void sfp_check_state(struct sfp * @@ -2573,10 +2577,12 @@ static void sfp_check_state(struct sfp *
mutex_lock(&sfp->st_mutex); mutex_lock(&sfp->st_mutex);
state = sfp_get_state(sfp); state = sfp_get_state(sfp);
changed = state ^ sfp->state; changed = state ^ sfp->state;

View File

@ -0,0 +1,86 @@
From 3b4329230db8750bea7a56ef07f07cbbf5fc6c5a Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 4 Jul 2023 22:50:12 +0200
Subject: [PATCH 19/20] net: dsa: qca8k: implement lag_fdb_add/del ops
Implement lag_fdb_add/del ops to correctly support using LAG interface.
Qca8k switch supports declaring fdb entry for link aggregation by simply
setting the DES_PORT bits to all the LAG member.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 2 ++
drivers/net/dsa/qca/qca8k-common.c | 48 ++++++++++++++++++++++++++++++
drivers/net/dsa/qca/qca8k.h | 6 ++++
3 files changed, 56 insertions(+)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1993,6 +1993,8 @@ static const struct dsa_switch_ops qca8k
.port_fdb_add = qca8k_port_fdb_add,
.port_fdb_del = qca8k_port_fdb_del,
.port_fdb_dump = qca8k_port_fdb_dump,
+ .lag_fdb_add = qca8k_lag_fdb_add,
+ .lag_fdb_del = qca8k_lag_fdb_del,
.port_mdb_add = qca8k_port_mdb_add,
.port_mdb_del = qca8k_port_mdb_del,
.port_mirror_add = qca8k_port_mirror_add,
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -1215,6 +1215,42 @@ int qca8k_port_lag_leave(struct dsa_swit
return qca8k_lag_refresh_portmap(ds, port, lag, true);
}
+int qca8k_lag_fdb_add(struct dsa_switch *ds, struct dsa_lag lag,
+ const unsigned char *addr, u16 vid,
+ struct dsa_db db)
+{
+ struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
+ struct dsa_port *dp;
+ u16 port_mask = 0;
+
+ /* Set the vid to the port vlan id if no vid is set */
+ if (!vid)
+ vid = QCA8K_PORT_VID_DEF;
+
+ dsa_lag_foreach_port(dp, ds->dst, &lag)
+ port_mask |= BIT(dp->index);
+
+ return qca8k_port_fdb_insert(priv, addr, port_mask, vid);
+}
+
+int qca8k_lag_fdb_del(struct dsa_switch *ds, struct dsa_lag lag,
+ const unsigned char *addr, u16 vid,
+ struct dsa_db db)
+{
+ struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
+ struct dsa_port *dp;
+ u16 port_mask = 0;
+
+ /* Set the vid to the port vlan id if no vid is set */
+ if (!vid)
+ vid = QCA8K_PORT_VID_DEF;
+
+ dsa_lag_foreach_port(dp, ds->dst, &lag)
+ port_mask |= BIT(dp->index);
+
+ return qca8k_fdb_del(priv, addr, port_mask, vid);
+}
+
int qca8k_read_switch_id(struct qca8k_priv *priv)
{
u32 val;
--- a/drivers/net/dsa/qca/qca8k.h
+++ b/drivers/net/dsa/qca/qca8k.h
@@ -590,5 +590,11 @@ int qca8k_port_lag_join(struct dsa_switc
struct netlink_ext_ack *extack);
int qca8k_port_lag_leave(struct dsa_switch *ds, int port,
struct dsa_lag lag);
+int qca8k_lag_fdb_add(struct dsa_switch *ds, struct dsa_lag lag,
+ const unsigned char *addr, u16 vid,
+ struct dsa_db db);
+int qca8k_lag_fdb_del(struct dsa_switch *ds, struct dsa_lag lag,
+ const unsigned char *addr, u16 vid,
+ struct dsa_db db);
#endif /* __QCA8K_H */

View File

@ -0,0 +1,37 @@
From b954d61d9ecfa64450fc178586719dc2a95b92a7 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 20 Jun 2023 21:48:24 +0200
Subject: [PATCH 3/4] net: dsa: qca8k: enable flooding to both CPU port
To permit a multi-CPU setup, flood all unknown frames to all CPU ports.
Each CPU port should have correct LOOKUP MEMBER configuration to
prevent receiving duplicate packets from user ports.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1882,15 +1882,12 @@ qca8k_setup(struct dsa_switch *ds)
}
}
- /* Forward all unknown frames to CPU port for Linux processing
- * Notice that in multi-cpu config only one port should be set
- * for igmp, unknown, multicast and broadcast packet
- */
+ /* Forward all unknown frames to CPU port for Linux processing */
ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1,
- FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_MASK, BIT(cpu_port)) |
- FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_BC_DP_MASK, BIT(cpu_port)) |
- FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_MC_DP_MASK, BIT(cpu_port)) |
- FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_UC_DP_MASK, BIT(cpu_port)));
+ FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_MASK, dsa_cpu_ports(ds)) |
+ FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_BC_DP_MASK, dsa_cpu_ports(ds)) |
+ FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_MC_DP_MASK, dsa_cpu_ports(ds)) |
+ FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_UC_DP_MASK, dsa_cpu_ports(ds)));
if (ret)
return ret;

View File

@ -0,0 +1,158 @@
From b2d6ebf2f92f8695c83fa6979f4ab579c588df76 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 20 Jun 2023 07:57:38 +0200
Subject: [PATCH 4/4] net: dsa: qca8k: add support for port_change_master
Add support for port_change_master to permit assigning an alternative
CPU port if the switch have both CPU port connected or create a LAG on
both CPU port and assign the LAG as DSA master.
On port change master request, we check if the master is a LAG.
With LAG we compose the cpu_port_mask with the CPU port in the LAG, if
master is a simple dsa_port, we derive the index.
Finally we apply the new cpu_port_mask to the LOOKUP MEMBER to permit
the port to receive packet by the new CPU port setup for the port and we
refresh the CPU ports LOOKUP MEMBER configuration to reflect the new
user port state.
port_lag_join/leave is updated to refresh the user ports if we detect
that the LAG is a DSA master and we have user port using it as a master.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/dsa/qca/qca8k-8xxx.c | 116 ++++++++++++++++++++++++++++++-
1 file changed, 114 insertions(+), 2 deletions(-)
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -1719,6 +1719,117 @@ qca8k_get_tag_protocol(struct dsa_switch
return DSA_TAG_PROTO_QCA;
}
+static int qca8k_port_change_master(struct dsa_switch *ds, int port,
+ struct net_device *master,
+ struct netlink_ext_ack *extack)
+{
+ struct dsa_switch_tree *dst = ds->dst;
+ struct qca8k_priv *priv = ds->priv;
+ u8 cpu_port_mask = 0;
+ struct dsa_port *dp;
+ u32 val;
+ int ret;
+
+ /* With LAG of CPU port, compose the mask for port LOOKUP MEMBER */
+ if (netif_is_lag_master(master)) {
+ struct dsa_lag *lag;
+ int id;
+
+ id = dsa_lag_id(dst, master);
+ lag = dsa_lag_by_id(dst, id);
+
+ dsa_lag_foreach_port(dp, dst, lag)
+ if (dsa_port_is_cpu(dp))
+ cpu_port_mask |= BIT(dp->index);
+ } else {
+ dp = master->dsa_ptr;
+ cpu_port_mask |= BIT(dp->index);
+ }
+
+ /* Connect port to new cpu port */
+ ret = regmap_read(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port), &val);
+ if (ret)
+ return ret;
+
+ /* Reset connected CPU port in port LOOKUP MEMBER */
+ val &= ~dsa_cpu_ports(ds);
+ /* Assign the new CPU port in port LOOKUP MEMBER */
+ val |= cpu_port_mask;
+
+ ret = regmap_update_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_MEMBER,
+ val);
+ if (ret)
+ return ret;
+
+ /* Refresh CPU port LOOKUP MEMBER with new port */
+ dsa_tree_for_each_cpu_port(dp, ds->dst) {
+ u32 reg = QCA8K_PORT_LOOKUP_CTRL(dp->index);
+
+ /* If CPU port in mask assign port, else remove port */
+ if (BIT(dp->index) & cpu_port_mask)
+ ret = regmap_set_bits(priv->regmap, reg, BIT(port));
+ else
+ ret = regmap_clear_bits(priv->regmap, reg, BIT(port));
+
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int qca8k_port_lag_refresh_user_ports(struct dsa_switch *ds,
+ struct dsa_lag lag)
+{
+ struct net_device *lag_dev = lag.dev;
+ struct dsa_port *dp;
+ int ret;
+
+ /* Ignore if LAG is not a DSA master */
+ if (!netif_is_lag_master(lag_dev))
+ return 0;
+
+ dsa_switch_for_each_user_port(dp, ds) {
+ /* Skip if assigned master is not the LAG */
+ if (dsa_port_to_master(dp) != lag_dev)
+ continue;
+
+ ret = qca8k_port_change_master(ds, dp->index,
+ lag_dev, NULL);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int qca8xxx_port_lag_join(struct dsa_switch *ds, int port,
+ struct dsa_lag lag,
+ struct netdev_lag_upper_info *info,
+ struct netlink_ext_ack *extack)
+{
+ int ret;
+
+ ret = qca8k_port_lag_join(ds, port, lag, info, extack);
+ if (ret)
+ return ret;
+
+ return qca8k_port_lag_refresh_user_ports(ds, lag);
+}
+
+static int qca8xxx_port_lag_leave(struct dsa_switch *ds, int port,
+ struct dsa_lag lag)
+{
+ int ret;
+
+ ret = qca8k_port_lag_leave(ds, port, lag);
+ if (ret)
+ return ret;
+
+ return qca8k_port_lag_refresh_user_ports(ds, lag);
+}
+
static void
qca8k_master_change(struct dsa_switch *ds, const struct net_device *master,
bool operational)
@@ -2005,8 +2116,9 @@ static const struct dsa_switch_ops qca8k
.phylink_mac_link_down = qca8k_phylink_mac_link_down,
.phylink_mac_link_up = qca8k_phylink_mac_link_up,
.get_phy_flags = qca8k_get_phy_flags,
- .port_lag_join = qca8k_port_lag_join,
- .port_lag_leave = qca8k_port_lag_leave,
+ .port_lag_join = qca8xxx_port_lag_join,
+ .port_lag_leave = qca8xxx_port_lag_leave,
+ .port_change_master = qca8k_port_change_master,
.master_state_change = qca8k_master_change,
.connect_tag_protocol = qca8k_connect_tag_protocol,
};

View File

@ -58,7 +58,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
+obj-$(CONFIG_NET_DSA_QCA8K_IPQ4019) += qca8k-ipq4019.o qca8k-common.o +obj-$(CONFIG_NET_DSA_QCA8K_IPQ4019) += qca8k-ipq4019.o qca8k-common.o
--- a/drivers/net/dsa/qca/qca8k-common.c --- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c +++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -449,7 +449,7 @@ static int qca8k_vlan_del(struct qca8k_p @@ -412,7 +412,7 @@ static int qca8k_vlan_del(struct qca8k_p
/* Check if we're the last member to be removed */ /* Check if we're the last member to be removed */
del = true; del = true;
@ -67,7 +67,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
mask = QCA8K_VTU_FUNC0_EG_MODE_PORT_NOT(i); mask = QCA8K_VTU_FUNC0_EG_MODE_PORT_NOT(i);
if ((reg & mask) != mask) { if ((reg & mask) != mask) {
@@ -642,7 +642,7 @@ int qca8k_port_bridge_join(struct dsa_sw @@ -653,7 +653,7 @@ int qca8k_port_bridge_join(struct dsa_sw
cpu_port = dsa_to_port(ds, port)->cpu_dp->index; cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
port_mask = BIT(cpu_port); port_mask = BIT(cpu_port);
@ -76,7 +76,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
if (dsa_is_cpu_port(ds, i)) if (dsa_is_cpu_port(ds, i))
continue; continue;
if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
@@ -674,7 +674,7 @@ void qca8k_port_bridge_leave(struct dsa_ @@ -685,7 +685,7 @@ void qca8k_port_bridge_leave(struct dsa_
cpu_port = dsa_to_port(ds, port)->cpu_dp->index; cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
@ -1057,7 +1057,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
#define QCA8K_QCA832X_MIB_COUNT 39 #define QCA8K_QCA832X_MIB_COUNT 39
#define QCA8K_QCA833X_MIB_COUNT 41 #define QCA8K_QCA833X_MIB_COUNT 41
@@ -263,6 +267,7 @@ @@ -265,6 +269,7 @@
#define QCA8K_PORT_LOOKUP_STATE_LEARNING QCA8K_PORT_LOOKUP_STATE(0x3) #define QCA8K_PORT_LOOKUP_STATE_LEARNING QCA8K_PORT_LOOKUP_STATE(0x3)
#define QCA8K_PORT_LOOKUP_STATE_FORWARD QCA8K_PORT_LOOKUP_STATE(0x4) #define QCA8K_PORT_LOOKUP_STATE_FORWARD QCA8K_PORT_LOOKUP_STATE(0x4)
#define QCA8K_PORT_LOOKUP_LEARN BIT(20) #define QCA8K_PORT_LOOKUP_LEARN BIT(20)
@ -1065,7 +1065,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
#define QCA8K_PORT_LOOKUP_ING_MIRROR_EN BIT(25) #define QCA8K_PORT_LOOKUP_ING_MIRROR_EN BIT(25)
#define QCA8K_REG_GOL_TRUNK_CTRL0 0x700 #define QCA8K_REG_GOL_TRUNK_CTRL0 0x700
@@ -339,6 +344,53 @@ @@ -341,6 +346,53 @@
#define MII_ATH_MMD_ADDR 0x0d #define MII_ATH_MMD_ADDR 0x0d
#define MII_ATH_MMD_DATA 0x0e #define MII_ATH_MMD_DATA 0x0e
@ -1119,7 +1119,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
enum { enum {
QCA8K_PORT_SPEED_10M = 0, QCA8K_PORT_SPEED_10M = 0,
QCA8K_PORT_SPEED_100M = 1, QCA8K_PORT_SPEED_100M = 1,
@@ -467,6 +519,10 @@ struct qca8k_priv { @@ -466,6 +518,10 @@ struct qca8k_priv {
struct qca8k_pcs pcs_port_6; struct qca8k_pcs pcs_port_6;
const struct qca8k_match_data *info; const struct qca8k_match_data *info;
struct qca8k_led ports_led[QCA8K_LED_COUNT]; struct qca8k_led ports_led[QCA8K_LED_COUNT];

View File

@ -16,11 +16,11 @@ KERNELNAME:=zImage Image dtbs
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += \ DEFAULT_PACKAGES += \
kmod-leds-gpio kmod-gpio-button-hotplug swconfig \ kmod-leds-gpio kmod-gpio-button-hotplug \
kmod-ata-ahci kmod-ata-ahci-platform \ kmod-ata-ahci kmod-ata-ahci-platform \
kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
kmod-phy-qcom-ipq806x-usb kmod-usb3 kmod-usb-dwc3-qcom \ kmod-phy-qcom-ipq806x-usb kmod-usb3 kmod-usb-dwc3-qcom \
kmod-ath10k-ct wpad-openssl uboot-envtools \ kmod-ath10k-ct wpad-openssl uboot-envtools \
automount ip-tiny automount
$(eval $(call BuildTarget)) $(eval $(call BuildTarget))

View File

@ -9,9 +9,21 @@ board_config_update
board=$(board_name) board=$(board_name)
case "$board" in case "$board" in
askey,rt4230w-rev6)
ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "qca8k-0.0:00:green:wan" "wan" "link-10 link-100 link-1000"
ucidef_set_led_netdev "wan-port-activity" "WAN-PORT-ACTIVITY" "qca8k-0.0:00:amber:wan" "wan" "tx rx"
ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "qca8k-0.0:01:green:lan" "lan1" "link-10 link-100 link-1000"
ucidef_set_led_netdev "lan1-port-activity" "LAN1-PORT-ACTIVITY" "qca8k-0.0:01:amber:lan" "lan1" "tx rx"
ucidef_set_led_netdev "lan2-port-link" "LAN2-PORT-LINK" "qca8k-0.0:02:green:lan" "lan2" "link-10 link-100 link-1000"
ucidef_set_led_netdev "lan2-port-activity" "LAN2-PORT-ACTIVITY" "qca8k-0.0:02:amber:lan" "lan2" "tx rx"
ucidef_set_led_netdev "lan3-port-link" "LAN3-PORT-LINK" "qca8k-0.0:03:green:lan" "lan3" "link-10 link-100 link-1000"
ucidef_set_led_netdev "lan3-port-activity" "LAN3-PORT-ACTIVITY" "qca8k-0.0:03:amber:lan" "lan3" "tx rx"
ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "qca8k-0.0:04:green:lan" "lan4" "link-10 link-100 link-1000"
ucidef_set_led_netdev "lan4-port-activity" "LAN4-PORT-ACTIVITY" "qca8k-0.0:04:amber:lan" "lan4" "tx rx"
;;
buffalo,wxr-2533dhp) buffalo,wxr-2533dhp)
ucidef_set_led_wlan "wlan" "WLAN" "white:wireless" "phy0tpt" ucidef_set_led_wlan "wlan" "WLAN" "white:wireless" "phy0tpt"
ucidef_set_led_switch "wan" "WAN" "white:internet" "switch0" "0x20" ucidef_set_led_netdev "wan" "WAN" "white:internet" "wan"
;; ;;
compex,wpq864) compex,wpq864)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
@ -28,10 +40,25 @@ meraki,mr52)
nec,wg2600hp) nec,wg2600hp)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
ucidef_set_led_switch "wan" "WAN" "green:active" "switch0" "0x2" ucidef_set_led_netdev "wan" "WAN" "green:active" "wan"
;; ;;
nec,wg2600hp3) nec,wg2600hp3)
ucidef_set_led_switch "wan" "WAN" "green:active" "switch0" "0x2" ucidef_set_led_netdev "wan" "WAN" "green:active" "wan"
ucidef_set_led_netdev "wan-port-10" "WAN-PORT-10" "qca8k-0.0:00:green:wan-1" "wan" "tx rx link-10"
ucidef_set_led_netdev "wan-port-100" "WAN-PORT-100" "qca8k-0.0:00:green:wan-2" "wan" "tx rx link-100"
ucidef_set_led_netdev "wan-port-1000" "WAN-PORT-1000" "qca8k-0.0:00:green:wan-3" "wan" "tx rx link-1000"
ucidef_set_led_netdev "lan1-port-10" "LAN1-PORT-10" "qca8k-0.0:01:green:lan-1" "lan1" "tx rx link-10"
ucidef_set_led_netdev "lan1-port-100" "LAN1-PORT-100" "qca8k-0.0:01:green:lan-2" "lan1" "tx rx link-100"
ucidef_set_led_netdev "lan1-port-1000" "LAN1-PORT-1000" "qca8k-0.0:01:green:lan-3" "lan1" "tx rx link-1000"
ucidef_set_led_netdev "lan2-port-10" "LAN2-PORT-10" "qca8k-0.0:02:green:lan-1" "lan2" "tx rx link-10"
ucidef_set_led_netdev "lan2-port-100" "LAN2-PORT-100" "qca8k-0.0:02:green:lan-2" "lan2" "tx rx link-100"
ucidef_set_led_netdev "lan2-port-1000" "LAN2-PORT-1000" "qca8k-0.0:02:green:lan-3" "lan2" "tx rx link-1000"
ucidef_set_led_netdev "lan3-port-10" "LAN3-PORT-10" "qca8k-0.0:03:green:lan-1" "lan3" "tx rx link-10"
ucidef_set_led_netdev "lan3-port-100" "LAN3-PORT-100" "qca8k-0.0:03:green:lan-2" "lan3" "tx rx link-100"
ucidef_set_led_netdev "lan3-port-1000" "LAN3-PORT-1000" "qca8k-0.0:03:green:lan-3" "lan3" "tx rx link-1000"
ucidef_set_led_netdev "lan4-port-10" "LAN4-PORT-10" "qca8k-0.0:04:green:lan-1" "lan4" "tx rx link-10"
ucidef_set_led_netdev "lan4-port-100" "LAN4-PORT-100" "qca8k-0.0:04:green:lan-2" "lan4" "tx rx link-100"
ucidef_set_led_netdev "lan4-port-1000" "LAN4-PORT-1000" "qca8k-0.0:04:green:lan-3" "lan4" "tx rx link-1000"
;; ;;
netgear,d7800 |\ netgear,d7800 |\
netgear,r7500 |\ netgear,r7500 |\
@ -41,7 +68,7 @@ netgear,xr450 |\
netgear,xr500) netgear,xr500)
ucidef_set_led_usbport "usb1" "USB 1" "white:usb1" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb1" "USB 1" "white:usb1" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB 2" "white:usb2" "usb3-port1" "usb4-port1" ucidef_set_led_usbport "usb2" "USB 2" "white:usb2" "usb3-port1" "usb4-port1"
ucidef_set_led_switch "wan" "WAN" "white:wan" "switch0" "0x20" ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan"
ucidef_set_led_ide "esata" "eSATA" "white:esata" ucidef_set_led_ide "esata" "eSATA" "white:esata"
;; ;;
nokia,ac400i) nokia,ac400i)
@ -55,8 +82,8 @@ nokia,ac400i)
tplink,ad7200) tplink,ad7200)
ucidef_set_led_usbport "usb1" "USB 1" "blue:usb1" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb1" "USB 1" "blue:usb1" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB 2" "blue:usb3" "usb3-port1" "usb4-port1" ucidef_set_led_usbport "usb2" "USB 2" "blue:usb3" "usb3-port1" "usb4-port1"
ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x02" ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan"
ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x3c" ucidef_set_led_netdev "lan" "lan" "blue:lan" "br-lan"
ucidef_set_led_wlan "wlan2g" "wlan2g" "blue:wlan2g" "phy2tpt" ucidef_set_led_wlan "wlan2g" "wlan2g" "blue:wlan2g" "phy2tpt"
ucidef_set_led_wlan "wlan5g" "wlan5g" "blue:wlan5g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "wlan5g" "blue:wlan5g" "phy1tpt"
ucidef_set_led_netdev "wlan60g" "wlan60g" "blue:wlan60g" "wlan0" ucidef_set_led_netdev "wlan60g" "wlan60g" "blue:wlan60g" "wlan0"
@ -64,18 +91,18 @@ tplink,ad7200)
tplink,c2600) tplink,c2600)
ucidef_set_led_usbport "usb1" "USB 1" "white:usb_2" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb1" "USB 1" "white:usb_2" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB 2" "white:usb_4" "usb3-port1" "usb4-port1" ucidef_set_led_usbport "usb2" "USB 2" "white:usb_4" "usb3-port1" "usb4-port1"
ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x20" ucidef_set_led_netdev "wan" "wan" "white:wan" "wan"
ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x1e" ucidef_set_led_netdev "lan" "lan" "white:lan" "br-lan"
;; ;;
tplink,vr2600v) tplink,vr2600v)
ucidef_set_led_usbport "usb" "USB" "white:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" ucidef_set_led_usbport "usb" "USB" "white:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x1e" ucidef_set_led_netdev "lan" "lan" "white:lan" "br-lan"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "white:wlan2g" "phy0tpt" ucidef_set_led_wlan "wlan2g" "WLAN2G" "white:wlan2g" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "white:wlan5g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "white:wlan5g" "phy1tpt"
ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x20" ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan"
;; ;;
zyxel,nbg6817) zyxel,nbg6817)
ucidef_set_led_netdev "wan" "WAN" "white:internet" "eth1" ucidef_set_led_netdev "wan" "WAN" "white:internet" "wan"
;; ;;
esac esac

View File

@ -12,35 +12,48 @@ ipq806x_setup_interfaces()
case "$board" in case "$board" in
arris,tr4400-v2) arris,tr4400-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth2" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth2"
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "0u@eth0"
;; ;;
askey,rt4230w-rev6 |\ askey,rt4230w-rev6 |\
asrock,g10 |\ asrock,g10 |\
nec,wg2600hp) nec,wg2600hp |\
ucidef_add_switch "switch0" \
"2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
;;
buffalo,wxr-2533dhp |\ buffalo,wxr-2533dhp |\
compex,wpq864 |\ compex,wpq864 |\
netgear,d7800 |\ netgear,d7800 |\
netgear,r7500 |\ netgear,r7500 |\
netgear,r7500v2 |\ netgear,r7500v2 |\
qcom,ipq8064-ap148) qcom,ipq8064-ap148 |\
ucidef_add_switch "switch0" \ linksys,ea7500-v1 |\
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0" linksys,ea8500 |\
nec,wg2600hp3 |\
netgear,r7800 |\
netgear,xr500 |\
netgear,xr450 |\
tplink,c2600 |\
tplink,vr2600v |\
tplink,ad7200 |\
zyxel,nbg6817)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
asus,onhub |\
ruijie,rg-mtfi-m520 |\
tplink,onhub)
ucidef_set_interfaces_lan_wan "lan1" "wan"
;; ;;
edgecore,ecw5410) edgecore,ecw5410)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
;; ;;
linksys,ea7500-v1) qcom,ipq8064-ap161)
ucidef_add_switch "switch0" \ ucidef_set_interface_lan "eth1 eth2 lan1 lan2 lan3 lan4" "wan"
"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
;; ;;
linksys,ea8500) qcom,ipq8064-db149)
ucidef_add_switch "switch0" \ ucidef_set_interface_lan "eth1 eth2 eth3 lan1 lan2 lan3 lan4" "wan"
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0" ;;
ubnt,unifi-ac-hd)
ucidef_set_interface_lan "eth0 eth1"
;;
xiaomi,mi-router-hd)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;; ;;
meraki,mr42) meraki,mr42)
ucidef_set_interface_lan "eth0" ucidef_set_interface_lan "eth0"
@ -48,57 +61,13 @@ ipq806x_setup_interfaces()
meraki,mr52) meraki,mr52)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
;; ;;
nec,wg2600hp3)
ucidef_add_switch "switch0" \
"2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
;;
netgear,r7800 |\
netgear,xr450 |\
netgear,xr500 |\
tplink,c2600 |\
tplink,vr2600v)
ucidef_add_switch "switch0" \
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
;;
qcom,ipq8064-ap161)
ucidef_set_interface_lan "eth1 eth2"
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
;;
qcom,ipq8064-db149)
ucidef_set_interface_lan "eth1 eth2 eth3"
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
;;
tplink,ad7200)
ucidef_add_switch "switch0" \
"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
;;
asus,onhub |\
tplink,onhub)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" \
"1:lan" "6@eth1" "2:wan" "0@eth0"
;;
nokia,ac400i |\
ubnt,unifi-ac-hd)
ucidef_set_interface_lan "eth0 eth1"
;;
xiaomi,mi-router-hd)
ucidef_add_switch "switch0" \
"1:lan:3" "2:lan:2" "3:lan:1" "6@eth1" "5:wan" "0@eth0"
;;
zyxel,nbg6817)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
;;
*) *)
echo "Unsupported hardware. Network interfaces not intialized" echo "Unsupported hardware. Network interfaces not intialized"
;; ;;
esac esac
} }
ipq806x_setup_mac_address() ipq806x_setup_macs()
{ {
local board="$1" local board="$1"
@ -115,8 +84,6 @@ ipq806x_setup_mac_address()
;; ;;
ruijie,rg-mtfi-m520) ruijie,rg-mtfi-m520)
hw_mac_addr=$(mtd_get_mac_ascii PRODUCTINFO ethaddr) hw_mac_addr=$(mtd_get_mac_ascii PRODUCTINFO ethaddr)
ucidef_add_switch "switch0" \
"1:lan" "6@eth1" "5:wan" "0@eth0"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr" ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 1)" ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 1)"
;; ;;
@ -125,14 +92,19 @@ ipq806x_setup_mac_address()
ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)" ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)" ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
;; ;;
asrock,g10)
hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
esac esac
} }
board_config_update board_config_update
board=$(board_name) board=$(board_name)
ipq806x_setup_mac_address $board ipq806x_setup_macs $board
ipq806x_setup_interfaces $board ipq806x_setup_interfaces $board
board_config_flush board_config_flush

View File

@ -0,0 +1,47 @@
#!/bin/sh
#
# Copyright (C) 2020 OpenWrt.org
#
. /lib/functions.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
arris,tr4400-v2 |\
askey,rt4230w-rev6 |\
asrock,g10 |\
buffalo,wxr-2533dhp |\
compex,wpq864 |\
nec,wg2600hp |\
nec,wg2600hp3 |\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
netgear,r7800 |\
netgear,xr450 |\
netgear,xr500 |\
nokia,ac400i |\
qcom,ipq8064-ap148 |\
qcom,ipq8064-ap161 |\
qcom,ipq8064-db149 |\
ruijie,rg-mtfi-m520 |\
tplink,ad7200 |\
tplink,c2600 |\
tplink,vr2600v |\
xiaomi,mi-router-hd |\
zyxel,nbg6817 |\
asus,onhub |\
tplink,onhub)
ucidef_set_compat_version "1.1"
;;
linksys,ea7500-v1 |\
linksys,ea8500)
ucidef_set_compat_version "2.1"
;;
esac
board_config_flush
exit 0

View File

@ -0,0 +1,52 @@
#!/bin/sh /etc/rc.common
START=15
set_qca8k_port() {
local port=$1
local master=$2
ip link set $port type dsa conduit $master
}
boot() {
# Restore original implementation where the eth1 (port 6) was used
# for the lan port and the eth0 (port 0) was used for the wan port
case $(board_name) in
askey,rt4230w-rev6 |\
asrock,g10 |\
buffalo,wxr-2533dhp |\
compex,wpq864 |\
nec,wg2600hp |\
nec,wg2600hp3 |\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
netgear,r7800 |\
netgear,xr450 |\
netgear,xr500 |\
nokia,ac400i |\
tplink,ad7200 |\
tplink,c2600 |\
tplink,vr2600v |\
zyxel,nbg6817)
set_qca8k_port lan1 eth1
set_qca8k_port lan2 eth1
set_qca8k_port lan3 eth1
set_qca8k_port lan4 eth1
set_qca8k_port wan eth0
;;
asus,onhub |\
ruijie,rg-mtfi-m520 |\
tplink,onhub)
set_qca8k_port lan1 eth1
set_qca8k_port wan eth0
;;
xiaomi,mi-router-hd)
set_qca8k_port lan1 eth1
set_qca8k_port lan2 eth1
set_qca8k_port lan3 eth1
set_qca8k_port wan eth0
;;
esac
}

View File

@ -1,19 +0,0 @@
. /lib/functions.sh
preinit_set_mac_address() {
case $(board_name) in
asrock,g10)
lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
wan_mac=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
ip link set dev eth0 address "${lan_mac}"
ip link set dev eth1 address "${wan_mac}"
;;
ruijie,rg-mtfi-m520)
base_mac=$(mtd_get_mac_ascii PRODUCTINFO ethaddr)
ip link set dev eth0 address $(macaddr_add "$base_mac" 1)
ip link set dev eth1 address $(macaddr_add "$base_mac" 2)
;;
esac
}
boot_hook_add preinit_main preinit_set_mac_address

View File

@ -1,7 +1,6 @@
CONFIG_ALIGNMENT_TRAP=y CONFIG_ALIGNMENT_TRAP=y
# CONFIG_APQ_GCC_8084 is not set # CONFIG_APQ_GCC_8084 is not set
# CONFIG_APQ_MMCC_8084 is not set # CONFIG_APQ_MMCC_8084 is not set
CONFIG_AR8216_PHY=y
CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_32BIT_OFF_T=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y
# CONFIG_ARCH_IPQ40XX is not set # CONFIG_ARCH_IPQ40XX is not set

View File

@ -2,6 +2,7 @@
#include "qcom-ipq8062-smb208.dtsi" #include "qcom-ipq8062-smb208.dtsi"
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ { / {
model = "NEC Platforms Aterm WG2600HP3"; model = "NEC Platforms Aterm WG2600HP3";
@ -413,21 +414,198 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x04 0x80080080 /* PAD0_MODE */ ethernet = <&gmac1>;
0x0c 0x06000000 /* PAD6_MODE */ phy-mode = "rgmii";
0x10 0x002613a0 /* PWS_REG */ tx-internal-delay-ps = <1000>;
0x50 0xcc36cc36 /* LED_CTRL0 */
0x54 0xca36ca36 /* LED_CTRL1 */ fixed-link {
0x58 0xc936c936 /* LED_CTRL2 */ speed = <1000>;
0x5c 0x03ffff00 /* LED_CTRL3 */ full-duplex;
0x7c 0x0000004e /* PORT0_STATUS */ };
0x94 0x0000004e /* PORT6_STATUS */ };
0xe0 0xc74164de /* SGMII_CTRL */
0xe4 0x0006a545 /* MAC_PWR_SEL */ port@1 {
>; reg = <1>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port1>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_WAN;
default-state = "keep";
};
};
};
port@2 {
reg = <2>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port2>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@4 {
reg = <4>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port4>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@5 {
reg = <5>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port5>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
qca,sgmii-rxclk-falling-edge;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -337,21 +337,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -129,6 +129,32 @@
}; };
}; };
&mdio0 {
switch@10 {
ports {
port@1 {
label = "wan";
};
port@2 {
label = "lan1";
};
port@3 {
label = "lan2";
};
port@4 {
label = "lan3";
};
port@5 {
label = "lan4";
};
};
};
};
&pcie2 { &pcie2 {
status = "okay"; status = "okay";
max-link-speed = <1>; max-link-speed = <1>;

View File

@ -90,21 +90,106 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
/*
port@6 {
reg = <0>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
asym-pause;
};
};
*/
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -102,24 +102,106 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac0>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x20080 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
qca,phy-rgmii-en; label = "lan1";
qca,txclk-delay-en; phy-mode = "internal";
qca,rxclk-delay-en; phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
/*
port@6 {
reg = <0>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
asym-pause;
};
};
*/
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
phy3: ethernet-phy@3 { phy3: ethernet-phy@3 {

View File

@ -340,21 +340,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -117,21 +117,106 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac0>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
/*
port@6 {
reg = <0>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
asym-pause;
};
};
*/
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
phy6: ethernet-phy@6 { phy6: ethernet-phy@6 {
@ -147,7 +232,6 @@
status = "okay"; status = "okay";
phy-mode = "rgmii"; phy-mode = "rgmii";
qcom,id = <0>; qcom,id = <0>;
phy-handle = <&phy4>;
pinctrl-0 = <&rgmii0_pins>; pinctrl-0 = <&rgmii0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";

View File

@ -89,3 +89,29 @@
reg = <0x6080000 0x1f80000>; reg = <0x6080000 0x1f80000>;
}; };
}; };
&mdio0 {
switch@10 {
ports {
port@1 {
label = "wan";
};
port@2 {
label = "lan1";
};
port@3 {
label = "lan2";
};
port@4 {
label = "lan3";
};
port@5 {
label = "lan4";
};
};
};
};

View File

@ -106,12 +106,6 @@
}; };
}; };
&mdio0 {
phy4: ethernet-phy@4 {
reg = <4>;
};
};
&gmac1 { &gmac1 {
qcom,phy_mdio_addr = <4>; qcom,phy_mdio_addr = <4>;
qcom,poll_required = <1>; qcom,poll_required = <1>;

View File

@ -185,18 +185,103 @@
reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>; reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>;
reset-post-delay-us = <12000>; reset-post-delay-us = <12000>;
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x00010 0x2613a0 /* PWS_REG */ rx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */ fixed-link {
0x0007c 0x4e /* PORT0_STATUS */ speed = <1000>;
0x00094 0x4e /* PORT6_STATUS */ full-duplex;
>; };
};
port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -158,17 +158,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
};
port@1 {
reg = <1>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -410,22 +410,92 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x04 0x07600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x08 0x01000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0c 0x00000080 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x7c 0x0000004e /* PORT0_STATUS */ rx-internal-delay-ps = <1000>;
0x94 0x0000004e /* PORT6_STATUS */
0xe0 0xc74164de /* SGMII_CTRL */ fixed-link {
0xe4 0x0006a545 /* MAC_POWER_SEL */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port5: phy@4 {
reg = <4>; reg = <4>;
}; };
};
}; };
&gmac1 { &gmac1 {

View File

@ -62,21 +62,70 @@
pinctrl-0 = <&mdio_pins>; pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac0>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0xaa545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy1: ethernet-phy@1 { port@1 {
reg = <1>; reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
};
}; };
}; };

View File

@ -254,21 +254,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -337,21 +337,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0xaa545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -266,22 +266,70 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port5: phy@4 {
reg = <4>; reg = <4>;
}; };
};
}; };
&gmac1 { &gmac1 {

View File

@ -369,21 +369,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -141,20 +141,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x06000000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x0000c 0x00080080 /* PAD6_MODE */ phy-mode = "rgmii";
0x000e4 0x0006a545 /* MAC_POWER_SEL */ tx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x0000004e /* PORT0_STATUS */ fixed-link {
0x00094 0x0000004e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
ethernet-phy@4 { port@1 {
reg = <1>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
qca,sgmii-rxclk-falling-edge;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -270,21 +270,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0x6a545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
>; full-duplex;
};
}; };
ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -195,25 +195,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x07600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x01000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x00000080 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x00050 0xcc35cc35 /* LED_CTRL0 */ rx-internal-delay-ps = <1000>;
0x00054 0xca35ca35 /* LED_CTRL1 */
0x00058 0xc935c935 /* LED_CTRL2 */ fixed-link {
0x0005c 0x03ffff00 /* LED_CTRL3 */ speed = <1000>;
0x000e4 0x0006a545 /* MAC_POWER_SEL */ full-duplex;
0x000e0 0xc74164de /* SGMII_CTRL */ };
0x0007c 0x0000007e /* PORT0_STATUS */
0x00094 0x0000007e /* PORT6_STATUS */
>;
}; };
ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -245,40 +245,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
phy0: ethernet-phy@0 { ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0xaa545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ full-duplex;
0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ };
0x00978 0x19008643 /* QM_PORT1_CTRL0 */
0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */
0x00980 0x19008643 /* QM_PORT2_CTRL0 */
0x00984 0x000001c6 /* QM_PORT2_CTRL1 */
0x00988 0x19008643 /* QM_PORT3_CTRL0 */
0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */
0x00990 0x19008643 /* QM_PORT4_CTRL0 */
0x00994 0x000001c6 /* QM_PORT4_CTRL1 */
0x00998 0x1e864443 /* QM_PORT5_CTRL0 */
0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */
0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */
0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */
>;
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
qca,ar8327-initvals = < label = "lan4";
0x000e4 0x6a545 /* MAC_POWER_SEL */ phy-mode = "internal";
0x0000c 0x80 /* PAD6_MODE */ phy-handle = <&phy_port4>;
>; };
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -302,43 +302,103 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>; reg = <0>;
qca,ar8327-initvals = < label = "cpu";
0x00004 0x7600000 /* PAD0_MODE */ ethernet = <&gmac1>;
0x00008 0x1000000 /* PAD5_MODE */ phy-mode = "rgmii";
0x0000c 0x80 /* PAD6_MODE */ tx-internal-delay-ps = <1000>;
0x000e4 0xaa545 /* MAC_POWER_SEL */ rx-internal-delay-ps = <1000>;
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */ fixed-link {
0x00094 0x4e /* PORT6_STATUS */ speed = <1000>;
0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ full-duplex;
0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ };
0x00978 0x19008643 /* QM_PORT1_CTRL0 */
0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */
0x00980 0x19008643 /* QM_PORT2_CTRL0 */
0x00984 0x000001c6 /* QM_PORT2_CTRL1 */
0x00988 0x19008643 /* QM_PORT3_CTRL0 */
0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */
0x00990 0x19008643 /* QM_PORT4_CTRL0 */
0x00994 0x000001c6 /* QM_PORT4_CTRL1 */
0x00998 0x1e864443 /* QM_PORT5_CTRL0 */
0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */
0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */
0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */
>;
qca,ar8327-vlans = <
0x1 0x5e /* VLAN1 Ports 1/2/3/4/6 */
0x2 0x21 /* VLAN2 Ports 0/5 */
>;
}; };
phy4: ethernet-phy@4 { port@1 {
reg = <1>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>; reg = <4>;
qca,ar8327-initvals = < label = "lan1";
0x000e4 0x6a545 /* MAC_POWER_SEL */ phy-mode = "internal";
0x0000c 0x80 /* PAD6_MODE */ phy-handle = <&phy_port4>;
>; };
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac2>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -2,6 +2,7 @@
#include "qcom-ipq8065-smb208.dtsi" #include "qcom-ipq8065-smb208.dtsi"
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ { / {
model = "Askey RT4230W REV6"; model = "Askey RT4230W REV6";
@ -297,19 +298,198 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
phy0: ethernet-phy@0 { switch@10 {
reg = <0x0>; compatible = "qca,qca8337";
qca,ar8327-initvals = < #address-cells = <1>;
0x00004 0x7600000 /* PAD0_MODE */ #size-cells = <0>;
0x00008 0x1000000 /* PAD5_MODE */ reg = <0x10>;
0x0000c 0x80 /* PAD6_MODE */
0x000e4 0xaa545 /* MAC_POWER_SEL */ ports {
0x000e0 0xc74164de /* SGMII_CTRL */ #address-cells = <1>;
0x0007c 0x4e /* PORT0_STATUS */ #size-cells = <0>;
0x00094 0x4e /* PORT6_STATUS */
0x00050 0xcf02cf02 /* LED_CTRL_0 */ port@0 {
0x00054 0xc832c832 /* LED_CTRL_1 */ reg = <0>;
>; label = "cpu";
ethernet = <&gmac0>;
phy-mode = "rgmii";
tx-internal-delay-ps = <1000>;
rx-internal-delay-ps = <1000>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
port@1 {
reg = <1>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port1>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_WAN;
default-state = "keep";
};
};
};
port@2 {
reg = <2>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port2>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@3 {
reg = <3>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port3>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@4 {
reg = <4>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port4>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@5 {
reg = <5>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port5>;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_AMBER>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac1>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
phy_port5: phy@4 {
reg = <4>;
};
};
}; };
}; };

View File

@ -311,17 +311,92 @@
pinctrl-0 = <&mdio0_pins>; pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default"; pinctrl-names = "default";
ethernet-phy@0 { switch@10 {
reg = <0x0>; compatible = "qca,qca8337";
qca,ar8327-initvals = < #address-cells = <1>;
0x00004 0x7600000 /* PAD0_MODE */ #size-cells = <0>;
0x00008 0x1000000 /* PAD5_MODE */ reg = <0x10>;
0x0000c 0x80 /* PAD6_MODE */
0x000e4 0xaa545 /* MAC_POWER_SEL */ ports {
0x000e0 0xc74164de /* SGMII_CTRL */ #address-cells = <1>;
0x0007c 0x4e /* PORT0_STATUS */ #size-cells = <0>;
0x00094 0x4e /* PORT6_STATUS */
>; port@0 {
reg = <0>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "rgmii";
tx-internal-delay-ps = <1000>;
rx-internal-delay-ps = <1000>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;
};
port@4 {
reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac1>;
phy-mode = "sgmii";
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy_port1: phy@0 {
reg = <0>;
};
phy_port2: phy@1 {
reg = <1>;
};
phy_port3: phy@2 {
reg = <2>;
};
phy_port4: phy@3 {
reg = <3>;
};
};
}; };
phy7: ethernet-phy@7 { phy7: ethernet-phy@7 {

View File

@ -1,3 +1,8 @@
define Device/dsa-migration
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
endef
define Build/cros-gpt define Build/cros-gpt
cp $@ $@.tmp 2>/dev/null || true cp $@ $@.tmp 2>/dev/null || true
ptgen -o $@.tmp -g \ ptgen -o $@.tmp -g \
@ -47,6 +52,7 @@ endef
define Device/asus_onhub define Device/asus_onhub
$(call Device/OnhubImage) $(call Device/OnhubImage)
$(Device/dsa-migration)
DEVICE_VENDOR := ASUS DEVICE_VENDOR := ASUS
DEVICE_MODEL := OnHub SRT-AC1900 DEVICE_MODEL := OnHub SRT-AC1900
DEVICE_DTS := $$(SOC)-asus-onhub DEVICE_DTS := $$(SOC)-asus-onhub
@ -56,6 +62,7 @@ TARGET_DEVICES += asus_onhub
define Device/tplink_onhub define Device/tplink_onhub
$(call Device/OnhubImage) $(call Device/OnhubImage)
$(Device/dsa-migration)
DEVICE_VENDOR := TP-Link DEVICE_VENDOR := TP-Link
DEVICE_MODEL := OnHub AC1900 Cloud Router DEVICE_MODEL := OnHub AC1900 Cloud Router
DEVICE_DTS := $$(SOC)-tplink-onhub DEVICE_DTS := $$(SOC)-tplink-onhub

View File

@ -8,6 +8,16 @@ define Device/kernel-size-migration
use the force flag when image check fails. Settings will be lost. *** use the force flag when image check fails. Settings will be lost. ***
endef endef
define Device/dsa-migration
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
endef
define Device/dsa-migration-from-2_0
DEVICE_COMPAT_VERSION := 2.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
endef
define Build/buffalo-rootfs-cksum define Build/buffalo-rootfs-cksum
( \ ( \
echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \ echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \
@ -67,6 +77,7 @@ endef
define Device/arris_tr4400-v2 define Device/arris_tr4400-v2
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
DEVICE_VENDOR := Arris DEVICE_VENDOR := Arris
DEVICE_MODEL := TR4400 DEVICE_MODEL := TR4400
DEVICE_VARIANT := v2 DEVICE_VARIANT := v2
@ -80,6 +91,7 @@ TARGET_DEVICES += arris_tr4400-v2
define Device/askey_rt4230w-rev6 define Device/askey_rt4230w-rev6
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
DEVICE_VENDOR := Askey DEVICE_VENDOR := Askey
DEVICE_MODEL := RT4230W DEVICE_MODEL := RT4230W
DEVICE_VARIANT := REV6 DEVICE_VARIANT := REV6
@ -94,6 +106,7 @@ TARGET_DEVICES += askey_rt4230w-rev6
define Device/asrock_g10 define Device/asrock_g10
$(call Device/FitImage) $(call Device/FitImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
SOC := qcom-ipq8064 SOC := qcom-ipq8064
DEVICE_VENDOR := ASRock DEVICE_VENDOR := ASRock
DEVICE_MODEL := G10 DEVICE_MODEL := G10
@ -107,6 +120,7 @@ TARGET_DEVICES += asrock_g10
define Device/buffalo_wxr-2533dhp define Device/buffalo_wxr-2533dhp
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
SOC := qcom-ipq8064 SOC := qcom-ipq8064
DEVICE_VENDOR := Buffalo DEVICE_VENDOR := Buffalo
DEVICE_MODEL := WXR-2533DHP DEVICE_MODEL := WXR-2533DHP
@ -123,6 +137,7 @@ TARGET_DEVICES += buffalo_wxr-2533dhp
define Device/compex_wpq864 define Device/compex_wpq864
$(call Device/FitImage) $(call Device/FitImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
DEVICE_VENDOR := Compex DEVICE_VENDOR := Compex
DEVICE_MODEL := WPQ864 DEVICE_MODEL := WPQ864
BLOCKSIZE := 128k BLOCKSIZE := 128k
@ -148,6 +163,7 @@ TARGET_DEVICES += edgecore_ecw5410
define Device/linksys_ea7500-v1 define Device/linksys_ea7500-v1
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/kernel-size-migration) $(Device/kernel-size-migration)
$(Device/dsa-migration-from-2_0)
DEVICE_VENDOR := Linksys DEVICE_VENDOR := Linksys
DEVICE_MODEL := EA7500 DEVICE_MODEL := EA7500
DEVICE_VARIANT := v1 DEVICE_VARIANT := v1
@ -168,6 +184,7 @@ TARGET_DEVICES += linksys_ea7500-v1
define Device/linksys_ea8500 define Device/linksys_ea8500
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/kernel-size-migration) $(Device/kernel-size-migration)
$(Device/dsa-migration-from-2_0)
DEVICE_VENDOR := Linksys DEVICE_VENDOR := Linksys
DEVICE_MODEL := EA8500 DEVICE_MODEL := EA8500
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -223,6 +240,7 @@ TARGET_DEVICES += meraki_mr52
define Device/nec_wg2600hp define Device/nec_wg2600hp
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NEC DEVICE_VENDOR := NEC
DEVICE_MODEL := Aterm WG2600HP DEVICE_MODEL := Aterm WG2600HP
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -236,6 +254,7 @@ TARGET_DEVICES += nec_wg2600hp
define Device/nec_wg2600hp3 define Device/nec_wg2600hp3
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NEC Platforms DEVICE_VENDOR := NEC Platforms
DEVICE_MODEL := Aterm WG2600HP3 DEVICE_MODEL := Aterm WG2600HP3
SOC := qcom-ipq8062 SOC := qcom-ipq8062
@ -252,6 +271,7 @@ TARGET_DEVICES += nec_wg2600hp3
define Device/netgear_d7800 define Device/netgear_d7800
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk X4 D7800 DEVICE_MODEL := Nighthawk X4 D7800
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -271,6 +291,7 @@ TARGET_DEVICES += netgear_d7800
define Device/netgear_r7500 define Device/netgear_r7500
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk X4 R7500 DEVICE_MODEL := Nighthawk X4 R7500
DEVICE_VARIANT := v1 DEVICE_VARIANT := v1
@ -288,6 +309,7 @@ TARGET_DEVICES += netgear_r7500
define Device/netgear_r7500v2 define Device/netgear_r7500v2
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk X4 R7500 DEVICE_MODEL := Nighthawk X4 R7500
DEVICE_VARIANT := v2 DEVICE_VARIANT := v2
@ -306,6 +328,7 @@ TARGET_DEVICES += netgear_r7500v2
define Device/netgear_r7800 define Device/netgear_r7800
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk X4S R7800 DEVICE_MODEL := Nighthawk X4S R7800
SOC := qcom-ipq8065 SOC := qcom-ipq8065
@ -322,6 +345,7 @@ TARGET_DEVICES += netgear_r7800
define Device/netgear_xr450 define Device/netgear_xr450
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk XR450 DEVICE_MODEL := Nighthawk XR450
SOC := qcom-ipq8065 SOC := qcom-ipq8065
@ -336,6 +360,7 @@ TARGET_DEVICES += netgear_xr450
define Device/netgear_xr500 define Device/netgear_xr500
$(call Device/DniImage) $(call Device/DniImage)
$(Device/dsa-migration)
DEVICE_VENDOR := NETGEAR DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := Nighthawk XR500 DEVICE_MODEL := Nighthawk XR500
SOC := qcom-ipq8065 SOC := qcom-ipq8065
@ -351,6 +376,7 @@ TARGET_DEVICES += netgear_xr500
define Device/nokia_ac400i define Device/nokia_ac400i
$(call Device/FitImage) $(call Device/FitImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
DEVICE_VENDOR := Nokia DEVICE_VENDOR := Nokia
DEVICE_MODEL := AC400i DEVICE_MODEL := AC400i
SOC := qcom-ipq8065 SOC := qcom-ipq8065
@ -365,6 +391,7 @@ TARGET_DEVICES += nokia_ac400i
define Device/qcom_ipq8064-ap148 define Device/qcom_ipq8064-ap148
$(call Device/FitImage) $(call Device/FitImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
DEVICE_VENDOR := Qualcomm DEVICE_VENDOR := Qualcomm
DEVICE_MODEL := AP148 DEVICE_MODEL := AP148
DEVICE_VARIANT := standard DEVICE_VARIANT := standard
@ -382,6 +409,7 @@ TARGET_DEVICES += qcom_ipq8064-ap148
define Device/qcom_ipq8064-ap148-legacy define Device/qcom_ipq8064-ap148-legacy
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
DEVICE_VENDOR := Qualcomm DEVICE_VENDOR := Qualcomm
DEVICE_MODEL := AP148 DEVICE_MODEL := AP148
DEVICE_VARIANT := legacy DEVICE_VARIANT := legacy
@ -398,6 +426,7 @@ TARGET_DEVICES += qcom_ipq8064-ap148-legacy
define Device/qcom_ipq8064-ap161 define Device/qcom_ipq8064-ap161
$(call Device/FitImage) $(call Device/FitImage)
$(call Device/UbiFit) $(call Device/UbiFit)
$(Device/dsa-migration)
DEVICE_VENDOR := Qualcomm DEVICE_VENDOR := Qualcomm
DEVICE_MODEL := AP161 DEVICE_MODEL := AP161
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -412,6 +441,7 @@ TARGET_DEVICES += qcom_ipq8064-ap161
define Device/qcom_ipq8064-db149 define Device/qcom_ipq8064-db149
$(call Device/FitImage) $(call Device/FitImage)
$(Device/dsa-migration)
DEVICE_VENDOR := Qualcomm DEVICE_VENDOR := Qualcomm
DEVICE_MODEL := DB149 DEVICE_MODEL := DB149
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -423,6 +453,7 @@ endef
TARGET_DEVICES += qcom_ipq8064-db149 TARGET_DEVICES += qcom_ipq8064-db149
define Device/ruijie_rg-mtfi-m520 define Device/ruijie_rg-mtfi-m520
$(Device/dsa-migration)
DEVICE_VENDOR := Ruijie DEVICE_VENDOR := Ruijie
DEVICE_MODEL := RG-MTFi-M520 DEVICE_MODEL := RG-MTFi-M520
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -441,6 +472,7 @@ TARGET_DEVICES += ruijie_rg-mtfi-m520
define Device/tplink_ad7200 define Device/tplink_ad7200
$(call Device/TpSafeImage) $(call Device/TpSafeImage)
$(Device/dsa-migration)
DEVICE_VENDOR := TP-Link DEVICE_VENDOR := TP-Link
DEVICE_MODEL := AD7200 DEVICE_MODEL := AD7200
DEVICE_VARIANT := v1/v2 DEVICE_VARIANT := v1/v2
@ -457,6 +489,7 @@ TARGET_DEVICES += tplink_ad7200
define Device/tplink_c2600 define Device/tplink_c2600
$(call Device/TpSafeImage) $(call Device/TpSafeImage)
$(Device/dsa-migration)
DEVICE_VENDOR := TP-Link DEVICE_VENDOR := TP-Link
DEVICE_MODEL := Archer C2600 DEVICE_MODEL := Archer C2600
DEVICE_VARIANT := v1 DEVICE_VARIANT := v1
@ -471,6 +504,7 @@ endef
TARGET_DEVICES += tplink_c2600 TARGET_DEVICES += tplink_c2600
define Device/tplink_vr2600v define Device/tplink_vr2600v
$(Device/dsa-migration)
DEVICE_VENDOR := TP-Link DEVICE_VENDOR := TP-Link
DEVICE_MODEL := Archer VR2600v DEVICE_MODEL := Archer VR2600v
DEVICE_VARIANT := v1 DEVICE_VARIANT := v1
@ -504,6 +538,7 @@ TARGET_DEVICES += ubnt_unifi-ac-hd
define Device/xiaomi_mi-router-hd define Device/xiaomi_mi-router-hd
$(call Device/LegacyImage) $(call Device/LegacyImage)
$(Device/dsa-migration)
DEVICE_VENDOR := Xiaomi DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Mi Router HD DEVICE_MODEL := Mi Router HD
SOC := qcom-ipq8064 SOC := qcom-ipq8064
@ -520,6 +555,7 @@ endef
TARGET_DEVICES += xiaomi_mi-router-hd TARGET_DEVICES += xiaomi_mi-router-hd
define Device/zyxel_nbg6817 define Device/zyxel_nbg6817
$(Device/dsa-migration)
DEVICE_VENDOR := ZyXEL DEVICE_VENDOR := ZyXEL
DEVICE_MODEL := NBG6817 DEVICE_MODEL := NBG6817
SOC := qcom-ipq8065 SOC := qcom-ipq8065

View File

@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -2153,6 +2153,13 @@ static void sfp_sm_module(struct sfp *sf @@ -2160,6 +2160,13 @@ static void sfp_sm_module(struct sfp *sf
return; return;
} }

View File

@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
--- a/drivers/net/phy/sfp.c --- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c
@@ -549,32 +549,72 @@ static int sfp_i2c_write(struct sfp *sfp @@ -556,32 +556,72 @@ static int sfp_i2c_write(struct sfp *sfp
return ret == ARRAY_SIZE(msgs) ? len : 0; return ret == ARRAY_SIZE(msgs) ? len : 0;
} }