AnsweredAssumed Answered

iMX8QXP SCU FW 1.2.7.1 disables PWM clocks during suspend?

Question asked by Jonas Karlsson on Mar 18, 2020
Latest reply on Mar 19, 2020 by Jonas Karlsson

Linux 4.19.35 BSP, untested on 4.14.98 BSP

 

The following scenario causes a kernel SError exception with the IDS bit set:
1. Enable a PWM
2. Suspend to RAM
3. Resume from suspend using ON_OFF button
4. Re-configure or disable the same PWM as step 1

 

I traced this to that the SCU disables the ipg, per, or both, clocks during the KS1 suspend, but does not re-enable it/them during resume.Which causes Linux to believe clocks to be on which aren't.

 

I can avoid the crash by implementing pm_ops in the pwm-imx.c driver, disabling the clocks on suspend, and enabling them again on resume. But I am not certain if this is the correct way to solve the issue long-term. So my question is this:

 

Is the SCU supposed to re-enable enabled clocks that it disables during KS1, after KS1 is over? If so, is PWM an exception to this or did we find an SCU bug?

 

See below for an example panic.


[ 555.819813] SError Interrupt on CPU0, code 0xbf000002 – SError
[ 555.819818] CPU: 0 PID: 1058 Comm: XXXXXXXXXXXXXXX Not tainted 4.19.35+fscl #1
[ 555.819820] Hardware name: Freescale i.MX8QXP (DT)
[ 555.819822] pstate: 80000005 (Nzcv daif -PAN -UAO)
[ 555.819824] pc : clk_disable+0x18/0x28
[ 555.819826] lr : imx_pwm_apply_v2+0x5c/0x368
[ 555.819828] sp : ffff00000c533c20
[ 555.819830] x29: ffff00000c533c20 x28: ffff80003ac12640
[ 555.819835] x27: 0000000000000000 x26: 0000000000000001
[ 555.819840] x25: 0000000056000000 x24: 0000000000000015
[ 555.819844] x23: ffff00000c533e80 x22: 0000000000000001
[ 555.819849] x21: ffff80003a8f3100 x20: ffff80003a8a6100
[ 555.819853] x19: ffff80003a8f23a0 x18: 0000000000000000
[ 555.819857] x17: 0000000000000000 x16: 0000000000000000
[ 555.819862] x15: 0000000000000000 x14: 0000000000000000
[ 555.819866] x13: 0000000000000000 x12: 0000000000000000
[ 555.819871] x11: ffff00000c533c70 x10: ffff80002cfd9b80
[ 555.819875] x9 : ffff000008ae86c8 x8 : 0000000000000008
[ 555.819879] x7 : 00000000ffffffbf x6 : 0000000000000001
[ 555.819884] x5 : 0000000000000000 x4 : ffff0000083bd4a8
[ 555.819888] x3 : 00000000002625a0 x2 : ffff00000c533ce8
[ 555.819893] x1 : ffff80003a8f3100 x0 : ffff80003a285d00
[ 555.819898] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 555.819901] CPU: 0 PID: 1058 Comm: XXXXXXXXXXXXXXX Not tainted 4.19.35+fscl #1
[ 555.819903] Hardware name: Freescale i.MX8QXP (DT)
[ 555.819905] Call trace:
[ 555.819906] dump_backtrace+0x0/0x188
[ 555.819908] show_stack+0x14/0x20
[ 555.819910] dump_stack+0x90/0xb4
[ 555.819911] panic+0x120/0x268
[ 555.819913] nmi_panic+0x6c/0x70
[ 555.819915] arm64_serror_panic+0x74/0x80
[ 555.819917] is_valid_bugaddr+0x0/0x8
[ 555.819918] el1_error+0x7c/0xdc
[ 555.819920] clk_disable+0x18/0x28
[ 555.819922] imx_pwm_apply_v2+0x5c/0x368
[ 555.819923] pwm_apply_state+0x60/0x1a0
[ 555.819925] enable_store+0xa8/0xd0
[ 555.819927] dev_attr_store+0x18/0x28
[ 555.819929] sysfs_kf_write+0x40/0x50
[ 555.819930] kernfs_fop_write+0xcc/0x1e0
[ 555.819932] __vfs_write+0x30/0x158
[ 555.819934] vfs_write+0xa4/0x190
[ 555.819935] ksys_write+0x5c/0xc0
[ 555.819937] __arm64_sys_write+0x18/0x20
[ 555.819939] el0_svc_handler+0x8c/0x108
[ 555.819941] el0_svc+0x8/0xc
[ 555.819957] SMP: stopping secondary CPUs
[ 555.819958] Kernel Offset: disabled
[ 555.819960] CPU features: 0x0,20802008
[ 555.819962] Memory Limit: none
[ 556.048917] ---
[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]---

Outcomes