Skip to content

Instantly share code, notes, and snippets.

@guilhem
Created April 10, 2012 08:54
Show Gist options
  • Save guilhem/2349486 to your computer and use it in GitHub Desktop.
Save guilhem/2349486 to your computer and use it in GitHub Desktop.
add 2 Wan port to dir300 (ramips arch)
config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'
option macaddr '14:d6:4d:bb:04:67'
config interface 'wan2'
option ifname 'eth0.3'
option proto 'dhcp'
option macaddr '14:d6:4d:bb:04:68'
--- trunk2/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c 2012-04-10 10:42:11.679418918 +0200
+++ trunk/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c 2012-04-03 19:04:49.024811431 +0200
@@ -315,6 +315,22 @@
BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT6));
break;
+ case RT305X_ESW_VLAN_CONFIG_WLLLW:
+ rt305x_esw_set_vlan_id(esw, 0, 1);
+ rt305x_esw_set_vlan_id(esw, 1, 2);
+ rt305x_esw_set_vlan_id(esw, 2, 3);
+ rt305x_esw_set_pvid(esw, RT305X_ESW_PORT4, 2);
+ rt305x_esw_set_pvid(esw, RT305X_ESW_PORT0, 3);
+
+ rt305x_esw_set_vmsc(esw, 0,
+ BIT(RT305X_ESW_PORT1) | BIT(RT305X_ESW_PORT2) |
+ BIT(RT305X_ESW_PORT3) | BIT(RT305X_ESW_PORT6));
+ rt305x_esw_set_vmsc(esw, 1,
+ BIT(RT305X_ESW_PORT4) | BIT(RT305X_ESW_PORT6));
+ rt305x_esw_set_vmsc(esw, 2,
+ BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT6));
+ break;
+
default:
BUG();
}
--- trunk2/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h 2012-04-03 15:46:30.609685280 +0200
+++ trunk/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h 2012-04-03 19:03:53.768812571 +0200
@@ -16,6 +16,7 @@
RT305X_ESW_VLAN_CONFIG_BYPASS,
RT305X_ESW_VLAN_CONFIG_LLLLW,
RT305X_ESW_VLAN_CONFIG_WLLLL,
+ RT305X_ESW_VLAN_CONFIG_WLLLW,
};
--- ./trunk2/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c 2012-04-03 15:46:30.541685281 +0200
+++ ./trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c 2012-04-03 18:51:57.904827337 +0200
@@ -69,7 +69,7 @@
rt305x_register_flash(0);
- rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
+ rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLW;
rt305x_register_ethernet();
ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_300b_leds_gpio),
dir_300b_leds_gpio);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment