All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Mayer <code@mmayer.net>
To: Brian Norris <computersforpeace@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>
Cc: Markus Mayer <mmayer@broadcom.com>,
	Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>,
	ARM Kernel List <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] memory: brcmstb: dpfe: wait for DCPU to be ready
Date: Tue,  2 Apr 2019 16:01:00 -0700	[thread overview]
Message-ID: <20190402230103.25491-4-code@mmayer.net> (raw)
In-Reply-To: <20190402230103.25491-1-code@mmayer.net>

From: Markus Mayer <mmayer@broadcom.com>

We wait for the DCPU to be ready before sending a command.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 drivers/memory/brcmstb_dpfe.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c
index c67774a4fe8b..f8d05a8266c3 100644
--- a/drivers/memory/brcmstb_dpfe.c
+++ b/drivers/memory/brcmstb_dpfe.c
@@ -304,6 +304,18 @@ static int __send_command(struct private_data *priv, unsigned int cmd,
 
 	mutex_lock(&priv->lock);
 
+	/* Wait for DCPU to become ready */
+	for (i = 0; i < DELAY_LOOP_MAX; i++) {
+		resp = readl_relaxed(regs + REG_TO_HOST_MBOX);
+		if (resp == 0)
+			break;
+		msleep(1);
+	}
+	if (resp != 0) {
+		mutex_unlock(&priv->lock);
+		return -ETIMEDOUT;
+	}
+
 	/* Write command and arguments to message area */
 	for (i = 0; i < MSG_FIELD_MAX; i++)
 		writel_relaxed(msg[i], regs + DCPU_MSG_RAM(i));
-- 
2.17.1


  parent reply	other threads:[~2019-04-02 23:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 23:00 [PATCH 0/6] memory: brcmstb: dpfe: introduce DPFE API v3 Markus Mayer
2019-04-02 23:00 ` [PATCH 1/6] memory: brcmstb: dpfe: remove unused code and fix formatting Markus Mayer
2019-04-17 18:53   ` Florian Fainelli
2019-04-17 18:53     ` Florian Fainelli
2019-04-02 23:00 ` [PATCH 2/6] memory: brcmstb: dpfe: report firmware loading error Markus Mayer
2019-04-17 18:53   ` Florian Fainelli
2019-04-17 18:53     ` Florian Fainelli
2019-04-02 23:01 ` Markus Mayer [this message]
2019-04-17 18:54   ` [PATCH 3/6] memory: brcmstb: dpfe: wait for DCPU to be ready Florian Fainelli
2019-04-17 18:54     ` Florian Fainelli
2019-04-02 23:01 ` [PATCH 4/6] memory: brcmstb: dpfe: prepare support for multiple API versions Markus Mayer
2019-04-17 18:54   ` Florian Fainelli
2019-04-17 18:54     ` Florian Fainelli
2019-04-02 23:01 ` [PATCH 5/6] memory: brcmstb: dpfe: prepare for API-dependent sysfs attributes Markus Mayer
2019-04-17 18:54   ` Florian Fainelli
2019-04-17 18:54     ` Florian Fainelli
2019-04-02 23:01 ` [PATCH 6/6] memory: brcmstb: dpfe: introduce DPFE API v3 Markus Mayer
2019-04-17 18:54   ` Florian Fainelli
2019-04-17 18:54     ` Florian Fainelli

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=20190402230103.25491-4-code@mmayer.net \
    --to=code@mmayer.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmayer@broadcom.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.