[OpenWrt-Devel] [RFC]ramips: fix embedded switch init

serge vasilugin at yandex.ru
Sat Feb 27 22:59:43 EST 2016


Starting from AA when ramips support was added we get failsafe mode issue.
Digging the problem I suggest:

1. Change switch init: if vlan disabled set pvid 1 for all ports and add 
all ports
into vlan0 with vid=1
2. Change init order in ethernet driver probe - init ESW after FE.

First step allow to set eth0 in predictable state after ethernet
driver init'ed or at any time with simple:
         swconfig dev switch0 set reset 1

Second step is needed because some SOCs (rt5350,rt3352) reset FE and ESW 
together
during ethernet probe but I think only for AA.

All these allow simplify ramips_set_preinit_iface() to set ifname=eth0 only.
Or add fallback to eth0 into preinit if both pi_ifname and ifname are 
undefined.
In last case no need ramips_set_preinit_iface() at all.

Was tested for rt5350. Check for other SOCs is needed.

Signed-off-by: Serge Vasilugin <vasilugin at yandex.ru>

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
+++ c/target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3052.c
@@ -768,7 +768,7 @@ static int esw_apply_config(struct switc
  			doubletag |= x << i;
  			en_vlan   |= x << i;
  			untag     |= x << i;
-			pvid       = 0;
+			pvid       = 1;
  		}
  		esw_set_pvid(esw, i, pvid);
  		if (i < RT305X_ESW_NUM_LEDS)
@@ -795,7 +795,7 @@ static int esw_apply_config(struct switc
  		 * isolated.
  		 * NOTE: vlan 0 is special, no vlan tag is prepended
  		 */
-		esw_set_vlan_id(esw, 0, 0);
+		esw_set_vlan_id(esw, 0, 1);
  		esw_set_vmsc(esw, 0, RT305X_ESW_PORTS_ALL);
  	}
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list