Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH 0/3] clk: at91: sam9x7: Fix GMAC TSU clock configuration
@ 2026-11-26  9:18 Mihai Sain
  2026-11-26  9:18 ` [PATCH 1/3] clk: at91: sam9x7: Fix GMAC TSU generic clock definition Mihai Sain
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mihai Sain @ 2026-11-26  9:18 UTC (permalink / raw)
  To: sboyd, bmasney+clk, jbrunet+clk, nicolas.ferre, alexandre.belloni,
	claudiu.beznea, robh, krzk+dt, conor+dt
  Cc: linux-clk, linux-arm-kernel, devicetree, Mihai Sain

This series fixes the GMAC Time Stamp Unit (TSU) clock configuration for
the Microchip SAM9X7 SoC.

The fixes cover the TSU generic clock definition in the clock driver and
the corresponding clock ID and frequency in the device tree.

Mismatches in these definitions can result in an incorrect clock configuration
for the GMAC TSU.

Mihai Sain (3):
  clk: at91: sam9x7: Fix GMAC TSU generic clock definition
  ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID
  ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency

 arch/arm/boot/dts/microchip/sam9x7.dtsi |  6 +++---
 drivers/clk/at91/sam9x7.c               | 10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
-- 
2.56.1


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

* [PATCH 1/3] clk: at91: sam9x7: Fix GMAC TSU generic clock definition
  2026-11-26  9:18 [PATCH 0/3] clk: at91: sam9x7: Fix GMAC TSU clock configuration Mihai Sain
@ 2026-11-26  9:18 ` Mihai Sain
  2026-11-26  9:18 ` [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID Mihai Sain
  2026-11-26  9:18 ` [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency Mihai Sain
  2 siblings, 0 replies; 6+ messages in thread
From: Mihai Sain @ 2026-11-26  9:18 UTC (permalink / raw)
  To: sboyd, bmasney+clk, jbrunet+clk, nicolas.ferre, alexandre.belloni,
	claudiu.beznea, robh, krzk+dt, conor+dt
  Cc: linux-clk, linux-arm-kernel, devicetree, Mihai Sain

According to the latest datasheet (see link section), table 12.1,
the instance ID 67 is used for the GMAC TSU generic clock.

Add the gmac_tsu_gclk clock to the SAM9X7 PMC clock configuration.
Configure the clock with a maximum frequency of 400 MHz and
support two possible parents: audiopll and plladiv2ck,
using the corresponding PMC mux selections.

This enables proper parent clock selection for the
GMAC Time Stamp Unit (TSU).

Link: https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAM9X7-Series-Data-Sheet-DS60001813.pdf
Fixes: 33013b43e271 ("clk: at91: sam9x7: add sam9x7 pmc driver")
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
---
 drivers/clk/at91/sam9x7.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c
index 946aa54dd2e8..80e9ee154b97 100644
--- a/drivers/clk/at91/sam9x7.c
+++ b/drivers/clk/at91/sam9x7.c
@@ -710,6 +710,16 @@ static const struct {
 		.pp_count = 1,
 		.pp_chg_id = INT_MIN,
 	},
+
+	{
+		.n = "gmac_tsu_gclk",
+		.id = 67,
+		.r = { .max = 400000000 },
+		.pp = { "audiopll_divpmcck", "plla_div2pmcck", },
+		.pp_mux_table = { 6, 8, },
+		.pp_count = 2,
+		.pp_chg_id = INT_MIN,
+	},
 };
 
 static void __init sam9x7_pmc_setup(struct device_node *np)
-- 
2.56.1


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

* [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID
  2026-11-26  9:18 [PATCH 0/3] clk: at91: sam9x7: Fix GMAC TSU clock configuration Mihai Sain
  2026-11-26  9:18 ` [PATCH 1/3] clk: at91: sam9x7: Fix GMAC TSU generic clock definition Mihai Sain
@ 2026-11-26  9:18 ` Mihai Sain
  2026-11-26  9:24   ` sashiko-bot
  2026-11-26  9:18 ` [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency Mihai Sain
  2 siblings, 1 reply; 6+ messages in thread
From: Mihai Sain @ 2026-11-26  9:18 UTC (permalink / raw)
  To: sboyd, bmasney+clk, jbrunet+clk, nicolas.ferre, alexandre.belloni,
	claudiu.beznea, robh, krzk+dt, conor+dt
  Cc: linux-clk, linux-arm-kernel, devicetree, Mihai Sain

Correct the GMAC TSU clock reference in the SAM9X7 device tree.

Use PMC GCK ID 67 instead of ID 24 for the tsu_clk input and
its assigned clock configuration, ensuring the GMAC TSU clock
is configured using the correct generic clock identifier.

[root@SAM9X75 ~]$ ptp4l -i eth0 -m -2 -H --clientOnly=1
ptp4l[3920.698]: selected /dev/ptp0 as PTP clock
ptp4l[3920.702]: port 1 (eth0): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[3920.703]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[3920.703]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[3922.226]: port 1 (eth0): new foreign master 803428.fffe.37d483-1
ptp4l[3926.226]: selected best master clock 803428.fffe.37d483
ptp4l[3926.230]: port 1 (eth0): LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[3928.226]: master offset          7 s0 freq   +7815 path delay       650
ptp4l[3929.226]: master offset          8 s2 freq   +7816 path delay       650
ptp4l[3929.227]: port 1 (eth0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[3931.226]: master offset          3 s2 freq   +7829 path delay       652
ptp4l[3932.226]: master offset          2 s2 freq   +7828 path delay       652
ptp4l[3933.226]: master offset          7 s2 freq   +7834 path delay       652
ptp4l[3934.226]: master offset         -2 s2 freq   +7827 path delay       653
ptp4l[3935.226]: master offset          4 s2 freq   +7833 path delay       652
ptp4l[3936.226]: master offset         -2 s2 freq   +7828 path delay       655
ptp4l[3937.226]: master offset          3 s2 freq   +7832 path delay       654
ptp4l[3938.227]: master offset          6 s2 freq   +7836 path delay       654
ptp4l[3939.227]: master offset          2 s2 freq   +7834 path delay       655
ptp4l[3940.227]: master offset         -1 s2 freq   +7831 path delay       656
ptp4l[3941.227]: master offset          3 s2 freq   +7835 path delay       656

Fixes: 41af45af8bc3 ("ARM: dts: at91: sam9x7: add device tree for SoC")
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
---
 arch/arm/boot/dts/microchip/sam9x7.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/microchip/sam9x7.dtsi b/arch/arm/boot/dts/microchip/sam9x7.dtsi
index c680a5033b6b..f400d709901f 100644
--- a/arch/arm/boot/dts/microchip/sam9x7.dtsi
+++ b/arch/arm/boot/dts/microchip/sam9x7.dtsi
@@ -990,9 +990,9 @@ gmac: ethernet@f802c000 {
 				     <62 IRQ_TYPE_LEVEL_HIGH 3>,	/* Queue 3 */
 				     <63 IRQ_TYPE_LEVEL_HIGH 3>,	/* Queue 4 */
 				     <64 IRQ_TYPE_LEVEL_HIGH 3>;	/* Queue 5 */
-			clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 24>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 67>;
 			clock-names = "hclk", "pclk", "tsu_clk";
-			assigned-clocks = <&pmc PMC_TYPE_GCK 24>;
+			assigned-clocks = <&pmc PMC_TYPE_GCK 67>;
 			assigned-clock-rates = <266666666>;
 			status = "disabled";
 		};
-- 
2.56.1


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

* [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency
  2026-11-26  9:18 [PATCH 0/3] clk: at91: sam9x7: Fix GMAC TSU clock configuration Mihai Sain
  2026-11-26  9:18 ` [PATCH 1/3] clk: at91: sam9x7: Fix GMAC TSU generic clock definition Mihai Sain
  2026-11-26  9:18 ` [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID Mihai Sain
@ 2026-11-26  9:18 ` Mihai Sain
  2026-11-26  9:24   ` sashiko-bot
  2 siblings, 1 reply; 6+ messages in thread
From: Mihai Sain @ 2026-11-26  9:18 UTC (permalink / raw)
  To: sboyd, bmasney+clk, jbrunet+clk, nicolas.ferre, alexandre.belloni,
	claudiu.beznea, robh, krzk+dt, conor+dt
  Cc: linux-clk, linux-arm-kernel, devicetree, Mihai Sain

According to the datasheet (see link section), chapter 64.6.2,
the supported TSU clock frequencies are:
8,10,20,25,40,50,100,125,200,250 MHz.

Set the clock frequency to 200 MHz, allowing the PMC to derive
the required frequency from the parrent PLLs.

Link: https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAM9X7-Series-Data-Sheet-DS60001813.pdf
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
---
 arch/arm/boot/dts/microchip/sam9x7.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/microchip/sam9x7.dtsi b/arch/arm/boot/dts/microchip/sam9x7.dtsi
index f400d709901f..e77683162239 100644
--- a/arch/arm/boot/dts/microchip/sam9x7.dtsi
+++ b/arch/arm/boot/dts/microchip/sam9x7.dtsi
@@ -993,7 +993,7 @@ gmac: ethernet@f802c000 {
 			clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 67>;
 			clock-names = "hclk", "pclk", "tsu_clk";
 			assigned-clocks = <&pmc PMC_TYPE_GCK 67>;
-			assigned-clock-rates = <266666666>;
+			assigned-clock-rates = <200000000>;
 			status = "disabled";
 		};
 
-- 
2.56.1


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

* Re: [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency
  2026-11-26  9:18 ` [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency Mihai Sain
@ 2026-11-26  9:24   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-26  9:24 UTC (permalink / raw)
  To: Mihai Sain; +Cc: linux-clk, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ARM: dts: microchip: sam9x7: missing Fixes trailer for GMAC TSU
  clock fix
--

commit e08604f20c8a6ce19e494241d87354c098dba453
Author: Mihai Sain <mihai.sain@microchip.com>

> ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency
>
> According to the datasheet (see link section), chapter 64.6.2,
> the supported TSU clock frequencies are:
> 8,10,20,25,40,50,100,125,200,250 MHz.
>
> Set the clock frequency to 200 MHz, allowing the PMC to derive
> the required frequency from the parrent PLLs.
>
> Link: https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/DataSheets/SAM9X7-Series-Data-Sheet-DS60001813.pdf
> Signed-off-by: Mihai Sain <mihai.sain@microchip.com>

[Severity: Low]
Since this fixes the unsupported GMAC TSU clock frequency introduced with
the SAM9X7 device tree, should it include a Fixes tag?

  Fixes: 41af45af8bc3 ("ARM: dts: at91: sam9x7: add device tree for SoC")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126091809.13012-1-mihai.sain@microchip.com?part=3

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

* Re: [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID
  2026-11-26  9:18 ` [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID Mihai Sain
@ 2026-11-26  9:24   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-26  9:24 UTC (permalink / raw)
  To: Mihai Sain; +Cc: linux-clk, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ARM: dts: microchip: sam9x7: Fixes tag cites wrong introducing
  commit
--

commit ab9dcb34321c197d0e90e97c7fa545aa535bd40a
Author: Mihai Sain <mihai.sain@microchip.com>

> ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID
>
> Correct the GMAC TSU clock reference in the SAM9X7 device tree.
>
> Use PMC GCK ID 67 instead of ID 24 for the tsu_clk input and
> its assigned clock configuration, ensuring the GMAC TSU clock
> is configured using the correct generic clock identifier.
>
> [root@SAM9X75 ~]$ ptp4l -i eth0 -m -2 -H --clientOnly=1
> ptp4l[3920.698]: selected /dev/ptp0 as PTP clock
> ptp4l[3920.702]: port 1 (eth0): INITIALIZING to LISTENING on INIT_COMPLETE
> ptp4l[3920.703]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
> ptp4l[3920.703]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
> ptp4l[3922.226]: port 1 (eth0): new foreign master 803428.fffe.37d483-1
> ptp4l[3926.226]: selected best master clock 803428.fffe.37d483
> ptp4l[3926.230]: port 1 (eth0): LISTENING to UNCALIBRATED on RS_SLAVE
> ptp4l[3928.226]: master offset          7 s0 freq   +7815 path delay       650
> ptp4l[3929.226]: master offset          8 s2 freq   +7816 path delay       650
> ptp4l[3929.227]: port 1 (eth0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
> ptp4l[3931.226]: master offset          3 s2 freq   +7829 path delay       652
> ptp4l[3932.226]: master offset          2 s2 freq   +7828 path delay       652
> ptp4l[3933.226]: master offset          7 s2 freq   +7834 path delay       652
> ptp4l[3934.226]: master offset         -2 s2 freq   +7827 path delay       653
> ptp4l[3935.226]: master offset          4 s2 freq   +7833 path delay       652
> ptp4l[3936.226]: master offset         -2 s2 freq   +7828 path delay       655
> ptp4l[3937.226]: master offset          3 s2 freq   +7832 path delay       654
> ptp4l[3938.227]: master offset          6 s2 freq   +7836 path delay       654
> ptp4l[3939.227]: master offset          2 s2 freq   +7834 path delay       655
> ptp4l[3940.227]: master offset         -1 s2 freq   +7831 path delay       656
> ptp4l[3941.227]: master offset          3 s2 freq   +7835 path delay       656
>
> Fixes: 41af45af8bc3 ("ARM: dts: at91: sam9x7: add device tree for SoC")
> Signed-off-by: Mihai Sain <mihai.sain@microchip.com>

[Severity: Low]
In commit 41af45af8bc3 ("ARM: dts: at91: sam9x7: add device tree for
SoC"), the gmac node already configured tsu_clk and assigned-clocks with
<&pmc PMC_TYPE_GCK 67>; it was commit 765aaba18413 ("ARM: dts: microchip:
sam9x7: fix GMAC clock configuration") that changed both to <&pmc
PMC_TYPE_GCK 24>.

Should the Fixes tag reference 765aaba18413 ("ARM: dts: microchip:
sam9x7: fix GMAC clock configuration") instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126091809.13012-1-mihai.sain@microchip.com?part=2

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

end of thread, other threads:[~2026-11-26  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  9:18 [PATCH 0/3] clk: at91: sam9x7: Fix GMAC TSU clock configuration Mihai Sain
2026-11-26  9:18 ` [PATCH 1/3] clk: at91: sam9x7: Fix GMAC TSU generic clock definition Mihai Sain
2026-11-26  9:18 ` [PATCH 2/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock ID Mihai Sain
2026-11-26  9:24   ` sashiko-bot
2026-11-26  9:18 ` [PATCH 3/3] ARM: dts: microchip: sam9x7: Fix GMAC TSU clock frequency Mihai Sain
2026-11-26  9:24   ` sashiko-bot

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