mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: jassisinghbrar@gmail.com, robh+dt@kernel.org, shawnguo@kernel.org
Cc: s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, aisheng.dong@nxp.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>,
	Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 4/7] mailbox: imx: enlarge timeout while reading/writing messages to SCFW
Date: Tue,  4 Jan 2022 14:25:44 +0800	[thread overview]
Message-ID: <20220104062547.2103016-5-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20220104062547.2103016-1-peng.fan@oss.nxp.com>

From: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>

Mailbox driver needs to wait and read all the words in response to a
SCFW API call, else the protocol gets messed up and results in kernel hang.
When the responses are longer than 3 words its possible that SCFW will
take some time to fill up the rest of the words in the MU, a timeout of
100us is arbritrary and too short. While waiting for Linux to consume the
first 3 words of the response SCFW can be busy doing other stuff and hence
Linux needs to wait for the rest of the words.
Similar restriction applies when writing messages that are longer than
3 words.
This patch increases the timeout to 5secs while waiting for response
or writing long messages to SCFW.

Signed-off-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/mailbox/imx-mailbox.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 1f44ee11054d..e8a212d0da2f 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -218,7 +218,7 @@ static int imx_mu_specific_tx(struct imx_mu_priv *priv, struct imx_mu_con_priv *
 			ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_TSR],
 						 xsr,
 						 xsr & IMX_MU_xSR_TEn(priv->dcfg->type, i % num_tr),
-						 0, 100);
+						 0, 5 * USEC_PER_SEC);
 			if (ret) {
 				dev_err(priv->dev, "Send data index: %d timeout\n", i);
 				return ret;
@@ -263,7 +263,8 @@ static int imx_mu_specific_rx(struct imx_mu_priv *priv, struct imx_mu_con_priv *
 
 	for (i = 1; i < size; i++) {
 		ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_RSR], xsr,
-					 xsr & IMX_MU_xSR_RFn(priv->dcfg->type, i % 4), 0, 100);
+					 xsr & IMX_MU_xSR_RFn(priv->dcfg->type, i % 4), 0,
+					 5 * USEC_PER_SEC);
 		if (ret) {
 			dev_err(priv->dev, "timeout read idx %d\n", i);
 			return ret;
-- 
2.25.1


  parent reply	other threads:[~2022-01-04  6:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  6:25 [PATCH 0/7] mailbox: imx: misc fix and SECO MU support Peng Fan (OSS)
2022-01-04  6:25 ` [PATCH 1/7] mailbox: imx: fix wakeup failure from freeze mode Peng Fan (OSS)
2022-01-04  6:25 ` [PATCH 2/7] mailbox: imx: fix crash in resume on i.mx8ulp Peng Fan (OSS)
2022-01-04  6:25 ` [PATCH 3/7] mailbox: imx: Add support for identifying SCU wakeup source from sysfs Peng Fan (OSS)
2022-01-04 23:22   ` kernel test robot
2022-01-04  6:25 ` Peng Fan (OSS) [this message]
2022-01-04  6:25 ` [PATCH 5/7] dt-bindings: mailbox: imx-mu: add i.MX8 SECO MU support Peng Fan (OSS)
2022-01-12  1:03   ` Rob Herring
2022-01-04  6:25 ` [PATCH 6/7] mailbox: imx: introduce rxdb callback Peng Fan (OSS)
2022-01-04  6:25 ` [PATCH 7/7] mailbox: imx: add i.MX8 SECO MU support Peng Fan (OSS)
2022-01-26  8:28 ` [PATCH 0/7] mailbox: imx: misc fix and " Peng Fan
2022-01-30  0:17   ` Jassi Brar
2022-02-07  3:17     ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220104062547.2103016-5-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=ranjani.vaidyanathan@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®