From: David Woodhouse <dwmw2@infradead.org>
To: davem@davemloft.net
Cc: "Frank Wunderlich" <frank-w@public-files.de>,
"Sean Wang" <sean.wang@mediatek.com>,
andrew@lunn.ch, f.fainelli@gmail.com,
vivien.didelot@savoirfairelinux.com, Mark-MC.Lee@mediatek.com,
john@phrozen.org, Landen.Chao@mediatek.com,
steven.liu@mediatek.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
"René van Dorst" <opensource@vdorst.com>,
linux-mediatek <linux-mediatek@lists.infradead.org>
Subject: [PATCH] net: ethernet: mtk_eth_soc: Always call mtk_gmac0_rgmii_adjust() for mt7623
Date: Thu, 23 Jul 2020 20:07:10 +0100 [thread overview]
Message-ID: <52f10e30f62b8521fd83525a03ecff94b72d509b.camel@infradead.org> (raw)
In-Reply-To: <trinity-fb0cdf15-dfcf-4d60-9144-87d8fbfad5ba-1586179542451@3c-app-gmx-bap62>
[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]
From: René van Dorst <opensource@vdorst.com>
Modify mtk_gmac0_rgmii_adjust() so it can always be called.
mtk_gmac0_rgmii_adjust() sets-up the TRGMII clocks.
Signed-off-by: René van Dorst <opensource@vdorst.com>
Signed-off-By: David Woodhouse <dwmw2@infradead.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
On Mon, 2020-04-06 at 15:25 +0200, Frank Wunderlich wrote:
> have tested these 2 and additional rene's 3rd Patch on my tree [1]
> on BPi-R2, no problem with trgmii yet (multiple power-cycle+reboots).
> I had issues with current 5.6.0 version, so imho these should go
> also into 5.6.y
Here's that third patch of which Frank speaks. I don't see it submitted
yet, and I found I needed it on 5.4 too for the Ethernet to be
functional.
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index b5408c5b954a..f89f225ab144 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -171,11 +171,21 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth,
return 0;
}
-static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, int speed)
+static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth,
+ phy_interface_t interface, int speed)
{
u32 val;
int ret;
+ if (interface == PHY_INTERFACE_MODE_TRGMII) {
+ mtk_w32(eth, TRGMII_MODE, INTF_MODE);
+ val = 500000000;
+ ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val);
+ if (ret)
+ dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret);
+ return;
+ }
+
val = (speed == SPEED_1000) ?
INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100;
mtk_w32(eth, val, INTF_MODE);
@@ -262,10 +272,9 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
state->interface))
goto err_phy;
} else {
- if (state->interface !=
- PHY_INTERFACE_MODE_TRGMII)
- mtk_gmac0_rgmii_adjust(mac->hw,
- state->speed);
+ mtk_gmac0_rgmii_adjust(mac->hw,
+ state->interface,
+ state->speed);
/* mt7623_pad_clk_setup */
for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
next prev parent reply other threads:[~2020-07-23 19:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-05 21:42 [PATCH v2 net 1/2] net: dsa: mt7530: move mt7623 settings out off the mt7530 sean.wang
2020-04-05 21:42 ` [PATCH v2 net 2/2] net: ethernet: mediatek: " sean.wang
2020-04-08 1:29 ` David Miller
2020-04-06 13:25 ` Aw: [PATCH v2 net 1/2] net: dsa: mt7530: " Frank Wunderlich
2020-07-23 19:07 ` David Woodhouse [this message]
2020-07-29 0:05 ` [PATCH] net: ethernet: mtk_eth_soc: Always call mtk_gmac0_rgmii_adjust() for mt7623 David Miller
2020-07-29 7:30 ` Aw: " Frank Wunderlich
2020-04-08 1:29 ` [PATCH v2 net 1/2] net: dsa: mt7530: move mt7623 settings out off the mt7530 David Miller
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=52f10e30f62b8521fd83525a03ecff94b72d509b.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=Landen.Chao@mediatek.com \
--cc=Mark-MC.Lee@mediatek.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=frank-w@public-files.de \
--cc=john@phrozen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=opensource@vdorst.com \
--cc=sean.wang@mediatek.com \
--cc=steven.liu@mediatek.com \
--cc=vivien.didelot@savoirfairelinux.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).