* [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies
@ 2024-09-25 14:54 Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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.
It also tried to fix the AM625 devicetree syscon nodes, while also ensuring that
within the driver we don't end up breaking the older DT.
Test logs:
https://gist.github.com/DhruvaG2000/63f5e28636d52787488f776e5bf39498
Changelog:
---
Changes in v6:
- Ensure backward compaibility for AM625 DT, by handling the old DT in a special
way inside the cpufreq driver itself. This is based on feedback from Nishanth
where we are not okay to break the old DT working with new kernels.
- Link to v5: https://lore.kernel.org/r/20240924-ti-cpufreq-fixes-v5-v5-0-cbe16b9ddb1b@ti.com
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 | 23 +++++++---
9 files changed, 151 insertions(+), 10 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] 8+ messages in thread
* [PATCH v6 1/6] arm64: dts: ti: k3-am62a: add opp frequencies
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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 [flat|nested] 8+ messages in thread
* [PATCH v6 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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 [flat|nested] 8+ messages in thread
* [PATCH v6 3/6] arm64: dts: ti: k3-am62p: add opp frequencies
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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 [flat|nested] 8+ messages in thread
* [PATCH v6 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
` (2 preceding siblings ...)
2024-09-25 14:54 ` [PATCH v6 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
5 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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 [flat|nested] 8+ messages in thread
* [PATCH v6 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
` (3 preceding siblings ...)
2024-09-25 14:54 ` [PATCH v6 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
5 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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 [flat|nested] 8+ messages in thread
* [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
` (4 preceding siblings ...)
2024-09-25 14:54 ` [PATCH v6 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
@ 2024-09-25 14:54 ` Dhruva Gole
2024-09-25 16:12 ` Andrew Davis
5 siblings, 1 reply; 8+ messages in thread
From: Dhruva Gole @ 2024-09-25 14:54 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.
However, to maintain the backward compatibility with old devicetree, also
add condition to handle the case where we have the wrong offset and add
the older efuse_offset value there such that we don't end up reading the
wrong register offset.
Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
drivers/cpufreq/ti-cpufreq.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index ba621ce1cdda694c98867422dbb7f10c0df2afef..8a97b95b4c44a76b12cab76ddc0f9a5b8ae73f84 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,
};
@@ -349,11 +346,25 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data,
u32 *efuse_value)
{
struct device *dev = opp_data->cpu_dev;
+ struct device_node *np = opp_data->opp_node;
u32 efuse;
int ret;
- ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset,
- &efuse);
+ /*
+ * The following check is used as a way to check if this is an older devicetree
+ * being used where the entire wkup_conf node was marked as "syscon",
+ * "simple-mfd".
+ * Since this bug only affects AM625, make sure it enters this condition
+ * only for that SoC.
+ */
+ if (of_device_is_compatible(np, "simple-mfd") &&
+ of_device_is_compatible(np, "ti,am625")) {
+ ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset + 0x0018,
+ &efuse);
+ } else {
+ 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) {
/* not a syscon register! */
void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family
2024-09-25 14:54 ` [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
@ 2024-09-25 16:12 ` Andrew Davis
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Davis @ 2024-09-25 16:12 UTC (permalink / raw)
To: Dhruva Gole, 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, Bryan Brattlof
On 9/25/24 9:54 AM, Dhruva Gole wrote:
> 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.
>
> However, to maintain the backward compatibility with old devicetree, also
> add condition to handle the case where we have the wrong offset and add
> the older efuse_offset value there such that we don't end up reading the
> wrong register offset.
>
> Signed-off-by: Dhruva Gole <d-gole@ti.com>
> ---
> drivers/cpufreq/ti-cpufreq.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index ba621ce1cdda694c98867422dbb7f10c0df2afef..8a97b95b4c44a76b12cab76ddc0f9a5b8ae73f84 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,
> };
>
> @@ -349,11 +346,25 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data,
> u32 *efuse_value)
> {
> struct device *dev = opp_data->cpu_dev;
> + struct device_node *np = opp_data->opp_node;
> u32 efuse;
> int ret;
>
> - ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset,
> - &efuse);
> + /*
> + * The following check is used as a way to check if this is an older devicetree
"check is used as a way to check" sound redundant, maybe just:
This checks for old AM625 Devicetrees where the syscon was a phandle
to the wkup_conf parent, this required a hard-coded offset to
the efuse register.
> + * being used where the entire wkup_conf node was marked as "syscon",
> + * "simple-mfd".
> + * Since this bug only affects AM625, make sure it enters this condition
> + * only for that SoC.
> + */
> + if (of_device_is_compatible(np, "simple-mfd") &&
> + of_device_is_compatible(np, "ti,am625")) {
Kinda hacky, but keeping backwards compat often is hacky..
Does `of_device_is_compatible(np, "ti,am625")` actually work here? I'm assuming you
tested with an old DT to make sure this path ever got taken. Maybe put a warning
here that an old DT is in use and the user should update at some point.
Andrew
> + ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset + 0x0018,
> + &efuse);
> + } else {
> + 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) {
> /* not a syscon register! */
> void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-09-25 16:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-25 14:54 [PATCH v6 0/6] ti: k3-am62{a,p}x-sk: add opp frequencies Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 1/6] arm64: dts: ti: k3-am62a: " Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 2/6] arm64: dts: ti: k3-am62a7-sk: add 1.4ghz opp entry Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 3/6] arm64: dts: ti: k3-am62p: add opp frequencies Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 4/6] arm64: dts: ti: k3-am62p5-sk: add 1.4ghz opp entry Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 5/6] arm64: dts: ti: k3-am62: use opp_efuse_table for opp-table syscon Dhruva Gole
2024-09-25 14:54 ` [PATCH v6 6/6] cpufreq: ti-cpufreq: Update efuse/rev offsets in AM62 family Dhruva Gole
2024-09-25 16:12 ` Andrew Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®