Skip to contentSkip to conversation

arm64: dts: ti: k3-am62-wakeup: Configure ti-sysc for wkup_uart0

PATCH Superseded Tony Lindgren 3 participants 10 messages Nov 14, 2023 – Dec 19, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: dts: ti: k3-am62-wakeup: Configure ti-sysc for wkup_uart0

The devices in the wkup domain are capable of waking up the system from suspend. We can configure the wkup domain devices in a generic way using the ti-sysc interconnect target module driver like we have done with the earlier TI SoCs.

As ti-sysc manages the SYSCONFIG related registers independent of the child hardware device, the wake-up configuration is also set even if wkup_uart0 is reserved by sysfw.

The wkup_uart0 device has interconnect target module register mapping like dra7 wkup uart. There is a 1 MB interconnect target range with one uart IP block in the target module. The power domain and clock affects the whole interconnect target module.

Note we change the functional clock name to follow the ti-sysc binding and use "fck" instead of "fclk".

---

Changes since v1:

- Added Tested-by from Dhruva

---
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi | 33 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +27 -6
@@ -5,6 +5,8 @@
  * Copyright (C) 2020-2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include <dt-bindings/bus/ti-sysc.h>
+
 &cbass_wakeup {
 	wkup_conf: syscon@43000000 {
 		bootph-all;
@@ -21,14 +23,33 @@ chipid: chipid@14 {
 		};
 	};
 
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {
+		compatible = "ti,sysc-omap2", "ti,sysc";
+		reg = <0 0x2b300050 0 0x4>,
+		      <0 0x2b300054 0 0x4>,
+		      <0 0x2b300058 0 0x4>;
+		reg-names = "rev", "sysc", "syss";
+		ti,sysc-mask = <(SYSC_OMAP2_ENAWAKEUP |
+				 SYSC_OMAP2_SOFTRESET |
+				 SYSC_OMAP2_AUTOIDLE)>;
+		ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+				<SYSC_IDLE_NO>,
+				<SYSC_IDLE_SMART>,
+				<SYSC_IDLE_SMART_WKUP>;
+		ti,syss-mask = <1>;
 		power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 114 0>;
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
 	};
 
 	wkup_i2c0: i2c@2b200000 {
Signature · 1 line
2.42.1
#1 lore raw
Quoted 55 lines · Tony Lindgren

The devices in the wkup domain are capable of waking up the system from suspend. We can configure the wkup domain devices in a generic way using the ti-sysc interconnect target module driver like we have done with the earlier TI SoCs.

As ti-sysc manages the SYSCONFIG related registers independent of the child hardware device, the wake-up configuration is also set even if wkup_uart0 is reserved by sysfw.

The wkup_uart0 device has interconnect target module register mapping like dra7 wkup uart. There is a 1 MB interconnect target range with one uart IP block in the target module. The power domain and clock affects the whole interconnect target module.

Note we change the functional clock name to follow the ti-sysc binding and use "fck" instead of "fclk".

---

Changes since v1:

- Added Tested-by from Dhruva

---
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi | 33 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +8 -4
@@ -5,6 +5,8 @@
  * Copyright (C) 2020-2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include <dt-bindings/bus/ti-sysc.h>
+
 &cbass_wakeup {
 	wkup_conf: syscon@43000000 {
 		bootph-all;
@@ -21,14 +23,33 @@ chipid: chipid@14 {
 		};
 	};
 
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {
+		compatible = "ti,sysc-omap2", "ti,sysc";
+		reg = <0 0x2b300050 0 0x4>,
+		      <0 0x2b300054 0 0x4>,
+		      <0 0x2b300058 0 0x4>;
+		reg-names = "rev", "sysc", "syss";

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 41

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +8 -0
+		ti,sysc-mask = <(SYSC_OMAP2_ENAWAKEUP |
+				 SYSC_OMAP2_SOFTRESET |
+				 SYSC_OMAP2_AUTOIDLE)>;
+		ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+				<SYSC_IDLE_NO>,
+				<SYSC_IDLE_SMART>,
+				<SYSC_IDLE_SMART_WKUP>;
+		ti,syss-mask = <1>;
 		power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 114 0>;

I'm a little confused why these power-domain and clocks stay here and are not moved under the wkup_uart0 node...

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 51

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -2
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";

...here.

The SCI device ID 114 is specifically for wkup_uart0[1], so it seems to me those should be in the wkup_uart0 node.

Kevin

[1] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am62x/devices.html

#2 lore raw
Quoted 2 lines · Kevin Hilman

I'm a little confused why these power-domain and clocks stay here and are not moved under the wkup_uart0 node...

The resources are also needed by the interconnect target module. It's the wrapper IP for the child device(s). In this case there's one chip 8250 IP instance. In some other devices there can be multiple child IP devices wired to one target module.

Quoted 15 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 51

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -2
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";

...here.

Quoted 2 lines

The SCI device ID 114 is specifically for wkup_uart0[1], so it seems to me those should be in the wkup_uart0 node.

Those resources are also needed for the parent target module for revision detection, quirks, reset, idle register configuration, and to probe the child devices.

Here the 8250 IP can be set to status = "reserved" when used by the firmware, and 8250 not touched by Linux. However, the parent interconnect target module still needs to be configured for idle registers and wake-up path register bit so the wake-up from deeper suspend states works.

Regards,

Tony

#3 lore raw
Quoted 27 lines · Tony Lindgren
Quoted 2 lines · Kevin Hilman

I'm a little confused why these power-domain and clocks stay here and are not moved under the wkup_uart0 node...

The resources are also needed by the interconnect target module. It's the wrapper IP for the child device(s). In this case there's one chip 8250 IP instance. In some other devices there can be multiple child IP devices wired to one target module.

Quoted 15 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 51

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -2
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";

...here.

Quoted 2 lines

The SCI device ID 114 is specifically for wkup_uart0[1], so it seems to me those should be in the wkup_uart0 node.

Quoted 8 lines

Those resources are also needed for the parent target module for revision detection, quirks, reset, idle register configuration, and to probe the child devices.

Here the 8250 IP can be set to status = "reserved" when used by the firmware, and 8250 not touched by Linux. However, the parent interconnect target module still needs to be configured for idle registers and wake-up path register bit so the wake-up from deeper suspend states works.

OK, makes sense. Thanks for the clarification.

In that case, shouldn't the same be done for the other wakeup sources there (e.g. wkup_rtc0) ?

Kevin

#4 lore raw
Quoted 33 lines · Kevin Hilman
Quoted 31 lines · Tony Lindgren
Quoted 2 lines · Kevin Hilman

I'm a little confused why these power-domain and clocks stay here and are not moved under the wkup_uart0 node...

The resources are also needed by the interconnect target module. It's the wrapper IP for the child device(s). In this case there's one chip 8250 IP instance. In some other devices there can be multiple child IP devices wired to one target module.

Quoted 15 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 51

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -2
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";

...here.

Quoted 2 lines

The SCI device ID 114 is specifically for wkup_uart0[1], so it seems to me those should be in the wkup_uart0 node.

Those resources are also needed for the parent target module for revision detection, quirks, reset, idle register configuration, and to probe the child devices.

Quoted 6 lines
Quoted 4 lines

Here the 8250 IP can be set to status = "reserved" when used by the firmware, and 8250 not touched by Linux. However, the parent interconnect target module still needs to be configured for idle registers and wake-up path register bit so the wake-up from deeper suspend states works.

OK, makes sense. Thanks for the clarification.

One more thing to clarify, there's nothing stopping also mapping the needed resources for the child IP too if needed by the driver or the dts binding. The calls for resources by the 8250 driver just won't do anything as the resources are already enabled by the parent.

Quoted 2 lines

In that case, shouldn't the same be done for the other wakeup sources there (e.g. wkup_rtc0) ?

Yes it should be done for devices with the wake-up path wired like wkup_rtc0.

Regards,

Tony

Reviewed-by
#5 lore raw
Quoted 39 lines · Tony Lindgren
Quoted 38 lines · Kevin Hilman
Quoted 35 lines · Tony Lindgren
Quoted 2 lines · Kevin Hilman

I'm a little confused why these power-domain and clocks stay here and are not moved under the wkup_uart0 node...

The resources are also needed by the interconnect target module. It's the wrapper IP for the child device(s). In this case there's one chip 8250 IP instance. In some other devices there can be multiple child IP devices wired to one target module.

Quoted 15 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 51

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -2
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";

...here.

Quoted 2 lines

The SCI device ID 114 is specifically for wkup_uart0[1], so it seems to me those should be in the wkup_uart0 node.

Those resources are also needed for the parent target module for revision detection, quirks, reset, idle register configuration, and to probe the child devices.

Here the 8250 IP can be set to status = "reserved" when used by the firmware, and 8250 not touched by Linux. However, the parent interconnect target module still needs to be configured for idle registers and wake-up path register bit so the wake-up from deeper suspend states works.

Quoted 6 lines
Quoted 1 line

OK, makes sense. Thanks for the clarification.

One more thing to clarify, there's nothing stopping also mapping the needed resources for the child IP too if needed by the driver or the dts binding. The calls for resources by the 8250 driver just won't do anything as the resources are already enabled by the parent.

OK, thanks.

Quoted 5 lines
Quoted 2 lines

In that case, shouldn't the same be done for the other wakeup sources there (e.g. wkup_rtc0) ?

Yes it should be done for devices with the wake-up path wired like wkup_rtc0.

OK, in that case, this all makes sense to me.

Kevin

maintainer
#6 lore raw
In reply to Tony Lindgren
Quoted 42 lines · Tony Lindgren

The devices in the wkup domain are capable of waking up the system from suspend. We can configure the wkup domain devices in a generic way using the ti-sysc interconnect target module driver like we have done with the earlier TI SoCs.

As ti-sysc manages the SYSCONFIG related registers independent of the child hardware device, the wake-up configuration is also set even if wkup_uart0 is reserved by sysfw.

The wkup_uart0 device has interconnect target module register mapping like dra7 wkup uart. There is a 1 MB interconnect target range with one uart IP block in the target module. The power domain and clock affects the whole interconnect target module.

Note we change the functional clock name to follow the ti-sysc binding and use "fck" instead of "fclk".

---

Changes since v1:

- Added Tested-by from Dhruva

---
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi | 33 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +2 -0
@@ -5,6 +5,8 @@
  * Copyright (C) 2020-2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include <dt-bindings/bus/ti-sysc.h>
+
 &cbass_wakeup {
 	wkup_conf: syscon@43000000 {
 		bootph-all;

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 26

Quoted 8 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -4
@@ -21,14 +23,33 @@ chipid: chipid@14 {
 		};
 	};
 
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {

should be target-module@2b300050 to match up with reg?

Quoted 13 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +13 -0
+		compatible = "ti,sysc-omap2", "ti,sysc";
+		reg = <0 0x2b300050 0 0x4>,
+		      <0 0x2b300054 0 0x4>,
+		      <0 0x2b300058 0 0x4>;
+		reg-names = "rev", "sysc", "syss";
+		ti,sysc-mask = <(SYSC_OMAP2_ENAWAKEUP |
+				 SYSC_OMAP2_SOFTRESET |
+				 SYSC_OMAP2_AUTOIDLE)>;
+		ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+				<SYSC_IDLE_NO>,
+				<SYSC_IDLE_SMART>,
+				<SYSC_IDLE_SMART_WKUP>;
+		ti,syss-mask = <1>;

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 47

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +6 -2
 		power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>;
 		clocks = <&k3_clks 114 0>;
-		clock-names = "fclk";
-		status = "disabled";
+		clock-names = "fck";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x2b300000 0x100000>;
+
+		wkup_uart0: serial@2b300000 {

serial@0 to match up with reg?

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +5 -0
+			compatible = "ti,am64-uart", "ti,am654-uart";
+			reg = <0 0x100>;
+			interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
 	};
 
 	wkup_i2c0: i2c@2b200000 {
Signature · 1 line
2.42.1
Signature · 8 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#7 lore raw
Quoted 8 lines · Nishanth Menon

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 26

Quoted 5 lines · Tony Lindgren
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -4
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {

should be target-module@2b300050 to match up with reg?

It's best to use the target-module IO range here, not the first reg. The first reg may be tossed anywhere in the target module address space depending on the device.

Ideally of course there would be just a standardized range of target module related registers at the end of the IO space..

Quoted 3 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 47

Quoted 1 line
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -0
+		wkup_uart0: serial@2b300000 {

serial@0 to match up with reg?

Yes thanks for catching this. The 8250 IP is at the beginning of the target module IO space. Will post an updated patch.

Regards,

Tony

maintainer
#8 lore raw
Quoted 10 lines · Tony Lindgren
Quoted 8 lines · Nishanth Menon

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 26

Quoted 5 lines · Tony Lindgren
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -4
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {

should be target-module@2b300050 to match up with reg?

Quoted 6 lines

It's best to use the target-module IO range here, not the first reg. The first reg may be tossed anywhere in the target module address space depending on the device.

Ideally of course there would be just a standardized range of target module related registers at the end of the IO space..

Sorry Tony, but the node address must matchup with the reg description for the node. I'd rather not sit and argue about this with automated tools and deal with trivial patches - so either tools like dtc need to ignore this or lets just fix the node address.

Quoted 10 lines
Quoted 3 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 47

Quoted 1 line
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -0
+		wkup_uart0: serial@2b300000 {

serial@0 to match up with reg?

Yes thanks for catching this. The 8250 IP is at the beginning of the target module IO space. Will post an updated patch.

Regards,

Tony

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#9 lore raw
Quoted 15 lines · Nishanth Menon
Quoted 14 lines · Tony Lindgren
Quoted 8 lines · Nishanth Menon

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 26

Quoted 5 lines · Tony Lindgren
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +1 -4
-	wkup_uart0: serial@2b300000 {
-		compatible = "ti,am64-uart", "ti,am654-uart";
-		reg = <0x00 0x2b300000 0x00 0x100>;
-		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+	target-module@2b300000 {

should be target-module@2b300050 to match up with reg?

It's best to use the target-module IO range here, not the first reg. The first reg may be tossed anywhere in the target module address space depending on the device.

Quoted 7 lines
Quoted 2 lines

Ideally of course there would be just a standardized range of target module related registers at the end of the IO space..

Sorry Tony, but the node address must matchup with the reg description for the node. I'd rather not sit and argue about this with automated tools and deal with trivial patches - so either tools like dtc need to ignore this or lets just fix the node address.

Oh sorry I did not mean to add a make W=1 dtbs warning. Yeah let's change the node name to match the first reg to avoid the warning.

It should be also add some better checks for node names with ranges but with just a few control registers.

Regards,

Tony