[FS#612] WAN to LAN leakage on MT7620 devices

LEDE Bugs lede-bugs at lists.infradead.org
Thu Oct 12 18:38:57 PDT 2017


The following task has a new comment added:

FS#612 - WAN to LAN leakage on MT7620 devices
User who did this - Toan (tpham3783)

----------

Hi,

I just want to share my patch which resolved the issue w/ the leakage, and also enable gigabit speed on the mt7530.  Feel free to adopt it if you feel it could be useful.

thanks,

TP


------ target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
@@ -43,6 +43,8 @@
 #include 
 #include 
 
+#include 
+
 #include "ralink_soc_eth.h"
 #include "gsw_mt7620a.h"
 #include "mt7530.h"
@@ -469,10 +471,57 @@ void mt7620_port_init(struct fe_priv *priv, struct device_node *np)
 	}
 }
 
+static void reset_mt7530_gsw(struct mt7620_gsw *gsw)
+{
+	u32 val;
+	int active_low = 0;
+	int reset_gpio = 10;
+	int delay=100000;
+	printk("mt7530: entering reset gws\r\n");
+	if (!gpio_request(reset_gpio, "gsw-reset")) {
+		printk("mt7530: reseting gws\r\n");
+        gpio_direction_output(reset_gpio, active_low ? 1 : 0);
+        udelay(delay);
+        gpio_set_value(reset_gpio, active_low ? 0 : 1);
+        udelay(delay);
+        gpio_set_value(reset_gpio, active_low ? 1 : 0);
+        udelay(delay);
+        gpio_set_value(reset_gpio, active_low ? 0 : 1);
+        udelay(125000);
+     }
+//#ifdef _notuse_
+    if ((rt_sysc_r32(SYSC_REG_CHIP_REV_ID) & 0xFFFF) == 0x0101) {
+        /* (GE1, Force 1000M/FD, FC ON) */
+        gsw_w32(gsw, 0x2005e30b, 0x100);
+        mt7530_mdio_w32(gsw, 0x3600, 0x5e30b); // use 0x5e337 for force link;
+    } else {
+        /* (GE1, Force 1000M/FD, FC ON) */
+        gsw_w32(gsw, 0x2005e33b, 0x100);
+        mt7530_mdio_w32(gsw, 0x3600, 0x5e33b);  // use 0x5e337 for 100mb Force link;
+    }
+
+    /* (GE2, Link down) */
+    gsw_w32(gsw, 0x8000, 0x200);
+
+    //val = 0x117ccf; //Enable Port 6, P5 as GMAC5, P5 disable
+    val = mt7530_mdio_r32(gsw, 0x7804);
+    val &= ~(1



More information about the lede-bugs mailing list