Skip to contentSkip to conversation

clk: mediatek: mt7981: clk migration for OF_UPSTREAM

PATCH In review Christian Marangi 2 participants 16 messages Aug 2, 2024 – Aug 20, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover clk: mediatek: mt7981: clk migration for OF_UPSTREAM

These are all the required patches to migrate clk and correctly support OF_UPSTREAM. This will align the clk index to upstream to support the same clk implementation with downstream and upstream DTS.

Christian Marangi (14):
clk: mediatek: mt7981: add missing clock for infra_ipcie_pipe
clk: mediatek: mt7981: fix typo for infra_i2c0_ck
clk: mediatek: mt7981: fix wrong mux width for pwm2 and pwm1 clock
clk: mediatek: mt7981: fix wrong clock definition for spi2
clk: mediatek: mt7981: add missing clock for spi1 node
clk: mediatek: mt7981: swap wrong clock-names for spi nodes
clk: mediatek: mt7981: fix wrong parent for TOP_FAUD clock
clk: mediatek: mt7981: fix wrong parent list for INFRA_PWM1_SEL mux
clk: mediatek: mt7981: implement sgmii0/1 clock
clk: mediatek: mt7981: drop 1/1 spurious factor
clk: mediatek: mt7981: replace infracfg ID with upstream linux
clk: mediatek: mt7981: fix support for pwm3 clock
clk: mediatek: mt7981: convert to unified infracfg gates + muxes
clk: mediatek: mt7981: rename CK to CLK

 arch/arm/dts/mt7981.dtsi               | 124 ++---
 drivers/clk/mediatek/clk-mt7981.c      | 735 +++++++++++++------------
 include/dt-bindings/clock/mt7981-clk.h | 429 +++++++--------
 3 files changed, 642 insertions(+), 646 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/14 clk: mediatek: mt7981: add missing clock for infra_ipcie_pipe

Add missing clock for infra_ipcie_pipe to make PCIe correctly work. This clock is a parent of the fixed clock from topckgen cb_cksq_40m.

---
 drivers/clk/mediatek/clk-mt7981.c      | 1 +
 include/dt-bindings/clock/mt7981-clk.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt7981.c +1 -0
index 13dc3df0e9e..7a699162421 100644
@@ -515,6 +515,7 @@ static const struct mtk_gate infracfg_ao_gates[] = {
 	GATE_INFRA2(CK_INFRA_IUSB_CK, "infra_iusb", CK_INFRA_USB_CK, 3),
 	GATE_INFRA2(CK_INFRA_IPCIE_CK, "infra_ipcie",
 		    CK_INFRA_PCIE_GFMUX_TL_O_PRE, 12),
+	GATE_INFRA2(CK_INFRA_IPCIE_PIPE_CK, "infra_ipcie_pipe", CK_TOP_CB_CKSQ_40M, 13),
 	GATE_INFRA2(CK_INFRA_IPCIER_CK, "infra_ipcier", CK_INFRA_F26M_CK0, 14),
 	GATE_INFRA2(CK_INFRA_IPCIEB_CK, "infra_ipcieb", CK_INFRA_133M_PHCK, 15),
 };
include/dt-bindings/clock/mt7981-clk.h +2 -1
index e24c759e499..1c2781cd765 100644
@@ -226,7 +226,8 @@
 #define CK_INFRA_IPCIE_CK		(54 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_IPCIER_CK		(55 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_IPCIEB_CK		(56 - INFRACFG_AO_OFFSET)
-#define CLK_INFRA_AO_NR_CLK		(57 - INFRACFG_AO_OFFSET)
+#define CK_INFRA_IPCIE_PIPE_CK		(57 - INFRACFG_AO_OFFSET)
+#define CLK_INFRA_AO_NR_CLK		(58 - INFRACFG_AO_OFFSET)
 
 /* APMIXEDSYS */
 
Signature · 1 line
2.45.2
#2 lore raw

PATCH 2/14 clk: mediatek: mt7981: fix typo for infra_i2c0_ck

In reply to Christian Marangi

Fix a typo for infra_i2c0_ck where 0 was misspelled as O.

---
 arch/arm/dts/mt7981.dtsi               | 2 +-
 drivers/clk/mediatek/clk-mt7981.c      | 2 +-
 include/dt-bindings/clock/mt7981-clk.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/dts/mt7981.dtsi +1 -1
index 7aaa7770f83..1056667ba65 100644
@@ -158,7 +158,7 @@
 		      <0x10217080 0x80>;
 		interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
 		clock-div = <1>;
-		clocks = <&infracfg_ao CK_INFRA_I2CO_CK>,
+		clocks = <&infracfg_ao CK_INFRA_I2C0_CK>,
 			 <&infracfg_ao CK_INFRA_AP_DMA_CK>;
 		clock-names = "main", "dma";
 		#address-cells = <1>;
