Il 07/06/23 09:22, Tinghan Shen ha scritto:
Due to that SCP core 0 controls the SCP clock and SRAM power, add two
new mtk_scp_of_data operations, scp_boot_peers and scp_shutdown_peers,
to manage the boot sequence and watchdog timeout handling of SCP core 1.
It ensures that core 1 boots after or shuts down before core 0 for
maintaining the proper control flow over SCP core 1.
Signed-off-by: Tinghan Shen <tinghan.shen@xxxxxxxxxxxx>
---
drivers/remoteproc/mtk_common.h | 3 ++
drivers/remoteproc/mtk_scp.c | 55 +++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index 56395e8664cb..0bfd242c41cc 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -93,6 +93,8 @@ struct mtk_scp_of_data {
void (*scp_reset_deassert)(struct mtk_scp *scp);
void (*scp_stop)(struct mtk_scp *scp);
void *(*scp_da_to_va)(struct mtk_scp *scp, u64 da, size_t len);
+ void (*scp_boot_peers)(struct mtk_scp *scp);
+ void (*scp_shutdown_peers)(struct mtk_scp *scp);
u32 host_to_scp_reg;
u32 host_to_scp_int_bit;
@@ -130,6 +132,7 @@ struct mtk_scp {
struct rproc_subdev *rpmsg_subdev;
struct list_head elem;
+ struct list_head *cluster;
};
/**
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index d644e232dfec..edbf71f4c21e 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -74,8 +74,21 @@ void scp_put(struct mtk_scp *scp)
}
EXPORT_SYMBOL_GPL(scp_put);
+static void mt8195_scp_shutdown_peers(struct mtk_scp *scp)
+{
+ struct mtk_scp *next_scp;
+
+ next_scp = list_next_entry(scp, elem);
+ list_for_each_entry_from(next_scp, scp->cluster, elem) {
+ rproc_shutdown(next_scp->rproc);
+ }
braces are not needed here; after fixing that,
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>