From d93936f175bd914067df8f63f5fbe6e3b77bb4d2 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 23 May 2023 14:46:28 +0300
Subject: [PATCH 11/19] soc: qcom: fix smp2p ack on ipq6018

IPQ6018 seem to need different ack mechanism for smp2p messaging. This
fixes q6v5_wcss remoteproc firmware reloading. Without this first load
is OK, but subsequent loads would hang and fail to complete.

Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi | 1 +
 drivers/soc/qcom/smp2p.c              | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -1155,6 +1155,7 @@
 
 		wcss_smp2p_out: master-kernel {
 			qcom,entry-name = "master-kernel";
+			qcom,smp2p-feature-ssr-ack;
 			#qcom,smem-state-cells = <1>;
 		};
 
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -158,6 +158,8 @@ struct qcom_smp2p {
 
 	struct list_head inbound;
 	struct list_head outbound;
+
+	bool need_ssr_ack;
 };
 
 static void qcom_smp2p_kick(struct qcom_smp2p *smp2p)
@@ -306,7 +308,7 @@ static irqreturn_t qcom_smp2p_intr(int i
 		ack_restart = qcom_smp2p_check_ssr(smp2p);
 		qcom_smp2p_notify_in(smp2p);
 
-		if (ack_restart)
+		if (ack_restart || smp2p->need_ssr_ack)
 			qcom_smp2p_do_ssr_ack(smp2p);
 	}
 
@@ -427,6 +429,7 @@ static int qcom_smp2p_outbound_entry(str
 
 	/* Make the logical entry reference the physical value */
 	entry->value = &out->entries[out->valid_entries].value;
+	smp2p->need_ssr_ack = of_property_read_bool(node, "qcom,smp2p-feature-ssr-ack");
 
 	out->valid_entries++;
 
