soc: microchip: mpfs: handle timeouts and failed services differently
authorConor Dooley <conor.dooley@microchip.com>
Tue, 7 Mar 2023 20:22:58 +0000 (20:22 +0000)
committerConor Dooley <conor.dooley@microchip.com>
Mon, 3 Apr 2023 18:27:02 +0000 (19:27 +0100)
commit8f943dd12eeff71857b9a1ca45adbaaba379bf30
treee068dcbf1c25c247497f59062fec198d0ac855e9
parent7606f4dfffa7a4e4aadd8aef918cc8ac1f1e2196
soc: microchip: mpfs: handle timeouts and failed services differently

The system controller will only deliver an interrupt if a service
succeeds. This leaves us in the unfortunate position with current code
where there is no way to differentiate between a legitimate timeout
where the service has not completed & where it has completed, but
failed.

mbox_send_message() has its own completion, and it will time out of the
system controller does not lower the busy flag. In this case, a timeout
has occurred and the error can be propagated back to the caller.

If the busy flag is lowered, but no interrupt has arrived to trigger the
rx callback, the service can be deemed to have failed. Report -EBADMSG
in this case so that callers can differentiate.

Tested-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
drivers/soc/microchip/mpfs-sys-controller.c