[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230504113942.187054-1-angelogioacchino.delregno@collabora.com>
Date: Thu, 4 May 2023 13:39:42 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: sboyd@...nel.org
Cc: matthias.bgg@...il.com, angelogioacchino.delregno@...labora.com,
hsin-hsiung.wang@...iatek.com, james.lo@...iatek.com,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, kernel@...labora.com
Subject: [PATCH] spmi: mtk-pmif: Add a WFVLDCLR specific timeout
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@...labora.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
Powered by blists - more mailing lists