Skip to content

Conversation

@CV-Bowen
Copy link
Contributor

@CV-Bowen CV-Bowen commented Jan 4, 2026

Summary

This PR fix some reconnecting bugs when peer core reboot/carsh to
make sure the two cores can reconntecting and continue to communicate.

In addition, this PR also add the rpmsg-port-spi low power support.

rpmsg_port_spi: fix reconnect failed issue
rpmsg_port_spi/slave: change state to connecting when received connect cmd during the shutdown cmd process
rpmsg_port_spi.c: setfreq to 0 to shutdown the spi device
rpmsg_port_spi/slave: add suspend/resume notify
rpmsg_port_spi: add support for peer's shutting down notify
rpmsg_port_spi_slave: only drop tx queue used buffer when unconnecting
rpmsg_port_spi: add connecting/disconnecting status for port spi
rpmsg_port_spi: only drop tx queue used buffer, because rxq may have received reconnection data
rpmsg_port_spi: add log to know spi complete callback not called
rpmsg_port_spi: add more detail debug info for transfer failed

Impact

Rpmsg Port SPI

Testing

Testing with internal projects

@CV-Bowen CV-Bowen marked this pull request as draft January 4, 2026 03:06
@github-actions github-actions bot added Area: Drivers Drivers issues Size: M The size of the change in this PR is medium labels Jan 4, 2026
xiaoxiang781216
xiaoxiang781216 previously approved these changes Jan 4, 2026
@xiaoxiang781216
Copy link
Contributor

@CV-Bowen please fix:

a2dcc7a2e7 rpmsg_port_spi: add debug info for transfer failed
../nuttx/tools/checkpatch.sh -c -u -m -g 090860a348d4bbb37a69901bd059112f57106cbf..HEAD
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Commit subject too long > 80
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Commit subject too long > 80
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Commit subject too long > 80
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Commit subject too long > 80
❌ Remove Gerrit Change-ID's before submitting upstream
❌ Commit subject too long > 80
❌ Remove Gerrit Change-ID's before submitting upstream
Used config files:

Add log to know the error command and aviable buffer number

Signed-off-by: liaoao <liaoao@xiaomi.com>
1. add error log when transferring keeps rasing because of no spi
exchange complete callback;
2. this log can also be used to check if there is an interrupt has
been caught when peer side keeps trying to send data;

Signed-off-by: liaoao <liaoao@xiaomi.com>
Because rxq may have received reconnection data, when connect state
changed to unconnected but the reconnect data has not been processed,
and during that time there is a tx buffer to be sent, the
drop_packets may drop the reconnect data and two sides can not
reconnected anymore.

Signed-off-by: liaoao <liaoao@xiaomi.com>
to make sure the connecting process will not be interrupted

Signed-off-by: liaoao <liaoao@xiaomi.com>
because rxq may have received peer's reconnection data, so we can
connect with peer again.

Signed-off-by: liaoao <liaoao@xiaomi.com>
Shutdown mean peer's want to disconnect the connection untial
peer want connect with local side again.

After receive shutdown command, local will clear the state until
reconnecting and clear the gpio status to avoid the leak current.

Signed-off-by: liaoao <liaoao@xiaomi.com>
Now rpmsg port spi can receive peer's suspend and resume command,
suspend command means peer enter into the lowpower state and
resume command means peer waked up

These two commands can let us know peer's running status, so we
will modify the rpmsg signals to let the rpmsg service can get
peer's running state too.

Signed-off-by: liaoao <liaoao@xiaomi.com>
In the stop process, add SPI_SETFREQUENCY(rpspi->spi, 0) to stutdown
the spi device.

Signed-off-by: liaoao <liaoao@xiaomi.com>
If connect cmd is dropped during the shutdown cmd process, it will
not be able to reconnect because current side will not try to send
connect cmd after shutdown cmd processed.

So change state to connecting when received connect cmd during the
shutdown cmd process.

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
The reconnect will fail because the state changes to connecting when
shutdown cmd is still in process.

And after the shutdown cmd processed, it will reset the state to
unconnected, even though the connect cmd is in ready list,
it will still not be processed.

This patch solve this issue.

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
@CV-Bowen CV-Bowen marked this pull request as ready for review January 6, 2026 15:17
@jerpelea jerpelea changed the title Rpmsg port spi add debug log, low power feature and bug fixs drivers/rpmsg: port spi add debug log, low power feature and bug fixs Jan 7, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit f9272fa into apache:master Jan 7, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants