ipq806x: dwmac: fix GMACs connected via SGMII fixed-link
authorMark Mentovai <mark@moxienet.com>
Sat, 8 May 2021 15:00:55 +0000 (11:00 -0400)
committerPetr Štetiar <ynezz@true.cz>
Sat, 8 May 2021 16:45:42 +0000 (18:45 +0200)
commitd62825dd77b3990b8ff2cf341ff3a8b16f4883d1
tree16c9214756637f0692547e5c9182316c403794ec
parentf68c9474acf9a65b5a9538db8e45c173462487e3
ipq806x: dwmac: fix GMACs connected via SGMII fixed-link

fa731838c524 cleared the forced speed in the QSGMII PCS_ALL_CH_CTL
register during probe, but this is only correct for GMACs that are not
configured with fixed-link. This prevented GMACs configured with both
phy-mode = "sgmii" and fixed-link from working properly, as discussed at
https://github.com/openwrt/openwrt/pull/3954#issuecomment-834625090 and
the comments that follow. Notably, this prevented all communication
between gmac2 and the switch on the Netgear R7800.

The correct behavior is to set the QSGMII PCS_ALL_CH_CTL register by
considering the gmac's fixed-link child, setting the speed as directed by
fixed-link if present, and otherwise clearing it as was done previously.

Fixes: fa731838c524 ("ipq806x: dwmac: clear forced speed during probe")
Signed-off-by: Mark Mentovai <mark@moxienet.com>
Tested-by: Hannu Nyman <hannu.nyman@iki.fi>
Run-tested: ipq806x/ubnt,unifi-ac-hd, ipq806x/netgear,r7800
Cc: Petr Štetiar <ynezz@true.cz>
Cc: Ansuel Smith <ansuelsmth@gmail.com>
Tested-by: Ansuel Smith <ansuelsmth@gmail.com>
target/linux/ipq806x/patches-5.4/100-dwmac-ipq806x-qsgmii-pcs-all-ch-ctl.patch