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.

AM3358: Suspend/resume doesn't work as expected

Part Number: AM3358
Other Parts Discussed in Thread: TPS65217

Hi,

I wanted to use latest stable linux kernel on beaglebone black board but I found out that suspend/resume doesn't work.

I prepared minimalistic defconfig as I do not use ethernet and usb.

When device goes to suspend its not possible to wake it up via UART, however I can use rtcwake which works. Unfortunately rtcwake doesn't work if device is put into suspend for the second time. After reboot the first rtcwake suspend/resume works again but the second one not.

Do you have any idea what can be the issue?

This is my defconfig:

CONFIG_KERNEL_LZO=y
CONFIG_SYSVIPC=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
# CONFIG_UID16 is not set
# CONFIG_SYSFS_SYSCALL is not set
# CONFIG_FHANDLE is not set
# CONFIG_AIO is not set
# CONFIG_IO_URING is not set
# CONFIG_ADVISE_SYSCALLS is not set
CONFIG_KALLSYMS_ALL=y
CONFIG_EMBEDDED=y
# CONFIG_VM_EVENT_COUNTERS is not set
# CONFIG_SLUB_DEBUG is not set
CONFIG_SOC_AM33XX=y
CONFIG_ARM_THUMBEE=y
# CONFIG_HARDEN_BRANCH_PREDICTOR is not set
# CONFIG_CACHE_L2X0 is not set
# CONFIG_DEBUG_ALIGN_RODATA is not set
# CONFIG_HIGHPTE is not set
# CONFIG_ARM_MODULE_PLTS is not set
CONFIG_FORCE_MAX_ZONEORDER=11
# CONFIG_ATAGS is not set
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPUFREQ_DT=y
CONFIG_KERNEL_MODE_NEON=y
CONFIG_PM_DEBUG=y
CONFIG_JUMP_LABEL=y
# CONFIG_SECCOMP is not set
# CONFIG_STACKPROTECTOR is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_COREDUMP is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
# CONFIG_WIRELESS is not set
# CONFIG_ETHTOOL_NETLINK is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_FW_CACHE is not set
CONFIG_SRAM=y
CONFIG_EEPROM_AT24=m
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
# CONFIG_LDISC_AUTOLOAD is not set
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_OMAP=y
# CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP is not set
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_HW_RANDOM=y
# CONFIG_I2C_COMPAT is not set
CONFIG_PINCTRL_SINGLE=y
CONFIG_GPIO_SYSFS=y
# CONFIG_GPIO_CDEV is not set
# CONFIG_HWMON is not set
# CONFIG_THERMAL_OF is not set
# CONFIG_TI_SOC_THERMAL is not set
CONFIG_WATCHDOG=y
CONFIG_OMAP_WATCHDOG=y
CONFIG_MFD_TPS65217=y
CONFIG_REGULATOR_TPS65217=y
# CONFIG_USB_SUPPORT is not set
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_OMAP=y
CONFIG_MMC_OMAP_HS=y
CONFIG_MMC_SDHCI_OMAP=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=m
CONFIG_LEDS_GPIO=m
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_ONESHOT=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_GPIO=m
CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_OMAP=m
CONFIG_DMADEVICES=y
# CONFIG_DMA_OMAP is not set
# CONFIG_VIRTIO_MENU is not set
# CONFIG_VHOST_MENU is not set
CONFIG_HWSPINLOCK=y
CONFIG_HWSPINLOCK_OMAP=y
CONFIG_MAILBOX=y
CONFIG_OMAP2PLUS_MBOX=m
CONFIG_REMOTEPROC=y
CONFIG_WKUP_M3_RPROC=m
CONFIG_SOC_TI=y
CONFIG_AMX3_PM=m
CONFIG_WKUP_M3_IPC=m
CONFIG_TI_EMIF=m
CONFIG_TI_EMIF_SRAM=m
CONFIG_EXT4_FS=y
# CONFIG_FILE_LOCKING is not set
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
CONFIG_CRYPTO_DEV_OMAP=m
CONFIG_CRYPTO_DEV_OMAP_SHAM=m
CONFIG_CRYPTO_DEV_OMAP_AES=m
CONFIG_CRYPTO_DEV_OMAP_DES=m
CONFIG_PRINTK_TIME=y
# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
CONFIG_DEBUG_FS=y
# CONFIG_DEBUG_MISC is not set
# CONFIG_RUNTIME_TESTING_MENU is not set

  • Hi Petr,

    TI only supports kernel v4.19 on AM335x, and kernel v5.4 support is under development.

    What is the kernel version do you use? Do you have the CM3 PM firmware loaded and running during kernel boot?

  • Hi Bin,

    my idea was to use 5.10.y latest version.

    Here is my boot log with one successful sleep and one hanged sleep.

    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 5.4.108-dirty (pmlynar@LP-PMLN-U) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)) #130 Mon Mar 29 15:24:27 CEST 2021
    [    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: TI AM335x BeagleBone Black
    [    0.000000] Memory policy: Data cache writeback
    [    0.000000] On node 0 totalpages: 131072
    [    0.000000]   Normal zone: 1024 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 131072 pages, LIFO batch:31
    [    0.000000] CPU: All CPU(s) started in SVC mode.
    [    0.000000] AM335X ES2.1 (sgx neon)
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0 
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 130048
    [    0.000000] Kernel command line: console=ttyS0,115200 debug earlyprintk rootwait root=/dev/mmcblk0p2 rw rootfstype=ext4
    [    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
    [    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
    [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
    [    0.000000] Memory: 513004K/524288K available (3050K kernel code, 125K rwdata, 1072K rodata, 1024K init, 194K bss, 11284K reserved, 0K cma-reserved, 0K highmem)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    [    0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
    [    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [    0.000013] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [    0.000030] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [    0.000039] OMAP clocksource: timer1 at 24000000 Hz
    [    0.000259] timer_probe: no matching timers found
    [    0.000322] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
    [    0.089281] pid_max: default: 32768 minimum: 301
    [    0.089430] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.089443] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.089981] CPU: Testing write buffer coherency: ok
    [    0.090512] Setting up static identity map for 0x80100000 - 0x80100060
    [    0.090919] devtmpfs: initialized
    [    0.098856] random: get_random_u32 called from bucket_table_alloc+0x68/0x15c with crng_init=0
    [    0.098921] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    0.099124] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.099142] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
    [    0.099212] pinctrl core: initialized pinctrl subsystem
    [    0.099991] NET: Registered protocol family 16
    [    0.100432] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    0.120671] l3-aon-clkctrl:0000:0: failed to disable
    [    0.139517] edma 49000000.edma: TI EDMA DMA engine driver
    [    0.141237] clocksource: Switched to clocksource timer1
    [    0.142214] thermal_sys: Registered thermal governor 'step_wise'
    [    0.142356] NET: Registered protocol family 1
    [    0.142995] workingset: timestamp_bits=30 max_order=17 bucket_order=0
    [    0.145942] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
    [    0.145956] io scheduler mq-deadline registered
    [    0.145962] io scheduler kyber registered
    [    0.148607] OMAP GPIO hardware version 0.1
    [    0.190297] pinctrl-single 44e10800.pinmux: 142 pins, size 568
    [    0.191756] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
    [    0.193305] printk: console [ttyS0] disabled
    [    0.193369] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 29, base_baud = 3000000) is a 8250
    [    0.545079] printk: console [ttyS0] enabled
    [    0.551092] omap_rng 48310000.rng: Random Number Generator ver. 20
    [    0.558546] random: fast init done
    [    0.562111] random: crng init done
    [    0.566281] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [    0.573869] sdhci: Secure Digital Host Controller Interface driver
    [    0.580079] sdhci: Copyright(c) Pierre Ossman
    [    0.585172] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [    0.593950] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    0.649786] omap_hsmmc 47810000.mmc: RX DMA channel request failed
    [    0.656348] sdhci-pltfm: SDHCI platform and OF driver helper
    [    0.662467] ledtrig-cpu: registered to indicate activity on CPUs
    [    0.669451] NET: Registered protocol family 17
    [    0.674021] ThumbEE CPU extension supported.
    [    0.678313] omap_voltage_late_init: Voltage driver support not added
    [    0.699121] mmc0: host does not support reading read-only switch, assuming write-enable
    [    0.709244] mmc0: new high speed SDHC card at address 59b4
    [    0.715331] mmcblk0: mmc0:59b4 USD   3.75 GiB 
    [    0.721519]  mmcblk0: p1 p2
    [    0.733751] tps65217 0-0024: TPS65217 ID 0x6 version 1.2
    [    0.739319] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [    0.745972] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
    [    0.751714] hctosys: unable to open rtc device (rtc0)
    [    0.775065] mmc1: new high speed MMC card at address 0001
    [    0.782429] mmcblk1: mmc1:0001 W62704 3.56 GiB 
    [    0.787218] mmcblk1boot0: mmc1:0001 W62704 partition 1 2.00 MiB
    [    0.793420] mmcblk1boot1: mmc1:0001 W62704 partition 2 2.00 MiB
    [    0.799749] mmcblk1rpmb: mmc1:0001 W62704 partition 3 512 KiB, chardev (250:0)
    [    0.808524]  mmcblk1: p1
    [    0.856156] EXT4-fs (mmcblk0p2): recovery complete
    [    0.864915] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    0.873140] VFS: Mounted root (ext4 filesystem) on device 179:2.
    [    0.879337] devtmpfs: mounted
    [    0.883756] Freeing unused kernel memory: 1024K
    [    0.888520] Run /sbin/init as init process
    INIT: version 2.88 booting
    Starting udev
    [    1.308639] udevd[57]: starting version 3.2.7
    [    1.335564] udevd[57]: specified group 'kvm' unknown
    [    1.363627] udevd[58]: starting eudev-3.2.7
    [    1.484759] remoteproc remoteproc0: wkup_m3 is available
    [    1.570596] omap_rtc 44e3e000.rtc: already running
    [    1.588069] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [    1.602971] wkup_m3_ipc 44e11324.wkup_m3_ipc: IPC Request for A8->M3 Channel failed! -517
    [    1.619932] omap_rtc 44e3e000.rtc: registered as rtc0
    [    1.632284] wkup_m3_ipc 44e11324.wkup_m3_ipc: IPC Request for A8->M3 Channel failed! -517
    [    1.696930] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [    1.774301] remoteproc remoteproc0: powering up wkup_m3
    [    1.806980] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 242932
    [    1.815462] remoteproc remoteproc0: remote processor wkup_m3 is now up
    [    1.822032] wkup_m3_ipc 44e11324.wkup_m3_ipc: CM3 Firmware Version = 0x192
    [    1.903937] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
    [    1.915939] PM: bootloader does not support rtc-only!
    [    1.929835] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
    [    1.973989] omap-aes 53500000.aes: will run requests pump with realtime priority
    [    2.076824] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    INIT: Entering runlevel: 5
    Configuring network interfaces... ip: RTNETLINK answers: Operation not supported
    Successfully initialized wpa_supplicant
    nl80211: 'nl80211' generic netlink not found
    Failed to initialize driver 'nl80211'
    wlan0: Unsupported driver 'nl80211'
    ip: SIOCGIFFLAGS: No such device
    Starting system message bus: dbus.
    Starting Dropbear SSH server: Starting syslogd/klogd: done
    Starting TSP transceiver daemon: 
    Poky (Yocto Project Reference Distro) 2.7.1 tsp-transceiver /dev/ttyS0
    
    tsp-transceiver login: root
    root@tsp-transceiver:~# rtcwake -s 1 -m mem -d /dev/rtc0
    wakeup from "mem" at Thu Oct 22 14:43:31 2020
    [    5.747131] PM: suspend entry (deep)
    [    5.750846] Filesystems sync: 0.000 seconds
    [    5.756964] Freezing user space processes ... (elapsed 0.001 seconds) done.
    [    5.765159] OOM killer disabled.
    [    5.768396] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [    5.776937] printk: Suspending console(s) (use no_console_suspend to debug)
    [    5.789787] pm33xx pm33xx: PM: Successfully put all powerdomains to target state
    [    5.789787] PM: Wakeup source RTC Alarm
    [    5.815278] OOM killer enabled.
    [    5.818433] Restarting tasks ... done.
    [    5.823393] PM: suspend exit
    root@tsp-transceiver:~# rtcwake -s 1 -m mem -d /dev/rtc0
    wakeup from "mem" at Thu Oct 22 14:43:34 2020
    [    7.556227] PM: suspend entry (deep)
    [    7.559901] Filesystems sync: 0.000 seconds
    [    7.564414] Freezing user space processes ... (elapsed 0.001 seconds) done.
    [    7.572551] OOM killer disabled.
    [    7.575787] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [    7.584315] printk: Suspending console(s) (use no_console_suspend to debug)
    

  • Hi Petr,

    The log shows the CM3 PM firmware is loaded.

    Can you please try to clone the TI kernel v5.4 and use branch ti-linux-5.4.y?

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

    Then you can generate the kernel defconfig using the script ti_config_fragments/defconfig_builder.sh.

  • Hi Bin,

    I will try meanwhile I found out if I activate these configs, then I am able to suspend/resume via rtcwake multiple time. It seems that usb module is causing trouble.

    CONFIG_USB_MUSB_HDRC=y
    CONFIG_USB_MUSB_DSPS=y
    CONFIG_USB_TI_CPPI41_DMA=y
    CONFIG_NOP_USB_XCEIV=y
    CONFIG_AM335X_PHY_USB=y
    CONFIG_USB_GADGET=y

    And the uart wakeup sometime works and sometimes not with these config changes.

  • Hi Petr,

    Do you mean if you have these kernel settings rtcwake works? If so, what were the settings before the change?

  • Hi Bin,

    yes with above mentioned settings set the rtcwake works. Before they were not set as the CONFIG_USB_SUPPORT was not set. See the diff.

    I tried the ti linux 5.4.y and its the same. I can sleep only once with rtcwake and uart doesn't work.

  • here is the diff of the registers dump before first sleep (right) and after first sleep (left). The usb module is different so it seems the me as an issue however I have no idea why this was changed.

  • Hi Petr,

    yes with above mentioned settings set the rtcwake works. Before they were not set as the CONFIG_USB_SUPPORT was not set. See the diff.

    I don't think we tested suspend/resume with USB support disabled in kernel. I will look forward to your test result with TI kernel/U-Boot.

  • Hi Bin,

    I posted my test with TI kernel above. Its the same behaviour no uart wakeup and rtcwake works only once with usb disabled and works fine with usb enabled.

    Meanwhile I tested also mainline kernel version 4.19.183:

    - with usb enabled uart and rtc works like a charm

    - without usb enabled uart and rtc works only once

    So it seems like we have two problems.

    1. General issue with usb disabled (all branches)

    2. UART wakeup not working in later versions (5.4 or 5.10)

  • Hi Petr,

    Thanks for the summary.

    We haven't released SDK with kernel v5.4 for AM335x yet. But I will test the v5.4 dev branch to check on these two problems.