On 11 February 2012 19:12, Gabor Juhos <juh...@openwrt.org> wrote: > 2012.02.01. 3:19 keltezéssel, Roman Yeryomin írta: >> This fixes Belkin F5D8235 v2 ethernet stuff. >> To do it we first need to enable rgmii and then not to configure any >> vlans at all. Then there are two ways: enable double tagging on ports >> 5 and 6 and enable tag removal (as I was doing from the very >> beginning) OR we can simply disable vlans and vlan tag removal (as >> proposed by Tobias Diedrich). I'm leaving both variants (first one is >> commented out) for the sake of reference. Of cause you're free to >> remove the commented code. >> So: >> * add RT305X_ESW_VLAN_CONFIG_EXTSW >> * add belkin profile (and remove it from default one) >> * remap ports >> >> Tested with r29978. >> Adding the patch as attachment also. >> >> Signed-off-by: Roman Yeryomin <ro...@advem.lv> >> >> Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c >> =================================================================== >> --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c >> (revision >> 29868) >> +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c >> (working >> copy) >> @@ -124,15 +124,16 @@ >> >> static void __init f5d8235v2_init(void) >> { >> - rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << >> + rt305x_gpio_init(((RT305X_GPIO_MODE_GPIO << >> RT305X_GPIO_MODE_UART0_SHIFT) | >> RT305X_GPIO_MODE_I2C | >> RT305X_GPIO_MODE_SPI | >> - RT305X_GPIO_MODE_MDIO); >> + RT305X_GPIO_MODE_MDIO) & >> + ~RT305X_GPIO_MODE_RGMII); > > This change makes no sense. RT305X_GPIO_MODE_RGMII is defined as BIT(9), and > that bit is not present in the original value.
right, it's not present, but default value in the chip is 1, also it doesn't work without this >> rt305x_register_flash(0, &f5d8235v2_flash_data); >> ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio), >> f5d8235v2_leds_gpio); >> - rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE; >> + rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_EXTSW; >> rt305x_register_ethernet(); >> platform_device_register(&f5d8235v2_switch); >> rt305x_register_wifi(); >> Index: >> target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h >> =================================================================== >> --- >> a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h >> (revision >> 29868) >> +++ >> b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h >> (working >> copy) >> @@ -14,6 +14,7 @@ >> enum { >> RT305X_ESW_VLAN_CONFIG_NONE = 0, >> RT305X_ESW_VLAN_CONFIG_BYPASS, >> + RT305X_ESW_VLAN_CONFIG_EXTSW, > > The RT305X_ESW_VLAN_CONFIG_BYPASS mode has been introduced in order to handle > the external switch case. Adding yet another mode for the same thing seems > superfluous. BYPASS doesn't work for me, it works _only_ if I don't touch vlan config at all (see below) AND do one out of two things (one of those is commented) under CONFIG_EXTSW >> RT305X_ESW_VLAN_CONFIG_LLLLW, >> RT305X_ESW_VLAN_CONFIG_WLLLL, >> }; >> Index: target/linux/ramips/files/drivers/net/ramips_esw.c >> =================================================================== >> --- a/target/linux/ramips/files/drivers/net/ramips_esw.c (revision >> 29868) >> +++ b/target/linux/ramips/files/drivers/net/ramips_esw.c (working copy) >> @@ -265,14 +265,16 @@ >> /* select local register */ >> rt305x_mii_write(esw, 0, 31, 0x8000); >> >> - for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) { >> - rt305x_esw_set_vlan_id(esw, i, 0); >> - rt305x_esw_set_vmsc(esw, i, 0); >> + if (esw->pdata->vlan_config != RT305X_ESW_VLAN_CONFIG_EXTSW) { >> + for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) { >> + rt305x_esw_set_vlan_id(esw, i, 0); >> + rt305x_esw_set_vmsc(esw, i, 0); >> + } >> + >> + for (i = 0; i < RT305X_ESW_NUM_PORTS; i++) >> + rt305x_esw_set_pvid(esw, i, 1); >> } >> >> - for (i = 0; i < RT305X_ESW_NUM_PORTS; i++) >> - rt305x_esw_set_pvid(esw, i, 1); >> - >> switch (esw->pdata->vlan_config) { >> case RT305X_ESW_VLAN_CONFIG_NONE: >> break; >> @@ -289,6 +291,30 @@ >> RT305X_ESW_REG_POC3); >> break; >> >> + case RT305X_ESW_VLAN_CONFIG_EXTSW: >> + /* Disable per port vlan id and priority check (EN_VLAN = 0) */ >> + rt305x_esw_wr(esw, 0, RT305X_ESW_REG_PFC1); >> + /* Disable VLAN TAG removal and aging */ >> + rt305x_esw_wr(esw, 0, RT305X_ESW_REG_POC3); >> + >> + /* Enable VLAN on ports 5 and 6*/ >> + //rt305x_esw_wr(esw, 0x00605555, 0x14); >> + /* Remove VLAN tag field on all ports */ >> + //rt305x_esw_wr(esw, 0x00007f7f, 0x98); >> + /* Insert double tag field port 5 and 6 */ >> + //rt305x_esw_wr(esw, 0x00000060, 0xe4); >> + >> + /* Disable port 5 auto polling */ >> + rt305x_esw_wr(esw, rt305x_esw_rr(esw, RT305X_ESW_REG_FPA2) & >> + ~(1 << 29), RT305X_ESW_REG_FPA2); >> + /* Force 1000M full duplex */ >> + rt305x_esw_wr(esw, rt305x_esw_rr(esw, RT305X_ESW_REG_FPA2) | >> + 0x3fff, RT305X_ESW_REG_FPA2); >> + /* rxclk_skew, txclk_skew = 0 */ >> + rt305x_esw_wr(esw, rt305x_esw_rr(esw, RT305X_ESW_REG_FPA2) & >> + ~(0xf << 20), RT305X_ESW_REG_FPA2); > > You can override the FPA2 register value via platform data. maybe I overlooked it, could you point out where to look? >> + break; >> + >> case RT305X_ESW_VLAN_CONFIG_LLLLW: >> rt305x_esw_set_vlan_id(esw, 0, 1); >> rt305x_esw_set_vlan_id(esw, 1, 2); > > The rest of the patch is applied, but please don't mix unrelated changes into > a > single patch next time. > Well the rest actually is related because this was the patch to get Belkin board finally working without dirty hacks. Or you mean in the sense of files? Regards, Roman _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel