mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
8f638f9366
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.91 Remove upstreamed patches: - airoha/patches-6.12/017-v6.13-net-airoha-Implement-BQL-support.patch[1] - airoha/patches-6.12/138-v7.1-net-airoha-Add-missing-RX_CPU_IDX-configuration-in-a.patch[2] - airoha/patches-6.12/149-v7.1-net-airoha-Move-ndesc-initialization-at-end-of-airoh.patch[3] - generic/backport-6.12/940-v7.1-net-dsa-realtek-rtl8365mb-fix-mode-mask-calculation.patch[5] Manually rebased patches: - airoha/patches-6.12/048-01-v6.15-net-airoha-Move-airoha_eth-driver-in-a-dedicated-fol.patch[1] - ath79/patches-6.12/800-leds-add-reset-controller-based-driver.patch[4] - bcm27xx/patches-6.12/950-0122-bcmgenet-Better-coalescing-parameter-defaults.patch[6] We also backported four patches to fix perf tool regression: - generic/backport-6.12/216-01-revert-perf-cgroup-update-metric-leader-in-evlist__e.patch - generic/backport-6.12/216-02-revert-perf-tool_pmu-fix-aggregation-on-duration_tim.patch - generic/backport-6.12/216-03-revert-perf-python-add-parse_events-function.patch - generic/backport-6.12/216-04-revert-perf-tool_pmu-factor-tool-events-into-their-o.patch All other patches are automatically refreshed. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=ca24fcac1daaa5e8a667981d81986a3eb4b9fb04 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=f00037a99bc2332ef59dc85298b98b20af165904 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=d36be272adda7f313e39dd118086955d993bf6a7 [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=07d3611389ba7d78b80ea360a42ce32ab2521fbc [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=3354d6c62fd4baa7b32cbd80cc5a8aa3f2bd0656 [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.91&id=b84351dcc359667bc952131c1424b692ec83dce2 Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: https://github.com/openwrt/openwrt/pull/23444 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
203 lines
6.1 KiB
Diff
203 lines
6.1 KiB
Diff
From 9d5b5219f672c80bed4d4e15f0068e648cdca43b Mon Sep 17 00:00:00 2001
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Fri, 17 Oct 2025 11:06:20 +0200
|
|
Subject: [PATCH 10/12] net: airoha: Refactor src port configuration in
|
|
airhoha_set_gdm2_loopback
|
|
|
|
AN7583 chipset relies on different definitions for source-port
|
|
identifier used for hw offloading. In order to support hw offloading
|
|
in AN7583 controller, refactor src port configuration in
|
|
airhoha_set_gdm2_loopback routine and introduce get_src_port_id
|
|
callback.
|
|
|
|
Reviewed-by: Simon Horman <horms@kernel.org>
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Link: https://patch.msgid.link/20251017-an7583-eth-support-v3-11-f28319666667@kernel.org
|
|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
---
|
|
drivers/net/ethernet/airoha/airoha_eth.c | 82 ++++++++++++++++-------
|
|
drivers/net/ethernet/airoha/airoha_eth.h | 18 +++--
|
|
drivers/net/ethernet/airoha/airoha_regs.h | 6 +-
|
|
3 files changed, 73 insertions(+), 33 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
|
@@ -1708,13 +1708,17 @@ static int airoha_dev_set_macaddr(struct
|
|
return 0;
|
|
}
|
|
|
|
-static void airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
|
|
+static int airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
|
|
{
|
|
- u32 pse_port = port->id == 3 ? FE_PSE_PORT_GDM3 : FE_PSE_PORT_GDM4;
|
|
+ u32 val, pse_port, chan = port->id == AIROHA_GDM3_IDX ? 4 : 0;
|
|
struct airoha_eth *eth = port->qdma->eth;
|
|
- u32 chan = port->id == 3 ? 4 : 0;
|
|
+ /* XXX: handle XSI_USB_PORT and XSI_PCE1_PORT */
|
|
+ u32 nbq = port->id == AIROHA_GDM3_IDX ? 4 : 0;
|
|
+ int src_port;
|
|
|
|
/* Forward the traffic to the proper GDM port */
|
|
+ pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
|
|
+ : FE_PSE_PORT_GDM4;
|
|
airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(2), pse_port);
|
|
airoha_fe_clear(eth, REG_GDM_FWD_CFG(2), GDM_STRIP_CRC);
|
|
|
|
@@ -1735,29 +1739,25 @@ static void airhoha_set_gdm2_loopback(st
|
|
airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(2));
|
|
airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(2));
|
|
|
|
- if (port->id == 3) {
|
|
- /* FIXME: handle XSI_PCE1_PORT */
|
|
- airoha_fe_rmw(eth, REG_FE_WAN_PORT,
|
|
- WAN1_EN_MASK | WAN1_MASK | WAN0_MASK,
|
|
- FIELD_PREP(WAN0_MASK, HSGMII_LAN_PCIE0_SRCPORT));
|
|
- airoha_fe_rmw(eth,
|
|
- REG_SP_DFT_CPORT(HSGMII_LAN_PCIE0_SRCPORT >> 3),
|
|
- SP_CPORT_PCIE0_MASK,
|
|
- FIELD_PREP(SP_CPORT_PCIE0_MASK,
|
|
- FE_PSE_PORT_CDM2));
|
|
- } else {
|
|
- /* FIXME: handle XSI_USB_PORT */
|
|
+ src_port = eth->soc->ops.get_src_port_id(port, nbq);
|
|
+ if (src_port < 0)
|
|
+ return src_port;
|
|
+
|
|
+ airoha_fe_rmw(eth, REG_FE_WAN_PORT,
|
|
+ WAN1_EN_MASK | WAN1_MASK | WAN0_MASK,
|
|
+ FIELD_PREP(WAN0_MASK, src_port));
|
|
+ val = src_port & SP_CPORT_DFT_MASK;
|
|
+ airoha_fe_rmw(eth,
|
|
+ REG_SP_DFT_CPORT(src_port >> fls(SP_CPORT_DFT_MASK)),
|
|
+ SP_CPORT_MASK(val),
|
|
+ FE_PSE_PORT_CDM2 << __ffs(SP_CPORT_MASK(val)));
|
|
+
|
|
+ if (port->id != AIROHA_GDM3_IDX)
|
|
airoha_fe_rmw(eth, REG_SRC_PORT_FC_MAP6,
|
|
FC_ID_OF_SRC_PORT24_MASK,
|
|
FIELD_PREP(FC_ID_OF_SRC_PORT24_MASK, 2));
|
|
- airoha_fe_rmw(eth, REG_FE_WAN_PORT,
|
|
- WAN1_EN_MASK | WAN1_MASK | WAN0_MASK,
|
|
- FIELD_PREP(WAN0_MASK, HSGMII_LAN_ETH_SRCPORT));
|
|
- airoha_fe_rmw(eth,
|
|
- REG_SP_DFT_CPORT(HSGMII_LAN_ETH_SRCPORT >> 3),
|
|
- SP_CPORT_ETH_MASK,
|
|
- FIELD_PREP(SP_CPORT_ETH_MASK, FE_PSE_PORT_CDM2));
|
|
- }
|
|
+
|
|
+ return 0;
|
|
}
|
|
|
|
static int airoha_dev_init(struct net_device *dev)
|
|
@@ -1774,8 +1774,13 @@ static int airoha_dev_init(struct net_de
|
|
case 3:
|
|
case 4:
|
|
/* If GDM2 is active we can't enable loopback */
|
|
- if (!eth->ports[1])
|
|
- airhoha_set_gdm2_loopback(port);
|
|
+ if (!eth->ports[1]) {
|
|
+ int err;
|
|
+
|
|
+ err = airhoha_set_gdm2_loopback(port);
|
|
+ if (err)
|
|
+ return err;
|
|
+ }
|
|
fallthrough;
|
|
case 2:
|
|
if (airoha_ppe_is_enabled(eth, 1)) {
|
|
@@ -3093,11 +3098,38 @@ static const char * const en7581_xsi_rst
|
|
"xfp-mac",
|
|
};
|
|
|
|
+static int airoha_en7581_get_src_port_id(struct airoha_gdm_port *port, int nbq)
|
|
+{
|
|
+ switch (port->id) {
|
|
+ case 3:
|
|
+ /* 7581 SoC supports PCIe serdes on GDM3 port */
|
|
+ if (nbq == 4)
|
|
+ return HSGMII_LAN_7581_PCIE0_SRCPORT;
|
|
+ if (nbq == 5)
|
|
+ return HSGMII_LAN_7581_PCIE1_SRCPORT;
|
|
+ break;
|
|
+ case 4:
|
|
+ /* 7581 SoC supports eth and usb serdes on GDM4 port */
|
|
+ if (!nbq)
|
|
+ return HSGMII_LAN_7581_ETH_SRCPORT;
|
|
+ if (nbq == 1)
|
|
+ return HSGMII_LAN_7581_USB_SRCPORT;
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
static const struct airoha_eth_soc_data en7581_soc_data = {
|
|
.version = 0x7581,
|
|
.xsi_rsts_names = en7581_xsi_rsts_names,
|
|
.num_xsi_rsts = ARRAY_SIZE(en7581_xsi_rsts_names),
|
|
.num_ppe = 2,
|
|
+ .ops = {
|
|
+ .get_src_port_id = airoha_en7581_get_src_port_id,
|
|
+ },
|
|
};
|
|
|
|
static const struct of_device_id of_airoha_match[] = {
|
|
--- a/drivers/net/ethernet/airoha/airoha_eth.h
|
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.h
|
|
@@ -67,10 +67,10 @@ enum {
|
|
};
|
|
|
|
enum {
|
|
- HSGMII_LAN_PCIE0_SRCPORT = 0x16,
|
|
- HSGMII_LAN_PCIE1_SRCPORT,
|
|
- HSGMII_LAN_ETH_SRCPORT,
|
|
- HSGMII_LAN_USB_SRCPORT,
|
|
+ HSGMII_LAN_7581_PCIE0_SRCPORT = 0x16,
|
|
+ HSGMII_LAN_7581_PCIE1_SRCPORT,
|
|
+ HSGMII_LAN_7581_ETH_SRCPORT,
|
|
+ HSGMII_LAN_7581_USB_SRCPORT,
|
|
};
|
|
|
|
enum {
|
|
@@ -99,6 +99,13 @@ enum {
|
|
CRSN_25 = 0x19,
|
|
};
|
|
|
|
+enum airoha_gdm_index {
|
|
+ AIROHA_GDM1_IDX = 1,
|
|
+ AIROHA_GDM2_IDX = 2,
|
|
+ AIROHA_GDM3_IDX = 3,
|
|
+ AIROHA_GDM4_IDX = 4,
|
|
+};
|
|
+
|
|
enum {
|
|
FE_PSE_PORT_CDM1,
|
|
FE_PSE_PORT_GDM1,
|
|
@@ -555,6 +562,9 @@ struct airoha_eth_soc_data {
|
|
const char * const *xsi_rsts_names;
|
|
int num_xsi_rsts;
|
|
int num_ppe;
|
|
+ struct {
|
|
+ int (*get_src_port_id)(struct airoha_gdm_port *port, int nbq);
|
|
+ } ops;
|
|
};
|
|
|
|
struct airoha_eth {
|
|
--- a/drivers/net/ethernet/airoha/airoha_regs.h
|
|
+++ b/drivers/net/ethernet/airoha/airoha_regs.h
|
|
@@ -383,10 +383,8 @@
|
|
#define REG_MC_VLAN_DATA 0x2108
|
|
|
|
#define REG_SP_DFT_CPORT(_n) (0x20e0 + ((_n) << 2))
|
|
-#define SP_CPORT_PCIE1_MASK GENMASK(31, 28)
|
|
-#define SP_CPORT_PCIE0_MASK GENMASK(27, 24)
|
|
-#define SP_CPORT_USB_MASK GENMASK(7, 4)
|
|
-#define SP_CPORT_ETH_MASK GENMASK(7, 4)
|
|
+#define SP_CPORT_DFT_MASK GENMASK(2, 0)
|
|
+#define SP_CPORT_MASK(_n) GENMASK(3 + ((_n) << 2), ((_n) << 2))
|
|
|
|
#define REG_SRC_PORT_FC_MAP6 0x2298
|
|
#define FC_ID_OF_SRC_PORT27_MASK GENMASK(28, 24)
|