drivers/clk/mediatek/clk-mt7981.c +1 -1
index 7a699162421..69d018b817a 100644
@@ -474,7 +474,7 @@ static const struct mtk_gate infracfg_ao_gates[] = {
 	GATE_INFRA0(CK_INFRA_SEJ_CK, "infra_sej", CK_INFRA_66M_MCK, 24),
 	GATE_INFRA0(CK_INFRA_SEJ_13M_CK, "infra_sej_13m", CK_INFRA_CK_F26M, 25),
 	GATE_INFRA1(CK_INFRA_THERM_CK, "infra_therm", CK_INFRA_CK_F26M, 0),
-	GATE_INFRA1(CK_INFRA_I2CO_CK, "infra_i2co", CK_INFRA_I2CS_CK, 1),
+	GATE_INFRA1(CK_INFRA_I2C0_CK, "infra_i2c0", CK_INFRA_I2CS_CK, 1),
 	GATE_INFRA1(CK_INFRA_UART0_CK, "infra_uart0", CK_INFRA_MUX_UART0, 2),
 	GATE_INFRA1(CK_INFRA_UART1_CK, "infra_uart1", CK_INFRA_MUX_UART1, 3),
 	GATE_INFRA1(CK_INFRA_UART2_CK, "infra_uart2", CK_INFRA_MUX_UART2, 4),
include/dt-bindings/clock/mt7981-clk.h +1 -1
index 1c2781cd765..2dae6766ac3 100644
@@ -196,7 +196,7 @@
 #define CK_INFRA_SEJ_CK			(24 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_SEJ_13M_CK		(25 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_THERM_CK		(26 - INFRACFG_AO_OFFSET)
-#define CK_INFRA_I2CO_CK		(27 - INFRACFG_AO_OFFSET)
+#define CK_INFRA_I2C0_CK		(27 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_UART0_CK		(28 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_UART1_CK		(29 - INFRACFG_AO_OFFSET)
 #define CK_INFRA_UART2_CK		(30 - INFRACFG_AO_OFFSET)
Signature · 1 line
2.45.2
#3 lore raw

PATCH 3/14 clk: mediatek: mt7981: fix wrong mux width for pwm2 and pwm1 clock

In reply to Christian Marangi

Fix wrong mux width for pwm2 and pwm1. Upstream have width 1 but U-Boot have width set to 2. Change the value to follow upstream implementation.

---
 drivers/clk/mediatek/clk-mt7981.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-mt7981.c +2 -2
index 69d018b817a..6e770de99cf 100644
@@ -404,9 +404,9 @@ static const struct mtk_composite infra_muxes[] = {
 	INFRA_MUX(CK_INFRA_SPI2_SEL, "infra_spi2_sel", infra_spi0_parents, 0x10,
 		  6, 1),
 	INFRA_MUX(CK_INFRA_PWM1_SEL, "infra_pwm1_sel", infra_pwm1_parents, 0x10,
-		  9, 2),
+		  9, 1),
 	INFRA_MUX(CK_INFRA_PWM2_SEL, "infra_pwm2_sel", infra_pwm1_parents, 0x10,
-		  11, 2),
+		  11, 1),
 	INFRA_MUX(CK_INFRA_PWM_BSEL, "infra_pwm_bsel", infra_pwm_bsel_parents,
 		  0x10, 13, 2),
 	INFRA_MUX(CK_INFRA_PCIE_SEL, "infra_pcie_sel", infra_pcie_parents, 0x20,
Signature · 1 line
2.45.2
#4 lore raw

PATCH 4/14 clk: mediatek: mt7981: fix wrong clock definition for spi2

In reply to Christian Marangi

Fix wrong clock definition for spi2 node as they reference spi0 clock instead of spi2.

---
 arch/arm/dts/mt7981.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/mt7981.dtsi +2 -2
index 1056667ba65..131adc00a56 100644
@@ -286,10 +286,10 @@
 	spi2: spi@11009000 {
 		compatible = "mediatek,ipm-spi";
 		reg = <0x11009000 0x100>;
-		clocks = <&infracfg_ao CK_INFRA_SPI0_CK>,
+		clocks = <&infracfg_ao CK_INFRA_SPI2_CK>,
 			 <&topckgen CK_TOP_SPI_SEL>;
 		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
-				  <&infracfg CK_INFRA_SPI0_SEL>;
+				  <&infracfg CK_INFRA_SPI2_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
 					 <&topckgen CK_INFRA_ISPI0>;
 		clock-names = "sel-clk", "spi-clk";
Signature · 1 line
2.45.2
#5 lore raw

PATCH 5/14 clk: mediatek: mt7981: add missing clock for spi1 node

In reply to Christian Marangi

Add missing clock for spi1 node. Clocks taken from upstream clock definition and clock mux.

---
 arch/arm/dts/mt7981.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/dts/mt7981.dtsi +7 -0
index 131adc00a56..d80eceb8d4c 100644
@@ -280,6 +280,13 @@
 		compatible = "mediatek,ipm-spi";
 		reg = <0x1100b000 0x100>;
 		interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&infracfg_ao CK_INFRA_SPI1_CK>,
+			 <&topckgen CK_TOP_SPIM_MST_SEL>;
+		assigned-clocks = <&topckgen CK_TOP_SPIM_MST_SEL>,
+				  <&infracfg CK_INFRA_SPI1_SEL>;
+		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
+					 <&topckgen CK_INFRA_ISPI1>;
+		clock-names = "sel-clk", "spi-clk";
 		status = "disabled";
 	};
 
Signature · 1 line
2.45.2
#6 lore raw

PATCH 6/14 clk: mediatek: mt7981: swap wrong clock-names for spi nodes

In reply to Christian Marangi

Swap wrong clock-names for spi nodes as they were wrong and the spi-clk was referencing the sel-clk and the sel-clk was referencing the spi-clk.

---
 arch/arm/dts/mt7981.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/dts/mt7981.dtsi +3 -3
index d80eceb8d4c..be0d42bc997 100644
@@ -271,7 +271,7 @@
 				  <&infracfg CK_INFRA_SPI0_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
 					 <&topckgen CK_INFRA_ISPI0>;
-		clock-names = "sel-clk", "spi-clk";
+		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
@@ -286,7 +286,7 @@
 				  <&infracfg CK_INFRA_SPI1_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
 					 <&topckgen CK_INFRA_ISPI1>;
-		clock-names = "sel-clk", "spi-clk";
+		clock-names = "spi-clk", "sel-clk";
 		status = "disabled";
 	};
 
