public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
@ 2024-09-24  9:50 Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

Hello everyone

This series adds in the OPPs for the Cortex-A53s on the AM62Ax and
AM62Px SoC families along with the defining the
WKUP_MMR0_WKUP0_CTRL_MMR0_JTAG_USER_ID which we can use to properly
limit the OPPs available for that variant.

Moreover, it also adds a driver cleanup where we can finally get rid of
the rev_offsets and zero the efuse_offsets as they are now taken from socinfo and
DT efuse node register respectively. This series has been tested on all
devices that it affects and has been confirmed to cause no known regressions.

Test logs:
https://gist.github.com/DhruvaG2000/63f5e28636d52787488f776e5bf39498

**NOTE:** Special attention needed on the driver patch 5/6 & 6/6:

Viresh and Vignesh,

The driver fix needs to go with PATCH 5/6.

Subject: [PATCH V4 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for
 opp-table syscon

That patch fixes the efuse offset in the AM625 DT.
Without it, the driver will read from an incorrect efuse offset, and end
up breaking things in -next till all the DT changes make it in.
Hence, it would be preferrable if this entire series goes via a single
maintainer's tree.
Viresh, perhaps if you can ack this single patch, then Vignesh could take it up
if there are no objections?

I am sorry that this breaks compatibility with older AM625 devicetree.
However, the old devicetree was marking the entire wkup_conf as "syscon",
"simple-mfd" which was wrong and needed to be fixed.

This series finally tries to bring order to DT and the driver.

However, if there is still any way to maintain the backward
compatibility, then I am open to suggestions. Please try
and understand here that the ask for backward compatibility here
is to ask the driver to support a case where the register offset itself
was to be picked from a different node. I am not sure if there's any
cleaner way to do this.

Changelog:

---
Changes in v5:
- Based on Andrew's review on v4 of "arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon",
	- s/syscon@43000000/bus@43000000/
	- Drop the "reg = <>;" line
- Link to v4: https://lore.kernel.org/all/20240919082809.174589-1-d-gole@ti.com/

Changes in v4:
- Add 2 more patches to this series:
	- Driver cleanup as described above.
	- AM625 DT fixups (Link to v1 of that patch: https://lore.kernel.org/all/20240902093222.2828345-2-d-gole@ti.com/)
- Link to v3: https://lore.kernel.org/all/20240826-opp-v3-0-0934f8309e13@ti.com/

Changes in v3:
- Miscellaneous spelling fixes in commit body
- Link to v2: https://lore.kernel.org/r/20240823-opp-v2-0-e2f67b37c299@ti.com

Changes in v2:
- Expanded on commit descriptions
- Split board file and SoC fdt changes into different patches
- Link to v1: https://lore.kernel.org/r/20240809-opp-v1-0-fea8efeaf963@ti.com

---

Bryan Brattlof (4):
  arm64: dts: ti: k3-am62a: add opp frequencies
  arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry
  arm64: dts: ti: k3-am62p: add opp frequencies
  arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry

Dhruva Gole (2):
  arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon
  cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family

 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi    |  7 ++-
 arch/arm64/boot/dts/ti/k3-am625.dtsi          |  2 +-
 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 +++++++++++++++++++
 .../dts/ti/k3-am62p-j722s-common-wakeup.dtsi  |  5 ++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts       |  9 ++++
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi         | 47 +++++++++++++++++
 drivers/cpufreq/ti-cpufreq.c                  |  5 +-
 9 files changed, 134 insertions(+), 6 deletions(-)

base-commit: 55bcd2e0d04c1171d382badef1def1fd04ef66c5
--
2.34.1

---
Bryan Brattlof (4):
      arm64: dts: ti: k3-am62a: add opp frequencies
      arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry
      arm64: dts: ti: k3-am62p: add opp frequencies
      arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry

Dhruva Gole (2):
      arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon
      cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family

 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi         | 10 +++--
 arch/arm64/boot/dts/ti/k3-am625.dtsi               |  2 +-
 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 ++++++++++++++++++++++
 .../boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi  |  5 +++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts            |  9 ++++
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi              | 47 ++++++++++++++++++++
 drivers/cpufreq/ti-cpufreq.c                       |  5 +--
 9 files changed, 135 insertions(+), 8 deletions(-)
---
base-commit: 55bcd2e0d04c1171d382badef1def1fd04ef66c5
change-id: 20240924-ti-cpufreq-fixes-v5-dbb3e5056b6c

Best regards,
-- 
Dhruva Gole <d-gole@ti.com>


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

* [PATCH v5 1/6] arm64: dts: ti: k3-am62a: add opp frequencies
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

From: Bryan Brattlof <bb@ti.com>

One power management technique available to the Cortex-A53s is their
ability to dynamically scale their frequency across the device's
Operating Performance Points (OPP)

The OPPs available for the Cortex-A53s on the AM62Ax can vary based on
the silicon variant used. The SoC variant is encoded into the
WKUP_MMR0_WKUP0_CTRL_MMR0_JTAG_USER_ID register which is used to limit
to only OPP entries the variant supports. A table of all these variants
can be found in it's data sheet[0] for the AM62Ax family.

Add the OPP table into the SoC's fdti file along with the syscon node to
describe the WKUP_MMR0_WKUP0_CTRL_MMR0_JTAG_USER_ID register to detect
the SoC variant.

[0] https://www.ti.com/lit/ds/symlink/am62a3.pdf

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.dtsi       | 51 +++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
index f5ac101a04dfa0bdae8ac4f43b01473725433c51..0b1dd5390cd3f42b0ec56bab042388722b4c22a1 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi
@@ -17,6 +17,11 @@ chipid: chipid@14 {
 			reg = <0x14 0x4>;
 		};
 
+		opp_efuse_table: syscon@18 {
+			compatible = "ti,am62-opp-efuse-table", "syscon";
+			reg = <0x18 0x4>;
+		};
+
 		cpsw_mac_syscon: ethernet-mac-syscon@200 {
 			compatible = "ti,am62p-cpsw-mac-efuse", "syscon";
 			reg = <0x200 0x8>;
diff --git a/arch/arm64/boot/dts/ti/k3-am62a7.dtsi b/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
index f86a23404e6dde3ca90e41ac0efdb378948e6d50..6c99221beb6bd8e5ad93888e6b659cc6e08fb679 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 = <&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;
 		};
 	};
 

-- 
2.34.1


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

* [PATCH v5 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

From: Bryan Brattlof <bb@ti.com>

The AM62Ax reference board is capable of supplying 0v85 to the VDD_CORE
which allows the Cortex-A53s to operate at 1.4GHz according to chapter
7.5 of the SoC's data sheet[0]. Append the 1.4Ghz entry to the OPP table
to enable this OPP

[0] https://www.ti.com/lit/ds/symlink/am62a3.pdf

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
index 67faf46d7a35a5954a5a832b8ab766320b48ea59..a6f0d87a50d8a7ebdb61e609e8071d6681dbec9a 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
@@ -68,6 +68,15 @@ wkup_r5fss0_core0_memory_region: r5f-dma-memory@9c900000 {
 		};
 	};
 
+	opp-table {
+		/* 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";

-- 
2.34.1


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

* [PATCH v5 3/6] arm64: dts: ti: k3-am62p: add opp frequencies
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

From: Bryan Brattlof <bb@ti.com>

One power management technique available to the Cortex-A53s is their
ability to dynamically scale their frequency across the device's
Operating Performance Points (OPP)

The OPPs available for the Cortex-A53s on the AM62Px can vary based on
the silicon variant used. The SoC variant is encoded into the
WKUP_MMR0_WKUP0_CTRL_MMR0_JTAG_USER_ID register which is used to limit
the OPP entries the SoC supports. A table of all these variants can be
found in its data sheet[0] for the AM62Px processor family.

Add the OPP table into the SoC's fdti file along with the syscon node to
describe the WKUP_MMR0_WKUP0_CTRL_MMR0_JTAG_USER_ID register to detect
the SoC variant.

[0] https://www.ti.com/lit/ds/symlink/am62p-q1.pdf

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 .../boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi  |  5 +++
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi              | 47 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi
index 315d0092e73664416998cb34d9b9f5fa70a311c2..6f32135f00a551cfea4cc896fc03147271eab9b7 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-wakeup.dtsi
@@ -20,6 +20,11 @@ chipid: chipid@14 {
 			bootph-all;
 		};
 
+		opp_efuse_table: syscon@18 {
+			compatible = "ti,am62-opp-efuse-table", "syscon";
+			reg = <0x18 0x4>;
+		};
+
 		cpsw_mac_syscon: ethernet-mac-syscon@200 {
 			compatible = "ti,am62p-cpsw-mac-efuse", "syscon";
 			reg = <0x200 0x8>;
diff --git a/arch/arm64/boot/dts/ti/k3-am62p5.dtsi b/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
index 41f479dca455567c91bbb3a0b75d13810ea11157..140587d02e88e9d391c41001643ec715d41bf262 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.34.1


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

* [PATCH v5 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
                   ` (2 preceding siblings ...)
  2024-09-24  9:50 ` [PATCH v5 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

From: Bryan Brattlof <bb@ti.com>

The AM62Px reference board is capable of supplying 0v85 to the VDD_CORE
which allows the Cortex-A53s to operate at 1.4GHz according to chapter
6.6 of the SoC's data sheet[0] . Append the 1.4Ghz entry to the OPP
table to enable this frequency

[0] https://www.ti.com/lit/ds/symlink/am62p-q1.pdf

Signed-off-by: Bryan Brattlof <bb@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
index 3efa12bb72546291e2fda79695edf577bbb134a1..7f3dc39e12bc9ca4a746ff092f946b84a36404b3 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 {
+		/* 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";

-- 
2.34.1


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

* [PATCH v5 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
                   ` (3 preceding siblings ...)
  2024-09-24  9:50 ` [PATCH v5 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24  9:50 ` [PATCH v5 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
  2024-09-24 12:15 ` [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Nishanth Menon
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

Add another entry in the wkup_conf for the syscon node, and then use
that for the syscon in opp-table.

Marking entire wkup_conf as "syscon", "simple-mfd" is wrong and needs to
be addressed similar to how other child-nodes in wkup_conf are implemented
in the same file.

Also, rename syscon to bus and drop reg = <>;

Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi | 10 +++++++---
 arch/arm64/boot/dts/ti/k3-am625.dtsi       |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi
index e0afafd532a5c63f29ca0dabc541ffa22dde609b..9933bb55b00532fbd5ea74fc90036ab0eadd50bc 100644
--- a/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi
@@ -8,10 +8,9 @@
 #include <dt-bindings/bus/ti-sysc.h>
 
 &cbass_wakeup {
-	wkup_conf: syscon@43000000 {
+	wkup_conf: bus@43000000 {
 		bootph-all;
-		compatible = "syscon", "simple-mfd";
-		reg = <0x00 0x43000000 0x00 0x20000>;
+		compatible = "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x0 0x00 0x43000000 0x20000>;
@@ -22,6 +21,11 @@ chipid: chipid@14 {
 			reg = <0x14 0x4>;
 		};
 
+		opp_efuse_table: syscon@18 {
+			compatible = "ti,am62-opp-efuse-table", "syscon";
+			reg = <0x18 0x4>;
+		};
+
 		cpsw_mac_syscon: ethernet-mac-syscon@200 {
 			compatible = "ti,am62p-cpsw-mac-efuse", "syscon";
 			reg = <0x200 0x8>;
diff --git a/arch/arm64/boot/dts/ti/k3-am625.dtsi b/arch/arm64/boot/dts/ti/k3-am625.dtsi
index c3d1db47dc9f351d217721c0b9e46a0c68995838..c249883a8a8d846aa21092c4c341fd443cfcec15 100644
--- a/arch/arm64/boot/dts/ti/k3-am625.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am625.dtsi
@@ -108,7 +108,7 @@ cpu3: cpu@3 {
 	a53_opp_table: opp-table {
 		compatible = "operating-points-v2-ti-cpu";
 		opp-shared;
-		syscon = <&wkup_conf>;
+		syscon = <&opp_efuse_table>;
 
 		opp-200000000 {
 			opp-hz = /bits/ 64 <200000000>;

-- 
2.34.1


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

* [PATCH v5 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
                   ` (4 preceding siblings ...)
  2024-09-24  9:50 ` [PATCH v5 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
@ 2024-09-24  9:50 ` Dhruva Gole
  2024-09-24 12:15 ` [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Nishanth Menon
  6 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-24  9:50 UTC (permalink / raw)
  To: Nishanth Menon, Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar
  Cc: linux-arm-kernel, devicetree, linux-kernel, linux-pm,
	Andrew Davis, Bryan Brattlof, Dhruva Gole

With the Silicon revision being taken directly from socinfo, there's no
longer any need for reading any SOC register for revision from this driver.
Hence, we do not require any rev_offset for AM62 family of devices.
The efuse offset should be 0x0 for AM625 as well, as the syscon
register being used from DT refers to the efuse_offset directly.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
 drivers/cpufreq/ti-cpufreq.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index ba621ce1cdda694c98867422dbb7f10c0df2afef..870ab0b376c1c0389b952b61a13d169b174538bb 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -313,10 +313,9 @@ static const struct soc_device_attribute k3_cpufreq_soc[] = {
 
 static struct ti_cpufreq_soc_data am625_soc_data = {
 	.efuse_xlate = am625_efuse_xlate,
-	.efuse_offset = 0x0018,
+	.efuse_offset = 0x0,
 	.efuse_mask = 0x07c0,
 	.efuse_shift = 0x6,
-	.rev_offset = 0x0014,
 	.multi_regulator = false,
 };
 
@@ -325,7 +324,6 @@ static struct ti_cpufreq_soc_data am62a7_soc_data = {
 	.efuse_offset = 0x0,
 	.efuse_mask = 0x07c0,
 	.efuse_shift = 0x6,
-	.rev_offset = 0x0014,
 	.multi_regulator = false,
 };
 
@@ -334,7 +332,6 @@ static struct ti_cpufreq_soc_data am62p5_soc_data = {
 	.efuse_offset = 0x0,
 	.efuse_mask = 0x07c0,
 	.efuse_shift = 0x6,
-	.rev_offset = 0x0014,
 	.multi_regulator = false,
 };
 

-- 
2.34.1


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

* Re: [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
  2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
                   ` (5 preceding siblings ...)
  2024-09-24  9:50 ` [PATCH v5 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
@ 2024-09-24 12:15 ` Nishanth Menon
  2024-09-25  7:47   ` Dhruva Gole
  6 siblings, 1 reply; 11+ messages in thread
From: Nishanth Menon @ 2024-09-24 12:15 UTC (permalink / raw)
  To: Dhruva Gole
  Cc: Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, Andrew Davis, Bryan Brattlof

On 15:20-20240924, Dhruva Gole wrote:
[...]
> 
> I am sorry that this breaks compatibility with older AM625 devicetree.
> However, the old devicetree was marking the entire wkup_conf as "syscon",
> "simple-mfd" which was wrong and needed to be fixed.
> 
> This series finally tries to bring order to DT and the driver.
> 
> However, if there is still any way to maintain the backward
> compatibility, then I am open to suggestions. Please try
> and understand here that the ask for backward compatibility here
> is to ask the driver to support a case where the register offset itself
> was to be picked from a different node. I am not sure if there's any
> cleaner way to do this.


Have you tried to handle this with quirks? I am not in favor of breaking
backward compatibility.

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
  2024-09-24 12:15 ` [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Nishanth Menon
@ 2024-09-25  7:47   ` Dhruva Gole
  2024-09-25 12:51     ` Nishanth Menon
  0 siblings, 1 reply; 11+ messages in thread
From: Dhruva Gole @ 2024-09-25  7:47 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, Andrew Davis, Bryan Brattlof, Dhruva Gole

On Sep 24, 2024 at 07:15:44 -0500, Nishanth Menon wrote:
> On 15:20-20240924, Dhruva Gole wrote:
> [...]
> > 
> > I am sorry that this breaks compatibility with older AM625 devicetree.
> > However, the old devicetree was marking the entire wkup_conf as "syscon",
> > "simple-mfd" which was wrong and needed to be fixed.
> > 
> > This series finally tries to bring order to DT and the driver.
> > 
> > However, if there is still any way to maintain the backward
> > compatibility, then I am open to suggestions. Please try
> > and understand here that the ask for backward compatibility here
> > is to ask the driver to support a case where the register offset itself
> > was to be picked from a different node. I am not sure if there's any
> > cleaner way to do this.
> 
> 
> Have you tried to handle this with quirks? I am not in favor of breaking
> backward compatibility.

I was thinking of something on those lines, but quirks makes sense for
the case that there's a quirky behaviour in the SoC itself. Here it
seems to me that we are adding a quirk to handle quirk in some old devicetree.

There's no way to detect the devicetree version or somehow distinguish
within the driver if it's an old or a new DT. One way I could think of
is on these lines:

8<---------------------------------------------------------------------------
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 870ab0b376c1..e1b22c5d4ab8 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -93,6 +93,7 @@ struct ti_cpufreq_soc_data {
        bool multi_regulator;
 /* Backward compatibility hack: Might have missing syscon */
 #define TI_QUIRK_SYSCON_MAY_BE_MISSING 0x1
+#define TI_QUIRK_SYSCON_MAY_BE_INCORRECT       0x2
        u8 quirks;
 };

@@ -317,6 +318,7 @@ static struct ti_cpufreq_soc_data am625_soc_data = {
        .efuse_mask = 0x07c0,
        .efuse_shift = 0x6,
        .multi_regulator = false,
+       .quirks = TI_QUIRK_SYSCON_MAY_BE_INCORRECT,
 };

 static struct ti_cpufreq_soc_data am62a7_soc_data = {
@@ -349,6 +351,9 @@ static int ti_cpufreq_get_efuse(struct
ti_cpufreq_data *opp_data,
        u32 efuse;
        int ret;

+       if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_INCORRECT )
+               opp_data->soc_data->efuse_offset = 0x0018;
+
        ret = regmap_read(opp_data->syscon,
opp_data->soc_data->efuse_offset,
                          &efuse);
        if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING
&& ret == -EIO) {

---------------------------------------------------------------------------->8

Then, additionally read the soc_data->syscon value, compare it against
some hard coded value to check if the address needs the 0x0018 offset or
not... All this feels extremely hackish and hence I was against doing
this.

Am I missing some other obvious way to distinguish between old/new DT? I
don't suppose we can just go ahead and create a new binding just for
this.

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated

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

* Re: [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
  2024-09-25  7:47   ` Dhruva Gole
@ 2024-09-25 12:51     ` Nishanth Menon
  2024-09-25 14:47       ` Dhruva Gole
  0 siblings, 1 reply; 11+ messages in thread
From: Nishanth Menon @ 2024-09-25 12:51 UTC (permalink / raw)
  To: Dhruva Gole
  Cc: Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, Andrew Davis, Bryan Brattlof

On 13:17-20240925, Dhruva Gole wrote:
> On Sep 24, 2024 at 07:15:44 -0500, Nishanth Menon wrote:
> > On 15:20-20240924, Dhruva Gole wrote:
> > [...]
> > > 
> > > I am sorry that this breaks compatibility with older AM625 devicetree.
> > > However, the old devicetree was marking the entire wkup_conf as "syscon",
> > > "simple-mfd" which was wrong and needed to be fixed.
> > > 
> > > This series finally tries to bring order to DT and the driver.
> > > 
> > > However, if there is still any way to maintain the backward
> > > compatibility, then I am open to suggestions. Please try
> > > and understand here that the ask for backward compatibility here
> > > is to ask the driver to support a case where the register offset itself
> > > was to be picked from a different node. I am not sure if there's any
> > > cleaner way to do this.
> > 
> > 
> > Have you tried to handle this with quirks? I am not in favor of breaking
> > backward compatibility.
> 
> I was thinking of something on those lines, but quirks makes sense for
> the case that there's a quirky behaviour in the SoC itself. Here it
> seems to me that we are adding a quirk to handle quirk in some old devicetree.
> 
> There's no way to detect the devicetree version or somehow distinguish
> within the driver if it's an old or a new DT. One way I could think of
> is on these lines:

I suggest going and experimenting a bit. Sorry, changes that break
backward compatibility: NAK!

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
  2024-09-25 12:51     ` Nishanth Menon
@ 2024-09-25 14:47       ` Dhruva Gole
  0 siblings, 0 replies; 11+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:47 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Vignesh Raghavendra, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
	Viresh Kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, Andrew Davis, Bryan Brattlof

On Sep 25, 2024 at 07:51:15 -0500, Nishanth Menon wrote:
> On 13:17-20240925, Dhruva Gole wrote:
> > On Sep 24, 2024 at 07:15:44 -0500, Nishanth Menon wrote:
> > > On 15:20-20240924, Dhruva Gole wrote:
> > > [...]
> > > > 
> > > > I am sorry that this breaks compatibility with older AM625 devicetree.
> > > > However, the old devicetree was marking the entire wkup_conf as "syscon",
> > > > "simple-mfd" which was wrong and needed to be fixed.
> > > > 
> > > > This series finally tries to bring order to DT and the driver.
> > > > 
> > > > However, if there is still any way to maintain the backward
> > > > compatibility, then I am open to suggestions. Please try
> > > > and understand here that the ask for backward compatibility here
> > > > is to ask the driver to support a case where the register offset itself
> > > > was to be picked from a different node. I am not sure if there's any
> > > > cleaner way to do this.
> > > 
> > > 
> > > Have you tried to handle this with quirks? I am not in favor of breaking
> > > backward compatibility.
> > 
> > I was thinking of something on those lines, but quirks makes sense for
> > the case that there's a quirky behaviour in the SoC itself. Here it
> > seems to me that we are adding a quirk to handle quirk in some old devicetree.
> > 
> > There's no way to detect the devicetree version or somehow distinguish
> > within the driver if it's an old or a new DT. One way I could think of
> > is on these lines:
> 
> I suggest going and experimenting a bit. Sorry, changes that break
> backward compatibility: NAK!

OK, let me try using some information from old DT to distinguish and add
the offset based on that. Sending those patches soon.

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated

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

end of thread, other threads:[~2024-09-25 14:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24  9:50 [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
2024-09-24  9:50 ` [PATCH v5 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
2024-09-24 12:15 ` [PATCH v5 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Nishanth Menon
2024-09-25  7:47   ` Dhruva Gole
2024-09-25 12:51     ` Nishanth Menon
2024-09-25 14:47       ` Dhruva Gole

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