[rdkb][common][bsp][Refactor and sync kernel from openwrt]
[Description]
7cb2b67e [kernel][mt7988][bsp][Change number of CPUs to 3 for the MT7988C/D]
d13e0e89 [MAC80211][wed][remove wed rx ring1 setting to support eagle ics]
7ca8fcfd [spinand: etron get ecc status return ecc strength]
9dcd7ee4 [Add Unused patch to remove.patch.list]
28b05462 [kernel][common][eth][Add debug information to the SFP]
786df557 [[Eagle][BE19000][MT7988][MT76][WiFi][Auto_test][sigma]after flash image, give a cmd, will block]
[Release-log]
Change-Id: If0ea2dfdc0bbd6eb91fb0841c728afeffe753029
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch
deleted file mode 100644
index e69de29..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch
+++ /dev/null
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0001-net-bgmac-improve-handling-PHY.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0001-net-bgmac-improve-handling-PHY.patch
new file mode 100644
index 0000000..6788a2e
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0001-net-bgmac-improve-handling-PHY.patch
@@ -0,0 +1,84 @@
+From b5375509184dc23d2b7fa0c5ed8763899ccc9674 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sat, 2 Oct 2021 19:58:11 +0200
+Subject: [PATCH] net: bgmac: improve handling PHY
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+1. Use info from DT if available
+
+It allows describing for example a fixed link. It's more accurate than
+just guessing there may be one (depending on a chipset).
+
+2. Verify PHY ID before trying to connect PHY
+
+PHY addr 0x1e (30) is special in Broadcom routers and means a switch
+connected as MDIO devices instead of a real PHY. Don't try connecting to
+it.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac-bcma.c | 33 ++++++++++++++--------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
++++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
+@@ -11,6 +11,7 @@
+ #include <linux/bcma/bcma.h>
+ #include <linux/brcmphy.h>
+ #include <linux/etherdevice.h>
++#include <linux/of_mdio.h>
+ #include <linux/of_net.h>
+ #include "bgmac.h"
+
+@@ -86,17 +87,28 @@ static int bcma_phy_connect(struct bgmac
+ struct phy_device *phy_dev;
+ char bus_id[MII_BUS_ID_SIZE + 3];
+
++ /* DT info should be the most accurate */
++ phy_dev = of_phy_get_and_connect(bgmac->net_dev, bgmac->dev->of_node,
++ bgmac_adjust_link);
++ if (phy_dev)
++ return 0;
++
+ /* Connect to the PHY */
+- snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
+- bgmac->phyaddr);
+- phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
+- PHY_INTERFACE_MODE_MII);
+- if (IS_ERR(phy_dev)) {
+- dev_err(bgmac->dev, "PHY connection failed\n");
+- return PTR_ERR(phy_dev);
++ if (bgmac->mii_bus && bgmac->phyaddr != BGMAC_PHY_NOREGS) {
++ snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
++ bgmac->phyaddr);
++ phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
++ PHY_INTERFACE_MODE_MII);
++ if (IS_ERR(phy_dev)) {
++ dev_err(bgmac->dev, "PHY connection failed\n");
++ return PTR_ERR(phy_dev);
++ }
++
++ return 0;
+ }
+
+- return 0;
++ /* Assume a fixed link to the switch port */
++ return bgmac_phy_connect_direct(bgmac);
+ }
+
+ static const struct bcma_device_id bgmac_bcma_tbl[] = {
+@@ -297,10 +309,7 @@ static int bgmac_probe(struct bcma_devic
+ bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset;
+ bgmac->get_bus_clock = bcma_bgmac_get_bus_clock;
+ bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32;
+- if (bgmac->mii_bus)
+- bgmac->phy_connect = bcma_phy_connect;
+- else
+- bgmac->phy_connect = bgmac_phy_connect_direct;
++ bgmac->phy_connect = bcma_phy_connect;
+
+ err = bgmac_enet_probe(bgmac);
+ if (err)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0002-net-bgmac-support-MDIO-described-in-DT.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0002-net-bgmac-support-MDIO-described-in-DT.patch
new file mode 100644
index 0000000..f134828
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/710-v5.16-0002-net-bgmac-support-MDIO-described-in-DT.patch
@@ -0,0 +1,54 @@
+From 45c9d966688e7fad7f24bfc450547d91e4304d0b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sat, 2 Oct 2021 19:58:12 +0200
+Subject: [PATCH] net: bgmac: support MDIO described in DT
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Check ethernet controller DT node for "mdio" subnode and use it with
+of_mdiobus_register() when present. That allows specifying MDIO and its
+PHY devices in a standard DT based way.
+
+This is required for BCM53573 SoC support. That family is sometimes
+called Northstar (by marketing?) but is quite different from it. It uses
+different CPU(s) and many different hw blocks.
+
+One of shared blocks in BCM53573 is Ethernet controller. Switch however
+is not SRAB accessible (as it Northstar) but is MDIO attached.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
++++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
+@@ -10,6 +10,7 @@
+
+ #include <linux/bcma/bcma.h>
+ #include <linux/brcmphy.h>
++#include <linux/of_mdio.h>
+ #include "bgmac.h"
+
+ static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
+@@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(s
+ {
+ struct bcma_device *core = bgmac->bcma.core;
+ struct mii_bus *mii_bus;
++ struct device_node *np;
+ int err;
+
+ mii_bus = mdiobus_alloc();
+@@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(s
+ mii_bus->parent = &core->dev;
+ mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
+
+- err = mdiobus_register(mii_bus);
++ np = of_get_child_by_name(core->dev.of_node, "mdio");
++
++ err = of_mdiobus_register(mii_bus, np);
+ if (err) {
+ dev_err(&core->dev, "Registration of mii bus failed\n");
+ goto err_free_bus;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/711-v6.3-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/711-v6.3-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch
new file mode 100644
index 0000000..54f077b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/711-v6.3-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch
@@ -0,0 +1,76 @@
+From 327dabbd0111910a7d174b0b812d608d6b67bead Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 8 Aug 2022 23:05:25 +0200
+Subject: [PATCH] bgmac: fix *initial* chip reset to support BCM5358
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+While bringing hardware up we should perform a full reset including the
+switch bit (BGMAC_BCMA_IOCTL_SW_RESET aka SICF_SWRST). It's what
+specification says and what reference driver does.
+
+This seems to be critical for the BCM5358. Without this hardware doesn't
+get initialized properly and doesn't seem to transmit or receive any
+packets.
+
+Originally bgmac was calling bgmac_chip_reset() before setting
+"has_robosw" property which resulted in expected behaviour. That has
+changed as a side effect of adding platform device support which
+regressed BCM5358 support.
+
+Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
+Cc: Jon Mason <jdmason@kudzu.us>
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++--
+ drivers/net/ethernet/broadcom/bgmac.h | 2 ++
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -890,13 +890,13 @@ static void bgmac_chip_reset_idm_config(
+
+ if (iost & BGMAC_BCMA_IOST_ATTACHED) {
+ flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
+- if (!bgmac->has_robosw)
++ if (bgmac->in_init || !bgmac->has_robosw)
+ flags |= BGMAC_BCMA_IOCTL_SW_RESET;
+ }
+ bgmac_clk_enable(bgmac, flags);
+ }
+
+- if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
++ if (iost & BGMAC_BCMA_IOST_ATTACHED && (bgmac->in_init || !bgmac->has_robosw))
+ bgmac_idm_write(bgmac, BCMA_IOCTL,
+ bgmac_idm_read(bgmac, BCMA_IOCTL) &
+ ~BGMAC_BCMA_IOCTL_SW_RESET);
+@@ -1489,6 +1489,8 @@ int bgmac_enet_probe(struct bgmac *bgmac
+ struct net_device *net_dev = bgmac->net_dev;
+ int err;
+
++ bgmac->in_init = true;
++
+ bgmac_chip_intrs_off(bgmac);
+
+ net_dev->irq = bgmac->irq;
+@@ -1538,6 +1540,8 @@ int bgmac_enet_probe(struct bgmac *bgmac
+ net_dev->hw_features = net_dev->features;
+ net_dev->vlan_features = net_dev->features;
+
++ bgmac->in_init = false;
++
+ err = register_netdev(bgmac->net_dev);
+ if (err) {
+ dev_err(bgmac->dev, "Cannot register net device\n");
+--- a/drivers/net/ethernet/broadcom/bgmac.h
++++ b/drivers/net/ethernet/broadcom/bgmac.h
+@@ -511,6 +511,8 @@ struct bgmac {
+ int irq;
+ u32 int_mask;
+
++ bool in_init;
++
+ /* Current MAC state */
+ int mac_speed;
+ int mac_duplex;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/712-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/712-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch
new file mode 100644
index 0000000..2f3aa1c
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/712-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch
@@ -0,0 +1,45 @@
+From e7731194fdf085f46d58b1adccfddbd0dfee4873 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Fri, 7 Jul 2023 08:53:25 +0200
+Subject: [PATCH] net: bgmac: postpone turning IRQs off to avoid SoC hangs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Turning IRQs off is done by accessing Ethernet controller registers.
+That can't be done until device's clock is enabled. It results in a SoC
+hang otherwise.
+
+This bug remained unnoticed for years as most bootloaders keep all
+Ethernet interfaces turned on. It seems to only affect a niche SoC
+family BCM47189. It has two Ethernet controllers but CFE bootloader uses
+only the first one.
+
+Fixes: 34322615cbaa ("net: bgmac: Mask interrupts during probe")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -1491,8 +1491,6 @@ int bgmac_enet_probe(struct bgmac *bgmac
+
+ bgmac->in_init = true;
+
+- bgmac_chip_intrs_off(bgmac);
+-
+ net_dev->irq = bgmac->irq;
+ SET_NETDEV_DEV(net_dev, bgmac->dev);
+ dev_set_drvdata(bgmac->dev, bgmac);
+@@ -1510,6 +1508,8 @@ int bgmac_enet_probe(struct bgmac *bgmac
+ */
+ bgmac_clk_enable(bgmac, 0);
+
++ bgmac_chip_intrs_off(bgmac);
++
+ /* This seems to be fixing IRQ by assigning OOB #6 to the core */
+ if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
+ if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
index c7ea67c..d2c5014 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
@@ -172,7 +172,6 @@
file://417-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch \
file://417-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch \
file://420-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch \
- file://430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch;apply=no \
file://600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch \
file://601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch \
file://602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch \
@@ -204,6 +203,10 @@
file://709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch \
file://709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch \
file://709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch \
+ file://710-v5.16-0001-net-bgmac-improve-handling-PHY.patch \
+ file://710-v5.16-0002-net-bgmac-support-MDIO-described-in-DT.patch \
+ file://711-v6.3-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch \
+ file://712-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch \
file://716-v5.5-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch \
file://717-v5.5-net-sfp-rework-upstream-interface.patch \
file://718-v5.5-net-sfp-fix-sfp_bus_put-kernel-documentation.patch \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/773-bgmac-add-srab-switch.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/773-bgmac-add-srab-switch.patch
index 89e0df4..6398cd5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/773-bgmac-add-srab-switch.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/773-bgmac-add-srab-switch.patch
@@ -14,7 +14,7 @@
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_devic
+@@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
@@ -50,7 +50,7 @@
/**************************************************
* MII
**************************************************/
-@@ -1538,6 +1550,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
+@@ -1540,6 +1552,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
net_dev->hw_features = net_dev->features;
net_dev->vlan_features = net_dev->features;
@@ -62,10 +62,10 @@
+ bgmac->b53_device = &bgmac_b53_dev;
+ }
+
+ bgmac->in_init = false;
+
err = register_netdev(bgmac->net_dev);
- if (err) {
- dev_err(bgmac->dev, "Cannot register net device\n");
-@@ -1560,6 +1580,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
+@@ -1564,6 +1584,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
void bgmac_enet_remove(struct bgmac *bgmac)
{
@@ -86,7 +86,7 @@
struct bgmac_slot_info {
union {
-@@ -532,6 +533,9 @@ struct bgmac {
+@@ -534,6 +535,9 @@ struct bgmac {
void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
u32 set);
int (*phy_connect)(struct bgmac *bgmac);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
index 8e5751b..8176802 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
@@ -19,6 +19,10 @@
rootfstype=squashfs,f2fs pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
index a681b8b..aee27de 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
@@ -19,6 +19,10 @@
rootfstype=squashfs,f2fs pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
index 6a7773f..2df4cc2 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
@@ -19,6 +19,10 @@
pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
index d7df193..e158c6a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
@@ -19,6 +19,10 @@
pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
index 4f281a3..e8e3a69 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
@@ -19,6 +19,10 @@
pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
index 5369716..f3af5da 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
@@ -19,6 +19,10 @@
pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
memory {
reg = <0 0x40000000 0 0x10000000>;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
index c94247d..df35a38 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
@@ -18,6 +18,10 @@
earlycon=uart8250,mmio32,0x11000000";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,sysctrl = <ðwarp>;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
index 1b04950..8b9fe35 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
@@ -20,6 +20,10 @@
pci=pcie_bus_perf";
};
+ cpus {
+ /delete-node/ cpu@3;
+ };
+
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,sysctrl = <ðwarp>;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2341-mtd-spinand-Add-support-etron.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2341-mtd-spinand-Add-support-etron.patch
index 68a6f12..ae2458f 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2341-mtd-spinand-Add-support-etron.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2341-mtd-spinand-Add-support-etron.patch
@@ -23,7 +23,7 @@
===================================================================
--- /dev/null
+++ b/drivers/mtd/nand/spi/etron.c
-@@ -0,0 +1,196 @@
+@@ -0,0 +1,180 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020 Etron Technology, Inc.
@@ -92,6 +92,8 @@
+static int etron_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
+{
++ struct nand_device *nand = spinand_to_nand(spinand);
++
+ switch (status & STATUS_ECC_MASK) {
+ case STATUS_ECC_NO_BITFLIPS:
+ return 0;
@@ -100,11 +102,10 @@
+ return -EBADMSG;
+
+ case STATUS_ECC_HAS_BITFLIPS:
-+ return 1;
++ return nand->eccreq.strength >> 1;
+
+ case STATUS_ECC_LIMIT_BITFLIPS:
-+ return 3;
-+
++ return nand->eccreq.strength;
+
+ default:
+ break;
@@ -192,23 +193,6 @@
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
+};
+
-+static int etron_spinand_detect(struct spinand_device *spinand)
-+{
-+ u8 *id = spinand->id.data;
-+ int ret;
-+
-+ if (id[1] != SPINAND_MFR_ETRON)
-+ return 0;
-+
-+ ret = spinand_match_and_init(spinand, etron_spinand_table,
-+ ARRAY_SIZE(etron_spinand_table),
-+ id[2]);
-+ if (ret)
-+ return ret;
-+
-+ return 1;
-+}
-+
+static const struct spinand_manufacturer_ops etron_spinand_manuf_ops = {
+};
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2727-net-phy-sfp-add-debug-info.patch.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2727-net-phy-sfp-add-debug-info.patch.patch
new file mode 100644
index 0000000..593ddb1
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2727-net-phy-sfp-add-debug-info.patch.patch
@@ -0,0 +1,211 @@
+From 76314e98504e691f17a5d9d1362d476c534a5e0e Mon Sep 17 00:00:00 2001
+From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
+Date: Fri, 7 Jul 2023 11:14:32 +0800
+Subject: [PATCH] 999-2727-net-phy-sfp-add-debug-info.patch
+
+---
+ drivers/net/phy/phylink.c | 11 +++++++-
+ drivers/net/phy/sfp-bus.c | 3 +++
+ drivers/net/phy/sfp.c | 51 +++++++++++++++++++++++++++++------
+ include/linux/mdio/mdio-i2c.h | 16 +++++++++++
+ 4 files changed, 72 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
+index 949e3b8..bb4cd28 100644
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -782,6 +782,15 @@ static void phylink_resolve(struct work_struct *w)
+ &link_state);
+ }
+
++ if (pl->phydev && !(link_state.link & pl->phy_state.link))
++ phylink_printk(KERN_DEBUG, pl,
++ "resolve link status: system iface=%d, line iface=%d\n",
++ link_state.link, pl->phy_state.link);
++ else if (!link_state.link)
++ phylink_printk(KERN_DEBUG, pl,
++ "resolve link status: system iface=%d\n",
++ link_state.link);
++
+ /* If we have a phy, the "up" state is the union of
+ * both the PHY and the MAC
+ */
+@@ -2084,7 +2093,7 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode,
+ return ret;
+ }
+
+- phylink_dbg(pl, "requesting link mode %s/%s with support %*pb\n",
++ phylink_info(pl, "requesting link mode %s/%s with support %*pb\n",
+ phylink_an_mode_str(mode), phy_modes(config.interface),
+ __ETHTOOL_LINK_MODE_MASK_NBITS, support);
+
+diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
+index 4be2440..bcf45dd 100644
+--- a/drivers/net/phy/sfp-bus.c
++++ b/drivers/net/phy/sfp-bus.c
+@@ -279,6 +279,9 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
+ if (bus->sfp_quirk && bus->sfp_quirk->modes)
+ bus->sfp_quirk->modes(id, modes);
+
++ dev_info(bus->sfp_dev, "sfp: support mode %*pb\n",
++ __ETHTOOL_LINK_MODE_MASK_NBITS, modes);
++
+ bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ }
+ EXPORT_SYMBOL_GPL(sfp_parse_support);
+diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
+index 0fdf5d6..0c335b1 100644
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -480,7 +480,7 @@ static bool sfp_match(const char *qs, const char *str, size_t len)
+ return !strncmp(qs, str, len);
+ }
+
+-static const struct sfp_quirk *sfp_lookup_quirk(const struct sfp_eeprom_id *id)
++static const struct sfp_quirk *sfp_lookup_quirk(struct sfp *sfp, const struct sfp_eeprom_id *id)
+ {
+ const struct sfp_quirk *q;
+ unsigned int i;
+@@ -493,8 +493,14 @@ static const struct sfp_quirk *sfp_lookup_quirk(const struct sfp_eeprom_id *id)
+ for (i = 0, q = sfp_quirks; i < ARRAY_SIZE(sfp_quirks); i++, q++)
+ if (sfp_match(q->vendor, id->base.vendor_name, vs) &&
+ sfp_match(q->part, id->base.vendor_pn, ps) &&
+- sfp_match(q->revision, id->base.vendor_rev, rs))
++ sfp_match(q->revision, id->base.vendor_rev, rs)) {
++ dev_info(sfp->dev,
++ "module %.*s %.*s rev %.*s has been found in the quirk list\n",
++ (int)sizeof(id->base.vendor_name), id->base.vendor_name,
++ (int)sizeof(id->base.vendor_pn), id->base.vendor_pn,
++ (int)sizeof(id->base.vendor_rev), id->base.vendor_rev);
+ return q;
++ }
+
+ return NULL;
+ }
+@@ -1597,7 +1603,7 @@ static void sfp_hwmon_exit(struct sfp *sfp)
+ /* Helpers */
+ static void sfp_module_tx_disable(struct sfp *sfp)
+ {
+- dev_dbg(sfp->dev, "tx disable %u -> %u\n",
++ dev_info(sfp->dev, "tx disable %u -> %u\n",
+ sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 1);
+ sfp->state |= SFP_F_TX_DISABLE;
+ sfp_set_state(sfp, sfp->state);
+@@ -1605,7 +1611,7 @@ static void sfp_module_tx_disable(struct sfp *sfp)
+
+ static void sfp_module_tx_enable(struct sfp *sfp)
+ {
+- dev_dbg(sfp->dev, "tx disable %u -> %u\n",
++ dev_info(sfp->dev, "tx disable %u -> %u\n",
+ sfp->state & SFP_F_TX_DISABLE ? 1 : 0, 0);
+ sfp->state &= ~SFP_F_TX_DISABLE;
+ sfp_set_state(sfp, sfp->state);
+@@ -1660,7 +1666,8 @@ static void sfp_sm_phy_detach(struct sfp *sfp)
+ static int sfp_sm_probe_phy(struct sfp *sfp, int addr, bool is_c45)
+ {
+ struct phy_device *phy;
+- int err;
++ int err, i;
++ u32 id;
+
+ phy = get_phy_device(sfp->i2c_mii, addr, is_c45);
+ if (phy == ERR_PTR(-ENODEV))
+@@ -1677,6 +1684,30 @@ static int sfp_sm_probe_phy(struct sfp *sfp, int addr, bool is_c45)
+ return err;
+ }
+
++ if (phy->is_c45) {
++ for (i = 0; i < ARRAY_SIZE(phy->c45_ids.device_ids); i++) {
++ id = phy->c45_ids.device_ids[i];
++ if (id == 0xffffffff)
++ continue;
++
++ dev_info(sfp->dev,
++ "CL45 PHY device [0x%04x:0x%04x] found!\n",
++ (id >> 16) & 0xffff, id & 0xffff);
++ }
++ } else {
++ id = phy->phy_id;
++ dev_info(sfp->dev,
++ "CL22 PHY device [0x%04x:0x%04x] found!\n",
++ (id >> 16) & 0xffff, id & 0xffff);
++ }
++
++ dev_info(sfp->dev, "CL%s PHY driver [%s] found!\n",
++ phy->is_c45 ? "45" : "22",
++ phy->drv ? phy->drv->name : "not");
++
++ dev_info(sfp->dev, "phy: support mode %*pb\n",
++ __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported);
++
+ err = sfp_add_phy(sfp->sfp_bus, phy);
+ if (err) {
+ phy_device_remove(phy);
+@@ -1779,6 +1810,10 @@ static int sfp_sm_add_mdio_bus(struct sfp *sfp)
+ static int sfp_sm_probe_for_phy(struct sfp *sfp)
+ {
+ int err = 0;
++ struct phy_device *phy;
++
++ dev_info(sfp->dev, "probing phy device through the [%s] protocol\n",
++ mdio_i2c_proto_type(sfp->mdio_protocol));
+
+ switch (sfp->mdio_protocol) {
+ case MDIO_I2C_NONE:
+@@ -2090,7 +2125,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
+ else
+ sfp->mdio_protocol = MDIO_I2C_NONE;
+
+- sfp->quirk = sfp_lookup_quirk(&id);
++ sfp->quirk = sfp_lookup_quirk(sfp, &id);
+ if (sfp->quirk && sfp->quirk->fixup)
+ sfp->quirk->fixup(sfp);
+
+@@ -2419,7 +2454,7 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event)
+ {
+ mutex_lock(&sfp->sm_mutex);
+
+- dev_dbg(sfp->dev, "SM: enter %s:%s:%s event %s\n",
++ dev_info(sfp->dev, "SM: enter %s:%s:%s event %s\n",
+ mod_state_to_str(sfp->sm_mod_state),
+ dev_state_to_str(sfp->sm_dev_state),
+ sm_state_to_str(sfp->sm_state),
+@@ -2429,7 +2464,7 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event)
+ sfp_sm_module(sfp, event);
+ sfp_sm_main(sfp, event);
+
+- dev_dbg(sfp->dev, "SM: exit %s:%s:%s\n",
++ dev_info(sfp->dev, "SM: exit %s:%s:%s\n",
+ mod_state_to_str(sfp->sm_mod_state),
+ dev_state_to_str(sfp->sm_dev_state),
+ sm_state_to_str(sfp->sm_state));
+diff --git a/include/linux/mdio/mdio-i2c.h b/include/linux/mdio/mdio-i2c.h
+index 1c21140..4bf833d 100644
+--- a/include/linux/mdio/mdio-i2c.h
++++ b/include/linux/mdio/mdio-i2c.h
+@@ -18,6 +18,22 @@ enum mdio_i2c_proto {
+ MDIO_I2C_ROLLBALL,
+ };
+
++static inline const char *mdio_i2c_proto_type(int type)
++{
++ switch (type) {
++ case MDIO_I2C_NONE:
++ return "MDIO_I2C_NONE";
++ case MDIO_I2C_MARVELL_C22:
++ return "MDIO_I2C_MARVELL_C22";
++ case MDIO_I2C_C45:
++ return "MDIO_I2C_C45";
++ case MDIO_I2C_ROLLBALL:
++ return "MDIO_I2C_ROLLBALL";
++ default:
++ return "UNKNOWN";
++ }
++}
++
+ struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
+ enum mdio_i2c_proto protocol);
+
+--
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
index fc5ecff..a36f979 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
@@ -145,6 +145,7 @@
file://999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch \
file://999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch \
file://999-2725-iwconfig-wireless-rate-fix.patch;apply=no \
+ file://999-2727-net-phy-sfp-add-debug-info.patch.patch \
file://999-2800-misc-add-mtk-platform.patch \
file://999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch \
file://999-2901-dts-mt7622-remove-cooling-device.patch \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch
index 6d1273c..69df648 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch
@@ -13,7 +13,7 @@
drivers/net/ethernet/mediatek/mtk_ppe.c | 17 +-
drivers/net/ethernet/mediatek/mtk_ppe.h | 2 +-
.../net/ethernet/mediatek/mtk_ppe_offload.c | 13 +-
- drivers/net/ethernet/mediatek/mtk_wed.c | 1174 +++++++++++++----
+ drivers/net/ethernet/mediatek/mtk_wed.c | 1148 +++++++++++++----
drivers/net/ethernet/mediatek/mtk_wed.h | 25 +-
.../net/ethernet/mediatek/mtk_wed_debugfs.c | 584 ++++++++-
drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 13 +-
@@ -287,7 +287,7 @@
index 388982c..d59c29f 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -4709,7 +4709,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -4865,7 +4865,8 @@ static int mtk_probe(struct platform_device *pdev)
"mediatek,wed", i);
static const u32 wdma_regs[] = {
MTK_WDMA0_BASE,
@@ -301,7 +301,7 @@
index a9feaed..70e8377 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -600,9 +600,12 @@
+@@ -605,9 +605,12 @@
#define RX_DMA_SPORT_MASK 0x7
#define RX_DMA_SPORT_MASK_V2 0xf
@@ -1233,15 +1233,7 @@
wed_w32(dev, MTK_WED_EXT_INT_MASK1, 0);
wed_w32(dev, MTK_WED_EXT_INT_MASK2, 0);
}
-@@ -665,6 +1015,7 @@ mtk_wed_stop(struct mtk_wed_device *dev)
- wed_w32(dev, MTK_WED_WPDMA_INT_MASK, 0);
- }
-
-+#define IRQ_MASK_APMCU 0x1000301c
- static void
- mtk_wed_deinit(struct mtk_wed_device *dev)
- {
-@@ -677,13 +1028,31 @@ mtk_wed_deinit(struct mtk_wed_device *dev)
+@@ -677,13 +1027,21 @@ mtk_wed_deinit(struct mtk_wed_device *dev)
MTK_WED_CTRL_WED_TX_BM_EN |
MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
@@ -1255,26 +1247,16 @@
MTK_WED_CTRL_RX_RRO_QM_EN);
+
+ if (dev->hw->version == 3) {
-+ unsigned long addr;
-+ u32 value;
-+
+ wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_TX_PAO_EN);
+ wed_clr(dev, MTK_WED_RESET, MTK_WED_RESET_TX_PAO);
+ wed_clr(dev, MTK_WED_PCIE_INT_CTRL,
+ MTK_WED_PCIE_INT_CTRL_MSK_EN_POLA |
+ MTK_WED_PCIE_INT_CTRL_MSK_IRQ_FILTER);
-+
-+ /* clear mask apmcu */
-+ addr = (unsigned long)ioremap(IRQ_MASK_APMCU, 4);
-+ value = readl((void *)addr);
-+ value &= ~0x7;
-+ writel(value, (void *)addr);
-+ iounmap((void *)addr);
+ }
}
static void
-@@ -702,9 +1071,9 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -702,9 +1060,9 @@ mtk_wed_detach(struct mtk_wed_device *dev)
mtk_wdma_tx_reset(dev);
@@ -1286,7 +1268,7 @@
mtk_wed_wo_reset(dev);
mtk_wed_free_rx_rings(dev);
mtk_wed_wo_exit(hw);
-@@ -731,70 +1100,93 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -731,24 +1089,29 @@ mtk_wed_detach(struct mtk_wed_device *dev)
static void
mtk_wed_bus_init(struct mtk_wed_device *dev)
{
@@ -1295,8 +1277,6 @@
+ case MTK_WED_BUS_PCIE: {
+ struct device_node *np = dev->hw->eth->dev->of_node;
+ struct regmap *regs;
-+ unsigned long addr;
-+ u32 value;
- if (dev->wlan.bus_type == MTK_WED_BUS_PCIE) {
- struct device_node *node;
@@ -1330,28 +1310,15 @@
+ wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER, BIT(24));
+ }
-- wed_w32(dev, MTK_WED_PCIE_INT_CTRL,
-- FIELD_PREP(MTK_WED_PCIE_INT_CTRL_POLL_EN, 2));
-+ if (dev->hw->version < 3 || dev->hw->index) {
-+ wed_w32(dev, MTK_WED_PCIE_INT_CTRL,
-+ FIELD_PREP(MTK_WED_PCIE_INT_CTRL_POLL_EN, 2));
-+ } else {
-+ /* set mask apmcu */
-+ addr = (unsigned long)ioremap(IRQ_MASK_APMCU, 4);
-+ value = readl((void *)addr);
-+ value |= 0x7;
-+ writel(value, (void *)addr);
-+ iounmap((void *)addr);
-+ }
-
+ wed_w32(dev, MTK_WED_PCIE_INT_CTRL,
+ FIELD_PREP(MTK_WED_PCIE_INT_CTRL_POLL_EN, 2));
+@@ -756,45 +1119,51 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
/* pcie interrupt control: pola/source selection */
wed_set(dev, MTK_WED_PCIE_INT_CTRL,
MTK_WED_PCIE_INT_CTRL_MSK_EN_POLA |
- FIELD_PREP(MTK_WED_PCIE_INT_CTRL_SRC_SEL, 1));
- wed_r32(dev, MTK_WED_PCIE_INT_CTRL);
-+ MTK_WED_PCIE_INT_CTRL_MSK_IRQ_FILTER |
-+ FIELD_PREP(MTK_WED_PCIE_INT_CTRL_SRC_SEL, dev->hw->index));
-
+-
- value = wed_r32(dev, MTK_WED_PCIE_CFG_INTM);
- value = wed_r32(dev, MTK_WED_PCIE_CFG_BASE);
- wed_w32(dev, MTK_WED_PCIE_CFG_INTM, PCIE_BASE_ADDR0 | 0x180);
@@ -1359,7 +1326,9 @@
-
- value = wed_r32(dev, MTK_WED_PCIE_CFG_INTM);
- value = wed_r32(dev, MTK_WED_PCIE_CFG_BASE);
--
++ MTK_WED_PCIE_INT_CTRL_MSK_IRQ_FILTER |
++ FIELD_PREP(MTK_WED_PCIE_INT_CTRL_SRC_SEL, dev->hw->index));
+
- wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER, BIT(24));
- wed_r32(dev, MTK_WED_PCIE_INT_TRIGGER);
-
@@ -1406,7 +1375,6 @@
+
+ wed_w32(dev, MTK_WED_WPDMA_RX_GLO_CFG, dev->wlan.wpdma_rx_glo);
+ wed_w32(dev, MTK_WED_WPDMA_RX_RING0, dev->wlan.wpdma_rx);
-+ wed_w32(dev, MTK_WED_WPDMA_RX_RING1, dev->wlan.wpdma_rx + 0x10);
+
+ if (dev->wlan.hwrro) {
+ wed_w32(dev, MTK_WED_RRO_RX_D_CFG(0), dev->wlan.wpdma_rx_rro[0]);
@@ -1420,7 +1388,7 @@
}
}
-@@ -806,21 +1198,25 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
+@@ -806,21 +1175,25 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
mtk_wed_deinit(dev);
mtk_wed_reset(dev, MTK_WED_RESET_WED);
@@ -1456,7 +1424,7 @@
offset = dev->hw->index ? 0x04000400 : 0;
wed_w32(dev, MTK_WED_WDMA_OFFSET0, 0x2a042a20 + offset);
wed_w32(dev, MTK_WED_WDMA_OFFSET1, 0x29002800 + offset);
-@@ -907,11 +1303,16 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
+@@ -907,11 +1280,16 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
} while (1);
/* configure RX_ROUTE_QM */
@@ -1478,7 +1446,7 @@
/* enable RX_ROUTE_QM */
wed_set(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_ROUTE_QM_EN);
-@@ -920,23 +1321,45 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
+@@ -920,23 +1298,45 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
static void
mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
{
@@ -1534,7 +1502,7 @@
wed_w32(dev, MTK_WED_TX_BM_TKID,
FIELD_PREP(MTK_WED_TX_BM_TKID_START,
-@@ -946,25 +1369,44 @@ mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
+@@ -946,25 +1346,44 @@ mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
wed_w32(dev, MTK_WED_TX_BM_BUF_LEN, MTK_WED_PKT_SIZE);
@@ -1590,7 +1558,7 @@
wed_clr(dev, MTK_WED_TX_TKID_CTRL, MTK_WED_TX_TKID_CTRL_PAUSE);
}
-@@ -977,7 +1419,26 @@ mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
+@@ -977,7 +1396,26 @@ mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX, 0);
@@ -1617,7 +1585,7 @@
mtk_wed_rro_hw_init(dev);
mtk_wed_route_qm_hw_init(dev);
}
-@@ -991,7 +1452,7 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
+@@ -991,7 +1429,7 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
dev->init_done = true;
mtk_wed_set_ext_int(dev, false);
mtk_wed_tx_hw_init(dev);
@@ -1626,7 +1594,7 @@
mtk_wed_rx_hw_init(dev);
}
-@@ -1015,26 +1476,6 @@ mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
+@@ -1015,26 +1453,6 @@ mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
}
}
@@ -1653,7 +1621,7 @@
static void
mtk_wed_rx_reset(struct mtk_wed_device *dev)
{
-@@ -1133,7 +1574,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1133,7 +1551,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
mtk_wed_ring_reset(desc, MTK_WED_RX_RING_SIZE, 1, false);
}
@@ -1662,7 +1630,7 @@
}
-@@ -1271,12 +1712,15 @@ mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev,
+@@ -1271,12 +1689,15 @@ mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev,
int idx, int size, bool reset)
{
struct mtk_wed_ring *wdma = &dev->tx_wdma[idx];
@@ -1679,7 +1647,7 @@
wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_BASE,
wdma->desc_phys);
wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_COUNT,
-@@ -1296,12 +1740,31 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
+@@ -1296,12 +1717,31 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
int idx, int size, bool reset)
{
struct mtk_wed_ring *wdma = &dev->rx_wdma[idx];
@@ -1712,7 +1680,7 @@
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_BASE,
wdma->desc_phys);
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_COUNT,
-@@ -1312,7 +1775,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
+@@ -1312,7 +1752,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_DMA_IDX, 0);
if (reset)
mtk_wed_ring_reset(wdma->desc, MTK_WED_WDMA_RING_SIZE,
@@ -1721,7 +1689,7 @@
if (idx == 0) {
wed_w32(dev, MTK_WED_WDMA_RING_TX
+ MTK_WED_RING_OFS_BASE, wdma->desc_phys);
-@@ -1395,7 +1858,7 @@ mtk_wed_send_msg(struct mtk_wed_device *dev, int cmd_id, void *data, int len)
+@@ -1395,7 +1835,7 @@ mtk_wed_send_msg(struct mtk_wed_device *dev, int cmd_id, void *data, int len)
{
struct mtk_wed_wo *wo = dev->hw->wed_wo;
@@ -1730,7 +1698,7 @@
return 0;
return mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, cmd_id, data, len, true);
-@@ -1420,13 +1883,87 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
+@@ -1420,13 +1860,87 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
}
}
@@ -1820,7 +1788,7 @@
for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
if (!dev->tx_wdma[i].desc)
-@@ -1437,7 +1974,7 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -1437,7 +1951,7 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
mtk_wed_set_int(dev, irq_mask);
mtk_wed_set_ext_int(dev, true);
@@ -1829,7 +1797,7 @@
u32 val;
val = dev->wlan.wpdma_phys |
-@@ -1448,33 +1985,52 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -1448,33 +1962,52 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
val |= BIT(1);
val |= BIT(0);
regmap_write(dev->hw->mirror, dev->hw->index * 4, val);
@@ -1885,7 +1853,7 @@
int ret = 0;
RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
-@@ -1494,34 +2050,30 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -1494,34 +2027,30 @@ mtk_wed_attach(struct mtk_wed_device *dev)
goto out;
}
@@ -1930,7 +1898,7 @@
ret = mtk_wed_rro_alloc(dev);
if (ret)
goto error;
-@@ -1533,15 +2085,20 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -1533,15 +2062,20 @@ mtk_wed_attach(struct mtk_wed_device *dev)
init_completion(&dev->wlan_reset_done);
atomic_set(&dev->fe_reset, 0);
@@ -1954,7 +1922,7 @@
out:
mutex_unlock(&hw_lock);
-@@ -1576,8 +2133,26 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx,
+@@ -1576,8 +2110,26 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx,
if (mtk_wed_wdma_rx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE, reset))
return -ENOMEM;
@@ -1981,7 +1949,7 @@
/* WED -> WPDMA */
wpdma_tx_w32(dev, idx, MTK_WED_RING_OFS_BASE, ring->desc_phys);
-@@ -1599,7 +2174,7 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+@@ -1599,7 +2151,7 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
struct mtk_wed_ring *ring = &dev->txfree_ring;
int i, idx = 1;
@@ -1990,7 +1958,7 @@
idx = 0;
/*
-@@ -1652,6 +2227,129 @@ mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
+@@ -1652,6 +2204,129 @@ mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
return 0;
}
@@ -2120,7 +2088,7 @@
static u32
mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
{
-@@ -1660,6 +2358,8 @@ mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
+@@ -1660,6 +2335,8 @@ mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
val = wed_r32(dev, MTK_WED_EXT_INT_STATUS);
wed_w32(dev, MTK_WED_EXT_INT_STATUS, val);
val &= MTK_WED_EXT_INT_STATUS_ERROR_MASK;
@@ -2129,7 +2097,7 @@
WARN_RATELIMIT(val, "mtk_wed%d: error status=%08x\n",
dev->hw->index, val);
-@@ -1752,6 +2452,9 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1752,6 +2429,9 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.tx_ring_setup = mtk_wed_tx_ring_setup,
.txfree_ring_setup = mtk_wed_txfree_ring_setup,
.rx_ring_setup = mtk_wed_rx_ring_setup,
@@ -2139,7 +2107,7 @@
.msg_update = mtk_wed_send_msg,
.start = mtk_wed_start,
.stop = mtk_wed_stop,
-@@ -1763,6 +2466,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1763,6 +2443,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.detach = mtk_wed_detach,
.setup_tc = mtk_wed_eth_setup_tc,
.ppe_check = mtk_wed_ppe_check,
@@ -2147,7 +2115,7 @@
};
struct device_node *eth_np = eth->dev->of_node;
struct platform_device *pdev;
-@@ -1802,9 +2506,10 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1802,9 +2483,10 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
hw->wdma_phy = wdma_phy;
hw->index = index;
hw->irq = irq;
@@ -2160,7 +2128,7 @@
hw->mirror = syscon_regmap_lookup_by_phandle(eth_np,
"mediatek,pcie-mirror");
hw->hifsys = syscon_regmap_lookup_by_phandle(eth_np,
-@@ -1819,7 +2524,6 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1819,7 +2501,6 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
regmap_write(hw->mirror, 0, 0);
regmap_write(hw->mirror, 4, 0);
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch
index ef09f35..36ed532 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch
@@ -153,7 +153,7 @@
if (mtk_wed_get_rx_capa(dev)) {
wed_set(dev, MTK_WED_WPDMA_RX_D_PREF_CFG,
MTK_WED_WPDMA_RX_D_PREF_EN |
-@@ -1487,13 +1590,30 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1465,13 +1568,30 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, MTK_WED_WO_CMD_CHANGE_STATE,
&state, sizeof(state), true);
@@ -184,7 +184,7 @@
wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX,
MTK_WED_WPDMA_RX_D_RST_CRX_IDX |
MTK_WED_WPDMA_RX_D_RST_DRV_IDX);
-@@ -1521,6 +1641,24 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1499,6 +1619,24 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
wed_w32(dev, MTK_WED_RROQM_RST_IDX, 0);
}
@@ -209,7 +209,7 @@
/* reset route qm */
wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_ROUTE_QM_EN);
busy = mtk_wed_poll_busy(dev, MTK_WED_CTRL,
-@@ -1528,8 +1666,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1506,8 +1644,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
if (busy) {
mtk_wed_reset(dev, MTK_WED_RESET_RX_ROUTE_QM);
} else {
@@ -225,7 +225,7 @@
}
/* reset tx wdma */
-@@ -1537,8 +1680,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1515,8 +1658,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
/* reset tx wdma drv */
wed_clr(dev, MTK_WED_WDMA_GLO_CFG, MTK_WED_WDMA_GLO_CFG_TX_DRV_EN);
@@ -241,7 +241,7 @@
mtk_wed_reset(dev, MTK_WED_RESET_WDMA_TX_DRV);
/* reset wed rx dma */
-@@ -1556,9 +1704,17 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1534,9 +1682,17 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
/* reset rx bm */
wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_WED_RX_BM_EN);
mtk_wed_poll_busy(dev, MTK_WED_CTRL,
@@ -260,7 +260,7 @@
/* wo change to enable state */
state = WO_STATE_ENABLE;
mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, MTK_WED_WO_CMD_CHANGE_STATE,
-@@ -1575,6 +1731,9 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1553,6 +1709,9 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
}
mtk_wed_free_rx_buffer(dev);
@@ -270,7 +270,7 @@
}
-@@ -1608,18 +1767,40 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1586,18 +1745,40 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
/* 2. Reset WDMA Rx DMA/Driver_Engine */
busy = !!mtk_wdma_rx_reset(dev);
@@ -314,7 +314,7 @@
wed_w32(dev, MTK_WED_WDMA_RESET_IDX, 0);
wed_set(dev, MTK_WED_WDMA_GLO_CFG,
-@@ -1634,9 +1815,15 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1612,9 +1793,15 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
for (i = 0; i < 100; i++) {
@@ -333,7 +333,7 @@
}
mtk_wed_reset(dev, MTK_WED_RESET_TX_FREE_AGENT);
-@@ -1645,18 +1832,20 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1623,18 +1810,20 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
/* 4. Reset WED WPDMA Tx Driver Engine */
busy = mtk_wed_poll_busy(dev, MTK_WED_WPDMA_GLO_CFG,
@@ -356,7 +356,7 @@
} else {
wed_w32(dev, MTK_WED_WPDMA_RESET_IDX,
MTK_WED_WPDMA_RESET_IDX_TX |
-@@ -1669,7 +1858,13 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1647,7 +1836,13 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
}
}
@@ -371,7 +371,7 @@
dev->init_done = false;
mtk_wed_rx_reset(dev);
}
-@@ -1884,7 +2079,7 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
+@@ -1862,7 +2057,7 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
}
static void
@@ -380,7 +380,7 @@
{
int idx, ret;
-@@ -1894,6 +2089,11 @@ mtk_wed_start_hwrro(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -1872,6 +2067,11 @@ mtk_wed_start_hwrro(struct mtk_wed_device *dev, u32 irq_mask)
if (!mtk_wed_get_rx_capa(dev) || !dev->wlan.hwrro)
return;