Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

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.

AM625: AM62(P): Suspend failure with 12.01.00.05 Linux Kernel

Part Number: AM625

Hello,

this is a follow-up of https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1663669/am62p-suspend-failure-with-12-01-00-05-linux-kernel , which seems to be locked now.

Platform: Verdin AM62 (AM62x), TIFS 11.2.5--v11.02.05 (Fancy Rat).

Some updates after additional tests:

  • Linux mainline fails too — 4db207599acf upstream, backported to stable as ddcf84b25af0 (v6.18.36).
  • In our testing it only happens when console suspend is disabled (no_console_suspend, or echo N > /sys/module/printk/parameters/console_suspend).

I added the debug proposed by Anshu Madwesh, plus:

@@ -99,8 +101,8 @@ static inline void ti_sci_pd_set_wkup_constraint(struct device *dev)
                ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx,
                                                               TISCI_MSG_CONSTRAINT_SET);
-               if (!ret)
-                       dev_dbg(dev, "ti_sci_pd: ID:%d set device constraint.\n", pd->idx);
+
+               dev_err(dev, "ti_sci_pd: ID:%d set device constraint. Ret. %d\n", pd->idx, ret);

In the failing case, all constraints are ACKed:

rtc-ti-k3 2b1f0000.rtc:      ti_sci_pd: ID:117 set device constraint. Ret. 0
dwc3-am62 f900000.dwc3-usb:  ti_sci_pd: ID:178 set device constraint. Ret. 0
dwc3-am62 f910000.dwc3-usb:  ti_sci_pd: ID:179 set device constraint. Ret. 0
omap8250 2800000.serial:     ti_sci_pd: ID:146 set device constraint. Ret. 0
ti-sci 44043000.system-controller: Failed to prepare sleep
ti-sci 44043000.system-controller: PM: failed to suspend: error -19

and then TI_SCI_MSG_PREPARE_SLEEP is NACKed, which ti_sci_cmd_prepare_sleep() turns into -ENODEV.

ID 146 is AM62X_DEV_UART0, the console (main_uart0, 0x02800000). The only difference between a working and a failing cycle is that constraint: with console suspend enabled, 117/178/179 are set, PREPARE_SLEEP is ACKed and deep sleep works.

So my questions are:

  1. Why does the DM accept the constraint on AM62X_DEV_UART0 and then refuse PREPARE_SLEEP? Note that MAIN_USB0_ISO_VD and MAIN_USB1_ISO_VD are also in MAIN and are accepted, so it does not look like a plain MAIN/WKUP split.
  2. Since the documentation says a constraint restricts the low power modes the SoC can enter, would it not be better for the DM to NACK TISCI_MSG_CONSTRAINT_SET when it cannot honour it, rather than accepting it and failing PREPARE_SLEEP later? A NACK would let the kernel react; silently ignoring it would be worse than either.
  3. Separate issue: after one failed PREPARE_SLEEP, every subsequent suspend fails until reboot, even with console suspend re-enabled and the same constraints as a previously successful cycle. The docs say LPM_ABORT should be sent after a failed prepare sleep, and the kernel does that only when MSG_FLAG_CAPS_LPM_ABORT is advertised. Is that capability exposed by TIFS 11.2.5?

As a workaround users can avoid disabling console suspend, but I think this should be fixed properly.

Do you have any suggestions?

Emanuele

  • Just a correction about the TFIFS version:

    TIFS firmware rev 0x000c '12.1.2--v12.01.02 (Clever Cat)')

  • Hi Emanuele,

    I’m out of office, returning next week. Please expect a delayed response.

  • Some progress: I went through the device manager sources in mcu_plus_sdk_am62x_12_01_00_31/source/drivers/device_manager/, which matches the firmware version running on the board. Points 2 and 3 look like defects in the DM.

    1. Why UART0 is refused and USB is not

    rm_pm_hal/rm_pm_hal_src/pm/drivers/lpm/lpm_handler.c, lpm_select_sleep_mode():

    /*
     * If device having constraints belongs to MAIN DEVGRP, then no lpm is possible
     * Exceptions: USB0 and USB1
     */
    if (devgrp == MAIN_DEVGRP) {
        if ((i == USB0_DEV_ID) || (i == USB1_DEV_ID) ||
            (i == USB0_ISO_DEV_ID) || (i == USB1_ISO_DEV_ID)) {
            *mode = lpm_select_shallowest_mode(TISCI_MSG_VALUE_SLEEP_MODE_DEEP_SLEEP, *mode);
        } else {
            ret = -EFAIL;
            done = STRUE;
        }
    }

    So any constraint on a MAIN device makes LPM impossible, with a hardcoded exception list for USB. USB0_ISO_DEV_ID is AM62X_DEV_MAIN_USB0_ISO_VD,
    which is exactly why IDs 178/179 are accepted and 146 is not. Question answered.

    2. The check could be done when the constraint is set

    From a superficial look at the source, it seems feasible, though I may be missing context.

    Rejecting the request at the point where it is made loses no information, and it lets the host decide what to do instead of failing a later, unrelated message. 

    3. Why suspend stays broken until reboot

    lpm_clear_sleep_data(), which clears dev_cons[], latency[] and lpm_locked, has only two callers: the resume path, reached only after a real LPM entry and exit, and lpm_abort(), guarded by if (lpm_locked == STRUE).

    On the failing path lpm_select_sleep_mode() returns before lpm_locked = STRUE is set, so lpm_abort() does nothing and the stale constraint survives. The next PREPARE_SLEEP hits the same device and fails again, forever. When the kernel does send the MSG_FLAG_CAPS_LPM_ABORT, it is a no-op in this situation.

    The most targeted fix looks like clearing on the failure path itself, in lpm_prepare_sleep_handler(), so that recovery does not depend on the host sending LPM_ABORT at all. Dropping the lpm_locked guard in lpm_abort() would also work, but since dev_cons[] is a per-host bitmask, that would let any host clear every other host's constraints at any time.

    What's your opinion on this?

    Kind regards,

    Emanuele

  • Hi Emanuele,

    Thanks for the update. I'm discussing the points with the software team. Will follow up when I get a response.

    Best Regards,

    Anshu

  • Hi Emanuele,

    Apologies for the delay as I was on business travel. I'll be working on following up with the development team on this item.

    Best Regards,

    Anshu

  • Hi  ,

    thanks.

    Kind regards,
    Emanuele