From: Jon Hunter <jonathanh@nvidia.com>
To: Andrew Lunn <andrew@lunn.ch>, Subbaraya Sundeep <sbhatta@marvell.com>
Cc: 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>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-tegra@vger.kernel.org,
Alexis Lothorrr <alexis.lothore@bootlin.com>
Subject: Re: [PATCH] net: stmmac: Fix PTP ref clock for Tegra234
Date: Thu, 12 Jun 2025 13:26:55 +0100 [thread overview]
Message-ID: <e720596d-6fbb-40a4-9567-e8d05755cf6f@nvidia.com> (raw)
In-Reply-To: <85e27a26-b115-49aa-8e23-963bff11f3f6@lunn.ch>
On 12/06/2025 13:10, Andrew Lunn wrote:
> On Thu, Jun 12, 2025 at 10:57:49AM +0000, Subbaraya Sundeep wrote:
>> Hi,
>>
>> On 2025-06-12 at 06:20:32, Jon Hunter (jonathanh@nvidia.com) wrote:
>>> Since commit 030ce919e114 ("net: stmmac: make sure that ptp_rate is not
>>> 0 before configuring timestamping") was added the following error is
>>> observed on Tegra234:
>>>
>>> ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
>>> WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
>>>
>>> It turns out that the Tegra234 device-tree binding defines the PTP ref
>>> clock name as 'ptp-ref' and not 'ptp_ref' and the above commit now
>>> exposes this and that the PTP clock is not configured correctly.
>>>
>>> Ideally, we would rename the PTP ref clock for Tegra234 to fix this but
>>> this will break backward compatibility with existing device-tree blobs.
>>> Therefore, fix this by using the name 'ptp-ref' for devices that are
>>> compatible with 'nvidia,tegra234-mgbe'.
>
>> AFAIU for Tegra234 device from the beginning, entry in dts is ptp-ref.
>> Since driver is looking for ptp_ref it is getting 0 hence the crash
>> and after the commit 030ce919e114 result is Invalid error instead of crash.
>> For me PTP is not working for Tegra234 from day 1 so why to bother about
>> backward compatibility and instead fix dts.
>> Please help me understand it has been years I worked on dts.
>
> Please could you expand on that, because when i look at the code....
>
>
> /* Fall-back to main clock in case of no PTP ref is passed */
> plat->clk_ptp_ref = devm_clk_get(&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;
>
> if the ptp_ref does not exist, it falls back to stmmac_clk. Why would
> that cause a crash?
> > While i agree if this never worked, we can ignore backwards
> compatibility and just fix the DT, but i would like a fuller
> explanation why the fallback is not sufficient to prevent a crash.
The problem is that in the 'ptp-ref' clock name is also defined in the
'mgbe_clks' array in dwmac-tegra.c driver. All of these clocks are
requested and enabled using the clk_bulk_xxx APIs and so I don't see how
we can simply fix this now without breaking support for older device-trees.
Jon
--
nvpublic
next prev parent reply other threads:[~2025-06-12 12:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 6:20 [PATCH] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
2025-06-12 10:57 ` Subbaraya Sundeep
2025-06-12 12:10 ` Andrew Lunn
2025-06-12 12:26 ` Jon Hunter [this message]
2025-06-12 12:45 ` Andrew Lunn
2025-06-13 11:15 ` Jon Hunter
2025-06-13 13:22 ` Andrew Lunn
2025-06-16 10:06 ` Jon Hunter
2025-06-16 13:06 ` Andrew Lunn
2025-06-25 14:40 ` Jon Hunter
2025-06-25 14:01 ` Jon Hunter
2025-06-25 16:24 ` Andrew Lunn
2025-06-26 8:52 ` Jon Hunter
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=e720596d-6fbb-40a4-9567-e8d05755cf6f@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-tegra@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.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