rockchip: add some stmmac / dsa workaround

This commit is contained in:
aiamadeus 2025-08-15 22:10:06 +08:00
parent cecb436800
commit 6631052ac6
3 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/drivers/net/dsa/realtek/rtl83xx.c
+++ b/drivers/net/dsa/realtek/rtl83xx.c
@@ -184,7 +184,7 @@ rtl83xx_probe(struct device *dev,
"realtek,disable-leds");
/* TODO: if power is software controlled, set up any regulators here */
- priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
+ priv->reset_ctl = devm_reset_control_get_optional(dev, "switch");
if (IS_ERR(priv->reset_ctl))
return dev_err_cast_probe(dev, priv->reset_ctl,
"failed to get reset control\n");

View File

@ -0,0 +1,48 @@
From 54ad65e581e180eaf81306334b1da3fa0ee7e3f5 Mon Sep 17 00:00:00 2001
From: jensen <jensenhuang@friendlyarm.com>
Date: Thu, 17 Nov 2022 18:35:43 +0800
Subject: [PATCH] ethernet: stmmac: Add property to disable VLAN hw filter
Since adding VLAN in promisc mode not supported, which makes unable to
setup bridge, add a configurable option to disable it.
Signed-off-by: jensen <jensenhuang@friendlyarm.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +++
include/linux/stmmac.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7691,7 +7691,7 @@ int stmmac_dvr_probe(struct device *device,
ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
priv->hw->hw_vlan_en = true;
}
- if (priv->dma_cap.vlhash) {
+ if (priv->plat->vlhash_en && priv->dma_cap.vlhash) {
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
}
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -596,6 +596,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
"force_sf_dma_mode is ignored if force_thresh_dma_mode is set.\n");
}
+ /* To disable VLAN tag filter */
+ plat->vlhash_en = !of_property_read_bool(np, "snps,no-vlhash");
+
of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed);
plat->axi = stmmac_axi_setup(pdev);
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -263,6 +263,7 @@ struct plat_stmmacenet_data {
int mac_port_sel_speed;
int has_xgmac;
u8 vlan_fail_q;
+ bool vlhash_en;
unsigned int eee_usecs_rate;
struct pci_dev *pdev;
int int_snapshot_num;

View File

@ -0,0 +1,48 @@
From 54ad65e581e180eaf81306334b1da3fa0ee7e3f5 Mon Sep 17 00:00:00 2001
From: jensen <jensenhuang@friendlyarm.com>
Date: Thu, 17 Nov 2022 18:35:43 +0800
Subject: [PATCH] ethernet: stmmac: Add property to disable VLAN hw filter
Since adding VLAN in promisc mode not supported, which makes unable to
setup bridge, add a configurable option to disable it.
Signed-off-by: jensen <jensenhuang@friendlyarm.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +++
include/linux/stmmac.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7577,7 +7577,7 @@ int stmmac_dvr_probe(struct device *device,
#ifdef STMMAC_VLAN_TAG_USED
/* Both mac100 and gmac support receive VLAN tag detection */
ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX;
- if (priv->dma_cap.vlhash) {
+ if (priv->plat->vlhash_en && priv->dma_cap.vlhash) {
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
}
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -596,6 +596,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
"force_sf_dma_mode is ignored if force_thresh_dma_mode is set.\n");
}
+ /* To disable VLAN tag filter */
+ plat->vlhash_en = !of_property_read_bool(np, "snps,no-vlhash");
+
of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed);
plat->axi = stmmac_axi_setup(pdev);
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -300,6 +300,7 @@ struct plat_stmmacenet_data {
int mac_port_sel_speed;
int has_xgmac;
u8 vlan_fail_q;
+ bool vlhash_en;
unsigned int eee_usecs_rate;
struct pci_dev *pdev;
int int_snapshot_num;