This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3356: Cannot enter sleep mode with kernel 6.1.49

Part Number: AM3356

Tool/software:

Hi expert

We cannot enter sleep(stand-by) mode with kernel 6.1.46 on our custom board.
How can we enter the sleep mode?
In case of kernel 4.19 and 5.10, we can enter the sleep mode on the board.


SDK version:
09.01.00.001

Board:
custom board

kernel version:

$ uname -a
Linux am335x-evm 6.1.46-g1d4b5da681 #2 PREEMPT Tue Nov  5 15:47:28 JST 2024 armv7l GNU/Linux

Operation and error message:

$ echo standby > /sys/power/state
bash: echo: write error: Invalid argument

sleep.conf:

$ cat /etc/systemd/sleep.conf
[Sleep]
SuspendState=standby

device tree:

&wkup_m3_ipc {
    ti,scale-data-fw = "am335x-evm-scale-data.bin";
};
or
&wkup_m3_ipc {
    ti,scale-data-fw = "am335x-boneblack-scale-data.bin";
};
or
&wkup_m3_ipc {
    firmware-name = "am335x-evm-scale-data.bin";
};

ls of /lib/firmware:

am335x-bone-scale-data.bin
am335x-evm-scale-data.bin
am335x-pm-firmware.elf
am43x-evm-scale-data.bin
inv_dmpfirmware.bin
regulatory.db
regulatory.db.p7s
ti-connectivity/

An excerpt from dmesg output:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.1.46-g1d4b5da681 (katsu@pck-134) (arm-oe-linux-gnueabi-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #2 PREEMPT Tue Nov  5 15:47:28 JST 2024
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: JRCM AM335x JRN-430K
[    0.000000] Memory policy: Data cache writeback
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 64 MiB at 0x88800000
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000080000000-0x000000008fdfffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x000000008fdfffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000008fdfffff]
[    0.000000] CPU: All CPU(s) started in SVC mode.
  ...
[    0.163293] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.613646] remoteproc remoteproc0: wkup_m3 is available
  ...
[    1.071960] edma 49000000.dma: TI EDMA DMA engine driver
  ...
[    3.261695] remoteproc remoteproc0: powering up wkup_m3
[    3.267221] remoteproc remoteproc0: Direct firmware load for am335x-pm-firmware.elf failed with error -2
[    3.379025] remoteproc remoteproc0: Falling back to sysfs fallback for: am335x-pm-firmware.elf
[    3.391467] input: wakeup_pins as /devices/platform/wakeup_pins/input/input0
  ...
[   24.433096] PM: Cannot get wkup_m3_ipc handle
[   25.345573] PM: Cannot get wkup_m3_ipc handle
[   44.610947] PM: Cannot get wkup_m3_ipc handle
[   64.491064] remoteproc remoteproc0: request_firmware failed: -110
[   64.497362] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed

Kernel config:

# Firmware Loading from rootfs
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y

# AMx3 Power Config Options
CONFIG_MAILBOX=y
CONFIG_OMAP2PLUS_MBOX=y

CONFIG_WKUP_M3_RPROC=y
CONFIG_SOC_TI=y
CONFIG_WKUP_M3_IPC=y
CONFIG_TI_EMIF_SRAM=y/m
CONFIG_AMX3_PM=y/m 

CONFIG_RTC_DRV_OMAP=y/m

