cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157 UART RX suspend wakeup

drew
Associate III

We are having issues with STM32MP157 UART7 (address 40018000) exiting low power CStop mode and waking up Linux (v4.19 from ST github).

We have confirmed that CStop mode is entered, and it can be exited using an external interrupt (55 pmic_irq), however it does not exit CStop mode with UART7 RX.

The stm32mp175c.dtsi defines uart7 interrupts as GIC interrupt 82 and EXTI interrupt 32, and defines the uart as a wakeup source

   uart7: serial@40018000 {

         ...

         interrupt-names = "event", "wakeup";

         interrupts-extended = <&intc GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,

                    <&exti 32 1>;

         ...

         wakeup-source;

Here is our DTS entry for uart7 and the pins for default, sleep and idle modes. DMA is also disabled since it was causing issues entering suspend-to-RAM. Using the 'interrupts =' property, we enabled interrupts 82 and 32, matching the dtsi.

   uart7_pins_mx: uart7_mx-0 {

      pins1 {

         pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART7_RX */

               <STM32_PINMUX('E', 10, AF7)>; /* UART7_CTS */

         bias-disable;

      };

      pins2 {

         pinmux = <STM32_PINMUX('E', 8, AF7)>, /* UART7_TX */

               <STM32_PINMUX('E', 9, AF7)>; /* UART7_RTS */

         bias-disable;

         drive-push-pull;

         slew-rate = <0>;

      };

   };

   uart7_sleep_pins_mx: uart7_sleep_mx-0 {

      pins {

         pinmux = <STM32_PINMUX('E', 7, ANALOG)>, /* UART7_RX */

               <STM32_PINMUX('E', 8, ANALOG)>, /* UART7_TX */

               <STM32_PINMUX('E', 9, ANALOG)>, /* UART7_RTS */

               <STM32_PINMUX('E', 10, ANALOG)>; /* UART7_CTS */

      };

   };

   uart7_idle_pins_mx: uart7_mx-0 {

      pins1 {

         pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART7_RX */

               <STM32_PINMUX('E', 10, AF7)>; /* UART7_CTS */

         bias-disable;

      };

      pins2 {

         pinmux = <STM32_PINMUX('E', 8, ANALOG)>, /* UART7_TX */

               <STM32_PINMUX('E', 9, AF7)>; /* UART7_RTS */

         bias-disable;

         drive-push-pull;

         slew-rate = <0>;

      };

   };

   &uart7{

      pinctrl-names = "default", "sleep", "idle";

      pinctrl-0 = <&uart7_pins_mx>;

      pinctrl-1 = <&uart7_sleep_pins_mx>;

      pinctrl-2 = <&uart7_idle_pins_mx>;

      /delete-property/dmas;

      /delete-property/dma-names;

      interrupts = <82>, <32>;

      uart-has-rtscts;

      st,hw-flow-ctrl;

      status = "okay";

   };

On boot we see the following log:

   [   0.396996] stm32-usart 40010000.serial: Linked as a consumer to 48000000.dma

   [   0.397419] 40010000.serial: ttySTM0 at MMIO 0x40010000 (irq = 23, base_baud = 4000000) is a stm32-usart

   [   1.200314] console [ttySTM0] enabled

   [   1.205840] stm32-usart 40018000.serial: interrupt mode used for rx (no dma)

   [   1.211528] stm32-usart 40018000.serial: interrupt mode used for tx (no dma)

   [   1.218523] 40018000.serial: ttySTM2 at MMIO 0x40018000 (irq = 30, base_baud = 6527435) is a stm32-usart

Here is what is in the interrupt table:

   root@stm32mp157:~ # cat /proc/interrupts |grep serial

   23:       372         0    GIC-0 84 Level    40010000.serial

   30:         3         0    GIC-0 114 Level    40018000.serial  <----- This is only present when the uart port is opened by a program

   67:         0         0 stm32-exti-h 30 Edge     40010000.serial:wakeup

   68:         0         0 stm32-exti-h 32 Edge     40018000.serial:wakeup

And the wakeup sources are enabled.

   root@stm32mp157:~ # find /sys/devices/ -name wakeup | while read f; do echo $f; cat $f; done

   ...

   /sys/devices/platform/soc/40018000.serial/power/wakeup

   enabled

   /sys/devices/platform/soc/40018000.serial/tty/ttySTM2/power/wakeup

   enabled

   ...

However once we enter suspend-to-RAM, RX on the uart7 does not wake the processor up. We have confirmed that when Linux is awake, data is received correctly, and the reading program works before and after suspend-to-RAM.

How can we enable wakeup on RX?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
drew
Associate III

Revisiting this issue with fresh eyes found that the issue was UART7 was assigned to PCLK1 in the TF-A and Uboot device trees. Setting UART7 to HSI fixes the problem. The pin definition was also updated to remove the analog setting of the pins in sleep, there is only a 'default' pin config.

We expect this is due to PCLK1 being disabled in the low power state selected by the Linux system.

View solution in original post

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @drew​ 

Are you working on an ST board or custom one ?

Thx

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
drew
Associate III

We are developing a custom system. The processor is the STM32MP157C

drew
Associate III

Revisiting this issue with fresh eyes found that the issue was UART7 was assigned to PCLK1 in the TF-A and Uboot device trees. Setting UART7 to HSI fixes the problem. The pin definition was also updated to remove the analog setting of the pins in sleep, there is only a 'default' pin config.

We expect this is due to PCLK1 being disabled in the low power state selected by the Linux system.