mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Jia Wang <wangjia@ultrarisc.com>
Cc: Andrew Lunn <andrew@lunn.ch>, 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>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 3/3] net: stmmac: Add UltraRISC DP1000 GMAC support
Date: Mon, 7 Sep 2026 09:28:51 +0200	[thread overview]
Message-ID: <248c1a07-7a5c-44dc-a73e-f95a69bb4161@bootlin.com> (raw)
In-Reply-To: <178876008871.2542659.8460758662538260209.b4-reply@b4>

Hi,

On 9/7/26 07:48, Jia Wang wrote:
> On 2026-09-04 14:01 +0800, Jia Wang wrote:
>> On 2026-09-03 14:30 +0200, Maxime Chevallier wrote:
>>>
>>>
>>> On 9/3/26 14:10, Andrew Lunn wrote:
>>>>>> This looks to be 90% identical to dwmac-sophgo.c.
>>>>>>
>>>>>> Do you expect any further changes to this driver? Is everything
>>>>>> supported? Are there more clocks? A GPIO for WoL?
>>>>>>
>>>>>> I'm just wondering if the common code should be pulled out, or even
>>>>>> dwmac-sophgo.c made generic so it can handle all plain boring devices
>>>>>> which have RGMII delays and not a lot else.
>>>>>>
>>>>>
>>>>> The probe boilerplate is indeed largely similar because both drivers
>>>>> use the common stmmac platform helpers. However, their platform-specific
>>>>> requirements differ: Sophgo requires additional TX clock handling and
>>>>> other configuration, while DP1000 requires fixed TX and RX delay
>>>>> handling. ACPI support under development is also intended to use the
>>>>> UltraRISC glue driver.
>>>>
>>>> ACPI is going to be fun, since nobody does ACPI networking.
>>>>
>>>> But how big is the change to the glue driver? I expect the change will
>>>> be minor, a call to devm_stmmac_probe_config_acpi(), in addition to
>>>> devm_stmmac_probe_config_dt(). Anything else?
>>>
>>> I agree that if ACPI support is added, let's try to make it part of the
>>> core.
>>>
>>
>> The ACPI support is still under development, but the current prototype
>> adds ACPI device matching and ACPI-specific platform-data setup. Some
>> common stmmac changes are also needed for ACPI-described platform
>> resources and MDIO.
>>
>>>>
>>>> One problem the stmmac driver has is cut/paste glue driver
>>>> development. The same code is repeated again and again. Russell King
>>>> spent a lot of time and effort trying to reduce the duplication. So we
>>>> should not be adding more duplicated code unless it is actually
>>>> required.
>>>
>>> It seems to me that all the RGMII handling could be made much more generic,
>>> as this is commong pattern in glue drivers :
>>>
>>> dwmac-sophgo has the "has_internal_rx_delay" field, and dwmac-eic7700 has
>>> both has_internal_[r|t]x_delay.
>>>
>>> With this third one, it makes sense to start sharing that logic across
>>> glues.
>>>
>>
>> I agree. DP1000 is another user of this pattern, with fixed internal
>> delays on both the TX and RX paths. I will look at moving this handling
>> into the common stmmac platform code, leaving each glue driver to
>> describe its internal delay capabilities.
>>
> 
> After looking further into the implementation, I see two possible
> approaches:
> 
> 1. Keep a minimal UltraRISC glue driver that only describes the fixed TX
> and RX delay capabilities, while the common stmmac code handles the PHY
> mode adjustment.
> 
> 2. Store these capabilities as compatible-specific match data in
> dwmac-generic and remove the UltraRISC glue driver entirely.
Let's go with 1 for now I'd say. UtraRISC will be the only one that's basically
an empty glue calling core code (maybe you have some plat->flags to passs ?).

If we manage to simplify even further (e.g. tx clock handling for exmaple), we could
also deal with dwmac-sophgo the same way. We could then consider something like
dwmac-simple.c , keeping dwmac-generic.c for the raw dwmac IPs.

Maxime

  reply	other threads:[~2026-09-07  7:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  1:27 [PATCH net-next 0/3] " Jia Wang
2026-09-01  1:27 ` [PATCH net-next 1/3] dt-bindings: net: snps,dwmac: Add UltraRISC DP1000 compatible Jia Wang
2026-09-01 17:46   ` Conor Dooley
2026-09-02  9:35     ` Jia Wang
2026-09-01  1:27 ` [PATCH net-next 2/3] dt-bindings: net: Add UltraRISC DP1000 GMAC Jia Wang
2026-09-01 17:47   ` Conor Dooley
2026-09-01  1:27 ` [PATCH net-next 3/3] net: stmmac: Add UltraRISC DP1000 GMAC support Jia Wang
2026-09-01  7:29   ` Maxime Chevallier
2026-09-01  8:32     ` Jia Wang
2026-09-01  9:05       ` Maxime Chevallier
2026-09-01 13:48   ` Andrew Lunn
2026-09-03  7:47     ` Jia Wang
2026-09-03 12:10       ` Andrew Lunn
2026-09-03 12:30         ` Maxime Chevallier
2026-09-04  6:01           ` Jia Wang
2026-09-07  5:48             ` Jia Wang
2026-09-07  7:28               ` Maxime Chevallier [this message]
2026-09-07  7:36                 ` Jia Wang

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=248c1a07-7a5c-44dc-a73e-f95a69bb4161@bootlin.com \
    --to=maxime.chevallier@bootlin.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=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=robh@kernel.org \
    --cc=wangjia@ultrarisc.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

all inboxes | Powered by JetHome®