From: "René van Dorst" <opensource@vdorst.com>
To: Sean Wang <sean.wang@mediatek.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Matthias Brugger <matthias.bgg@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>
Cc: netdev@vger.kernel.org, john@phrozen.org,
linux-mediatek@lists.infradead.org, linux-mips@vger.kernel.org,
"René van Dorst" <opensource@vdorst.com>
Subject: [PATCH net-next 2/2] net: dsa: mt7530: Add MT7621 TRGMII mode support
Date: Sun, 16 Jun 2019 20:20:10 +0200 [thread overview]
Message-ID: <20190616182010.18778-3-opensource@vdorst.com> (raw)
In-Reply-To: <20190616182010.18778-1-opensource@vdorst.com>
MT7621 internal MT7530 switch also supports TRGMII mode.
TRGMII speed is 1200MBit.
Signed-off-by: René van Dorst <opensource@vdorst.com>
---
drivers/net/dsa/mt7530.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index c7d352da5448..88de4e880417 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -435,11 +435,20 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode)
trgint = 0;
ncpo1 = 0x0c80;
ssc_delta = 0x87;
+
+ /* Port 6 delay settings RGMII central align */
+ mt7530_rmw(priv, MT7530_TRGMII_TXCTRL, BIT(30) | BIT(28), 0);
+ mt7530_write(priv, MT7530_TRGMII_TCK_CTRL, 0x0855);
break;
case PHY_INTERFACE_MODE_TRGMII:
trgint = 1;
- ncpo1 = 0x1400;
+ /* PLL frequency: MT7621 150MHz, other 162.5MHz */
+ ncpo1 = (priv->id == ID_MT7621 ? 0x0780 : 0x1400);
ssc_delta = 0x57;
+
+ /* Port 6 delay settings TRGMII central align */
+ mt7530_rmw(priv, MT7530_TRGMII_TXCTRL, 0, BIT(30));
+ mt7530_write(priv, MT7530_TRGMII_TCK_CTRL, 0x0055);
break;
default:
dev_err(priv->dev, "xMII mode %d not supported\n", mode);
@@ -507,7 +516,9 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode)
mt7530_rmw(priv, MT7530_TRGMII_RD(i),
RD_TAP_MASK, RD_TAP(16));
else
- mt7623_trgmii_set(priv, GSW_INTF_MODE, INTF_MODE_TRGMII);
+ if (priv->id != ID_MT7621)
+ mt7623_trgmii_set(priv, GSW_INTF_MODE,
+ INTF_MODE_TRGMII);
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-06-16 18:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-16 18:20 [PATCH net-next 0/2] net: mediatek: Add MT7621 TRGMII mode support René van Dorst
2019-06-16 18:20 ` [PATCH net-next 1/2] net: ethernet: " René van Dorst
2019-06-16 18:20 ` René van Dorst [this message]
2019-06-17 14:02 ` [PATCH net-next 0/2] net: " Andrew Lunn
2019-06-17 21:33 ` René van Dorst
2019-06-17 21:44 ` Andrew Lunn
2019-06-17 23:20 ` René van Dorst
2019-06-18 1:53 ` Andrew Lunn
2019-06-18 2:21 ` Florian Fainelli
2019-06-18 11:46 ` René van Dorst
2019-06-17 22:19 ` Florian Fainelli
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=20190616182010.18778-3-opensource@vdorst.com \
--to=opensource@vdorst.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=john@phrozen.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sean.wang@mediatek.com \
--cc=vivien.didelot@gmail.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).