MYiR-Dev / myir-st-manifest

GNU General Public License v3.0
3 stars 1 forks source link

Problem waking up myd-ya157c from standby with rtc #1

Closed radoslavp closed 1 year ago

radoslavp commented 1 year ago

Hi, i'm trying to wake up myd-ya157c from standby when the wakeup source is RTC.

First, i make sure the only wakeup source is RTC by manually disabling everything except RTC and confirm it with this command:

root@myir:~# find /sys/devices/ -name wakeup | xargs grep "enabled" /sys/devices/platform/soc/5c004000.rtc/power/wakeup:enabled

Then I put the board to sleep via this command:

echo +5 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state

It goes to sleep, but either doesn't wakeup after 5 seconds at all and is restarted by watchdog after a while:

root@myir:~# echo +5 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state [ 4332.531090] PM: suspend entry (deep) [ 4332.536835] Filesystems sync: 0.003 seconds [ 4332.551517] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 4332.558764] OOM killer disabled. [ 4332.562256] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 4332.569542] printk: Suspending console(s) (use no_console_suspend to debug) NOTICE: CPU: STM32MP157AAC Rev.Z NOTICE: Model: MYIRTECH MYD-YA157C-512D v2 Development Board INFO: Reset reason (0x214): INFO: IWDG2 Reset (rst_iwdg2) INFO: Using EMMC INFO: Instance 2 INFO: Boot used partition fsbl1 NOTICE: BL2: v2.2-r1.0(debug):v2.2-stm32mp-r1-17-g2681164a7 NOTICE: BL2: Built : 13:24:33, Nov 28 2022 INFO: Using crypto library 'stm32_crypto_lib' INFO: BL2: Doing platform setup INFO: RAM: DDR3-1066/888 bin G 2x2Gb 533MHz v1.44 INFO: Memory size = 0x20000000 (512 MB) INFO: BL2 runs SP_MIN setup INFO: BL2: Loading image id 4 INFO: Loading image id=4 at address 0x2ffed000 INFO: Image id=4 loaded: 0x2ffed000 - 0x2ffff000 INFO: BL2: Loading image id 5 INFO: Loading image id=5 at address 0xc0100000 INFO: STM32 Image size : 875362 INFO: Image id=5 loaded: 0xc0100000 - 0xc01d5b62 WARNING: Skip signature check (header option) NOTICE: ROTPK is not deployed on platform. Skipping ROTPK verification. NOTICE: BL2: Booting BL32 INFO: Entry point address = 0x2ffed000 INFO: SPSR = 0x1d3 NOTICE: SP_MIN: v2.2-r1.0(debug):v2.2-stm32mp-r1-17-g2681164a7 NOTICE: SP_MIN: Built : 13:24:33, Nov 28 2022 INFO: ARM GICv2 driver initialized INFO: stm32mp IWDG1 (12): Secure INFO: ETZPC: CRYP1 (9) could be non secure INFO: SP_MIN: Initializing runtime services INFO: SP_MIN: Preparing exit to normal world

U-Boot 2020.01-stm32mp-r1 (Nov 28 2022 - 12:54:26 +0000)

...

Or wakes up, but throws illegal access error and then waits till it's restarted by the watchdog:

root@myir:~# echo +5 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state [ 197.788998] PM: suspend entry (deep) [ 197.797025] Filesystems sync: 0.005 seconds [ 197.804233] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 197.811466] OOM killer disabled. [ 197.814636] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 197.822204] printk: Suspending console(s) (use no_console_suspend to debug) NOTICE: CPU: STM32MP157AAC Rev.Z NOTICE: Model: MYIRTECH MYD-YA157C-512D v2 Development Board INFO: Reset reason (0x810): INFO: System exits from STANDBY INFO: Using EMMC INFO: Instance 2 INFO: Boot used partition fsbl1 NOTICE: BL2: v2.2-r1.0(debug):v2.2-stm32mp-r1-17-g2681164a7 NOTICE: BL2: Built : 13:24:33, Nov 28 2022 INFO: Using crypto library 'stm32_crypto_lib' INFO: BL2: Doing platform setup INFO: RAM: DDR3-1066/888 bin G 2x2Gb 533MHz v1.44 INFO: BL2 runs SP_MIN setup INFO: BL2: Loading image id 4 INFO: Loading image id=4 at address 0x2ffed000 INFO: Image id=4 loaded: 0x2ffed000 - 0x2ffff000 INFO: BL2: Skip loading image id 5 NOTICE: BL2: Booting BL32 INFO: Entry point address = 0x2ffed000 INFO: SPSR = 0x1d3 NOTICE: SP_MIN: v2.2-r1.0(debug):v2.2-stm32mp-r1-17-g2681164a7 NOTICE: SP_MIN: Built : 13:24:33, Nov 28 2022 INFO: ARM GICv2 driver initialized INFO: stm32mp IWDG1 (12): Secure INFO: ETZPC: CRYP1 (9) could be non secure INFO: SP_MIN: Initializing runtime services INFO: SP_MIN: Preparing exit to normal world ERROR: Illegal access to 0xe0000000 in : ERROR: Non-Secure ERROR: Privilege ERROR: Read PANIC at PC : 0x2ffefeb5

Exception mode=0x00000016 at: 0xc09200d4

I tried the same with stm32mp157A-dk1 board by ST and it works.

I found out the issue has probably something to do with your bsp not providing fip image - or more specifically firmware configuration with "firewall" rules for access to RAM (via TZC chip). Why is that? Especially since that's already implemented in DK1 board by ST. I'm now looking into what's needed to implement it to your board, but it doesn't seem to be simple (i don't have much experience with this stuff), so could you help me? Or do you plan to implement it yourself? Thank you.

radoslavp commented 1 year ago

sorry, posted to wrong repo. The correct one is here: https://github.com/MYiR-Dev/meta-myir-st/issues/1. Closing.