I am attempting to learn how to make progress with this issue.
I opened an issue on github and it contains links to the patchset causing the issue and a serial console log showing the broken ethernet.
Evidently the patch author wasn't aware rt5350 requires the frame engine and the switch to be reset at the same time to prevent a pdma panic. I saw about it in a comment in the original ethernet patchset for these systems from long ago.
Also, the last of the patches in this patchset says "implement carrier detection similar to mt7620" and here is some of the new code:
int rt3050_esw_has_carrier(struct fe_priv *priv)
{
struct rt305x_esw *esw = priv->soc->swpriv;
u32 link;
int i;
bool cpuport;
link = esw_r32(esw, RT305X_ESW_REG_POA);
link >>= RT305X_ESW_POA_LINK_SHIFT;
cpuport = link & BIT(RT305X_ESW_PORT6);
link &= RT305X_ESW_POA_LINK_MASK;
for (i = 0; i <= RT305X_ESW_PORT5; i++) {
if (priv->link[i] != (link & BIT(i)))
dev_info(esw->dev, "port %d link %s\n", i, link & BIT(i) ? "up" : "down");
priv->link[i] = link & BIT(i);
}
return !!link && cpuport;
}
The POA register port status bits are manipulated then checked, recorded and port link changes are reported.
The overall objective of the patch is to be able to call netif_carrier_on() when at least 1 port is up otherwise netif_carrier_off() is called.
Port 6 is the cpu port and making use of it here appears to be unnecessary. I checked a running system and in the context of the above code the cpu port bit is always 1.
I am not much of a programmer these days but I am willing to learn.
How to explain the superfluous use of the cpu port bit and the strange return statement?
Is reverting these patches an option?
Or should I try to make a new patch to fix my rt5350 issue?
Or is it normally expected that I contact the patch author and discuss the issue with him?
Any insight would be very much appreciated.