Best Regards,
Katsuyama

  • Hi Katsuyama-san,

    System suspend and resume is not enabled in SDK9.x which uses kernel 6.1.

    [   64.491064] remoteproc remoteproc0: request_firmware failed: -110
    [   64.497362] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed

    These messages mean the M3 firmware is not loaded properly, then suspend won't work.

    I could help solve this issue, however resume is broken in kernel 6.1. The issue has been reported to our sw dev team but it has not be resolved yet.

  • Hi Bin-san

    Thank you for your quick response.

    This is a fatal problem for our products.
    So, I hope it will be fixed in a few weeks.

    Best regards
    Katsuyama

  • Hi Katsuyama-san,

    It is planned to be fixed in AM335x SDK9.3, which will be released by mid/end of next month.

  • Hi Katsuyama-san,

    What wakeup source will you be using?

  • Hi Bin-san

    We will use GPIO0 and UARTs as wakeup source.

    Best regards
    Katsuyama

  • Hi Katsuyama-san,

    Noted. Thanks.

  • Hi Bin-san,

    Thank you.

    By the way, I just realized I got the version number wrong in this title. It must be "6.1.46".

    I understand new fixed version will be "6.1.49".

  • Hi Katsuyama-san,

    The AM335x SDK9.3 will be based on mainline kernel v6.1.105 or newer.

  • Hi Bin-san

    What is the status of countermeasures?

    If the kernel version is 6.1.113 or higher, that would be great.
    Because vulnerabilities such as CVE-2024-49884 have been addressed.

    Best regards
    Katsuyama

  • Hi Katsuyama-san,

    Currently the SDK9.3 release candidate is based on v6.1.112. The branch will be sync'd with the upstream stable branch again today which is v6.1.119 as of now and run through the test cycles. If there is no any issue in this update, the SDK9.3 will be at least based on v6.1.119.

  • Hi Bin-san,

    Thank you for your reply.
    I'm very happy to hear that the next kernel base version will be 6.1.119.

    I previously heard that the release would be in the middle or end of this month.
    When do you think it will be?

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    The SDK release candidate is in the last few rounds of testing. As far as I know the release is still on schedule.

  • Hi Katsuyama-san,

    $ echo standby > /sys/power/state
    bash: echo: write error: Invalid argument

    Sorry I just noticed you were reporting issue in standby usecase. Do you only require standby mode but not deepsleep mode?

    There was a miscommunication in the issue report to our sw dev team. Then now resume/wakeup only work in deepsleep suspend, but not in standby mode. The miscommunication has been corrected now, and our sw dev team is investigating the standby resume issue. It is likely too late to include the solution in SDK9.3 release, but the fix patch will be available on the kernel 6.1.y branch on git.ti.com once the issue is fixed.

  • Hi Bin-san,

    Thank you for the information.

    > Do you only require standby mode but not deepsleep mode?
    Yes, I only require standby mode. I don't use deepsleep mode.

    We hope that the fix will be released as soon as possible, and ideally included in SDK9.3.

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    Sorry it is unlikely to be included in SDK9.3. The SDK9.3 will be released in a couple weeks and the code is already frozen. But I will let you know as soon as the patch is available on the kernel repo on git.ti.com.

  • Hi Bin-san,

    Can you show me the URL for SDK 9.3 when it is released?
    I will Check periodically to see if it has been uploaded.

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    The SDK9.3 release is at https://www.ti.com/tool/PROCESSOR-SDK-AM335X

    But the release itself won't be updated. The future kernel update will be on the ti-linux-6.1.y-cicd branch linked below.

    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/log/?h=ti-linux-6.1.y-cicd

  • Hi Katsuyama-san,

    Sorry I think I misunderstood your question, and my previous response didn't answer it.

    AM335x SDK9.3 has been released last week. Please refer to the link below.

    https://www.ti.com/tool/PROCESSOR-SDK-AM335X

  • Hi Bin-san,

    Thank you for your reply.

    In case of SDK 9.1, I download it from the following URL.

    software-dl.ti.com/.../Overview_Building_the_SDK.html

    I want to know this style URL for SDK 9.3.

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    In case of SDK 9.1, I download it from the following URL.

    software-dl.ti.com/.../Overview_Building_the_SDK.html

    This links to the SDK9.1 documentation. The corresponding link for SDK9.3 is

    https://software-dl.ti.com/processor-sdk-linux/esd/AM335X/09_03_05_02/exports/docs/linux/Overview_Building_the_SDK.html

  • Hi Bin-san,

    I saw software-dl.ti.com/.../Overview_Building_the_SDK.html.
    I'm a little confused because the contents were very different from the one
    for SDK 9.1.

    Is the following SDK 9.1 method still possible in SDK 9.3?

      $ git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk
      $ cd tisdk
      $ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-09.03.05.02-legacy-config.txt
    


    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    The documentation scheme is changed in SDK9.3, but the build instruction is the same as that in SDK9.1 doc:

    git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk
    cd tisdk
    ./oe-layertool-setup.sh -f configs/processor-sdk/<oeconfig-file>
    cd build
    . conf/setenv
    MACHINE=<machine> bitbake -k tisdk-default-image

    Link https://software-dl.ti.com/processor-sdk-linux/esd/AM335X/09_03_05_02/exports/docs/linux/Release_Specific_Yocto_layer_Configuration.html#yocto-layer-configuration shows the oeconfig-file is "processor-sdk-09.03.05.02-legacy-config.txt", so yes, your instruction is correct.

    I also wanted to let you know that the SDK provide prebuilt Linux images, which you can download and install the SDK package linked below, just in case you can use it without re-build the SDK in Yocto.

    https://dr-download.ti.com/software-development/software-development-kit-sdk/MD-1BUptXj3op/09.03.05.02/ti-processor-sdk-linux-am335x-evm-09.03.05.02-Linux-x86-Install.bin

  • Hi Bin-san,

    I was able to build the 'tisdk-base-image' of SDK 9.3 successfully.
    Thank you very much!

    By the way, I'll be checking the kernel repositories regularly, when do you think the fix for the sleep issue will be available?

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    The developer is actively debugging the issue, there is some understanding of the problem, but the root cause has not been identified yet, so at this moment it is not clear when the fix will be available,

  • Hi Bin-san,

    A happy new year!

    How is debugging the sleep issue going?
    I checked the repository and couldn't find any commits about it.
    I am looking forward to the patch being released.

    Best regards,
    Katsuyama

  • Hi Katsuyama-san,

    Most of us were out of office in the past two weeks for the holidays, I don't believe it has much debugging work done recently. I will keep you posted.

  • Hi Bin-san,

    Has there been any progress?

  • Hi Katsuyama-san,

    Apologies for the delay. Attached below are the two patches I just got from the developer.

    7776.0001-soc-ti-omap-prm-Fix-STANDBY-handling-of-PER-power-do.patch

    7776.0002-ARM-OMAP2-Fix-l4ls-clk-domain-handling-in-STANDBY.patch

    And here is my standby wakeup log.

    root@am335x-evm:~# rtcwake -s 10 -m standby
    rtcwake: wakeup from "standby" using /dev/rtc0 at Sat Jan  1 00:01:17 2000
    [   68.734885] PM: suspend entry (shallow)
    [   68.738957] Filesystems sync: 0.000 seconds
    [   68.747341] Freezing user space processes
    [   68.754855] Freezing user space processes completed (elapsed 0.002 seconds)
    [   68.762255] OOM killer disabled.
    [   68.765517] Freezing remaining freezable tasks
    [   68.771514] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
    [   68.779116] printk: Suspending console(s) (use no_console_suspend to debug)
    [   68.915120] cpsw-switch 4a100000.switch eth0: Link is Down
    [   68.926728] PM: suspend devices took 0.140 seconds
    [   68.942623] Disabling non-boot CPUs ...
    [   68.942685] pm33xx pm33xx: PM: Successfully put all powerdomains to target state
    [   68.942685] PM: Wakeup source RTC Alarm
    [   68.956377] cpsw-switch 4a100000.switch: starting ndev. mode: dual_mac
    [   69.041664] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
    [   69.165276] PM: resume devices took 0.210 seconds
    [   69.215722] OOM killer enabled.
    [   69.219309] Restarting tasks ... done.
    [   69.248182] random: crng reseeded on system resumption
    [   69.259365] PM: suspend exit
    root@am335x-evm:~# [   71.161004] cpsw-switch 4a100000.switch eth0: Link is Up - 100Mbps/Full - flow control off

  • Hi Bin-san,

    Thank you for the patches.
    I applied them, but unfortunately nothing has changed.
    Following kernel messages are still shown.

    [   64.489759] remoteproc remoteproc0: request_firmware failed: -110
    [   64.496060] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed
    

    And rtcwake shows followings.

    rtcwake -s 10 -m standby 
    rtcwake: unrecognized suspend state 'standby' 
    

  • [   64.489759] remoteproc remoteproc0: request_firmware failed: -110
    [   64.496060] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed

    This error should be already fixed in the SDK9.3.

    How did you generate the kernel .config file? Please use command 'make linux' in the SDK top level directory to build the kernel.

  • Hi Bin-san,

    > Please use command 'make linux' in the SDK top level directory to build the kernel.

    I'm afraid I can't understand this method.
    I made .config as follows:
    ---
    1. cp -a 'kernel-source' directory in 'tisdk/build/arago-tmp-default-glibc/arago-tmp-default-glibc/work-shared/am335x-evm ' ./linux
    2. cd linux
    3. apply patches
    4. make mrproper
    5. make am335x_xxx_defconfig
    ---
    I'll upload am335x_xxx_defconfig after.

    Then build kernel and modules. And deploy them as follows.
    ---
    5. make
    6. make INSTALL_MOD_PATH=xxxx modules_install
    7. deploy zImage and modules on target board.
    ---

    Could this be caused by the cortex m3 firmware?

  • Hi Katsuyama-san,

    1. cp -a 'kernel-source' directory in 'tisdk/build/arago-tmp-default-glibc/arago-tmp-default-glibc/work-shared/am335x-evm ' ./linux

    Ensure the "kernel-source" is take from the AM335x SDK9.3 release.

    5. make am335x_xxx_defconfig

    The SDK9.3 kernel doesn't have this "am335x_xxx_defconfig" file. Please use the following command to generate .config.

    make multi_v7_defconfig ti_multi_v7_prune.config no_smp.config

  • Hi Bin-san,

    am335x_xxx_defconfig is what I customized after migrating from an old kernel.

    By the way, I tried as you said.
    I got the error "mpc.h: No such file or directory".
    Here's the log.

    $ make mrproper
    $ make multi_v7_defconfig ti_multi_v7_prune.config no_smp.config
      ...
    $ make
      SYNC    include/config/auto.conf.cmd
      SYSHDR  arch/arm/include/generated/uapi/asm/unistd-oabi.h
      SYSHDR  arch/arm/include/generated/uapi/asm/unistd-eabi.h
      HOSTCC  scripts/dtc/dtc.o
      HOSTCC  scripts/dtc/flattree.o
      HOSTCC  scripts/dtc/fstree.o
      HOSTCC  scripts/dtc/data.o
      HOSTCC  scripts/dtc/livetree.o
      HOSTCC  scripts/dtc/treesource.o
      HOSTCC  scripts/dtc/srcpos.o
      HOSTCC  scripts/dtc/checks.o
      HOSTCC  scripts/dtc/util.o
      LEX     scripts/dtc/dtc-lexer.lex.c
      YACC    scripts/dtc/dtc-parser.tab.[ch]
      HOSTCC  scripts/dtc/dtc-lexer.lex.o
      HOSTCC  scripts/dtc/dtc-parser.tab.o
      HOSTLD  scripts/dtc/dtc
      HOSTCC  scripts/dtc/libfdt/fdt.o
      HOSTCC  scripts/dtc/libfdt/fdt_ro.o
      HOSTCC  scripts/dtc/libfdt/fdt_wip.o
      HOSTCC  scripts/dtc/libfdt/fdt_sw.o
      HOSTCC  scripts/dtc/libfdt/fdt_rw.o
      HOSTCC  scripts/dtc/libfdt/fdt_strerror.o
      HOSTCC  scripts/dtc/libfdt/fdt_empty_tree.o
      HOSTCC  scripts/dtc/libfdt/fdt_addresses.o
      HOSTCC  scripts/dtc/libfdt/fdt_overlay.o
      HOSTCC  scripts/dtc/fdtoverlay.o
      HOSTLD  scripts/dtc/fdtoverlay
      HOSTCXX scripts/gcc-plugins/arm_ssp_per_task_plugin.so
    In file included from scripts/gcc-plugins/gcc-common.h:95,
                     from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3:
    /opt/arago-2023.10/sysroots/x86_64-arago-linux/usr/lib/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.5.0/plugin/include/builtins.h:23:10: fatal error: mpc.h: No such file or directory
       23 | #include <mpc.h>
          |          ^~~~~~~
    compilation terminated.
    make[2]: *** [scripts/gcc-plugins/Makefile:54: scripts/gcc-plugins/arm_ssp_per_task_plugin.so] Error 1
    make[1]: *** [scripts/Makefile.build:505: scripts/gcc-plugins] Error 2
    make: *** [Makefile:1268: scripts] Error 2
    

  • Hi Bin-san,

    Once I disabled CONFIG_GCC_PLUGINS the error about mcp.h disappeared and the build completed successfully.

    The following kernel message no longer appears:

    [   64.489759] remoteproc remoteproc0: request_firmware failed: -110
    [   64.496060] wkup_m3_ipc 44e11324.wkup_m3_ipc: rproc_boot failed
    

    But I still can't enter sleep mode.

    Below is the error message.

    $ echo standby > /sys/power/state
    bash: echo: write error: Invalid argument
    $ rtcwake -s 10 -m standby
    rtcwake: unrecognized suspend state 'standby'
    

  • Hi Bin-san,

    I can't see 'standby' in /sys/power/state.

    $ cat /sys/power/state
    freeze mem
    

  • Hi Katsuyama-san,

    By the way, I tried as you said.
    I got the error "mpc.h: No such file or directory".

    I think you need to install some packages on PC Ubuntu to solve this problem:

    $ sudo apt install libgmp3-dev libmpc-dev

    Once I disabled CONFIG_GCC_PLUGINS the error about mcp.h disappeared and the build completed successfully.


    I don't recommend to disable it, as the SDK always has it enabled. I am not sure about the behavior if it is disabled.

    I can't see 'standby' in /sys/power/state.

    Let's first ensure we are on the same page - instead of using your kernel build process, can you please do the following to ensure you can get deepsleep or standby resume working?

    - download and install the AM335x SDK9.3 release from ti.com;
    - go to the SDK installation directory;
    - run command "make linux", which compiles the kernel zImage, modules, and dtbs;
    - use your prefer methods to populate the kernel zImage, modules, and dtb to your board root filesystem.

  • Hi Bin-san,

    I installed libgmp3-dev libmpc-dev and enabled CONFIG_GCC_PLUGINS, following error occurs.

    cc1: error: cannot load plugin ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: undefined symbol: _ZN8opt_pass14set_pass_paramEjb
    cc1: error: cannot load plugin ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: undefined symbol: _ZN8opt_pass14set_pass_paramEjb
    make[1]: *** [scripts/Makefile.build:250: scripts/mod/empty.o] error 1
    

     - download and install the AM335x SDK9.3 release from ti.com;
     - go to the SDK installation directory;
     - run command "make linux", which compiles the kernel zImage, modules, and dtbs;
     - use your prefer methods to populate the kernel zImage, modules, and dtb to your board root filesystem.

    I don't understand "make linux".
    In which directory should I run it?

    I built with the following steps according to software-dl.ti.com/.../Overview_Building_the_SDK.html .

      $ sudo apt install libgmp3-dev libmpc-dev
      $ git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk
      $ cd tisdk/
      $ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-09.03.05.02-legacy-config.txt
      $ cd build/
      $ . conf/setenv
      $ MACHINE=am335x-evm bitbake -k tisdk-base-image
      $ cd ../..
      $ cp -a tisdk/build/arago-tmp-default-glibc/arago-tmp-default-glibc/work-shared/am335x-evm/kernel-source ./linux
      $ cd linux
      $ git apply 7776.0001-soc-ti-omap-prm-Fix-STANDBY-handling-of-PER-power-do.patch
      $ git apply 7776.0002-ARM-OMAP2-Fix-l4ls-clk-domain-handling-in-STANDBY.patch
      $ source /opt/arago-2023.10/environment-setup-armv7at2hf-neon-oe-linux-gnueabi
      $ export MACHINE=am335x-evm
      $ export ARCH=arm
      $ make mrproper
      $ make multi_v7_defconfig ti_multi_v7_prune.config no_smp.config
      $ make 
        I got the above error!
    

    I built toolchain as below.

    $ MACHINE=am335x-evm bitbake -k meta-toolchain-arago-tisdk
    

    My Ubunutu version is 22.04LTS.

    It might be the same problem as below.

     lists.openembedded.org/.../89633477

  • Hi Katsuyama-san,

    I don't understand "make linux".
    In which directory should I run it?

    I mentioned it in the instruction, "go to the SDK installation directory". The directory has the following content.

    dev@ula:am335x-plsdk-9352$ ls
    bin            example-applications    filesystem  linux-devkit  manifest  Rules.make
    board-support  external-toolchain-dir  licenses    makerules     Makefile  setup.sh
    

    I built with the following steps according to software-dl.ti.com/.../Overview_Building_the_SDK.html .

    The procedure compiles the entire SDK, including the root filesystem. it would take hours to finish.

    But the "make linux" instruction I mentioned only compile the kernel, which is much faster.

  • Hi Bin-san,

    I could finally enter to the sleep state.
    Thank you very much.

    Here's my conclusion:
    1. build error about CONFIG_GCC_PLUGINS
    The toolchain version included in the pre-build-SDK is 11.03.01,
    but the one built according to Overview_Building_the_SDK.html is 11.5.0.
    Probably version 11.5.0 is a cause of the error.
    Yocto seems to automatically disable CONFIG_GCC_PLUGINS.

    2. config for WKUP_M3* must be module
    I set these to 'y' because I wanted to reduce the number of modules.
    However, I should have set them like this:

         CONFIG_WKUP_M3_RPROC=m
         CONFIG_WKUP_M3_IPC=m
    

    One final question:
    Will these patches be committed to the repository in the near future?

  • Hi Katsuyama-san,

    Glad to hear to it working on your side now. Thanks for the update.

    The two patches are under review now, they should be committed to the ti-linux-6.1.y branch on git.ti.com very soon.