@@ -299,7 +299,7 @@
 				  <&infracfg CK_INFRA_SPI2_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
 					 <&topckgen CK_INFRA_ISPI0>;
-		clock-names = "sel-clk", "spi-clk";
+		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
Signature · 1 line
2.45.2
#7 lore raw

PATCH 7/14 clk: mediatek: mt7981: fix wrong parent for TOP_FAUD clock

In reply to Christian Marangi

Fix wrong parent for TOP_FAUD clock. Upstream linux sets the parent for TOP_FAUD to TOP_AUD_SEL instead of CB_CKSQ_40M.

---
 drivers/clk/mediatek/clk-mt7981.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt7981.c +1 -1
index 6e770de99cf..0ec5c943081 100644
@@ -89,7 +89,7 @@ static const struct mtk_fixed_factor top_fixed_divs[] = {
 	TOP_FACTOR(CK_TOP_CB_RTC_32P7K, "cb_rtc_32p7k", CK_TOP_CB_CKSQ_40M, 1,
 		   1220),
 	TOP_FACTOR(CK_TOP_USB_TX250M, "usb_tx250m", CK_TOP_CB_CKSQ_40M, 1, 1),
-	TOP_FACTOR(CK_TOP_FAUD, "faud", CK_TOP_CB_CKSQ_40M, 1, 1),
+	TOP_FACTOR(CK_TOP_FAUD, "faud", CK_TOP_AUD_SEL, 1, 1),
 	TOP_FACTOR(CK_TOP_NFI1X, "nfi1x", CK_TOP_NFI1X_SEL, 1, 1),
 	TOP_FACTOR(CK_TOP_USB_EQ_RX250M, "usb_eq_rx250m", CK_TOP_CB_CKSQ_40M, 1,
 		   1),
Signature · 1 line
2.45.2
#8 lore raw

PATCH 8/14 clk: mediatek: mt7981: fix wrong parent list for INFRA_PWM1_SEL mux

In reply to Christian Marangi

Fix wrong parent list for INFRA_PWM1_SEL mux. The list is incorrect and the parents are just 2. This also match the upstream linux implementation.

---
 drivers/clk/mediatek/clk-mt7981.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt7981.c +1 -1
index 0ec5c943081..8b2e667c049 100644
@@ -373,7 +373,7 @@ static const int infra_spi0_parents[] = { CK_INFRA_I2C, CK_INFRA_ISPI0 };
 
 static const int infra_spi1_parents[] = { CK_INFRA_I2C, CK_INFRA_ISPI1 };
 
-static const int infra_pwm1_parents[] = { -1, -1, -1, CK_INFRA_PWM };
+static const int infra_pwm1_parents[] = {-1, CK_INFRA_PWM };
 
 static const int infra_pwm_bsel_parents[] = { -1, -1, -1, CK_INFRA_PWM };
 
Signature · 1 line
2.45.2
#9 lore raw

PATCH 9/14 clk: mediatek: mt7981: implement sgmii0/1 clock

In reply to Christian Marangi

Implement missing sgmii0/1 clock and update the compatible the DTS to match upstream kernel linux and in preparation for OF_UPSTREAM support since the ethernet node define these additional clocks.

---
 arch/arm/dts/mt7981.dtsi          |  4 +-
 drivers/clk/mediatek/clk-mt7981.c | 68 +++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 2 deletions(-)
arch/arm/dts/mt7981.dtsi +2 -2
index be0d42bc997..1be1b797b3e 100644
@@ -244,14 +244,14 @@
 	};
 
 	sgmiisys0: syscon@10060000 {
-		compatible = "mediatek,mt7986-sgmiisys", "syscon";
+		compatible = "mediatek,mt7981-sgmiisys_0", "syscon";
 		reg = <0x10060000 0x1000>;
 		pn_swap;
 		#clock-cells = <1>;
 	};
 
 	sgmiisys1: syscon@10070000 {
-		compatible = "mediatek,mt7986-sgmiisys", "syscon";
+		compatible = "mediatek,mt7981-sgmiisys_1", "syscon";
 		reg = <0x10070000 0x1000>;
 		#clock-cells = <1>;
 	};
drivers/clk/mediatek/clk-mt7981.c +68 -0

74 lines not on this page · raw message

Signature · 1 line
2.45.2
#10 lore raw

PATCH 10/14 clk: mediatek: mt7981: drop 1/1 spurious factor

In reply to Christian Marangi

Now that we can have advanced parent handling for mux, we can drop spurious infracfg 1/1 factor. This is in preparation to make the clk ID match the ID in upstream include for mt7981.

Drop the factor entry from mt7981-clk.h and reference to them in mt7981.dtsi. Muxes and gates are updated to reference the topckgen clk following how it's done in upstream kernel linux. Add relevant clk type flag in clk_tree for infracfg and topckgen.

---
 arch/arm/dts/mt7981.dtsi               |  14 +-
 drivers/clk/mediatek/clk-mt7981.c      | 250 ++++++++++++-------------
 include/dt-bindings/clock/mt7981-clk.h |  40 +---
 3 files changed, 127 insertions(+), 177 deletions(-)
arch/arm/dts/mt7981.dtsi +7 -7
index 1be1b797b3e..fc13b90caf6 100644
@@ -140,7 +140,7 @@
 		#clock-cells = <1>;
 		#pwm-cells = <2>;
 		interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg CK_INFRA_PWM>,
+		clocks = <&topckgen CK_TOP_PWM_SEL>,
 			 <&infracfg_ao CK_INFRA_PWM_BSEL>,
 			 <&infracfg_ao CK_INFRA_PWM1_CK>,
 			 <&infracfg_ao CK_INFRA_PWM2_CK>,
