remoteproc: k3-r5: Simplify cluster mode setting usage
authorDevarsh Thakkar <devarsht@ti.com>
Mon, 27 Mar 2023 15:28:30 +0000 (20:58 +0530)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Wed, 29 Mar 2023 23:16:42 +0000 (17:16 -0600)
commit7f402919278aa5b8eec82a7dad2e0cb8e6bdee14
tree64f538805d8da162fbd3144d80b6ede281f1648d
parente19967994d342a5986d950a1bfddf19d7e1191b7
remoteproc: k3-r5: Simplify cluster mode setting usage

Check the validity of mode against SoC supported modes right
at the probe to minimize the usage of same check further in the code.

Set default value of cluster-mode only if cluster-mode device tree property
is empty.

In case devicetree provided cluster-mode property is invalid For e.g. using
CLUSTER_MODE_SINGLECPU on any SoC other than am64x then return error.

If firmware has set the PROC_BOOT_STATUS_FLAG_R5_SINGLECORE_ONLY flag then
what it means is that only CLUSTER_MODE_SINGLECPU is possible to use [1]
and hence there is no need to check for soc_data->single_cpu_mode first and
then checking cluster mode.

PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE flag can be set directly for
CLUSTER_MODE_SINGLECPU without checking for soc_data->single_cpu_mode since
that check has already been done during probe.

For IPC-only mode, directly override cluster mode as per config flag set by
bootloader without checking for soc specific data. This because config
flag would already have been validated by firmware when bootloader was
setting it.

Link:
[1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/security/PROC_BOOT.html?highlight=singlecore_only#arm-r5

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Link: https://lore.kernel.org/r/20230327152832.923480-2-devarsht@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/ti_k3_r5_remoteproc.c