New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipq806x: fix MAC_POWER_SEL switch configuration #134
Conversation
Fixes instability/corruption on the ethernet interface connected to port0 on the switch. Signed-off-by: Josh Bendavid <joshbendavid@gmail.com>
:-) how many hours/days did it take to figure out ? |
More than a few hours, not that many days :) |
We discussed this a while back on PR #6. What is strange, is that at that moment I searched the AR8337 datasheet to check the registers/bits meanings. I've found a datasheet for AR8327 and QCA8337N, and they document all the registers, but nothing is said about register 0x000E4. It is not even mentioned.
This is what I found at that time on the Linksys GPL board files, and the reason I changed the dts. 8337 is configured with this definition, from drivers/net/phy/ar8216.h:
and thus setting bit 19 to on and 18 off. |
Hah, I had completely forgot about that when debugging this. For EA8500 I think you will actually need both bits 18 and 19 set to 1, since I suspect you need rgmii working properly on both port0 and port5 (or at least the PHY which is normally used for port5). As you say this is not the cause of the eth1 problems on ea8500 given that the consequences of setting it wrong is an unstable link rather than one which doesn't work at all. |
Is this pulled (or is the right thing the dts change, and that pulled?) reason: was just about to flash one of these beasties from the buildbot... and it looks like I should hold off. |
merged into my staging tree |
@bendavid I can confirm that the original Linksys firmware also uses this mac_power_sel:
I also checked the rest of the initvals and they all coincide. So, I still have to find out what is causing trouble with eth1 |
The tool to read the registers is included in the stock linksys firmware? |
yes, its called ssdk_sh, it is also used to configure the switch. |
Alright that is indeed very useful. Are you sure the stock firmware is using gmac1 and gmac2 and not one of gmac0/3 for some reason? |
According to Lynksys' GPL source, in the board definition, gmac1 & 2 are used. |
34cfbb922c96 README.md: various spelling and documentation fixes ff32355ea645 build: make rtnl/nl80211 depend on linux instead of !APPLE c0e413c21f7b include: add uc_fn_thisval() 1e4d20932646 Merge pull request #134 from nbd168/thisval Signed-off-by: Felix Fietkau <nbd@nbd.name>
Fixes instability/corruption on the ethernet interface connected to port0 on the switch.
Original source of this problem is a possible typo/inconsistency in Qualcomm sources.
Looking at the TP-Link C2600 GPL tarball, there is an inconsistent definition of bits 18 and 19 of the MAC_POWER_SEL register.
In openwrt/qca/src/qca-ssdk-shell/include/init/ssdk_plat.h there is one definition
And what is currently in the device trees is consistent with this definition.
In openwrt/qca/src/qca-ssdk/include/init/ssdk_plat.h there is instead what I suspect is the correct definition with those two bits flipped.
Modifying the device tree to be consistent with this definition (enabling bit 18 and disabling bit 19) solves the instability and corruption issues I was having with eth0 on the Archer 2600 at high load. Probably the same problem affects all IPQ806x devices with switch port0 connected to the cpu with rgmii.