From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: jan.petrous@oss.nxp.com
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vinod Koul <vkoul@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Emil Renner Berthing <kernel@esmil.dk>,
Minda Chen <minda.chen@starfivetech.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Iyappan Subramanian <iyappan@os.amperecomputing.com>,
Keyur Chudgar <keyur@os.amperecomputing.com>,
Quan Nguyen <quan@os.amperecomputing.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-msm@vger.kernel.org, imx@lists.linux.dev,
devicetree@vger.kernel.org, NXP S32 Linux Team <s32@nxp.com>
Subject: Re: [PATCH v5 16/16] net: stmmac: platform: Fix PTP clock rate reading
Date: Tue, 19 Nov 2024 17:09:15 +0000 [thread overview]
Message-ID: <ZzzGO5zgDvIK6JJ_@shell.armlinux.org.uk> (raw)
In-Reply-To: <20241119-upstream_s32cc_gmac-v5-16-7dcc90fcffef@oss.nxp.com>
On Tue, Nov 19, 2024 at 04:00:22PM +0100, Jan Petrous via B4 Relay wrote:
> From: "Jan Petrous (OSS)" <jan.petrous@oss.nxp.com>
>
> The stmmac driver supports many vendors SoCs using Synopsys-licensed
> Ethernet controller IP. Most of these vendors reuse the stmmac_platform
> codebase, which has a potential PTP clock initialization issue.
> The PTP clock rate reading might require ungating what is not provided.
>
> Fix the PTP clock initialization by enabling it immediately.
>
> Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index b1e4df1a86a0..db3e8ef4fc3a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -632,7 +632,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
> clk_prepare_enable(plat->pclk);
>
> /* Fall-back to main clock in case of no PTP ref is passed */
> - plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref");
> + plat->clk_ptp_ref = devm_clk_get_enabled(&pdev->dev, "ptp_ref");
> if (IS_ERR(plat->clk_ptp_ref)) {
> plat->clk_ptp_rate = clk_get_rate(plat->stmmac_clk);
> plat->clk_ptp_ref = NULL;
Looking at where the driver makes use of clk_ptp_ref, it currently
prepares and enables this clock via stmmac_open(), disables and
unprepares via stmmac_release().
There could be a platform where this is being used as a power saving
measure, and replacing devm_clk_get() with devm_clk_get_enabled() will
defeat that.
I would suggest that if you need the clock to be enabled in order to
get its rate, then the call to clk_get_rate() should have the
enable/disable around it to allow these other sites to work as they
have done.
Alternatively, we may take the view that the power saving is not
necessary, or stopping the clock is not a good idea (loss of time
in the 1588 block?) so the above changed would be sensible but only
if the clk_prepare_enable() and clk_disable_unprepare() calls on
this particular clock are also removed.
I can't say which is the correct way forward.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-11-19 17:09 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 15:00 [PATCH v5 00/16] Add support for Synopsis DWMAC IP on NXP Automotive SoCs S32G2xx/S32G3xx/S32R45 Jan Petrous via B4 Relay
2024-11-19 15:00 ` [PATCH v5 01/16] net: driver: stmmac: Fix CSR divider comment Jan Petrous via B4 Relay
2024-11-19 15:00 ` [PATCH v5 02/16] net: driver: stmmac: Extend CSR calc support Jan Petrous via B4 Relay
2024-11-19 16:35 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 03/16] net: stmmac: Fix clock rate variables size Jan Petrous via B4 Relay
2024-11-19 16:29 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 04/16] net: phy: Add helper for mapping RGMII link speed to clock rate Jan Petrous via B4 Relay
2024-11-19 16:41 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 05/16] net: dwmac-dwc-qos-eth: Use helper rgmii_clock Jan Petrous via B4 Relay
2024-11-19 16:42 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 06/16] net: dwmac-imx: " Jan Petrous via B4 Relay
2024-11-19 16:42 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 07/16] net: dwmac-intel-plat: " Jan Petrous via B4 Relay
2024-11-19 16:44 ` Russell King (Oracle)
2024-11-23 6:54 ` Jan Petrous
2024-11-19 15:00 ` [PATCH v5 08/16] net: dwmac-rk: " Jan Petrous via B4 Relay
2024-11-19 16:45 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 09/16] net: dwmac-starfive: " Jan Petrous via B4 Relay
2024-11-19 16:46 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 10/16] net: macb: " Jan Petrous via B4 Relay
2024-11-19 16:46 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 11/16] net: xgene_enet: " Jan Petrous via B4 Relay
2024-11-19 16:47 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 12/16] net: dwmac-sti: " Jan Petrous via B4 Relay
2024-11-19 16:48 ` Russell King (Oracle)
2024-11-19 15:00 ` [PATCH v5 13/16] dt-bindings: net: Add DT bindings for DWMAC on NXP S32G/R SoCs Jan Petrous via B4 Relay
2024-11-19 16:24 ` Rob Herring (Arm)
2024-11-24 21:27 ` Jan Petrous
2024-11-19 20:39 ` Rob Herring
2024-11-20 13:01 ` Jan Petrous
2024-11-19 15:00 ` [PATCH v5 14/16] net: stmmac: dwmac-s32: add basic NXP S32G/S32R glue driver Jan Petrous via B4 Relay
2024-11-19 16:58 ` Russell King (Oracle)
2024-11-24 22:18 ` Jan Petrous
2024-11-19 15:00 ` [PATCH v5 15/16] MAINTAINERS: Add Jan Petrous as the NXP S32G/R DWMAC driver maintainer Jan Petrous via B4 Relay
2024-11-19 15:00 ` [PATCH v5 16/16] net: stmmac: platform: Fix PTP clock rate reading Jan Petrous via B4 Relay
2024-11-19 17:09 ` Russell King (Oracle) [this message]
2024-11-20 12:59 ` Jan Petrous
2024-11-21 7:45 ` Paolo Abeni
2024-11-21 17:12 ` Jan Petrous
2024-11-19 16:40 ` [PATCH v5 00/16] Add support for Synopsis DWMAC IP on NXP Automotive SoCs S32G2xx/S32G3xx/S32R45 Russell King (Oracle)
2024-11-20 11:58 ` Jan Petrous
2024-11-20 11:59 ` Russell King (Oracle)
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=ZzzGO5zgDvIK6JJ_@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=imx@lists.linux.dev \
--cc=iyappan@os.amperecomputing.com \
--cc=jan.petrous@oss.nxp.com \
--cc=joabreu@synopsys.com \
--cc=kernel@esmil.dk \
--cc=kernel@pengutronix.de \
--cc=keyur@os.amperecomputing.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=minda.chen@starfivetech.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=quan@os.amperecomputing.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
--cc=vkoul@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;
as well as URLs for NNTP newsgroup(s).