devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs
@ 2024-06-12 23:17 Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs Bryan Brattlof
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

Hello Everyone

This series starts off the process of updating the OPP decoding tables 
to align with the new speed grade schemes for TI's AM62Ax and AM62Px SoC 
families.

Following this update is the updated binding and the OPPv2 entries we 
will be using for the SoC including the 1.4GHz frequency for our 
reference boards when the VDD_CORE allows.

Thanks for reviewing
~Bryan

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
Changes in v2:
- removed errant DONOTMERGE tag 
- Link to v1: https://lore.kernel.org/r/20240612-ti-opp-updates-v1-0-3551c31d9872@ti.com

---
Bryan Brattlof (5):
      cpufreq: ti: update OPP table for AM62Ax SoCs
      cpufreq: ti: update OPP table for AM62Px SoCs
      dt-bindings: mfd: syscon: add TI's opp table compatible
      DONOTMERGE: arm64: dts: ti: k3-am62p: add in opp tables
      DONOTMERGE: arm64: dts: ti: k3-am62a: add in opp table

 Documentation/devicetree/bindings/mfd/syscon.yaml |  1 +
 arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi       |  5 ++
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts           |  9 +++
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi             | 51 ++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi       |  6 ++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts           |  9 +++
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi             | 47 ++++++++++++
 drivers/cpufreq/ti-cpufreq.c                      | 94 ++++++++++++++++++++++-
 8 files changed, 220 insertions(+), 2 deletions(-)
---
base-commit: 629b57597ab52cef2ac5dd16042183c298cc52ed
change-id: 20240509-ti-opp-updates-19c109ab1354

Best regards,
-- 
Bryan Brattlof <bb@ti.com>


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

