mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-16 09:10:02 +00:00
54 lines
1.7 KiB
Diff
54 lines
1.7 KiB
Diff
From 869d6244cd42d40d9a502152fe4f77e67814d0cb Mon Sep 17 00:00:00 2001
|
|
From: Luo Chongjun <luochongjun@gl-inet.com>
|
|
Date: Tue, 6 Jun 2023 18:33:08 +0800
|
|
Subject: [PATCH] fix mt7628 esw carrier status
|
|
|
|
---
|
|
.../drivers/net/ethernet/ralink/esw_rt3050.c | 23 +++++++++++++++++++
|
|
1 file changed, 23 insertions(+)
|
|
|
|
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c
|
|
index 75b6707be2..3f072353bc 100644
|
|
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c
|
|
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c
|
|
@@ -738,6 +738,28 @@ static void esw_hw_init(struct rt305x_esw *esw)
|
|
esw_w32(esw, ~RT305X_ESW_PORT_ST_CHG, RT305X_ESW_REG_IMR);
|
|
}
|
|
|
|
+static void rt3050_esw_port0_handle_carrier(struct rt305x_esw *esw, u32 status)
|
|
+{
|
|
+ struct net_device *netdev;
|
|
+ char ifname[IFNAMSIZ];
|
|
+ unsigned int pvid = esw_get_pvid(esw, 0 );
|
|
+ u32 cpuport = status & BIT(RT305X_ESW_PORT6);
|
|
+ u32 link = status & BIT(0);
|
|
+ if(pvid){
|
|
+ sprintf(ifname,"%s.%d",esw->priv->netdev->name,pvid);
|
|
+ netdev = dev_get_by_name(&init_net, ifname);
|
|
+ if(!netdev)
|
|
+ return;
|
|
+
|
|
+ if(!!link && cpuport){
|
|
+ netif_carrier_on(netdev);
|
|
+ }
|
|
+ else{
|
|
+ netif_carrier_off(netdev);
|
|
+ }
|
|
+ dev_put(netdev);
|
|
+ }
|
|
+}
|
|
|
|
int rt3050_esw_has_carrier(struct fe_priv *priv)
|
|
{
|
|
@@ -748,6 +770,7 @@ int rt3050_esw_has_carrier(struct fe_priv *priv)
|
|
|
|
link = esw_r32(esw, RT305X_ESW_REG_POA);
|
|
link >>= RT305X_ESW_POA_LINK_SHIFT;
|
|
+ rt3050_esw_port0_handle_carrier(esw, link);
|
|
cpuport = link & BIT(RT305X_ESW_PORT6);
|
|
link &= RT305X_ESW_POA_LINK_MASK;
|
|
for (i = 0; i <= RT305X_ESW_PORT5; i++) {
|
|
--
|
|
2.25.1
|
|
|