8080a2ca441e0ba6dd018246f0e03115879d9531
[openwrt/staging/xback.git] /
1 From 650a49bc65df6b0e0051a8f62d7c22d95a8f350d Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Wed, 18 May 2022 15:55:07 +0100
4 Subject: [PATCH 08/12] net: mtk_eth_soc: add fixme comment for state->speed
5 use
6
7 Add a fixme comment for the last remaining incorrect usage of
8 state->speed in the mac_config() method, which is strangely in a code
9 path which is only run when the PHY interface mode changes.
10
11 This means if we are in RGMII mode, changes in state->speed will not
12 cause the INTF_MODE, TRGMII_RCK_CTRL and TRGMII_TCK_CTRL registers to
13 be set according to the speed, nor will the TRGPLL clock be set to the
14 correct value.
15
16 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
17 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
18 ---
19 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
20 1 file changed, 8 insertions(+)
21
22 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
23 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
24 @@ -374,6 +374,14 @@ static void mtk_mac_config(struct phylin
25 state->interface))
26 goto err_phy;
27 } else {
28 + /* FIXME: this is incorrect. Not only does it
29 + * use state->speed (which is not guaranteed
30 + * to be correct) but it also makes use of it
31 + * in a code path that will only be reachable
32 + * when the PHY interface mode changes, not
33 + * when the speed changes. Consequently, RGMII
34 + * is probably broken.
35 + */
36 mtk_gmac0_rgmii_adjust(mac->hw,
37 state->interface,
38 state->speed);