From: Jakub Kicinski <kuba@kernel.org>
To: bartosz.golaszewski@oss.qualcomm.com
Cc: Jakub Kicinski <kuba@kernel.org>,
jbrunet@baylibre.com, linux-stm32@st-md-mailman.stormreply.com,
devicetree@vger.kernel.org, neil.armstrong@linaro.org,
unicorn_wang@outlook.com, andrew+netdev@lunn.ch,
vkoul@kernel.org, peppe.cavallaro@st.com,
jernej.skrabec@gmail.com, samin.guo@starfivetech.com,
david.wu@rock-chips.com, christophe.roullier@foss.st.com,
linux-amlogic@lists.infradead.org,
linux-riscv@lists.infradead.org,
martin.blumenstingl@googlemail.com, robh@kernel.org,
linux-imx@nxp.com, andersson@kernel.org, joabreu@synopsys.com,
s32@nxp.com, swathi.ks@samsung.com, konradybcio@kernel.org,
krzk+dt@kernel.org, keguang.zhang@gmail.com,
kernel@pengutronix.de, romain.gantois@bootlin.com,
brgl@kernel.org, sophgo@lists.linux.dev, netdev@vger.kernel.org,
xiaoning.wang@nxp.com, imx@lists.linux.dev,
dfustini@tenstorrent.com, davem@davemloft.net,
jan.petrous@oss.nxp.com, magnus.damm@gmail.com,
lizhi2@eswincomputing.com, linux-sunxi@lists.linux.dev,
linux-mips@vger.kernel.org, vineetha.g.jaya.kumaran@intel.com,
matthew.gerlach@altera.com, wefu@redhat.com,
geert+renesas@glider.be, edumazet@google.com,
linux-kernel@vger.kernel.org, Frank.Li@nxp.com,
conor+dt@kernel.org, mripard@kernel.org,
linux-arm-kernel@lists.infradead.org, kernel@esmil.dk,
linux-renesas-soc@vger.kernel.org, alexandre.torgue@foss.st.com,
inochiama@gmail.com, minda.chen@starfivetech.com,
s.hauer@pengutronix.de, nobuhiro.iwamatsu.x90@mail.toshiba,
prabhakar.mahadev-lad.rj@bp.renesas.com, fustini@kernel.org,
richardcochran@gmail.com, pabeni@redhat.com, shawnguo@kernel.org,
wens@kernel.org, heiko@sntech.de, guoren@kernel.org,
weishangjuan@eswincomputing.com, mcoquelin.stm32@gmail.com,
khilman@baylibre.com, festevam@gmail.com,
liangshuang@eswincomputing.com,
krzysztof.kozlowski@oss.qualcomm.com,
linux-arm-msm@vger.kernel.org, konrad.dybcio@oss.qualcomm.com,
linux-rockchip@lists.infradead.org, samuel@sholland.org
Subject: Re: [RESEND,net-next,v6,7/7] net: stmmac: qcom-ethqos: add support for sa8255p
Date: Mon, 12 Jan 2026 10:00:05 -0800 [thread overview]
Message-ID: <20260112180005.4144056-1-kuba@kernel.org> (raw)
In-Reply-To: <20260112-qcom-sa8255p-emac-v6-7-86a3d4b2ad83@oss.qualcomm.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least pausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: stmmac: qcom-ethqos: add support for sa8255p
This commit adds support for the SA8255P SoC which uses power domains
managed via SCMI firmware, rather than the traditional clock/phy-based
power management used by other variants.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 8ba57bba3f2e..54f8ef3cfd7d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
[ ... ]
> +static void ethqos_disable_serdes(void *data)
> +{
> + struct qcom_ethqos *ethqos = data;
> +
> + qcom_ethqos_domain_on(ethqos, ETHQOS_PD_SERDES);
^^
Should this be qcom_ethqos_domain_off() instead of qcom_ethqos_domain_on()?
This function is registered as a cleanup action via devm_add_action_or_reset()
to undo the qcom_ethqos_domain_on(ETHQOS_PD_SERDES) call during probe. Using
domain_on here would increment the PM runtime usage counter again rather than
decrementing it. The serdes power domain would never be properly turned off
on driver removal.
Compare with qcom_ethqos_pd_serdes_powerdown() which correctly uses
qcom_ethqos_domain_off().
> +}
[ ... ]
> +static int qcom_ethqos_pd_init(struct device *dev, void *priv)
> +{
> + struct qcom_ethqos *ethqos = priv;
> + int ret;
> +
> + /*
> + * Enable functional clock to prevent DMA reset after timeout due
> + * to no PHY clock being enabled after the hardware block has been
> + * power cycled. The actual configuration will be adjusted once
> + * ethqos_fix_mac_speed() is called.
> + */
> + ethqos_set_func_clk_en(ethqos);
> +
> + ret = qcom_ethqos_domain_on(ethqos, ETHQOS_PD_CORE);
> + if (ret)
> + return ret;
> +
> + ret = qcom_ethqos_domain_on(ethqos, ETHQOS_PD_MDIO);
> + if (ret) {
> + qcom_ethqos_domain_off(ethqos, ETHQOS_PD_CORE);
> + return ret;
> + }
> +
> + return 0;
> +}
[ ... ]
> if (pm_data && pm_data->use_domains) {
> ethqos->set_serdes_speed = ethqos_set_serdes_speed_pd;
>
> + ret = devm_pm_domain_attach_list(dev, &pm_data->pd,
> + ðqos->pd.pd_list);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "Failed to attach power domains\n");
> +
> + plat_dat->clks_config = ethqos_pd_clks_config;
> + plat_dat->serdes_powerup = qcom_ethqos_pd_serdes_powerup;
> + plat_dat->serdes_powerdown = qcom_ethqos_pd_serdes_powerdown;
> + plat_dat->exit = qcom_ethqos_pd_exit;
> + plat_dat->init = qcom_ethqos_pd_init;
^^^^^^^^^^^^^^^^^^^^^^^
> + plat_dat->clk_ptp_rate = pm_data->clk_ptp_rate;
> +
> + ret = qcom_ethqos_pd_init(dev, ethqos);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is qcom_ethqos_pd_init() being called twice?
It is assigned to plat_dat->init above, and then called directly here. Later,
devm_stmmac_pltfr_probe() -> stmmac_pltfr_probe() -> stmmac_dvr_probe() will
call plat_dat->init() again (see stmmac_main.c stmmac_dvr_probe function).
Each call to qcom_ethqos_pd_init() increments the PM runtime usage counter
for ETHQOS_PD_CORE and ETHQOS_PD_MDIO via pm_runtime_resume_and_get(). With
two calls, the refcount would be 2 for each domain, but qcom_ethqos_pd_exit()
only decrements once per domain. This would leave the power domains with a
dangling reference.
Perhaps the direct call to qcom_ethqos_pd_init() here should be removed, and
let stmmac_dvr_probe() invoke it through the plat_dat->init callback?
> + if (ret)
> + return ret;
[ ... ]
prev parent reply other threads:[~2026-01-12 18:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 10:15 [PATCH RESEND net-next v6 0/7] net: stmmac: qcom-ethqos: add support for SCMI power domains Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 1/7] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems Bartosz Golaszewski
2026-01-12 11:48 ` Lad, Prabhakar
2026-01-12 10:15 ` [PATCH RESEND net-next v6 2/7] net: stmmac: qcom-ethqos: use generic device properties Bartosz Golaszewski
2026-01-12 13:44 ` Andrew Lunn
2026-01-13 12:36 ` Bartosz Golaszewski
2026-01-13 22:05 ` Andrew Lunn
2026-01-14 15:51 ` Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 3/7] net: stmmac: qcom-ethqos: wrap emac driver data in additional structure Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 4/7] net: stmmac: qcom-ethqos: split power management fields into a separate structure Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 5/7] net: stmmac: qcom-ethqos: split power management context into a separate struct Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 6/7] net: stmmac: qcom-ethqos: define a callback for setting the serdes speed Bartosz Golaszewski
2026-01-12 10:15 ` [PATCH RESEND net-next v6 7/7] net: stmmac: qcom-ethqos: add support for sa8255p Bartosz Golaszewski
2026-01-12 13:54 ` Andrew Lunn
2026-01-13 12:38 ` Bartosz Golaszewski
2026-01-12 18:00 ` Jakub Kicinski [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=20260112180005.4144056-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=christophe.roullier@foss.st.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=david.wu@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dfustini@tenstorrent.com \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=fustini@kernel.org \
--cc=geert+renesas@glider.be \
--cc=guoren@kernel.org \
--cc=heiko@sntech.de \
--cc=imx@lists.linux.dev \
--cc=inochiama@gmail.com \
--cc=jan.petrous@oss.nxp.com \
--cc=jbrunet@baylibre.com \
--cc=jernej.skrabec@gmail.com \
--cc=joabreu@synopsys.com \
--cc=keguang.zhang@gmail.com \
--cc=kernel@esmil.dk \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=liangshuang@eswincomputing.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=lizhi2@eswincomputing.com \
--cc=magnus.damm@gmail.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=matthew.gerlach@altera.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=minda.chen@starfivetech.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=nobuhiro.iwamatsu.x90@mail.toshiba \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=romain.gantois@bootlin.com \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=samin.guo@starfivetech.com \
--cc=samuel@sholland.org \
--cc=shawnguo@kernel.org \
--cc=sophgo@lists.linux.dev \
--cc=swathi.ks@samsung.com \
--cc=unicorn_wang@outlook.com \
--cc=vineetha.g.jaya.kumaran@intel.com \
--cc=vkoul@kernel.org \
--cc=wefu@redhat.com \
--cc=weishangjuan@eswincomputing.com \
--cc=wens@kernel.org \
--cc=xiaoning.wang@nxp.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