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
WARNING: multiple messages have this Message-ID (diff)
From: "René van Dorst" <opensource-91nzXlUTePbQT0dZR+AlfA@public.gmane.org>
To: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Florian Fainelli
<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"David S . Miller"
<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Matthias Brugger
<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Vivien Didelot
<vivien.didelot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "René van Dorst"
<opensource-91nzXlUTePbQT0dZR+AlfA@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org
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-91nzXlUTePbQT0dZR+AlfA@public.gmane.org>
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
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2019-06-16 18:30 UTC|newest]
Thread overview: 15+ 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 ` 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
2019-06-16 18:20 ` René van Dorst [this message]
2019-06-16 18:20 ` [PATCH net-next 2/2] net: dsa: mt7530: " René van Dorst
2019-06-17 14:02 ` [PATCH net-next 0/2] net: mediatek: " 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 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.