[PATCH] spmi: mtk-pmif: Add a WFVLDCLR specific timeout

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Thu May 4 04:39:42 PDT 2023


At least on MT8195, in some instances, at cold-boot the PMIF seems to
get busy and slow, triggering a failure in pmif_spmi_read_cmd() with
"failed to wait for SWINF_WFVLDCLR" message: at least on the Tomato
Chromebook, this gives issues with the GPU power supply, resulting in
a probe failure for panfrost.

Through trial and error (rebooting the machine ~50 times), it was
found that a timeout of at least 50 milliseconds does effectively
mitigate this issue, hence add an "extended" timeout and use it for
the WFVLDCLR polling.

Fixes: b45b3ccef8c0 ("spmi: mediatek: Add support for MT6873/8192")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
---
 drivers/spmi/spmi-mtk-pmif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c
index b3c991e1ea40..a7b4b030929e 100644
--- a/drivers/spmi/spmi-mtk-pmif.c
+++ b/drivers/spmi/spmi-mtk-pmif.c
@@ -22,6 +22,7 @@
 
 #define PMIF_DELAY_US   10
 #define PMIF_TIMEOUT_US (10 * 1000)
+#define PMIF_WFVLDCLR_TIMEOUT_US (50 * 1000)
 
 #define PMIF_CHAN_OFFSET 0x5
 
@@ -357,7 +358,7 @@ static int pmif_spmi_read_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,
 	 */
 	ret = readl_poll_timeout_atomic(arb->base + arb->data->regs[inf_reg->ch_sta],
 					data, GET_SWINF(data) == SWINF_WFVLDCLR,
-					PMIF_DELAY_US, PMIF_TIMEOUT_US);
+					PMIF_DELAY_US, PMIF_WFVLDCLR_TIMEOUT_US);
 	if (ret < 0) {
 		dev_err(&ctrl->dev, "failed to wait for SWINF_WFVLDCLR\n");
 		return ret;
-- 
2.40.1




More information about the linux-arm-kernel mailing list