public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 0/3] net: stmmac: Fix Tegra234 MGBE clock
@ 2026-03-25 13:58 Jon Hunter
  2026-03-25 13:58 ` [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jon Hunter @ 2026-03-25 13:58 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding
  Cc: netdev, devicetree, linux-tegra, Jon Hunter

The name of the PTP ref clock for the Tegra234 MGBE ethernet controller
does not match the generic name in the stmmac platform driver. Despite
this basic ethernet is functional on the Tegra234 platforms that use
this driver and as far as I know, we have not tested PTP support with
this driver. Hence, the risk of breaking any functionality is low.

The previous attempt to fix this in the stmmac platform driver, by
supporting the Tegra234 PTP clock name, was rejected [0]. The preference
from the netdev maintainers is to fix this in the DT binding for
Tegra234.

This series fixes this by correcting the device-tree binding to align
with the generic name for the PTP clock. I understand that this is
breaking the ABI for this device, which we should never do, but this
is a last resort for getting this fixed. I am open to any better ideas
to fix this. Please note that we still maintain backward compatibility
in the driver to allow older device-trees to work, but we don't
advertise this via the binding, because I did not see any value in doing
so.

Changes since V2:
- Corrected example in dt-binding doc.

Changes since V1:
- Moved handling of different PTP clock names into Tegra234 MGBE driver.
- Add changes to update the Tegra234 MGBE DT binding and DT source.

[0] https://lore.kernel.org/linux-tegra/20250612062032.293275-1-jonathanh@nvidia.com/

Jon Hunter (3):
  net: stmmac: Fix PTP ref clock for Tegra234
  dt-bindings: net: Fix Tegra234 MGBE PTP clock
  arm64: tegra: Fix Tegra234 MGBE PTP clock

 .../bindings/net/nvidia,tegra234-mgbe.yaml    |  4 ++--
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  8 ++++----
 .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 19 +++++++++++++++++--
 3 files changed, 23 insertions(+), 8 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234
  2026-03-25 13:58 [PATCH V3 0/3] net: stmmac: Fix Tegra234 MGBE clock Jon Hunter
@ 2026-03-25 13:58 ` Jon Hunter
  2026-03-26  8:32   ` Krzysztof Kozlowski
  2026-03-25 13:58 ` [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock Jon Hunter
  2026-03-25 13:58 ` [PATCH V3 3/3] arm64: tegra: " Jon Hunter
  2 siblings, 1 reply; 10+ messages in thread
From: Jon Hunter @ 2026-03-25 13:58 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding
  Cc: netdev, devicetree, linux-tegra, Jon Hunter

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.

In order to update device-tree to use the correct 'ptp_ref' name, update
the Tegra MGBE driver to use 'ptp_ref' by default and fallback to using
'ptp-ref' if 'ptp_ref' is not found.

Fixes: d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
index b4b39e6a169e..ec18ee46889f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
@@ -9,7 +9,7 @@
 #include "stmmac_platform.h"
 
 static const char *const mgbe_clks[] = {
-	"rx-pcs", "tx", "tx-pcs", "mac-divider", "mac", "mgbe", "ptp-ref", "mac"
+	"rx-pcs", "tx", "tx-pcs", "mac-divider", "mac", "mgbe", "ptp_ref", "mac"
 };
 
 struct tegra_mgbe {
@@ -216,6 +216,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	struct plat_stmmacenet_data *plat;
 	struct stmmac_resources res;
 	struct tegra_mgbe *mgbe;
+	bool use_legacy_ptp;
 	int irq, err, i;
 	u32 value;
 
@@ -257,9 +258,23 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	if (!mgbe->clks)
 		return -ENOMEM;
 
-	for (i = 0; i <  ARRAY_SIZE(mgbe_clks); i++)
+	/*
+	 * Older device-trees use 'ptp-ref' rather than 'ptp_ref'.
+	 * Fall back to the legacy name when 'ptp_ref' is absent.
+	 */
+	use_legacy_ptp = of_property_match_string(pdev->dev.of_node,
+						  "clock-names", "ptp_ref") < 0;
+
+	for (i = 0; i < ARRAY_SIZE(mgbe_clks); i++) {
 		mgbe->clks[i].id = mgbe_clks[i];
 
+		if (use_legacy_ptp && !strcmp(mgbe_clks[i], "ptp_ref")) {
+			dev_warn(mgbe->dev,
+				 "Device-tree update needed for PTP clock!\n");
+			mgbe->clks[i].id = "ptp-ref";
+		}
+	}
+
 	err = devm_clk_bulk_get(mgbe->dev, ARRAY_SIZE(mgbe_clks), mgbe->clks);
 	if (err < 0)
 		return err;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock
  2026-03-25 13:58 [PATCH V3 0/3] net: stmmac: Fix Tegra234 MGBE clock Jon Hunter
  2026-03-25 13:58 ` [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
@ 2026-03-25 13:58 ` Jon Hunter
  2026-03-25 14:07   ` Krzysztof Kozlowski
  2026-03-26  8:30   ` Krzysztof Kozlowski
  2026-03-25 13:58 ` [PATCH V3 3/3] arm64: tegra: " Jon Hunter
  2 siblings, 2 replies; 10+ messages in thread
From: Jon Hunter @ 2026-03-25 13:58 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding
  Cc: netdev, devicetree, linux-tegra, Jon Hunter

The PTP clock for the Tegra234 MGBE device is incorrectly named
'ptp-ref' and should be 'ptp_ref'. This is causing the following
warning to be observed on Tegra234 platforms that use this device:

 ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
 WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed

Although this constitutes an ABI breakage in the binding for this
device, PTP support has clearly never worked and so fix this now
so we can correct the device-tree for this device. Note that the
MGBE driver still supports the legacy 'ptp-ref' clock name and so
older/existing device-trees will still work, but given that this
is not the correct name, there is no point to advertise this in the
binding.

Fixes: 189c2e5c7669 ("dt-bindings: net: Add Tegra234 MGBE")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 .../devicetree/bindings/net/nvidia,tegra234-mgbe.yaml         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/nvidia,tegra234-mgbe.yaml b/Documentation/devicetree/bindings/net/nvidia,tegra234-mgbe.yaml
index 2bd3efff2485..215f14d1897d 100644
--- a/Documentation/devicetree/bindings/net/nvidia,tegra234-mgbe.yaml
+++ b/Documentation/devicetree/bindings/net/nvidia,tegra234-mgbe.yaml
@@ -42,7 +42,7 @@ properties:
       - const: mgbe
       - const: mac
       - const: mac-divider
-      - const: ptp-ref
+      - const: ptp_ref
       - const: rx-input-m
       - const: rx-input
       - const: tx
@@ -133,7 +133,7 @@ examples:
                  <&bpmp TEGRA234_CLK_MGBE0_RX_PCS_M>,
                  <&bpmp TEGRA234_CLK_MGBE0_RX_PCS>,
                  <&bpmp TEGRA234_CLK_MGBE0_TX_PCS>;
-        clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m",
+        clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m",
                       "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m",
                       "rx-pcs", "tx-pcs";
         resets = <&bpmp TEGRA234_RESET_MGBE0_MAC>,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH V3 3/3] arm64: tegra: Fix Tegra234 MGBE PTP clock
  2026-03-25 13:58 [PATCH V3 0/3] net: stmmac: Fix Tegra234 MGBE clock Jon Hunter
  2026-03-25 13:58 ` [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
  2026-03-25 13:58 ` [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock Jon Hunter
@ 2026-03-25 13:58 ` Jon Hunter
  2026-03-26  8:30   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 10+ messages in thread
From: Jon Hunter @ 2026-03-25 13:58 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding
  Cc: netdev, devicetree, linux-tegra, Jon Hunter

The Tegra MGBE PTP clock is incorrectly named as 'ptp-ref' and not
'ptp_ref' and this causing the initialisation of the PTP clock to fail.
The device-tree binding doc for the device and the Tegra MGBE driver
have been updated to use the correct name and so update the device-tree
for Tegra234 as well.

Fixes: 610cdf3186bc ("arm64: tegra: Add MGBE nodes on Tegra234")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
index 04a95b6658ca..18220cdac9f9 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
@@ -3605,7 +3605,7 @@ ethernet@6800000 {
 				 <&bpmp TEGRA234_CLK_MGBE0_RX_PCS_M>,
 				 <&bpmp TEGRA234_CLK_MGBE0_RX_PCS>,
 				 <&bpmp TEGRA234_CLK_MGBE0_TX_PCS>;
-			clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m",
+			clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m",
 				      "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m",
 				      "rx-pcs", "tx-pcs";
 			resets = <&bpmp TEGRA234_RESET_MGBE0_MAC>,
@@ -3647,7 +3647,7 @@ ethernet@6900000 {
 				 <&bpmp TEGRA234_CLK_MGBE1_RX_PCS_M>,
 				 <&bpmp TEGRA234_CLK_MGBE1_RX_PCS>,
 				 <&bpmp TEGRA234_CLK_MGBE1_TX_PCS>;
-			clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m",
+			clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m",
 				      "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m",
 				      "rx-pcs", "tx-pcs";
 			resets = <&bpmp TEGRA234_RESET_MGBE1_MAC>,
@@ -3689,7 +3689,7 @@ ethernet@6a00000 {
 				 <&bpmp TEGRA234_CLK_MGBE2_RX_PCS_M>,
 				 <&bpmp TEGRA234_CLK_MGBE2_RX_PCS>,
 				 <&bpmp TEGRA234_CLK_MGBE2_TX_PCS>;
-			clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m",
+			clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m",
 				      "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m",
 				      "rx-pcs", "tx-pcs";
 			resets = <&bpmp TEGRA234_RESET_MGBE2_MAC>,
@@ -3731,7 +3731,7 @@ ethernet@6b00000 {
 				 <&bpmp TEGRA234_CLK_MGBE3_RX_PCS_M>,
 				 <&bpmp TEGRA234_CLK_MGBE3_RX_PCS>,
 				 <&bpmp TEGRA234_CLK_MGBE3_TX_PCS>;
-			clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m",
+			clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m",
 				      "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m",
 				      "rx-pcs", "tx-pcs";
 			resets = <&bpmp TEGRA234_RESET_MGBE3_MAC>,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock
  2026-03-25 13:58 ` [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock Jon Hunter
@ 2026-03-25 14:07   ` Krzysztof Kozlowski
  2026-03-25 14:09     ` Krzysztof Kozlowski
  2026-03-26  8:30   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-25 14:07 UTC (permalink / raw)
  To: Jon Hunter, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thierry Reding
  Cc: netdev, devicetree, linux-tegra

On 25/03/2026 14:58, Jon Hunter wrote:
> The PTP clock for the Tegra234 MGBE device is incorrectly named
> 'ptp-ref' and should be 'ptp_ref'. This is causing the following
> warning to be observed on Tegra234 platforms that use this device:
> 
>  ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
>  WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
> 
> Although this constitutes an ABI breakage in the binding for this
> device, PTP support has clearly never worked and so fix this now
> so we can correct the device-tree for this device. Note that the

I don't understand that explanation.

Driver dwmac-tegra.c: ptp-ref
Binding: ptp-ref
DTS: ptp-ref

but you say that nothing was working correctly?

Judging by these three - driver+binding+dts - obvious fix is no fix
because everything was fine, so please clarify the exact problem.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock
  2026-03-25 14:07   ` Krzysztof Kozlowski
@ 2026-03-25 14:09     ` Krzysztof Kozlowski
  2026-03-25 14:26       ` Jon Hunter
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-25 14:09 UTC (permalink / raw)
  To: Jon Hunter, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thierry Reding
  Cc: netdev, devicetree, linux-tegra

On 25/03/2026 15:07, Krzysztof Kozlowski wrote:
> On 25/03/2026 14:58, Jon Hunter wrote:
>> The PTP clock for the Tegra234 MGBE device is incorrectly named
>> 'ptp-ref' and should be 'ptp_ref'. This is causing the following
>> warning to be observed on Tegra234 platforms that use this device:

                           ^^^^^^^^^^^^^ Tegra234 (see further)
>>
>>  ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
>>  WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
>>
>> Although this constitutes an ABI breakage in the binding for this
>> device, PTP support has clearly never worked and so fix this now
>> so we can correct the device-tree for this device. Note that the
> 
> I don't understand that explanation.
> 
> Driver dwmac-tegra.c: ptp-ref
> Binding: ptp-ref
> DTS: ptp-ref
> 
> but you say that nothing was working correctly?
> 
> Judging by these three - driver+binding+dts - obvious fix is no fix
> because everything was fine, so please clarify the exact problem.

Correction - I missed in grep - there are ptp_ref users: tegra186 and
tegra194, but how tegra234 could not work if it has correctly in DTS
ptp-ref?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock
  2026-03-25 14:09     ` Krzysztof Kozlowski
@ 2026-03-25 14:26       ` Jon Hunter
  0 siblings, 0 replies; 10+ messages in thread
From: Jon Hunter @ 2026-03-25 14:26 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thierry Reding
  Cc: netdev, devicetree, linux-tegra


On 25/03/2026 14:09, Krzysztof Kozlowski wrote:
> On 25/03/2026 15:07, Krzysztof Kozlowski wrote:
>> On 25/03/2026 14:58, Jon Hunter wrote:
>>> The PTP clock for the Tegra234 MGBE device is incorrectly named
>>> 'ptp-ref' and should be 'ptp_ref'. This is causing the following
>>> warning to be observed on Tegra234 platforms that use this device:
> 
>                             ^^^^^^^^^^^^^ Tegra234 (see further)
>>>
>>>   ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
>>>   WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
>>>
>>> Although this constitutes an ABI breakage in the binding for this
>>> device, PTP support has clearly never worked and so fix this now
>>> so we can correct the device-tree for this device. Note that the
>>
>> I don't understand that explanation.
>>
>> Driver dwmac-tegra.c: ptp-ref
>> Binding: ptp-ref
>> DTS: ptp-ref
>>
>> but you say that nothing was working correctly?
>>
>> Judging by these three - driver+binding+dts - obvious fix is no fix
>> because everything was fine, so please clarify the exact problem.
> 
> Correction - I missed in grep - there are ptp_ref users: tegra186 and
> tegra194, but how tegra234 could not work if it has correctly in DTS
> ptp-ref?

The problem lies in 
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c which uses the 
name 'ptp_ref' which does not match 'ptp-ref'. This is where the warning 
is coming from. So basic ethernet does work, but stmmac_platform.c 
driver is complaining that the PTP clock is not found.

Yes Tegra186 and Tegra194 are not impacted by this, only Tegra234.

Jon

-- 
nvpublic


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock
  2026-03-25 13:58 ` [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock Jon Hunter
  2026-03-25 14:07   ` Krzysztof Kozlowski
@ 2026-03-26  8:30   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  8:30 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding, netdev, devicetree, linux-tegra

On Wed, Mar 25, 2026 at 01:58:10PM +0000, Jon Hunter wrote:
> The PTP clock for the Tegra234 MGBE device is incorrectly named
> 'ptp-ref' and should be 'ptp_ref'. This is causing the following
> warning to be observed on Tegra234 platforms that use this device:
> 
>  ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate
>  WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
> 
> Although this constitutes an ABI breakage in the binding for this
> device, PTP support has clearly never worked and so fix this now
> so we can correct the device-tree for this device. Note that the
> MGBE driver still supports the legacy 'ptp-ref' clock name and so
> older/existing device-trees will still work, but given that this
> is not the correct name, there is no point to advertise this in the
> binding.
> 
> Fixes: 189c2e5c7669 ("dt-bindings: net: Add Tegra234 MGBE")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  .../devicetree/bindings/net/nvidia,tegra234-mgbe.yaml         | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 3/3] arm64: tegra: Fix Tegra234 MGBE PTP clock
  2026-03-25 13:58 ` [PATCH V3 3/3] arm64: tegra: " Jon Hunter
@ 2026-03-26  8:30   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  8:30 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding, netdev, devicetree, linux-tegra

On Wed, Mar 25, 2026 at 01:58:11PM +0000, Jon Hunter wrote:
> The Tegra MGBE PTP clock is incorrectly named as 'ptp-ref' and not
> 'ptp_ref' and this causing the initialisation of the PTP clock to fail.
> The device-tree binding doc for the device and the Tegra MGBE driver
> have been updated to use the correct name and so update the device-tree
> for Tegra234 as well.
> 
> Fixes: 610cdf3186bc ("arm64: tegra: Add MGBE nodes on Tegra234")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234
  2026-03-25 13:58 ` [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
@ 2026-03-26  8:32   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  8:32 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thierry Reding, netdev, devicetree, linux-tegra

On Wed, Mar 25, 2026 at 01:58:09PM +0000, Jon Hunter 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.
> 
> In order to update device-tree to use the correct 'ptp_ref' name, update
> the Tegra MGBE driver to use 'ptp_ref' by default and fallback to using
> 'ptp-ref' if 'ptp_ref' is not found.
> 
> Fixes: d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> index b4b39e6a169e..ec18ee46889f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> @@ -9,7 +9,7 @@
>  #include "stmmac_platform.h"
>  
>  static const char *const mgbe_clks[] = {
> -	"rx-pcs", "tx", "tx-pcs", "mac-divider", "mac", "mgbe", "ptp-ref", "mac"
> +	"rx-pcs", "tx", "tx-pcs", "mac-divider", "mac", "mgbe", "ptp_ref", "mac"
>  };
>  
>  struct tegra_mgbe {
> @@ -216,6 +216,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
>  	struct plat_stmmacenet_data *plat;
>  	struct stmmac_resources res;
>  	struct tegra_mgbe *mgbe;
> +	bool use_legacy_ptp;
>  	int irq, err, i;
>  	u32 value;
>  
> @@ -257,9 +258,23 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
>  	if (!mgbe->clks)
>  		return -ENOMEM;
>  
> -	for (i = 0; i <  ARRAY_SIZE(mgbe_clks); i++)
> +	/*
> +	 * Older device-trees use 'ptp-ref' rather than 'ptp_ref'.
> +	 * Fall back to the legacy name when 'ptp_ref' is absent.
> +	 */
> +	use_legacy_ptp = of_property_match_string(pdev->dev.of_node,
> +						  "clock-names", "ptp_ref") < 0;
> +
> +	for (i = 0; i < ARRAY_SIZE(mgbe_clks); i++) {
>  		mgbe->clks[i].id = mgbe_clks[i];
>  
> +		if (use_legacy_ptp && !strcmp(mgbe_clks[i], "ptp_ref")) {

Why index 0 is not valid? And why -EINVAL would be considered as legacy
clock present?

> +			dev_warn(mgbe->dev,
> +				 "Device-tree update needed for PTP clock!\n");
> +			mgbe->clks[i].id = "ptp-ref";

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-26  8:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 13:58 [PATCH V3 0/3] net: stmmac: Fix Tegra234 MGBE clock Jon Hunter
2026-03-25 13:58 ` [PATCH V3 1/3] net: stmmac: Fix PTP ref clock for Tegra234 Jon Hunter
2026-03-26  8:32   ` Krzysztof Kozlowski
2026-03-25 13:58 ` [PATCH V3 2/3] dt-bindings: net: Fix Tegra234 MGBE PTP clock Jon Hunter
2026-03-25 14:07   ` Krzysztof Kozlowski
2026-03-25 14:09     ` Krzysztof Kozlowski
2026-03-25 14:26       ` Jon Hunter
2026-03-26  8:30   ` Krzysztof Kozlowski
2026-03-25 13:58 ` [PATCH V3 3/3] arm64: tegra: " Jon Hunter
2026-03-26  8:30   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox