Skip to contentSkip to conversation

Update gmac clocks and devicetree for sam9x7 mpu

PATCH Superseded Mihai Sain 2 participants 7 messages Feb 12 – Feb 28

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mihai Sain

author
#0 lore raw

v2 cover Update gmac clocks and devicetree for sam9x7 mpu

This series updates the GMAC clock configuration for the SAM9X7 family. The current clock definitions contain inconsistencies around the GMAC peripheral and its associated generic clock IDs, which lead to incorrect wiring in both the clock driver and the devicetree.

Changelog:

v1 -> v2:
- Add only one patch for devicetree with detailed description

Mihai Sain (4):
clk: at91: sam9x7: Remove gmac peripheral and generic clock entries with ID 67
clk: at91: sam9x7: Rename macb0_clk to gmac_clk
clk: at91: sam9x7: Add gmac generic clock entry with ID 24
ARM: dts: microchip: sam9x7: fix GMAC clock configuration

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

base-commit: 37a93dd5c49b5fda807fd204edf2547c3493319c

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v2 1/4 clk: at91: sam9x7: Remove gmac peripheral and generic clock entries with ID 67

According with datasheet table 12.1 the instance ID 67 is reserved. This change drops the gmactsu_clk and gmac_gclk entries from the SAM9X7 clock description tables.

---
 drivers/clk/at91/sam9x7.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/clk/at91/sam9x7.c +0 -10
index 89868a0aeaba..d9603f1124d0 100644
@@ -420,7 +420,6 @@ static const struct {
 	{ .n = "lvdsc_clk",	.id = 56, },
 	{ .n = "pit64b1_clk",	.id = 58, },
 	{ .n = "puf_clk",	.id = 59, },
-	{ .n = "gmactsu_clk",	.id = 67, },
 };
 
 /*
@@ -702,15 +701,6 @@ static const struct {
 		.pp_count = 1,
 		.pp_chg_id = INT_MIN,
 	},
-
-	{
-		.n = "gmac_gclk",
-		.id = 67,
-		.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)
Signature · 1 line
2.53.0
maintainer
#2 lore raw

Re: [PATCH v2 1/4] clk: at91: sam9x7: Remove gmac peripheral and generic clock entries with ID 67

Hi, Mihai,

Quoted 1 line · Mihai Sain

According with datasheet table 12.1 the instance ID 67 is reserved.

Could you please mention the datasheet revision ID?

Quoted 13 lines

This change drops the gmactsu_clk and gmac_gclk entries from the SAM9X7 clock description tables.

---
  drivers/clk/at91/sam9x7.c | 10 ----------
  1 file changed, 10 deletions(-)
drivers/clk/at91/sam9x7.c +0 -0
index 89868a0aeaba..d9603f1124d0 100644

drivers/clk/at91/sam9x7.c static const struct { · line 423

Quoted 4 lines
drivers/clk/at91/sam9x7.c +0 -1
@@ -420,7 +420,6 @@ static const struct {
  	{ .n = "lvdsc_clk",	.id = 56, },
  	{ .n = "pit64b1_clk",	.id = 58, },
  	{ .n = "puf_clk",	.id = 59, },
-	{ .n = "gmactsu_clk",	.id = 67, },

Could you please keep this in a separate patch?

Quoted 6 lines
drivers/clk/at91/sam9x7.c +0 -0
  };
 
  /*
@@ -702,15 +701,6 @@ static const struct {
  		.pp_count = 1,
  		.pp_chg_id = INT_MIN,

drivers/clk/at91/sam9x7.c static const struct { · line 713

Quoted 10 lines
drivers/clk/at91/sam9x7.c +0 -9
  	},
-
-	{
-		.n = "gmac_gclk",
-		.id = 67,
-		.pp = { "audiopll_divpmcck", "plla_div2pmcck", },
-		.pp_mux_table = { 6, 8, },
-		.pp_count = 2,
-		.pp_chg_id = INT_MIN,
-	},

And squash this changes with patch 3/4 "clk: at91: sam9x7: Add gmac generic clock entry with ID 24" and also provide a fixes tag for it?

Thank you,
Claudiu

author
#3 lore raw

PATCH v2 2/4 clk: at91: sam9x7: Rename macb0_clk to gmac_clk

In reply to Mihai Sain

Update the peripheral clock name for ID 24 from macb0_clk to gmac_clk to match the actual GMAC hardware block present on SAM9X7 SoCs. This aligns the clock naming with the device tree and avoids confusion with legacy MACB controllers.

---
 drivers/clk/at91/sam9x7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/at91/sam9x7.c +1 -1
index d9603f1124d0..68e569bd70f5 100644
@@ -387,7 +387,7 @@ static const struct {
 	{ .n = "dma0_clk",	.id = 20, },
 	{ .n = "uhphs_clk",	.id = 22, },
 	{ .n = "udphs_clk",	.id = 23, },
-	{ .n = "macb0_clk",	.id = 24, },
+	{ .n = "gmac_clk",	.id = 24, },
 	{ .n = "lcd_clk",	.id = 25, },
 	{ .n = "sdmmc1_clk",	.id = 26, },
 	{ .n = "ssc_clk",	.id = 28, },
Signature · 1 line
2.53.0
maintainer Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] clk: at91: sam9x7: Rename macb0_clk to gmac_clk

Quoted 6 lines · Mihai Sain

Update the peripheral clock name for ID 24 from macb0_clk to gmac_clk to match the actual GMAC hardware block present on SAM9X7 SoCs. This aligns the clock naming with the device tree and avoids confusion with legacy MACB controllers.

author
#5 lore raw

PATCH v2 3/4 clk: at91: sam9x7: Add gmac generic clock entry with ID 24

In reply to Mihai Sain

According with datasheet table 12.1 the instance ID 24 is used for gmac generic clock.
This change adds the gmac_gclk entry in SAM9X7 clock description table.

---
 drivers/clk/at91/sam9x7.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/clk/at91/sam9x7.c +9 -0
index 68e569bd70f5..8b52da194849 100644
@@ -568,6 +568,15 @@ static const struct {
 		.pp_chg_id = INT_MIN,
 	},
 
+	{
+		.n = "gmac_gclk",
+		.id = 24,
+		.pp = { "audiopll_divpmcck", "plla_div2pmcck", },
+		.pp_mux_table = { 6, 8, },
+		.pp_count = 2,
+		.pp_chg_id = INT_MIN,
+	},
+
 	{
 		.n = "lcd_gclk",
 		.id = 25,
Signature · 1 line
2.53.0
author
#6 lore raw

PATCH v2 4/4 ARM: dts: microchip: sam9x7: fix GMAC clock configuration

In reply to Mihai Sain

The GMAC node incorrectly listed four clocks, including a separate tx_clk and a TSU GCK clock sourced from ID 67.
According to the SAM9X7 clocking scheme, the GMAC uses only three
clocks: HCLK, PCLK, and the TSU GCK derived from the GMAC peripheral clock (ID 24).

This patch removes the unused tx_clk, updates the clock-names accordingly, and corrects the assigned clock to use GCK 24 instead of GCK 67. This aligns the device tree with the actual hardware clock topology and prevents misconfiguration of the GMAC clock tree.

[root@SAM9X75 ~]$ cat /sys/kernel/debug/clk/clk_summary | grep gmac

gmac_gclk      1       1        1        266666666   0          0     50000      Y         f802c000.ethernet           tsu_clk
                                                                                           f802c000.ethernet           tsu_clk
gmac_clk       2       2        0        266666666   0          0     50000      Y         f802c000.ethernet           hclk
                                                                                           f802c000.ethernet           pclk
Fixes 41af45af8bc3 ("ARM: dts: at91: sam9x7: add device tree for SoC")
---
 arch/arm/boot/dts/microchip/sam9x7.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/microchip/sam9x7.dtsi +3 -3
index 46dacbbd201d..a42716e18da3 100644
@@ -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>, <&pmc PMC_TYPE_GCK 67>;
-			clock-names = "hclk", "pclk", "tx_clk", "tsu_clk";
-			assigned-clocks = <&pmc PMC_TYPE_GCK 67>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 24>;
+			clock-names = "hclk", "pclk", "tsu_clk";
+			assigned-clocks = <&pmc PMC_TYPE_GCK 24>;
 			assigned-clock-rates = <266666666>;
 			status = "disabled";
 		};
Signature · 1 line
2.53.0