From: Jerome Brunet <jbrunet@baylibre.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.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>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Richard Cochran <richardcochran@gmail.com>,
Maxime Ripard <mripard@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Andre Przywara <andre.przywara@arm.com>
Subject: Re: [PATCH net-next v2 2/2] net: stmmac: Add support for Allwinner A733 GMAC210
Date: Thu, 10 Sep 2026 15:06:51 +0200 [thread overview]
Message-ID: <1jqzj16ys4.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <44d7840d-0cde-4022-937c-4c630398c45d@bootlin.com>
On jeu. 10 sept. 2026 at 12:59, Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:
> Hi Jerome,
>
> On 9/10/26 12:25, Jerome Brunet wrote:
>> The A733 GMAC210 is a DesignWare MAC 5.20 using an Allwinner glue close to
>> the A523 GMAC200 already supported by this driver, with the following
>> differences to handle:
>>
>> * The glue configuration registers are a dedicated MMIO region of the
>> controller instead of a syscon register. This new register region
>> appears to be in the reset domain of stmmac's main reset. This requires
>> the glue driver to handle the reset rather than letting stmmac deal with
>> it.
>> * The TX clock delay value is 5 bits wide, split over 2 register fields,
>> allowing delays up to 3100ps.
>> * The DMA channels have their own interrupt lines, so the per-DMA-channel
>> interrupt mode is enabled, as the vendor SDK does.
>> * TX LPI clock gating is supported, as the vendor SDK indicates. Follow
>> the PHY capability with STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP rather than
>> forcing it on with the deprecated 'snps,en-tx-lpi-clockgating' DT
>> property.
>>
>> Unlike the A523, both GMAC instances are supported by the same driver.
>>
>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>
> [...]
>
>> +
>> +static struct regmap *sun60i_gmac210_get_regmap(struct platform_device *pdev,
>> + struct plat_stmmacenet_data *plat)
>> +{
>> + struct device *dev = &pdev->dev;
>> + void __iomem *base;
>> + int ret;
>> +
>> + base = devm_platform_ioremap_resource(pdev, 1);
>> + if (IS_ERR(base)) {
>> + dev_err_probe(dev, PTR_ERR(base), "unable to get glue memory region\n");
>> + return ERR_CAST(base);
>> + }
>> +
>> + if (!plat->stmmac_rst || !plat->stmmac_ahb_rst) {
>
> Why check stmmac_ahb_rst, but not do anything with it ?
Not strictly required, it was cheap to do and catch mis-configuration
since the stmmac treat them as optional. I'll drop it
>
>> + dev_err(dev, "missing required reset controls\n");
>> + return ERR_PTR(-EINVAL);
>> + }
>> +
>> + /*
>> + * The configuration registers are inside the controller
>> + * reset domain, so the reset must happen before any write to them
>> + * and should not be done again by stmmac or the configuration will
>> + * be lost.
>> + */
>> + ret = reset_control_assert(plat->stmmac_rst);
>> + if (!ret)
>> + ret = reset_control_deassert(plat->stmmac_rst);
>> +
>> + if (ret) {
>> + dev_err_probe(dev, ret, "device reset failed\n");
>> + return ERR_PTR(ret);
>> + }
>> +
>> + ret = devm_add_action_or_reset(dev, sun60i_gmac210_reset_assert,
>> + plat->stmmac_rst);
>> + if (ret)
>> + return ERR_PTR(ret);
>> +
>> + plat->stmmac_rst = NULL;
>> +
>> + return devm_regmap_init_mmio(&pdev->dev, base, &sun60i_a733_regmap_cfg);
>
> I wonder if this is the first glue to face this...
>
> If you need further setup to be done after reset has been deasserted, I suggest
> adding a dedicated callback in plat_stmmacenet_data, instead of doing this behind
> the generic code's back.
>
> maybe something like "post_reset_init()", something like that ?
>
I'll check in this direction.
The idea was to do things behind anything's back, more to handle the
specifities of this SoC without polluting the rest. The timing seemed a
bit sensitve. For example touching the other reset in here broke the
link for some reason (recognize as GMII instead of RGMII)
> the ->mac_setup already runs after reset, but isn't really for this type of usecase.
>
> For readability of the patch, maybe you should split this patch to first do the
> a523 rework, then add a733 support.
ok
>
> Thanks !
>
> Maxime
--
Jerome
prev parent reply other threads:[~2026-09-10 13:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 10:25 [PATCH net-next v2 0/2] net: stmmac: Add support for Allwinner A733 GMAC210 Jerome Brunet
2026-09-10 10:25 ` [PATCH net-next v2 1/2] dt-bindings: net: sun8i-emac: Add A733 GMAC210 compatible Jerome Brunet
2026-09-10 10:25 ` [PATCH net-next v2 2/2] net: stmmac: Add support for Allwinner A733 GMAC210 Jerome Brunet
2026-09-10 10:59 ` Maxime Chevallier
2026-09-10 13:06 ` Jerome Brunet [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=1jqzj16ys4.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andre.przywara@arm.com \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.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=linux-sunxi@lists.linux.dev \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mripard@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
/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