Netdev List
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Simon Horman <horms@kernel.org>
Cc: Drew Fustini <fustini@kernel.org>, Guo Ren <guoren@kernel.org>,
	Fu Wei <wefu@redhat.com>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Emil Renner Berthing <emil.renner.berthing@canonical.com>,
	Jisheng Zhang <jszhang@kernel.org>,
	nux-riscv@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: stmmac: thead: Enable TX clock before MAC initialization
Date: Sat, 9 Aug 2025 01:54:00 +0000	[thread overview]
Message-ID: <aJaqOHYU_eklj2BR@pie> (raw)
In-Reply-To: <20250808133900.GD1705@horms.kernel.org>

On Fri, Aug 08, 2025 at 02:39:00PM +0100, Simon Horman wrote:
> On Fri, Aug 08, 2025 at 10:34:48AM +0000, Yao Zi wrote:
> 
> ...
> 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
> > index f2946bea0bc2..50c1920bde6a 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
> > @@ -152,7 +152,7 @@ static int thead_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
> >  static int thead_dwmac_enable_clk(struct plat_stmmacenet_data *plat)
> >  {
> >  	struct thead_dwmac *dwmac = plat->bsp_priv;
> > -	u32 reg;
> > +	u32 reg, div;
> >  
> >  	switch (plat->mac_interface) {
> >  	case PHY_INTERFACE_MODE_MII:
> > @@ -164,6 +164,13 @@ static int thead_dwmac_enable_clk(struct plat_stmmacenet_data *plat)
> >  	case PHY_INTERFACE_MODE_RGMII_RXID:
> >  	case PHY_INTERFACE_MODE_RGMII_TXID:
> >  		/* use pll */
> > +		div = clk_get_rate(plat->stmmac_clk) / rgmii_clock(SPEED_1000);
> > +		reg = FIELD_PREP(GMAC_PLLCLK_DIV_EN, 1) |
> > +		      FIELD_PREP(GMAC_PLLCLK_DIV_NUM, div),
> 
> Sorry for not noticing this before sending my previous email.
> 
> Although the code above is correct. I think it would be clearer
> to use ';' rather than ',' at the end of the line above. Perhaps ','
> is a typo.(',' is next to ';' on my keyboard at least).

This is actually a typo that occasionally passes the compilation... yeah
thanks for catching it.

I'll add a comment about the requirement that PLLCLK_DIV_EN must be set
to zero before changing the rate, and fix this typo in v3 as well.

> Flagged by Clang 20.1.8 with -Wcomma

Best regards,
Yao Zi

> > +
> > +		writel(0, dwmac->apb_base + GMAC_PLLCLK_DIV);
> > +		writel(reg, dwmac->apb_base + GMAC_PLLCLK_DIV);
> > +
> >  		writel(GMAC_GTXCLK_SEL_PLL, dwmac->apb_base + GMAC_GTXCLK_SEL);
> >  		reg = GMAC_TX_CLK_EN | GMAC_TX_CLK_N_EN | GMAC_TX_CLK_OUT_EN |
> >  		      GMAC_RX_CLK_EN | GMAC_RX_CLK_N_EN;
> 
> -- 
> pw-bot: changes-requested.

      reply	other threads:[~2025-08-09  1:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 10:34 [PATCH net v2] net: stmmac: thead: Enable TX clock before MAC initialization Yao Zi
2025-08-08 13:35 ` Simon Horman
2025-08-08 13:39 ` Simon Horman
2025-08-09  1:54   ` Yao Zi [this message]

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=aJaqOHYU_eklj2BR@pie \
    --to=ziyao@disroot.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=emil.renner.berthing@canonical.com \
    --cc=fustini@kernel.org \
    --cc=guoren@kernel.org \
    --cc=horms@kernel.org \
    --cc=jszhang@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nux-riscv@lists.infradead.org \
    --cc=pabeni@redhat.com \
    --cc=wefu@redhat.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