[PATCH v4 3/3] net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family
Joey Lu
a0987203069 at gmail.com
Fri Dec 6 14:17:48 AEDT 2024
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20241206/4c7a807a/attachment-0001.htm>
More information about the openbmc
mailing list