@@ -174,7 +174,7 @@
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
 				  <&infracfg_ao CK_INFRA_UART0_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&infracfg CK_INFRA_UART>;
+					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 		bootph-all;
@@ -188,7 +188,7 @@
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
 				  <&infracfg_ao CK_INFRA_UART1_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&infracfg CK_INFRA_UART>;
+					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 	};
@@ -201,7 +201,7 @@
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
 				  <&infracfg_ao CK_INFRA_UART2_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&infracfg CK_INFRA_UART>;
+					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 	};
@@ -270,7 +270,7 @@
 		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
 				  <&infracfg CK_INFRA_SPI0_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_INFRA_ISPI0>;
+					 <&topckgen CK_TOP_SPI_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
@@ -285,7 +285,7 @@
 		assigned-clocks = <&topckgen CK_TOP_SPIM_MST_SEL>,
 				  <&infracfg CK_INFRA_SPI1_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_INFRA_ISPI1>;
+					 <&topckgen CK_TOP_SPIM_MST_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		status = "disabled";
 	};
@@ -298,7 +298,7 @@
 		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
 				  <&infracfg CK_INFRA_SPI2_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_INFRA_ISPI0>;
+					 <&topckgen CK_TOP_SPI_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
drivers/clk/mediatek/clk-mt7981.c +118 -132

306 lines not on this page · raw message

include/dt-bindings/clock/mt7981-clk.h +2 -38
index 2dae6766ac3..8a6f5cb319e 100644
@@ -10,44 +10,8 @@
 
 /* INFRACFG */
 
-#define CK_INFRA_CK_F26M		0
-#define CK_INFRA_UART			1
-#define CK_INFRA_ISPI0			2
-#define CK_INFRA_I2C			3
-#define CK_INFRA_ISPI1			4
-#define CK_INFRA_PWM			5
-#define CK_INFRA_66M_MCK		6
-#define CK_INFRA_CK_F32K		7
-#define CK_INFRA_PCIE_CK		8
-#define CK_INFRA_PWM_BCK		9
-#define CK_INFRA_PWM_CK1		10
-#define CK_INFRA_PWM_CK2		11
-#define CK_INFRA_133M_HCK		12
-#define CK_INFRA_66M_PHCK		13
-#define CK_INFRA_FAUD_L_CK		14
-#define CK_INFRA_FAUD_AUD_CK		15
-#define CK_INFRA_FAUD_EG2_CK		16
-#define CK_INFRA_I2CS_CK		17
-#define CK_INFRA_MUX_UART0		18
-#define CK_INFRA_MUX_UART1		19
-#define CK_INFRA_MUX_UART2		20
-#define CK_INFRA_NFI_CK			21
-#define CK_INFRA_SPINFI_CK		22
-#define CK_INFRA_MUX_SPI0		23
-#define CK_INFRA_MUX_SPI1		24
-#define CK_INFRA_MUX_SPI2		25
-#define CK_INFRA_RTC_32K		26
-#define CK_INFRA_FMSDC_CK		27
-#define CK_INFRA_FMSDC_HCK_CK		28
-#define CK_INFRA_PERI_133M		29
-#define CK_INFRA_133M_PHCK		30
-#define CK_INFRA_USB_SYS_CK		31
-#define CK_INFRA_USB_CK			32
-#define CK_INFRA_USB_XHCI_CK		33
-#define CK_INFRA_PCIE_GFMUX_TL_O_PRE	34
-#define CK_INFRA_F26M_CK0		35
-#define CK_INFRA_133M_MCK		36
-#define CLK_INFRA_NR_CLK		37
+#define CK_INFRA_66M_MCK		0
+#define CLK_INFRA_NR_CLK		1
 
 /* TOPCKGEN */
 
Signature · 1 line
2.45.2
#11 lore raw

PATCH 11/14 clk: mediatek: mt7981: replace infracfg ID with upstream linux

In reply to Christian Marangi

Replace infracfg clk ID with upstream linux version.

Add some missing clk for PWM3 and for PCIe. The same format is used here with the factor first, then mux and then gates.

To correctly reference the gates in clk_gate function, define the gates_offs value in clk_tree now that they are at an offset from mux and factor.

---
 drivers/clk/mediatek/clk-mt7981.c      |   1 +
 include/dt-bindings/clock/mt7981-clk.h | 136 ++++++++++++-------------
 2 files changed, 66 insertions(+), 71 deletions(-)
