habanalabs/gaudi: refactor reset code
authorOded Gabbay <ogabbay@kernel.org>
Sun, 23 May 2021 16:00:49 +0000 (19:00 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:40 +0000 (15:23 +0300)
commita60d075c81f0730b62b277d9a94842a3737a4a42
tree2626fd96ebbbbb9aeb571e13bad6d385310f0194
parent4cb4508c86d700bdf243e013630ba1af93a01892
habanalabs/gaudi: refactor reset code

After all the latest changes to the reset code, there were some
redundancy and errors in the flows.

If the Linux FIT is loaded to the ASIC CPU, we need to communicate
with it only via GIC. If it is not loaded, we need to either use
COMMS protocol (for newer f/w) or MSG_TO_CPU register (for older f/w).

In addition, if we halted the device CPU then we need to mark that
the driver will do the reset, regardless of the capabilities.

Also, to prevent false errors, we need to keep track whether the
device CPU was already halted. If so, we shouldn't try to halt it
again.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/gaudi/gaudiP.h