Files
build/patch/kernel/archive/rockchip64-6.16/rk3308-fix-10mbit-ethernet.patch

62 lines
2.5 KiB
Diff

From 545ae14ee0159a449e6e0f2f1f54b8c5cc6023ef Mon Sep 17 00:00:00 2001
From: chillymattster <106633144+chillymattster@users.noreply.github.com>
From: Brent Roman <genosensor@gmail.com>
Date: Wed, 3 Sep 2025 18:29:16 +0200
Subject: [PATCH] rk3308: Fix 10Mbit Ethernet
Origin: https://github.com/armbian/build/pull/6117
Bug-armbian: https://github.com/armbian/build/pull/8575
Bug-armbian: https://armbian.atlassian.net/browse/AR-1904
Bug-armbian: https://forum.armbian.com/topic/30235-rockpi-s-ethernet-10mbps-not-working/
Signed-off-by: chillymattster <106633144+chillymattster@users.noreply.github.com>
Last-Update: 2025-09-06
---
This fixes bug AR-1904.
The original fix was only for current and not for edge kernel which caused
the patch being lost and made the problem reoccur.
.
According to the original PR#6117 the problem of 10mbps ethernot not working
has first been seen in the 5.15 armbian kernel caused by a rewrite of speed
setting for rk3308 in dwmc-rk.c that for unknown reasons completely omitted
the code needed to reprogram the MAC clock as appropriate for the selected
ethernet speed.
.
This patch corrects RK3308_GMAC_FLOW_CTRL and RK3308_GMAC_FLOW_CTRL_CLR to use
the correct bits for MAC onfiguration and restores the missing code needed for
setting the MAC clock required to match the selected ethernet speed.
.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 700858f..5a19f70 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -500,8 +500,8 @@ static const struct rk_gmac_ops rk3288_ops = {
/* RK3308_GRF_MAC_CON0 */
#define RK3308_GMAC_PHY_INTF_SEL_RMII (GRF_CLR_BIT(2) | GRF_CLR_BIT(3) | \
GRF_BIT(4))
-#define RK3308_GMAC_FLOW_CTRL GRF_BIT(3)
-#define RK3308_GMAC_FLOW_CTRL_CLR GRF_CLR_BIT(3)
+#define RK3308_GMAC_FLOW_CTRL GRF_BIT(1)
+#define RK3308_GMAC_FLOW_CTRL_CLR GRF_CLR_BIT(1)
#define RK3308_GMAC_SPEED_10M GRF_CLR_BIT(0)
#define RK3308_GMAC_SPEED_100M GRF_BIT(0)
@@ -524,6 +524,11 @@ static void rk3308_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)
} else {
dev_err(dev, "unknown speed value for RMII! speed=%d", speed);
}
+ int ret = clk_set_rate(bsp_priv->clks[RK_CLK_MAC_SPEED].clk, 250000*speed);
+ if (ret) {
+ dev_err(dev, "%s: clk_set_rate for %dMbps returned: %d\n",
+ __func__, speed, ret);
+ }
}
static const struct rk_gmac_ops rk3308_ops = {
--
2.39.5