* [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs
  2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
@ 2024-06-12 23:17 ` Bryan Brattlof
  2024-06-13 11:28   ` Dhruva Gole
  2024-06-12 23:17 ` [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs Bryan Brattlof
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

As the AM62Ax SoC family matures more speed grades are being defined.
These new grades unfortunately no longer align with the AM62x SoC
family. Define a new table with new OPP speed grade limits for the
AM62Ax

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 drivers/cpufreq/ti-cpufreq.c | 59 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 714ed53753fa5..a80698f3cfe65 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -47,6 +47,28 @@
 #define AM625_SUPPORT_S_MPU_OPP			BIT(1)
 #define AM625_SUPPORT_T_MPU_OPP			BIT(2)
 
+enum {
+	AM62A7_EFUSE_M_MPU_OPP =		13,
+	AM62A7_EFUSE_N_MPU_OPP,
+	AM62A7_EFUSE_O_MPU_OPP,
+	AM62A7_EFUSE_P_MPU_OPP,
+	AM62A7_EFUSE_Q_MPU_OPP,
+	AM62A7_EFUSE_R_MPU_OPP,
+	AM62A7_EFUSE_S_MPU_OPP,
+	/*
+	 * The V, U, and T speed grade numbering is out of order
+	 * to align with the AM625 more uniformly. I promise I know
+	 * my ABCs ;)
+	 */
+	AM62A7_EFUSE_V_MPU_OPP,
+	AM62A7_EFUSE_U_MPU_OPP,
+	AM62A7_EFUSE_T_MPU_OPP,
+};
+
+#define AM62A7_SUPPORT_N_MPU_OPP		BIT(0)
+#define AM62A7_SUPPORT_R_MPU_OPP		BIT(1)
+#define AM62A7_SUPPORT_V_MPU_OPP		BIT(2)
+
 #define VERSION_COUNT				2
 
 struct ti_cpufreq_data;
@@ -112,6 +134,32 @@ static unsigned long omap3_efuse_xlate(struct ti_cpufreq_data *opp_data,
 	return BIT(efuse);
 }
 
+static unsigned long am62a7_efuse_xlate(struct ti_cpufreq_data *opp_data,
+					unsigned long efuse)
+{
+	unsigned long calc_efuse = AM62A7_SUPPORT_N_MPU_OPP;
+
+	switch (efuse) {
+	case AM62A7_EFUSE_V_MPU_OPP:
+	case AM62A7_EFUSE_U_MPU_OPP:
+	case AM62A7_EFUSE_T_MPU_OPP:
+	case AM62A7_EFUSE_S_MPU_OPP:
+		calc_efuse |= AM62A7_SUPPORT_V_MPU_OPP;
+		fallthrough;
+	case AM62A7_EFUSE_R_MPU_OPP:
+	case AM62A7_EFUSE_Q_MPU_OPP:
+	case AM62A7_EFUSE_P_MPU_OPP:
+	case AM62A7_EFUSE_O_MPU_OPP:
+		calc_efuse |= AM62A7_SUPPORT_R_MPU_OPP;
+		fallthrough;
+	case AM62A7_EFUSE_N_MPU_OPP:
+	case AM62A7_EFUSE_M_MPU_OPP:
+		calc_efuse |= AM62A7_SUPPORT_N_MPU_OPP;
+	}
+
+	return calc_efuse;
+}
+
 static unsigned long am625_efuse_xlate(struct ti_cpufreq_data *opp_data,
 				       unsigned long efuse)
 {
@@ -234,6 +282,15 @@ static struct ti_cpufreq_soc_data am625_soc_data = {
 	.multi_regulator = false,
 };
 
+static struct ti_cpufreq_soc_data am62a7_soc_data = {
+	.efuse_xlate = am62a7_efuse_xlate,
+	.efuse_offset = 0x0,
+	.efuse_mask = 0x07c0,
+	.efuse_shift = 0x6,
+	.rev_offset = 0x0014,
+	.multi_regulator = false,
+};
+
 /**
  * ti_cpufreq_get_efuse() - Parse and return efuse value present on SoC
  * @opp_data: pointer to ti_cpufreq_data context
@@ -337,7 +394,7 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
 	{ .compatible = "ti,omap34xx", .data = &omap34xx_soc_data, },
 	{ .compatible = "ti,omap36xx", .data = &omap36xx_soc_data, },
 	{ .compatible = "ti,am625", .data = &am625_soc_data, },
-	{ .compatible = "ti,am62a7", .data = &am625_soc_data, },
+	{ .compatible = "ti,am62a7", .data = &am62a7_soc_data, },
 	{ .compatible = "ti,am62p5", .data = &am625_soc_data, },
 	/* legacy */
 	{ .compatible = "ti,omap3430", .data = &omap34xx_soc_data, },

-- 
2.45.2


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

* [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs
  2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs Bryan Brattlof
@ 2024-06-12 23:17 ` Bryan Brattlof
  2024-06-13 11:33   ` Dhruva Gole
  2024-06-12 23:17 ` [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible Bryan Brattlof
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

More speed grades for the AM62Px SoC family have been defined which
unfortunately no longer align with the AM62x table. So create a new
table with these new speed grades defined for the AM62Px

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 drivers/cpufreq/ti-cpufreq.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index a80698f3cfe65..6c84562de5c6b 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -69,6 +69,13 @@ enum {
 #define AM62A7_SUPPORT_R_MPU_OPP		BIT(1)
 #define AM62A7_SUPPORT_V_MPU_OPP		BIT(2)
 
+#define AM62P5_EFUSE_O_MPU_OPP			15
+#define AM62P5_EFUSE_S_MPU_OPP			19
+#define AM62P5_EFUSE_U_MPU_OPP			21
+
+#define AM62P5_SUPPORT_O_MPU_OPP		BIT(0)
+#define AM62P5_SUPPORT_U_MPU_OPP		BIT(2)
+
 #define VERSION_COUNT				2
 
 struct ti_cpufreq_data;
@@ -134,6 +141,23 @@ static unsigned long omap3_efuse_xlate(struct ti_cpufreq_data *opp_data,
 	return BIT(efuse);
 }
 
+static unsigned long am62p5_efuse_xlate(struct ti_cpufreq_data *opp_data,
+					unsigned long efuse)
+{
+	unsigned long calc_efuse = AM62P5_SUPPORT_O_MPU_OPP;
+
+	switch (efuse) {
+	case AM62P5_EFUSE_U_MPU_OPP:
+	case AM62P5_EFUSE_S_MPU_OPP:
+		calc_efuse |= AM62P5_SUPPORT_U_MPU_OPP;
+		fallthrough;
+	case AM62P5_EFUSE_O_MPU_OPP:
+		calc_efuse |= AM62P5_SUPPORT_O_MPU_OPP;
+	}
+
+	return calc_efuse;
+}
+
 static unsigned long am62a7_efuse_xlate(struct ti_cpufreq_data *opp_data,
 					unsigned long efuse)
 {
@@ -291,6 +315,15 @@ static struct ti_cpufreq_soc_data am62a7_soc_data = {
 	.multi_regulator = false,
 };
 
+static struct ti_cpufreq_soc_data am62p5_soc_data = {
+	.efuse_xlate = am62p5_efuse_xlate,
+	.efuse_offset = 0x0,
+	.efuse_mask = 0x07c0,
+	.efuse_shift = 0x6,
+	.rev_offset = 0x0014,
+	.multi_regulator = false,
+};
+
 /**
  * ti_cpufreq_get_efuse() - Parse and return efuse value present on SoC
  * @opp_data: pointer to ti_cpufreq_data context
@@ -395,7 +428,7 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
 	{ .compatible = "ti,omap36xx", .data = &omap36xx_soc_data, },
 	{ .compatible = "ti,am625", .data = &am625_soc_data, },
 	{ .compatible = "ti,am62a7", .data = &am62a7_soc_data, },
-	{ .compatible = "ti,am62p5", .data = &am625_soc_data, },
+	{ .compatible = "ti,am62p5", .data = &am62p5_soc_data, },
 	/* legacy */
 	{ .compatible = "ti,omap3430", .data = &omap34xx_soc_data, },
 	{ .compatible = "ti,omap3630", .data = &omap36xx_soc_data, },

-- 
2.45.2


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

* [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible
  2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs Bryan Brattlof
@ 2024-06-12 23:17 ` Bryan Brattlof
  2024-06-13  6:22   ` Krzysztof Kozlowski
  2024-06-12 23:17 ` [PATCH v2 4/5] DONOTMERGE: arm64: dts: ti: k3-am62p: add in opp tables Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 5/5] DONOTMERGE: arm64: dts: ti: k3-am62a: add in opp table Bryan Brattlof
  4 siblings, 1 reply; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

The JTAG_USER_ID_USERCODE efuse address, which is located inside the
WKUP_CTRL_MMR0 range holds information to identify the speed grades of
various components on TI's K3 SoCs. Add a compatible to allow the
cpufreq driver to obtain the data to limit the maximum frequency for the
CPUs under Linux control.

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
index 7ed12a938baa3..ab1fcbe2148f7 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.yaml
+++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
@@ -88,6 +88,7 @@ properties:
               - rockchip,rv1126-qos
               - starfive,jh7100-sysmain
               - ti,am62-usb-phy-ctrl
+              - ti,am62-opp-efuse-table
               - ti,am62p-cpsw-mac-efuse
               - ti,am654-dss-oldi-io-ctrl
               - ti,am654-serdes-ctrl

-- 
2.45.2


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

* [PATCH v2 4/5] DONOTMERGE: arm64: dts: ti: k3-am62p: add in opp tables
  2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
                   ` (2 preceding siblings ...)
  2024-06-12 23:17 ` [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible Bryan Brattlof
@ 2024-06-12 23:17 ` Bryan Brattlof
  2024-06-12 23:17 ` [PATCH v2 5/5] DONOTMERGE: arm64: dts: ti: k3-am62a: add in opp table Bryan Brattlof
  4 siblings, 0 replies; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

To help reduce power consumption, reduce the frequency of the CPU cores
when they sit idle by specifying their supported OPP entries.

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi |  6 ++++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts     |  9 ++++++
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi       | 47 +++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi
index c71d9624ea277..8392c8cde2cd4 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi
@@ -19,6 +19,11 @@ chipid: chipid@14 {
 			bootph-all;
 		};
 
+		opp_efuse_table: syscon@18 {
+			compatible = "ti,am62-opp-efuse-table", "syscon";
+			reg = <0x18 0x4>;
+		};
+
 		usb0_phy_ctrl: syscon@4008 {
 			compatible = "ti,am62-usb-phy-ctrl", "syscon";
 			reg = <0x4008 0x4>;
@@ -28,6 +33,7 @@ usb1_phy_ctrl: syscon@4018 {
 			compatible = "ti,am62-usb-phy-ctrl", "syscon";
 			reg = <0x4018 0x4>;
 		};
+
 	};
 
 	wkup_uart0: serial@2b300000 {
diff --git a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
index 6983ec1b57cbd..08956ac1eaead 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
@@ -128,6 +128,15 @@ led-0 {
 		};
 	};
 
+	opp-table {
+		/* Add 1.4GHz OPP for am62p5-sk board. Requires VDD_CORE at 0v85 */
+		opp-1400000000 {
+			opp-hz = /bits/ 64 <1400000000>;
+			opp-supported-hw = <0x01 0x0004>;
+			clock-latency-ns = <6000000>;
+		};
+	};
+
 	tlv320_mclk: clk-0 {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
diff --git a/arch/arm64/boot/dts/ti/k3-am62p5.dtsi b/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
index 41f479dca4555..140587d02e88e 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
@@ -47,6 +47,7 @@ cpu0: cpu@0 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&l2_0>;
+			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 135 0>;
 		};
 
@@ -62,6 +63,7 @@ cpu1: cpu@1 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&l2_0>;
+			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 136 0>;
 		};
 
@@ -77,6 +79,7 @@ cpu2: cpu@2 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&l2_0>;
+			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 137 0>;
 		};
 
@@ -92,10 +95,54 @@ cpu3: cpu@3 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&l2_0>;
+			operating-points-v2 = <&a53_opp_table>;
 			clocks = <&k3_clks 138 0>;
 		};
 	};
 
+	a53_opp_table: opp-table {
+		compatible = "operating-points-v2-ti-cpu";
+		opp-shared;
+		syscon = <&opp_efuse_table>;
+
+		opp-200000000 {
+			opp-hz = /bits/ 64 <200000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-400000000 {
+			opp-hz = /bits/ 64 <400000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-600000000 {
+			opp-hz = /bits/ 64 <600000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-800000000 {
+			opp-hz = /bits/ 64 <800000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-1000000000 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-supported-hw = <0x01 0x0006>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-1250000000 {
+			opp-hz = /bits/ 64 <1250000000>;
+			opp-supported-hw = <0x01 0x0004>;
+			clock-latency-ns = <6000000>;
+			opp-suspend;
+		};
+	};
+
 	l2_0: l2-cache0 {
 		compatible = "cache";
 		cache-unified;

-- 
2.45.2


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

* [PATCH v2 5/5] DONOTMERGE: arm64: dts: ti: k3-am62a: add in opp table
  2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
                   ` (3 preceding siblings ...)
  2024-06-12 23:17 ` [PATCH v2 4/5] DONOTMERGE: arm64: dts: ti: k3-am62p: add in opp tables Bryan Brattlof
@ 2024-06-12 23:17 ` Bryan Brattlof
  4 siblings, 0 replies; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel, Bryan Brattlof

To help reduce power consumption, reduce the frequency of the CPU cores
when they sit idle by specifying their supported OPP entries.

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi |  5 +++
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts     |  9 +++++
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi       | 51 +++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
index 98043e9aa316b..bf16b29c3953b 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
@@ -13,6 +13,11 @@ wkup_conf: syscon@43000000 {
 		#size-cells = <1>;
 		ranges = <0x00 0x00 0x43000000 0x20000>;
 
+		opp_efuse_table: syscon@18 {
+			compatible = "ti,am62-opp-efuse-table", "syscon";
+			reg = <0x18 0x4>;
+		};
+
 		chipid: chipid@14 {
 			compatible = "ti,am654-chipid";
 			reg = <0x14 0x4>;
diff --git a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
index f241637a5642a..852a066585d6d 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
@@ -59,6 +59,15 @@ wkup_r5fss0_core0_memory_region: r5f-dma-memory@9c900000 {
 		};
 	};
 
+	opp-table {
+		/* Add 1.4GHz OPP for am62p5-sk board. Requires VDD_CORE at 0v85 */
+		opp-1400000000 {
+			opp-hz = /bits/ 64 <1400000000>;
+			opp-supported-hw = <0x01 0x0004>;
+			clock-latency-ns = <6000000>;
+		};
+	};
+
 	vmain_pd: regulator-0 {
 		/* TPS25750 PD CONTROLLER OUTPUT */
 		compatible = "regulator-fixed";
diff --git a/arch/arm64/boot/dts/ti/k3-am62a7.dtsi b/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
index f86a23404e6dd..b77390b66efa5 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
@@ -48,6 +48,8 @@ cpu0: cpu@0 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&L2_0>;
+			operating-points-v2 = <&a53_opp_table>;
+			clocks = <&k3_clks 135 0>;
 		};
 
 		cpu1: cpu@1 {
@@ -62,6 +64,8 @@ cpu1: cpu@1 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&L2_0>;
+			operating-points-v2 = <&a53_opp_table>;
+			clocks = <&k3_clks 136 0>;
 		};
 
 		cpu2: cpu@2 {
@@ -76,6 +80,8 @@ cpu2: cpu@2 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&L2_0>;
+			operating-points-v2 = <&a53_opp_table>;
+			clocks = <&k3_clks 137 0>;
 		};
 
 		cpu3: cpu@3 {
@@ -90,6 +96,51 @@ cpu3: cpu@3 {
 			d-cache-line-size = <64>;
 			d-cache-sets = <128>;
 			next-level-cache = <&L2_0>;
+			operating-points-v2 = <&a53_opp_table>;
+			clocks = <&k3_clks 138 0>;
+		};
+	};
+
+	a53_opp_table: opp-table {
+		compatible = "operating-points-v2-ti-cpu";
+		opp-shared;
+		syscon = <&wkup_conf>;
+
+		opp-200000000 {
+			opp-hz = /bits/ 64 <200000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-400000000 {
+			opp-hz = /bits/ 64 <400000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-600000000 {
+			opp-hz = /bits/ 64 <600000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-800000000 {
+			opp-hz = /bits/ 64 <800000000>;
+			opp-supported-hw = <0x01 0x0007>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-1000000000 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-supported-hw = <0x01 0x0006>;
+			clock-latency-ns = <6000000>;
+		};
+
+		opp-1250000000 {
+			opp-hz = /bits/ 64 <1250000000>;
+			opp-supported-hw = <0x01 0x0004>;
+			clock-latency-ns = <6000000>;
+			opp-suspend;
 		};
 	};
 

-- 
2.45.2


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

* Re: [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible
  2024-06-12 23:17 ` [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible Bryan Brattlof
@ 2024-06-13  6:22   ` Krzysztof Kozlowski
  2024-06-15 14:43     ` Bryan Brattlof
  0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-13  6:22 UTC (permalink / raw)
  To: Bryan Brattlof, Rafael J. Wysocki, Viresh Kumar, Lee Jones,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: Vibhore Vardhan, linux-pm, linux-kernel, devicetree,
	linux-arm-kernel

On 13/06/2024 01:17, Bryan Brattlof wrote:
> The JTAG_USER_ID_USERCODE efuse address, which is located inside the
> WKUP_CTRL_MMR0 range holds information to identify the speed grades of
> various components on TI's K3 SoCs. Add a compatible to allow the
> cpufreq driver to obtain the data to limit the maximum frequency for the
> CPUs under Linux control.
> 
> Signed-off-by: Bryan Brattlof <bb@ti.com>
> ---
>  Documentation/devicetree/bindings/mfd/syscon.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
> index 7ed12a938baa3..ab1fcbe2148f7 100644
> --- a/Documentation/devicetree/bindings/mfd/syscon.yaml
> +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
> @@ -88,6 +88,7 @@ properties:
>                - rockchip,rv1126-qos
>                - starfive,jh7100-sysmain
>                - ti,am62-usb-phy-ctrl
> +              - ti,am62-opp-efuse-table

These are ordered alphabetically.

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs
  2024-06-12 23:17 ` [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs Bryan Brattlof
@ 2024-06-13 11:28   ` Dhruva Gole
  0 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-06-13 11:28 UTC (permalink / raw)
  To: Bryan Brattlof
  Cc: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo, Vibhore Vardhan, linux-pm,
	linux-kernel, devicetree, linux-arm-kernel

On Jun 12, 2024 at 18:17:34 -0500, Bryan Brattlof wrote:
> As the AM62Ax SoC family matures more speed grades are being defined.
> These new grades unfortunately no longer align with the AM62x SoC
> family. Define a new table with new OPP speed grade limits for the
> AM62Ax
> 
> Signed-off-by: Bryan Brattlof <bb@ti.com>
> ---
>  drivers/cpufreq/ti-cpufreq.c | 59 +++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 58 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c

LGTM,
Reviewed-by: Dhruva Gole <d-gole@ti.com>

-- 
Best regards,
Dhruva

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

* Re: [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs
  2024-06-12 23:17 ` [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs Bryan Brattlof
@ 2024-06-13 11:33   ` Dhruva Gole
  2024-06-15 14:50     ` Bryan Brattlof
  0 siblings, 1 reply; 11+ messages in thread
From: Dhruva Gole @ 2024-06-13 11:33 UTC (permalink / raw)
  To: Bryan Brattlof
  Cc: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo, Vibhore Vardhan, linux-pm,
	linux-kernel, devicetree, linux-arm-kernel

On Jun 12, 2024 at 18:17:35 -0500, Bryan Brattlof wrote:
> More speed grades for the AM62Px SoC family have been defined which
> unfortunately no longer align with the AM62x table. So create a new
> table with these new speed grades defined for the AM62Px
> 
> Signed-off-by: Bryan Brattlof <bb@ti.com>
> ---
>  drivers/cpufreq/ti-cpufreq.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index a80698f3cfe65..6c84562de5c6b 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -69,6 +69,13 @@ enum {
>  #define AM62A7_SUPPORT_R_MPU_OPP		BIT(1)
>  #define AM62A7_SUPPORT_V_MPU_OPP		BIT(2)
>  
> +#define AM62P5_EFUSE_O_MPU_OPP			15
> +#define AM62P5_EFUSE_S_MPU_OPP			19
> +#define AM62P5_EFUSE_U_MPU_OPP			21
> +
> +#define AM62P5_SUPPORT_O_MPU_OPP		BIT(0)
> +#define AM62P5_SUPPORT_U_MPU_OPP		BIT(2)
> +
>  #define VERSION_COUNT				2
>  
>  struct ti_cpufreq_data;
> @@ -134,6 +141,23 @@ static unsigned long omap3_efuse_xlate(struct ti_cpufreq_data *opp_data,
>  	return BIT(efuse);
>  }
>  
> +static unsigned long am62p5_efuse_xlate(struct ti_cpufreq_data *opp_data,
> +					unsigned long efuse)
> +{
> +	unsigned long calc_efuse = AM62P5_SUPPORT_O_MPU_OPP;

This and he earlier patch, why not continue using the name convention
calculated_efuse like in am625 and dra ?

> +
> +	switch (efuse) {
> +	case AM62P5_EFUSE_U_MPU_OPP:
> +	case AM62P5_EFUSE_S_MPU_OPP:
> +		calc_efuse |= AM62P5_SUPPORT_U_MPU_OPP;
> +		fallthrough;
> +	case AM62P5_EFUSE_O_MPU_OPP:
> +		calc_efuse |= AM62P5_SUPPORT_O_MPU_OPP;
> +	}
> +
> +	return calc_efuse;
> +}
> +
>  static unsigned long am62a7_efuse_xlate(struct ti_cpufreq_data *opp_data,
>  					unsigned long efuse)

Otherwise, Looks good.
Reviewed-by: Dhruva Gole <d-gole@ti.com>

-- 
Best regards,
Dhruva

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

* Re: [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible
  2024-06-13  6:22   ` Krzysztof Kozlowski
@ 2024-06-15 14:43     ` Bryan Brattlof
  0 siblings, 0 replies; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-15 14:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo, Vibhore Vardhan, linux-pm,
	linux-kernel, devicetree, linux-arm-kernel

On June 13, 2024 thus sayeth Krzysztof Kozlowski:
> On 13/06/2024 01:17, Bryan Brattlof wrote:
> > The JTAG_USER_ID_USERCODE efuse address, which is located inside the
> > WKUP_CTRL_MMR0 range holds information to identify the speed grades of
> > various components on TI's K3 SoCs. Add a compatible to allow the
> > cpufreq driver to obtain the data to limit the maximum frequency for the
> > CPUs under Linux control.
> > 
> > Signed-off-by: Bryan Brattlof <bb@ti.com>
> > ---
> >  Documentation/devicetree/bindings/mfd/syscon.yaml | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
> > index 7ed12a938baa3..ab1fcbe2148f7 100644
> > --- a/Documentation/devicetree/bindings/mfd/syscon.yaml
> > +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
> > @@ -88,6 +88,7 @@ properties:
> >                - rockchip,rv1126-qos
> >                - starfive,jh7100-sysmain
> >                - ti,am62-usb-phy-ctrl
> > +              - ti,am62-opp-efuse-table
> 
> These are ordered alphabetically.
> 

Ha! I guess I don't know how to spell after all :)

~Bryan

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

* Re: [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs
  2024-06-13 11:33   ` Dhruva Gole
@ 2024-06-15 14:50     ` Bryan Brattlof
  0 siblings, 0 replies; 11+ messages in thread
From: Bryan Brattlof @ 2024-06-15 14:50 UTC (permalink / raw)
  To: Dhruva Gole
  Cc: Rafael J. Wysocki, Viresh Kumar, Lee Jones, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo, Vibhore Vardhan, linux-pm,
	linux-kernel, devicetree, linux-arm-kernel

On June 13, 2024 thus sayeth Dhruva Gole:
> On Jun 12, 2024 at 18:17:35 -0500, Bryan Brattlof wrote:
> > More speed grades for the AM62Px SoC family have been defined which
> > unfortunately no longer align with the AM62x table. So create a new
> > table with these new speed grades defined for the AM62Px
> > 
> > Signed-off-by: Bryan Brattlof <bb@ti.com>
> > ---
> >  drivers/cpufreq/ti-cpufreq.c | 35 ++++++++++++++++++++++++++++++++++-
> >  1 file changed, 34 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> > index a80698f3cfe65..6c84562de5c6b 100644
> > --- a/drivers/cpufreq/ti-cpufreq.c
> > +++ b/drivers/cpufreq/ti-cpufreq.c
> > @@ -69,6 +69,13 @@ enum {
> >  #define AM62A7_SUPPORT_R_MPU_OPP		BIT(1)
> >  #define AM62A7_SUPPORT_V_MPU_OPP		BIT(2)
> >  
> > +#define AM62P5_EFUSE_O_MPU_OPP			15
> > +#define AM62P5_EFUSE_S_MPU_OPP			19
> > +#define AM62P5_EFUSE_U_MPU_OPP			21
> > +
> > +#define AM62P5_SUPPORT_O_MPU_OPP		BIT(0)
> > +#define AM62P5_SUPPORT_U_MPU_OPP		BIT(2)
> > +
> >  #define VERSION_COUNT				2
> >  
> >  struct ti_cpufreq_data;
> > @@ -134,6 +141,23 @@ static unsigned long omap3_efuse_xlate(struct ti_cpufreq_data *opp_data,
> >  	return BIT(efuse);
> >  }
> >  
> > +static unsigned long am62p5_efuse_xlate(struct ti_cpufreq_data *opp_data,
> > +					unsigned long efuse)
> > +{
> > +	unsigned long calc_efuse = AM62P5_SUPPORT_O_MPU_OPP;
> 
> This and he earlier patch, why not continue using the name convention
> calculated_efuse like in am625 and dra ?
>

For whatever reason I've been more of a minimalist when it comes to 
naming stack variables. Single letters are just as good as full 
sentences ;)

I'll use the full name next round

~Bryan

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

end of thread, other threads:[~2024-06-15 14:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 23:17 [PATCH v2 0/5] Update OPP table and add entries for AM62Ax & AM62Px SoCs Bryan Brattlof
2024-06-12 23:17 ` [PATCH v2 1/5] cpufreq: ti: update OPP table for AM62Ax SoCs Bryan Brattlof
2024-06-13 11:28   ` Dhruva Gole
2024-06-12 23:17 ` [PATCH v2 2/5] cpufreq: ti: update OPP table for AM62Px SoCs Bryan Brattlof
2024-06-13 11:33   ` Dhruva Gole
2024-06-15 14:50     ` Bryan Brattlof
2024-06-12 23:17 ` [PATCH v2 3/5] dt-bindings: mfd: syscon: add TI's opp table compatible Bryan Brattlof
2024-06-13  6:22   ` Krzysztof Kozlowski
2024-06-15 14:43     ` Bryan Brattlof
2024-06-12 23:17 ` [PATCH v2 4/5] DONOTMERGE: arm64: dts: ti: k3-am62p: add in opp tables Bryan Brattlof
2024-06-12 23:17 ` [PATCH v2 5/5] DONOTMERGE: arm64: dts: ti: k3-am62a: add in opp table Bryan Brattlof

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).