drivers/clk/mediatek/clk-mt7981.c +1 -0
index aaaebd46791..4435430dcde 100644
@@ -523,6 +523,7 @@ static const struct mtk_clk_tree mt7981_topckgen_clk_tree = {
 static const struct mtk_clk_tree mt7981_infracfg_clk_tree = {
 	.fdivs_offs = CK_INFRA_66M_MCK,
 	.muxes_offs = CK_INFRA_UART0_SEL,
+	.gates_offs = CK_INFRA_GPT_STA,
 	.fdivs = infra_fixed_divs,
 	.muxes = infra_muxes,
 	.flags = CLK_INFRASYS,
include/dt-bindings/clock/mt7981-clk.h +65 -71

150 lines not on this page · raw message

Signature · 1 line
2.45.2
#12 lore raw

PATCH 12/14 clk: mediatek: mt7981: fix support for pwm3 clock

In reply to Christian Marangi

Add and fix support for pwm3 clock. In the pwm DTSI node we were actually using PWM2 clock for PWM3. Now that we have correct ID also add the missing entry of gate and mux to support PWM3 clock.

---
 arch/arm/dts/mt7981.dtsi          | 3 +--
 drivers/clk/mediatek/clk-mt7981.c | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/dts/mt7981.dtsi +1 -2
index fc13b90caf6..b3f8a50cd10 100644
@@ -144,8 +144,7 @@
 			 <&infracfg_ao CK_INFRA_PWM_BSEL>,
 			 <&infracfg_ao CK_INFRA_PWM1_CK>,
 			 <&infracfg_ao CK_INFRA_PWM2_CK>,
-			 /* FIXME */
-			 <&infracfg_ao CK_INFRA_PWM2_CK>;
+			 <&infracfg_ao CK_INFRA_PWM3_CK>;
 		assigned-clocks = <&topckgen CK_TOP_PWM_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>;
 		clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
drivers/clk/mediatek/clk-mt7981.c +3 -0
index 4435430dcde..7b692186dc1 100644
@@ -381,6 +381,8 @@ static const struct mtk_composite infra_muxes[] = {
 		  9, 1),
 	INFRA_MUX(CK_INFRA_PWM2_SEL, "infra_pwm2_sel", infra_pwm1_parents, 0x10,
 		  11, 1),
+	INFRA_MUX(CK_INFRA_PWM3_SEL, "infra_pwm3_sel", infra_pwm1_parents, 0x10,
+		  15, 1),
 	INFRA_MUX(CK_INFRA_PWM_BSEL, "infra_pwm_bsel", infra_pwm_bsel_parents,
 		  0x10, 13, 2),
 	INFRA_MUX(CK_INFRA_PCIE_SEL, "infra_pcie_sel", infra_pcie_parents, 0x20,
@@ -445,6 +447,7 @@ static const struct mtk_gate infracfg_ao_gates[] = {
 	GATE_INFRA0_INFRA(CK_INFRA_PWM_STA, "infra_pwm_sta", CK_INFRA_PWM_BSEL, 2),
 	GATE_INFRA0_INFRA(CK_INFRA_PWM1_CK, "infra_pwm1", CK_INFRA_PWM1_SEL, 3),
 	GATE_INFRA0_INFRA(CK_INFRA_PWM2_CK, "infra_pwm2", CK_INFRA_PWM2_SEL, 4),
+	GATE_INFRA0_INFRA(CK_INFRA_PWM3_CK, "infra_pwm3", CK_INFRA_PWM3_SEL, 27),
 	GATE_INFRA0_TOP(CK_INFRA_CQ_DMA_CK, "infra_cq_dma", CK_TOP_SYSAXI, 6),
 	GATE_INFRA0_TOP(CK_INFRA_AUD_BUS_CK, "infra_aud_bus", CK_TOP_SYSAXI, 8),
 	GATE_INFRA0_TOP(CK_INFRA_AUD_26M_CK, "infra_aud_26m", CK_TOP_F26M_SEL, 9),
Signature · 1 line
2.45.2
#13 lore raw

PATCH 13/14 clk: mediatek: mt7981: convert to unified infracfg gates + muxes

In reply to Christian Marangi

Convert to infracfg gates + muxes implementation now that it's supported.

Drop infracfg-ao nodes and rename all infracfg-ao clocks to infracfg.

---
 arch/arm/dts/mt7981.dtsi          | 46 +++++++++++++------------------
 drivers/clk/mediatek/clk-mt7981.c | 26 ++---------------
 2 files changed, 22 insertions(+), 50 deletions(-)
arch/arm/dts/mt7981.dtsi +19 -27
index b3f8a50cd10..1c54fce7520 100644
@@ -98,14 +98,6 @@
 		bootph-all;
 	};
 
-	infracfg_ao: infracfg_ao@10001000 {
-		compatible = "mediatek,mt7981-infracfg_ao";
-		reg = <0x10001000 0x80>;
-		clock-parent = <&infracfg>;
-		#clock-cells = <1>;
-		bootph-all;
-	};
-
 	infracfg: infracfg@10001000 {
 		compatible = "mediatek,mt7981-infracfg";
 		reg = <0x10001000 0x30>;
@@ -141,10 +133,10 @@
 		#pwm-cells = <2>;
 		interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&topckgen CK_TOP_PWM_SEL>,
-			 <&infracfg_ao CK_INFRA_PWM_BSEL>,
-			 <&infracfg_ao CK_INFRA_PWM1_CK>,
-			 <&infracfg_ao CK_INFRA_PWM2_CK>,
-			 <&infracfg_ao CK_INFRA_PWM3_CK>;
+			 <&infracfg CK_INFRA_PWM_BSEL>,
+			 <&infracfg CK_INFRA_PWM1_CK>,
+			 <&infracfg CK_INFRA_PWM2_CK>,
+			 <&infracfg CK_INFRA_PWM3_CK>;
 		assigned-clocks = <&topckgen CK_TOP_PWM_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>;
 		clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
@@ -157,8 +149,8 @@
 		      <0x10217080 0x80>;
 		interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
 		clock-div = <1>;
-		clocks = <&infracfg_ao CK_INFRA_I2C0_CK>,
-			 <&infracfg_ao CK_INFRA_AP_DMA_CK>;
+		clocks = <&infracfg CK_INFRA_I2C0_CK>,
+			 <&infracfg CK_INFRA_AP_DMA_CK>;
 		clock-names = "main", "dma";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -169,9 +161,9 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11002000 0x400>;
 		interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg_ao CK_INFRA_UART0_CK>;
+		clocks = <&infracfg CK_INFRA_UART0_CK>;
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg_ao CK_INFRA_UART0_SEL>;
+				  <&infracfg CK_INFRA_UART0_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
 					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
@@ -183,9 +175,9 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11003000 0x400>;
 		interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg_ao CK_INFRA_UART1_CK>;
+		clocks = <&infracfg CK_INFRA_UART1_CK>;
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg_ao CK_INFRA_UART1_SEL>;
+				  <&infracfg CK_INFRA_UART1_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
 					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
@@ -196,9 +188,9 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11004000 0x400>;
 		interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg_ao CK_INFRA_UART2_CK>;
+		clocks = <&infracfg CK_INFRA_UART2_CK>;
 		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg_ao CK_INFRA_UART2_SEL>;
+				  <&infracfg CK_INFRA_UART2_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
 					 <&topckgen CK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
@@ -210,9 +202,9 @@
 		reg = <0x11005000 0x1000>,
 		      <0x11006000 0x1000>;
 		reg-names = "nfi", "ecc";
-		clocks = <&infracfg_ao CK_INFRA_SPINFI1_CK>,
-			 <&infracfg_ao CK_INFRA_NFI1_CK>,
-			 <&infracfg_ao CK_INFRA_NFI_HCK_CK>;
+		clocks = <&infracfg CK_INFRA_SPINFI1_CK>,
+			 <&infracfg CK_INFRA_NFI1_CK>,
+			 <&infracfg CK_INFRA_NFI_HCK_CK>;
 		clock-names = "pad_clk", "nfi_clk", "nfi_hclk";
 		assigned-clocks = <&topckgen CK_TOP_SPINFI_SEL>,
 				  <&topckgen CK_TOP_NFI1X_SEL>;
@@ -264,7 +256,7 @@
 	spi0: spi@1100a000 {
 		compatible = "mediatek,ipm-spi";
 		reg = <0x1100a000 0x100>;
-		clocks = <&infracfg_ao CK_INFRA_SPI0_CK>,
+		clocks = <&infracfg CK_INFRA_SPI0_CK>,
 			 <&topckgen CK_TOP_SPI_SEL>;
 		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
 				  <&infracfg CK_INFRA_SPI0_SEL>;
@@ -279,7 +271,7 @@
 		compatible = "mediatek,ipm-spi";
 		reg = <0x1100b000 0x100>;
 		interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg_ao CK_INFRA_SPI1_CK>,
+		clocks = <&infracfg CK_INFRA_SPI1_CK>,
 			 <&topckgen CK_TOP_SPIM_MST_SEL>;
 		assigned-clocks = <&topckgen CK_TOP_SPIM_MST_SEL>,
 				  <&infracfg CK_INFRA_SPI1_SEL>;
@@ -292,7 +284,7 @@
 	spi2: spi@11009000 {
 		compatible = "mediatek,ipm-spi";
 		reg = <0x11009000 0x100>;
-		clocks = <&infracfg_ao CK_INFRA_SPI2_CK>,
+		clocks = <&infracfg CK_INFRA_SPI2_CK>,
 			 <&topckgen CK_TOP_SPI_SEL>;
 		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
 				  <&infracfg CK_INFRA_SPI2_SEL>;
@@ -310,7 +302,7 @@
 		interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&topckgen CK_TOP_EMMC_400M>,
 			 <&topckgen CK_TOP_EMMC_208M>,
-			 <&infracfg_ao CK_INFRA_MSDC_CK>;
+			 <&infracfg CK_INFRA_MSDC_CK>;
 		assigned-clocks = <&topckgen CK_TOP_EMMC_400M_SEL>,
 				  <&topckgen CK_TOP_EMMC_208M_SEL>;
 		assigned-clock-parents = <&topckgen CK_TOP_CB_NET2_D2>,
drivers/clk/mediatek/clk-mt7981.c +3 -23
index 7b692186dc1..2c10e36dfec 100644
@@ -441,7 +441,7 @@ static const struct mtk_gate_regs infra_2_cg_regs = {
 	GATE_INFRA2(_id, _name, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN)
 
 /* INFRA GATE */
-static const struct mtk_gate infracfg_ao_gates[] = {
+static const struct mtk_gate infracfg_gates[] = {
 	GATE_INFRA0_INFRA(CK_INFRA_GPT_STA, "infra_gpt_sta", CK_INFRA_66M_MCK, 0),
 	GATE_INFRA0_INFRA(CK_INFRA_PWM_HCK, "infra_pwm_hck", CK_INFRA_66M_MCK, 1),
 	GATE_INFRA0_INFRA(CK_INFRA_PWM_STA, "infra_pwm_sta", CK_INFRA_PWM_BSEL, 2),
@@ -529,6 +529,7 @@ static const struct mtk_clk_tree mt7981_infracfg_clk_tree = {
 	.gates_offs = CK_INFRA_GPT_STA,
 	.fdivs = infra_fixed_divs,
 	.muxes = infra_muxes,
+	.gates = infracfg_gates,
 	.flags = CLK_INFRASYS,
 };
 
@@ -583,20 +584,9 @@ static const struct udevice_id mt7981_infracfg_compat[] = {
 	{}
 };
 
-static const struct udevice_id mt7981_infracfg_ao_compat[] = {
-	{ .compatible = "mediatek,mt7981-infracfg_ao" },
-	{}
-};
-
 static int mt7981_infracfg_probe(struct udevice *dev)
 {
-	return mtk_common_clk_init(dev, &mt7981_infracfg_clk_tree);
-}
-
-static int mt7981_infracfg_ao_probe(struct udevice *dev)
-{
-	return mtk_common_clk_gate_init(dev, &mt7981_infracfg_clk_tree,
-					infracfg_ao_gates);
+	return mtk_common_clk_infrasys_init(dev, &mt7981_infracfg_clk_tree);
 }
 
 U_BOOT_DRIVER(mtk_clk_infracfg) = {
@@ -609,16 +599,6 @@ U_BOOT_DRIVER(mtk_clk_infracfg) = {
 	.flags = DM_FLAG_PRE_RELOC,
 };
 
-U_BOOT_DRIVER(mtk_clk_infracfg_ao) = {
-	.name = "mt7981-clock-infracfg-ao",
-	.id = UCLASS_CLK,
-	.of_match = mt7981_infracfg_ao_compat,
-	.probe = mt7981_infracfg_ao_probe,
-	.priv_auto = sizeof(struct mtk_cg_priv),
-	.ops = &mtk_clk_gate_ops,
-	.flags = DM_FLAG_PRE_RELOC,
-};
-
 /* sgmiisys */
 static const struct mtk_gate_regs sgmii_cg_regs = {
 	.set_ofs = 0xe4,
Signature · 1 line
2.45.2
#14 lore raw

PATCH 14/14 clk: mediatek: mt7981: rename CK to CLK

In reply to Christian Marangi

Rename each entry from CK to CLK to match the include in upstream kernel linux.

---
 arch/arm/dts/mt7981.dtsi               | 112 ++---
 drivers/clk/mediatek/clk-mt7981.c      | 552 ++++++++++++-------------
 include/dt-bindings/clock/mt7981-clk.h | 382 ++++++++---------
 3 files changed, 523 insertions(+), 523 deletions(-)
arch/arm/dts/mt7981.dtsi +56 -56
index 1c54fce7520..a9991a121f1 100644
@@ -132,13 +132,13 @@
 		#clock-cells = <1>;
 		#pwm-cells = <2>;
 		interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&topckgen CK_TOP_PWM_SEL>,
-			 <&infracfg CK_INFRA_PWM_BSEL>,
-			 <&infracfg CK_INFRA_PWM1_CK>,
-			 <&infracfg CK_INFRA_PWM2_CK>,
-			 <&infracfg CK_INFRA_PWM3_CK>;
-		assigned-clocks = <&topckgen CK_TOP_PWM_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>;
+		clocks = <&topckgen CLK_TOP_PWM_SEL>,
+			 <&infracfg CLK_INFRA_PWM_BSEL>,
+			 <&infracfg CLK_INFRA_PWM1_CK>,
+			 <&infracfg CLK_INFRA_PWM2_CK>,
+			 <&infracfg CLK_INFRA_PWM3_CK>;
+		assigned-clocks = <&topckgen CLK_TOP_PWM_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_CKSQ_40M>;
 		clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
 		status = "disabled";
 	};
@@ -149,8 +149,8 @@
 		      <0x10217080 0x80>;
 		interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
 		clock-div = <1>;
-		clocks = <&infracfg CK_INFRA_I2C0_CK>,
-			 <&infracfg CK_INFRA_AP_DMA_CK>;
+		clocks = <&infracfg CLK_INFRA_I2C0_CK>,
+			 <&infracfg CLK_INFRA_AP_DMA_CK>;
 		clock-names = "main", "dma";
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -161,11 +161,11 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11002000 0x400>;
 		interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg CK_INFRA_UART0_CK>;
-		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg CK_INFRA_UART0_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&topckgen CK_TOP_UART_SEL>;
+		clocks = <&infracfg CLK_INFRA_UART0_CK>;
+		assigned-clocks = <&topckgen CLK_TOP_UART_SEL>,
+				  <&infracfg CLK_INFRA_UART0_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_CKSQ_40M>,
+					 <&topckgen CLK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 		bootph-all;
@@ -175,11 +175,11 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11003000 0x400>;
 		interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg CK_INFRA_UART1_CK>;
-		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg CK_INFRA_UART1_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&topckgen CK_TOP_UART_SEL>;
+		clocks = <&infracfg CLK_INFRA_UART1_CK>;
+		assigned-clocks = <&topckgen CLK_TOP_UART_SEL>,
+				  <&infracfg CLK_INFRA_UART1_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_CKSQ_40M>,
+					 <&topckgen CLK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 	};
@@ -188,11 +188,11 @@
 		compatible = "mediatek,hsuart";
 		reg = <0x11004000 0x400>;
 		interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg CK_INFRA_UART2_CK>;
-		assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
-				  <&infracfg CK_INFRA_UART2_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
-					 <&topckgen CK_TOP_UART_SEL>;
+		clocks = <&infracfg CLK_INFRA_UART2_CK>;
+		assigned-clocks = <&topckgen CLK_TOP_UART_SEL>,
+				  <&infracfg CLK_INFRA_UART2_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_CKSQ_40M>,
+					 <&topckgen CLK_TOP_UART_SEL>;
 		mediatek,force-highspeed;
 		status = "disabled";
 	};
@@ -202,14 +202,14 @@
 		reg = <0x11005000 0x1000>,
 		      <0x11006000 0x1000>;
 		reg-names = "nfi", "ecc";
-		clocks = <&infracfg CK_INFRA_SPINFI1_CK>,
-			 <&infracfg CK_INFRA_NFI1_CK>,
-			 <&infracfg CK_INFRA_NFI_HCK_CK>;
+		clocks = <&infracfg CLK_INFRA_SPINFI1_CK>,
+			 <&infracfg CLK_INFRA_NFI1_CK>,
+			 <&infracfg CLK_INFRA_NFI_HCK_CK>;
 		clock-names = "pad_clk", "nfi_clk", "nfi_hclk";
-		assigned-clocks = <&topckgen CK_TOP_SPINFI_SEL>,
-				  <&topckgen CK_TOP_NFI1X_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D8>,
-					 <&topckgen CK_TOP_CB_M_D8>;
+		assigned-clocks = <&topckgen CLK_TOP_SPINFI_SEL>,
+				  <&topckgen CLK_TOP_NFI1X_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_M_D8>,
+					 <&topckgen CLK_TOP_CB_M_D8>;
 		status = "disabled";
 	};
 
@@ -256,12 +256,12 @@
 	spi0: spi@1100a000 {
 		compatible = "mediatek,ipm-spi";
 		reg = <0x1100a000 0x100>;
-		clocks = <&infracfg CK_INFRA_SPI0_CK>,
-			 <&topckgen CK_TOP_SPI_SEL>;
-		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
-				  <&infracfg CK_INFRA_SPI0_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_TOP_SPI_SEL>;
+		clocks = <&infracfg CLK_INFRA_SPI0_CK>,
+			 <&topckgen CLK_TOP_SPI_SEL>;
+		assigned-clocks = <&topckgen CLK_TOP_SPI_SEL>,
+				  <&infracfg CLK_INFRA_SPI0_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_M_D2>,
+					 <&topckgen CLK_TOP_SPI_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
@@ -271,12 +271,12 @@
 		compatible = "mediatek,ipm-spi";
 		reg = <0x1100b000 0x100>;
 		interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&infracfg CK_INFRA_SPI1_CK>,
-			 <&topckgen CK_TOP_SPIM_MST_SEL>;
-		assigned-clocks = <&topckgen CK_TOP_SPIM_MST_SEL>,
-				  <&infracfg CK_INFRA_SPI1_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_TOP_SPIM_MST_SEL>;
+		clocks = <&infracfg CLK_INFRA_SPI1_CK>,
+			 <&topckgen CLK_TOP_SPIM_MST_SEL>;
+		assigned-clocks = <&topckgen CLK_TOP_SPIM_MST_SEL>,
+				  <&infracfg CLK_INFRA_SPI1_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_M_D2>,
+					 <&topckgen CLK_TOP_SPIM_MST_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		status = "disabled";
 	};
@@ -284,12 +284,12 @@
 	spi2: spi@11009000 {
 		compatible = "mediatek,ipm-spi";
 		reg = <0x11009000 0x100>;
-		clocks = <&infracfg CK_INFRA_SPI2_CK>,
-			 <&topckgen CK_TOP_SPI_SEL>;
-		assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
-				  <&infracfg CK_INFRA_SPI2_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
-					 <&topckgen CK_TOP_SPI_SEL>;
+		clocks = <&infracfg CLK_INFRA_SPI2_CK>,
+			 <&topckgen CLK_TOP_SPI_SEL>;
+		assigned-clocks = <&topckgen CLK_TOP_SPI_SEL>,
+				  <&infracfg CLK_INFRA_SPI2_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_M_D2>,
+					 <&topckgen CLK_TOP_SPI_SEL>;
 		clock-names = "spi-clk", "sel-clk";
 		interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
@@ -300,13 +300,13 @@
 		reg = <0x11230000 0x1000>,
 		      <0x11C20000 0x1000>;
 		interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&topckgen CK_TOP_EMMC_400M>,
-			 <&topckgen CK_TOP_EMMC_208M>,
-			 <&infracfg CK_INFRA_MSDC_CK>;
-		assigned-clocks = <&topckgen CK_TOP_EMMC_400M_SEL>,
-				  <&topckgen CK_TOP_EMMC_208M_SEL>;
-		assigned-clock-parents = <&topckgen CK_TOP_CB_NET2_D2>,
-					 <&topckgen CK_TOP_CB_M_D2>;
+		clocks = <&topckgen CLK_TOP_EMMC_400M>,
+			 <&topckgen CLK_TOP_EMMC_208M>,
+			 <&infracfg CLK_INFRA_MSDC_CK>;
+		assigned-clocks = <&topckgen CLK_TOP_EMMC_400M_SEL>,
+				  <&topckgen CLK_TOP_EMMC_208M_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_CB_NET2_D2>,
+					 <&topckgen CLK_TOP_CB_M_D2>;
 		clock-names = "source", "hclk", "source_cg";
 		status = "disabled";
 	};
drivers/clk/mediatek/clk-mt7981.c +276 -276

738 lines not on this page · raw message

include/dt-bindings/clock/mt7981-clk.h +191 -191

408 lines not on this page · raw message

Signature · 1 line
2.45.2
#15 lore raw
In reply to Christian Marangi
Quoted 20 lines · Christian Marangi

These are all the required patches to migrate clk and correctly support OF_UPSTREAM. This will align the clk index to upstream to support the same clk implementation with downstream and upstream DTS.

Christian Marangi (14):
clk: mediatek: mt7981: add missing clock for infra_ipcie_pipe
clk: mediatek: mt7981: fix typo for infra_i2c0_ck
clk: mediatek: mt7981: fix wrong mux width for pwm2 and pwm1 clock
clk: mediatek: mt7981: fix wrong clock definition for spi2
clk: mediatek: mt7981: add missing clock for spi1 node
clk: mediatek: mt7981: swap wrong clock-names for spi nodes
clk: mediatek: mt7981: fix wrong parent for TOP_FAUD clock
clk: mediatek: mt7981: fix wrong parent list for INFRA_PWM1_SEL mux
clk: mediatek: mt7981: implement sgmii0/1 clock
clk: mediatek: mt7981: drop 1/1 spurious factor
clk: mediatek: mt7981: replace infracfg ID with upstream linux
clk: mediatek: mt7981: fix support for pwm3 clock
clk: mediatek: mt7981: convert to unified infracfg gates + muxes
clk: mediatek: mt7981: rename CK to CLK

Quoted 1 line

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom