All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joey Lu <a0987203069@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: ychuang3@nuvoton.com, edumazet@google.com, schung@nuvoton.com,
	yclu4@nuvoton.com, linux-stm32@st-md-mailman.stormreply.com,
	robh@kernel.org, openbmc@lists.ozlabs.org, joabreu@synopsys.com,
	kuba@kernel.org, pabeni@redhat.com, devicetree@vger.kernel.org,
	conor+dt@kernel.org, richardcochran@gmail.com,
	alexandre.torgue@foss.st.com, peppe.cavallaro@st.com,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch,
	mcoquelin.stm32@gmail.com, krzk+dt@kernel.org,
	davem@davemloft.net
Subject: Re: [PATCH v4 3/3] net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family
Date: Fri, 6 Dec 2024 11:17:48 +0800	[thread overview]
Message-ID: <b571fcd4-fb76-4538-8e73-4fc98e455b14@gmail.com> (raw)
In-Reply-To: <ba09cea2-4cf7-4203-ae98-ea5d8413f69e@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 2215 bytes --]


Andrew Lunn 於 12/3/2024 10:58 PM 寫道:
> On Tue, Dec 03, 2024 at 05:12:24PM +0800, Joey Lu wrote:
>> Dear Andrew,
>>
>> You're correct. In the stmmac_hw_init function within stmmac_main.c, whether
>> pmt is true is determined by checking the pmt_remote_wake_up bit in the
>> hardware feature register. However, our hardware configuration only supports
>> magic packet and not remote wakeup, so it must be overwritten in the glue
>> driver.
> Please add a comment explaining this.
>
>
> I'm not sure why the original code doesn't include magic packet as part
>> of pmt.
>>
>> source code:
>>
>>          stmmac_hw_init() @net/ethernet/stmicro/stmmac/stmmac_main.c
>>
>>          priv->plat->enh_desc = priv->dma_cap.enh_desc;
>>          priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
>>                  !(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
>>          priv->hw->pmt = priv->plat->pmt;
>>
>> Or modify the condition as follows:
>>
>>          priv->plat->pmt = (priv->dma_cap.pmt_remote_wake_up || priv->
>> dma_cap.pmt_magic_frame) &&
>>                  !(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
> Are there other glue drivers which would benefit from this? It is hard
> for me to say if you hardware is odd, or if this should be a generic
> feature which other glue drivers would use.
>
> 	Andrew

After reviewing the Synopsys DWMAC databook, it turns out that RWK is 
actually optional.

I reviewed the usage of the PMT flag in the core driver. In 
|/stmmac_ethtool.c/|, within the |/stmmac_set_wol/| function, the driver 
supports two wake-up methods corresponding to |/pmt_remote_wake_up/| 
and/|pmt_magic_frame|/. When the hardware is configured for magic packet 
only, |device_can_wakeup()| returns not supported. However, magic packet 
is the more widely used option.

In |/stmmac_hw_init()/|, adding a condition to check |pmt_magic_frame| 
for PMT flag will not affect the existing glue layer drivers, regardless 
of whether they config only RWK or both RWK and MGK.

However, it is hard for me to decide whether to modify stmmac driver. 
Overwriting the PMT flag and leaving a comment is fine for me.

BR,

Joey

[-- Attachment #2: Type: text/html, Size: 3098 bytes --]

      reply	other threads:[~2024-12-08 22:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02  2:36 [PATCH v4 0/3] Add support for Nuvoton MA35D1 GMAC Joey Lu
2024-12-02  2:36 ` Joey Lu
2024-12-02  2:36 ` [PATCH v4 1/3] dt-bindings: net: nuvoton: Add schema for Nuvoton MA35 family GMAC Joey Lu
2024-12-02  2:36   ` Joey Lu
2024-12-04 14:27   ` Rob Herring
2024-12-04 14:27     ` Rob Herring
2024-12-06  3:19     ` Joey Lu
2024-12-06  3:19       ` Joey Lu
2024-12-02  2:36 ` [PATCH v4 2/3] arm64: dts: nuvoton: Add Ethernet nodes Joey Lu
2024-12-02  2:36   ` Joey Lu
2024-12-02  2:36 ` [PATCH v4 3/3] net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family Joey Lu
2024-12-02  2:36   ` Joey Lu
2024-12-03  1:43   ` Andrew Lunn
2024-12-03  1:43     ` Andrew Lunn
2024-12-03  9:12     ` Joey Lu
2024-12-03 14:58       ` Andrew Lunn
2024-12-03 14:58         ` Andrew Lunn
2024-12-06  3:17         ` Joey Lu [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=b571fcd4-fb76-4538-8e73-4fc98e455b14@gmail.com \
    --to=a0987203069@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=ychuang3@nuvoton.com \
    --cc=yclu4@nuvoton.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.