An error occurs when poweroff on our board that uses i.MX 7Dual.
I am using i2c for poweroff.
I have attached images of the waveforms when normal and when an error occurs.
* normal
* error
green: SCL
yellow: SDA
blue: power
When an error occurs, it appears that the i.MX 7D is outputting an abnormal SCL.
(It is low for only 2μ seconds.)
It seems like that's why i2c devices can't release SDA.
Do you know of any similar cases?
The kernel is based on linux-imx/lf-6.1.55-2.2.0.
Sorry for my poor English.
In conclusion, increasing the timeout of i2c_imx_trx_complete() solved the problem. It seems that 1100us is not enough when the slave causes clock stretching.
After that, an error occurred in i2c_smbus_write_byte_data() for poweroff, but it was fixed by making the same changes as below.
https://github.com/torvalds/linux/commit/f8ee39b44b75ac955bb54f46d5370481727c47e7
P.S.: The following error message is output.
[2024-03-20 14:27:59.024] [ 67.333132] reboot: Power down [2024-03-20 14:28:02.367] [ 70.538916] ------------[ cut here ]------------ [2024-03-20 14:28:02.367] [ 70.543537] WARNING: CPU: 0 PID: 1 at drivers/power/reset/gpio-poweroff.c:46 legacy_pm_power_off+0x18/0x2c [2024-03-20 14:28:02.367] [ 70.553213] Modules linked in: [2024-03-20 14:28:02.367] [ 70.556278] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 6.1.55-at1 #1 [2024-03-20 14:28:02.367] [ 70.563073] Hardware name: Freescale i.MX7 Dual (Device Tree) [2024-03-20 14:28:02.367] [ 70.568830] unwind_backtrace from show_stack+0x10/0x14 [2024-03-20 14:28:02.367] [ 70.574075] show_stack from dump_stack_lvl+0x40/0x4c [2024-03-20 14:28:02.367] [ 70.579144] dump_stack_lvl from __warn+0x78/0xc4 [2024-03-20 14:28:02.367] [ 70.583870] __warn from warn_slowpath_fmt+0x174/0x208 [2024-03-20 14:28:02.367] [ 70.589031] warn_slowpath_fmt from legacy_pm_power_off+0x18/0x2c [2024-03-20 14:28:02.367] [ 70.595141] legacy_pm_power_off from sys_off_notify+0x34/0x58 [2024-03-20 14:28:02.367] [ 70.600984] sys_off_notify from atomic_notifier_call_chain+0x64/0x88 [2024-03-20 14:28:02.367] [ 70.607443] atomic_notifier_call_chain from do_kernel_power_off+0x40/0x58 [2024-03-20 14:28:02.367] [ 70.614337] do_kernel_power_off from __do_sys_reboot+0x1c4/0x228 [2024-03-20 14:28:02.367] [ 70.620443] __do_sys_reboot from ret_fast_syscall+0x0/0x64 [2024-03-20 14:28:02.367] [ 70.626027] Exception stack(0xc0815fa8 to 0xc0815ff0) [2024-03-20 14:28:02.376] [ 70.631087] 5fa0: 00000000 00000000 fee1dead 28121969 4321fedc 00000000 [2024-03-20 14:28:02.376] [ 70.639271] 5fc0: 00000000 00000000 00000003 00000058 7ed16df4 00000000 7ed16b4c 4321fedc [2024-03-20 14:28:02.376] [ 70.647453] 5fe0: 00000058 7ed16a9c 76c88b95 76bf8616 [2024-03-20 14:28:02.376] [ 70.652507] ---[ end trace 0000000000000000 ]--- [2024-03-20 14:28:12.845] [ 81.170347] ------------[ cut here ]------------
Hi @keitaro_takahas !
Thank you for contacting NXP Support!
You are using the I2C command to turn off the board?
If is possible please share the schematic to understand better the signals.
The blue signal is the power of the iMX board?
Please can you be detailed in the description of the problem?
I think that could be a hardware problem maybe you have to add a pull-up resistor or something like that, but I need to understand the problem and what are you doing to provide help.
I recommend checking the power-up/off sequence.
Sorry for the mistake!
Best Regards!
Chavira