From: "René van Dorst" <opensource@vdorst.com>
To: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>,
Landen Chao <Landen.Chao@mediatek.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
sander@svanheule.net, tsbogend@alpha.franken.de,
john@phrozen.org, Frank Wunderlich <frank-w@public-files.de>
Subject: Re: [PATCH net,v2] net: dsa: mt7530: setup core clock even in TRGMII mode
Date: Fri, 19 Mar 2021 10:25:55 +0000 [thread overview]
Message-ID: <20210319102555.Horde.jeA-oYm4tfkVqKj-gnqxRoo@www.vdorst.com> (raw)
In-Reply-To: <20210312080703.63281-1-ilya.lipnitskiy@gmail.com>
Quoting Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>:
> A recent change to MIPS ralink reset logic made it so mt7530 actually
> resets the switch on platforms such as mt7621 (where bit 2 is the reset
> line for the switch). That exposed an issue where the switch would not
> function properly in TRGMII mode after a reset.
>
> Reconfigure core clock in TRGMII mode to fix the issue.
>
> Tested on Ubiquiti ER-X (MT7621) with TRGMII mode enabled.
>
> Fixes: 3f9ef7785a9c ("MIPS: ralink: manage low reset lines")
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> ---
> drivers/net/dsa/mt7530.c | 52 +++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index f06f5fa2f898..9871d7cff93a 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -436,34 +436,32 @@ mt7530_pad_clk_setup(struct dsa_switch *ds,
> phy_interface_t interface)
> TD_DM_DRVP(8) | TD_DM_DRVN(8));
>
> /* Setup core clock for MT7530 */
> - if (!trgint) {
> - /* Disable MT7530 core clock */
> - core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
> -
> - /* Disable PLL, since phy_device has not yet been created
> - * provided for phy_[read,write]_mmd_indirect is called, we
> - * provide our own core_write_mmd_indirect to complete this
> - * function.
> - */
> - core_write_mmd_indirect(priv,
> - CORE_GSWPLL_GRP1,
> - MDIO_MMD_VEND2,
> - 0);
> -
> - /* Set core clock into 500Mhz */
> - core_write(priv, CORE_GSWPLL_GRP2,
> - RG_GSWPLL_POSDIV_500M(1) |
> - RG_GSWPLL_FBKDIV_500M(25));
> + /* Disable MT7530 core clock */
> + core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
>
> - /* Enable PLL */
> - core_write(priv, CORE_GSWPLL_GRP1,
> - RG_GSWPLL_EN_PRE |
> - RG_GSWPLL_POSDIV_200M(2) |
> - RG_GSWPLL_FBKDIV_200M(32));
> -
> - /* Enable MT7530 core clock */
> - core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
> - }
> + /* Disable PLL, since phy_device has not yet been created
> + * provided for phy_[read,write]_mmd_indirect is called, we
> + * provide our own core_write_mmd_indirect to complete this
> + * function.
> + */
> + core_write_mmd_indirect(priv,
> + CORE_GSWPLL_GRP1,
> + MDIO_MMD_VEND2,
> + 0);
> +
> + /* Set core clock into 500Mhz */
> + core_write(priv, CORE_GSWPLL_GRP2,
> + RG_GSWPLL_POSDIV_500M(1) |
> + RG_GSWPLL_FBKDIV_500M(25));
> +
> + /* Enable PLL */
> + core_write(priv, CORE_GSWPLL_GRP1,
> + RG_GSWPLL_EN_PRE |
> + RG_GSWPLL_POSDIV_200M(2) |
> + RG_GSWPLL_FBKDIV_200M(32));
> +
> + /* Enable MT7530 core clock */
> + core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
>
> /* Setup the MT7530 TRGMII Tx Clock */
> core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
> --
> 2.30.2
Hi Ilya,
Thanks for fixing this issue.
I remember that Frank also had an issue with TRGMII on his MT7623 ARM board.
I never found why it did not work but this may be also fix his issue
on the MT7623 devices.
Added Frank to CC.
Tested on Ubiquiti ER-X-SFP (MT7621) with and without TRGMII mode enabled.
Tested-by: René van Dorst <opensource@vdorst.com>
Greats,
René
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-19 10:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 1:21 [PATCH net] net: dsa: mt7530: setup core clock even in TRGMII mode Ilya Lipnitskiy
2021-03-11 3:21 ` Florian Fainelli
2021-03-12 8:07 ` [PATCH net, v2] " Ilya Lipnitskiy
2021-03-19 10:25 ` René van Dorst [this message]
2021-03-19 12:47 ` Aw: Re: [PATCH net,v2] " Frank Wunderlich
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=20210319102555.Horde.jeA-oYm4tfkVqKj-gnqxRoo@www.vdorst.com \
--to=opensource@vdorst.com \
--cc=Landen.Chao@mediatek.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=frank-w@public-files.de \
--cc=ilya.lipnitskiy@gmail.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=sander@svanheule.net \
--cc=sean.wang@mediatek.com \
--cc=tsbogend@alpha.franken.de \
--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).