[PATCH v2 4/5] arm64: dts: ti: k3-am62p5-sk: Enable Main UART wakeup

Kendall Willis posted 5 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 4/5] arm64: dts: ti: k3-am62p5-sk: Enable Main UART wakeup
Posted by Kendall Willis 1 month, 1 week ago
The Main UART can resume from suspend to RAM states when PIN_WKUP_EN
is enabled. Add the necessary pins needed to wakeup the system. Add the
system idle states that the Main UART can wakeup the system from.

Signed-off-by: Kendall Willis <k-willis@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
index ef719c6334fc094f01d9e8185992f2f58320e17d..96bba65f4f16792834567324db6f7f2bdee7bc06 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
@@ -328,14 +328,26 @@ AM62PX_IOPAD(0x0164, PIN_INPUT, 0) /* (A20) RGMII2_TX_CTL */
 		bootph-all;
 	};
 
-	main_uart0_pins_default: main-uart0-default-pins {
+	main_uart0_tx_pins_default: main-uart0-tx-default-pins {
 		pinctrl-single,pins = <
-			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
 			AM62PX_IOPAD(0x1cc, PIN_OUTPUT, 0)	/* (B22) UART0_TXD */
 		>;
 		bootph-all;
 	};
 
+	main_uart0_rx_pins_default: main-uart0-rx-default-pins {
+		pinctrl-single,pins = <
+			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
+		>;
+		bootph-all;
+	};
+
+	main_uart0_rx_pins_wakeup: main-uart0-rx-wakeup-pins {
+		pinctrl-single,pins = <
+			AM62PX_IOPAD(0x1c8, PIN_INPUT | PIN_WKUP_EN, 0)	/* (A22) UART0_RXD */
+		>;
+	};
+
 	main_uart1_pins_default: main-uart1-default-pins {
 		pinctrl-single,pins = <
 			AM62PX_IOPAD(0x0194, PIN_INPUT, 2) /* (D25) MCASP0_AXR3.UART1_CTSn */
@@ -692,8 +704,12 @@ partition@3fc0000 {
 };
 
 &main_uart0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&main_uart0_pins_default>;
+	pinctrl-names = "default", "wakeup";
+	pinctrl-0 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_default>;
+	pinctrl-1 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_wakeup>;
+	wakeup-source = <&system_deep_sleep>,
+			<&system_mcu_only>,
+			<&system_standby>;
 	status = "okay";
 	bootph-all;
 };

-- 
2.34.1
Re: [PATCH v2 4/5] arm64: dts: ti: k3-am62p5-sk: Enable Main UART wakeup
Posted by Nishanth Menon 1 month ago
On 20:38-20251230, Kendall Willis wrote:
> The Main UART can resume from suspend to RAM states when PIN_WKUP_EN
> is enabled. Add the necessary pins needed to wakeup the system. Add the
> system idle states that the Main UART can wakeup the system from.

Is the tx and rx pin register states both lost? I wonder why during
"wakeup" we set PIN_WKUP_EN ? is'nt that supposed to be set while
entering "suspend" state?

if the tx pin register state is not lost, then all we need to do is
play with the rx pin state (and leave pinctrl-0 as is)?

> 
> Signed-off-by: Kendall Willis <k-willis@ti.com>
> ---
>  arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 24 ++++++++++++++++++++----
>  1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
> index ef719c6334fc094f01d9e8185992f2f58320e17d..96bba65f4f16792834567324db6f7f2bdee7bc06 100644
> --- a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
> +++ b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
> @@ -328,14 +328,26 @@ AM62PX_IOPAD(0x0164, PIN_INPUT, 0) /* (A20) RGMII2_TX_CTL */
>  		bootph-all;
>  	};
>  
> -	main_uart0_pins_default: main-uart0-default-pins {
> +	main_uart0_tx_pins_default: main-uart0-tx-default-pins {
>  		pinctrl-single,pins = <
> -			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
>  			AM62PX_IOPAD(0x1cc, PIN_OUTPUT, 0)	/* (B22) UART0_TXD */
>  		>;
>  		bootph-all;
>  	};
>  
> +	main_uart0_rx_pins_default: main-uart0-rx-default-pins {
> +		pinctrl-single,pins = <
> +			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
> +		>;
> +		bootph-all;
> +	};
> +
> +	main_uart0_rx_pins_wakeup: main-uart0-rx-wakeup-pins {
> +		pinctrl-single,pins = <
> +			AM62PX_IOPAD(0x1c8, PIN_INPUT | PIN_WKUP_EN, 0)	/* (A22) UART0_RXD */
> +		>;
> +	};
> +
>  	main_uart1_pins_default: main-uart1-default-pins {
>  		pinctrl-single,pins = <
>  			AM62PX_IOPAD(0x0194, PIN_INPUT, 2) /* (D25) MCASP0_AXR3.UART1_CTSn */
> @@ -692,8 +704,12 @@ partition@3fc0000 {
>  };
>  
>  &main_uart0 {
> -	pinctrl-names = "default";
> -	pinctrl-0 = <&main_uart0_pins_default>;
> +	pinctrl-names = "default", "wakeup";
> +	pinctrl-0 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_default>;
> +	pinctrl-1 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_wakeup>;
> +	wakeup-source = <&system_deep_sleep>,
> +			<&system_mcu_only>,
> +			<&system_standby>;
>  	status = "okay";
>  	bootph-all;
>  };
> 
> -- 
> 2.34.1
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource
Re: [PATCH v2 4/5] arm64: dts: ti: k3-am62p5-sk: Enable Main UART wakeup
Posted by Kendall Willis 1 month ago
On 1/5/26 07:52, Nishanth Menon wrote:
> On 20:38-20251230, Kendall Willis wrote:
>> The Main UART can resume from suspend to RAM states when PIN_WKUP_EN
>> is enabled. Add the necessary pins needed to wakeup the system. Add the
>> system idle states that the Main UART can wakeup the system from.
> 
> Is the tx and rx pin register states both lost? I wonder why during
> "wakeup" we set PIN_WKUP_EN ? is'nt that supposed to be set while
> entering "suspend" state?
> 

The UART driver uses the default pinctrl state when the system is 
active. During the process of suspend, the wakeup pinctrl state is 
selected by the UART driver in order to allow wakeup. Upon resume, the 
default pinctrl state is selected again.

> if the tx pin register state is not lost, then all we need to do is
> play with the rx pin state (and leave pinctrl-0 as is)?
> 

Yes, it can be done where the pinctrl-0 does not change, and there is an 
additional pinctrl pins that has the TX and RX with PIN_WKUP_EN. The 
logic behind both implementations are the same, just a different approach.

>>
>> Signed-off-by: Kendall Willis <k-willis@ti.com>
>> ---
>>   arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 24 ++++++++++++++++++++----
>>   1 file changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
>> index ef719c6334fc094f01d9e8185992f2f58320e17d..96bba65f4f16792834567324db6f7f2bdee7bc06 100644
>> --- a/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
>> +++ b/arch/arm64/boot/dts/ti/k3-am62p5-sk.dts
>> @@ -328,14 +328,26 @@ AM62PX_IOPAD(0x0164, PIN_INPUT, 0) /* (A20) RGMII2_TX_CTL */
>>   		bootph-all;
>>   	};
>>   
>> -	main_uart0_pins_default: main-uart0-default-pins {
>> +	main_uart0_tx_pins_default: main-uart0-tx-default-pins {
>>   		pinctrl-single,pins = <
>> -			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
>>   			AM62PX_IOPAD(0x1cc, PIN_OUTPUT, 0)	/* (B22) UART0_TXD */
>>   		>;
>>   		bootph-all;
>>   	};
>>   
>> +	main_uart0_rx_pins_default: main-uart0-rx-default-pins {
>> +		pinctrl-single,pins = <
>> +			AM62PX_IOPAD(0x1c8, PIN_INPUT, 0)	/* (A22) UART0_RXD */
>> +		>;
>> +		bootph-all;
>> +	};
>> +
>> +	main_uart0_rx_pins_wakeup: main-uart0-rx-wakeup-pins {
>> +		pinctrl-single,pins = <
>> +			AM62PX_IOPAD(0x1c8, PIN_INPUT | PIN_WKUP_EN, 0)	/* (A22) UART0_RXD */
>> +		>;
>> +	};
>> +
>>   	main_uart1_pins_default: main-uart1-default-pins {
>>   		pinctrl-single,pins = <
>>   			AM62PX_IOPAD(0x0194, PIN_INPUT, 2) /* (D25) MCASP0_AXR3.UART1_CTSn */
>> @@ -692,8 +704,12 @@ partition@3fc0000 {
>>   };
>>   
>>   &main_uart0 {
>> -	pinctrl-names = "default";
>> -	pinctrl-0 = <&main_uart0_pins_default>;
>> +	pinctrl-names = "default", "wakeup";
>> +	pinctrl-0 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_default>;
>> +	pinctrl-1 = <&main_uart0_tx_pins_default>, <&main_uart0_rx_pins_wakeup>;
>> +	wakeup-source = <&system_deep_sleep>,
>> +			<&system_mcu_only>,
>> +			<&system_standby>;
>>   	status = "okay";
>>   	bootph-all;
>>   };
>>
>> -- 
>> 2.34.1
>>
> 

Best,
Kendall
Re: [PATCH v2 4/5] arm64: dts: ti: k3-am62p5-sk: Enable Main UART wakeup
Posted by Nishanth Menon 1 month ago
On 16:06-20260105, Kendall Willis wrote:
> On 1/5/26 07:52, Nishanth Menon wrote:
> > On 20:38-20251230, Kendall Willis wrote:
> > > The Main UART can resume from suspend to RAM states when PIN_WKUP_EN
> > > is enabled. Add the necessary pins needed to wakeup the system. Add the
> > > system idle states that the Main UART can wakeup the system from.
> > 
> > Is the tx and rx pin register states both lost? I wonder why during
> > "wakeup" we set PIN_WKUP_EN ? is'nt that supposed to be set while
> > entering "suspend" state?
> > 
> 
> The UART driver uses the default pinctrl state when the system is active.
> During the process of suspend, the wakeup pinctrl state is selected by the
> UART driver in order to allow wakeup. Upon resume, the default pinctrl state
> is selected again.
> 
> > if the tx pin register state is not lost, then all we need to do is
> > play with the rx pin state (and leave pinctrl-0 as is)?
> > 
> 
> Yes, it can be done where the pinctrl-0 does not change, and there is an
> additional pinctrl pins that has the TX and RX with PIN_WKUP_EN. The logic
> behind both implementations are the same, just a different approach.
> 

Keep the diff to as minimal as needed + update the commit message
please.

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