linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: "Marek Behún" <kabel@kernel.org>
Cc: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: [PATCH RFC net-next 08/12] net: mtk_eth_soc: add fixme comment for state->speed use
Date: Wed, 06 Apr 2022 15:35:35 +0100	[thread overview]
Message-ID: <E1nc6kx-004ikJ-CY@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Yk2k9D40QojsRhoo@shell.armlinux.org.uk>

Add a fixme comment for the last remaining incorrect usage of
state->speed in the mac_config() method, which is strangely in a code
path which is only run when the PHY interface mode changes.

This means if we are in RGMII mode, changes in state->speed will not
cause the INTF_MODE, TRGMII_RCK_CTRL and TRGMII_TCK_CTRL registers to
be set according to the speed, nor will the TRGPLL clock be set to the
correct value.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a16f02ed921a..b605a823dcd4 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -324,6 +324,14 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
 							      state->interface))
 					goto err_phy;
 			} else {
+				/* FIXME: this is incorrect. Not only does it
+				 * use state->speed (which is not guaranteed
+				 * to be correct) but it also makes use of it
+				 * in a code path that will only be reachable
+				 * when the PHY interface mode changes, not
+				 * when the speed changes. Consequently, RGMII
+				 * is probably broken.
+				 */
 				mtk_gmac0_rgmii_adjust(mac->hw,
 						       state->interface,
 						       state->speed);
-- 
2.30.2


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  parent reply	other threads:[~2022-04-06 14:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 14:34 [PATCH RFC 00/12] mtk_eth_soc phylink updates Russell King (Oracle)
2022-04-06 14:34 ` [PATCH RFC net-next 01/12] net: mtk_eth_soc: remove unused mac->mode Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 02/12] net: mtk_eth_soc: remove unused sgmii flags Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 03/12] net: mtk_eth_soc: add mask and update PCS speed definitions Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 04/12] net: mtk_eth_soc: correct 802.3z speed setting Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 05/12] net: mtk_eth_soc: correct 802.3z duplex setting Russell King
2022-04-06 14:35 ` [PATCH RFC net-next 06/12] net: mtk_eth_soc: stop passing phylink state to sgmii setup Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 07/12] net: mtk_eth_soc: provide mtk_sgmii_config() Russell King (Oracle)
2022-04-06 14:35 ` Russell King (Oracle) [this message]
2022-04-06 14:35 ` [PATCH RFC net-next 09/12] net: mtk_eth_soc: move MAC_MCR setting to mac_finish() Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 10/12] net: mtk_eth_soc: move restoration of SYSCFG0 " Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 11/12] net: mtk_eth_soc: convert code structure to suit split PCS support Russell King (Oracle)
2022-04-06 14:35 ` [PATCH RFC net-next 12/12] net: mtk_eth_soc: partially convert to phylink_pcs Russell King (Oracle)
2022-04-11 13:30 ` [PATCH RFC 00/12] mtk_eth_soc phylink updates Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1nc6kx-004ikJ-CY@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=john@phrozen.org \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).