aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorMarkus Mayer <mmayer@broadcom.com>2019-04-02 16:01:00 -0700
committerFlorian Fainelli <f.fainelli@gmail.com>2019-05-20 09:32:35 -0700
commita7c25759d8d84b64c437a78f05df7314b02934e5 (patch)
tree3d07554a5b42933fe7dd03d0ba17e2f399d29385 /drivers/memory
parentmemory: brcmstb: dpfe: report firmware loading error (diff)
downloadlinux-dev-a7c25759d8d84b64c437a78f05df7314b02934e5.tar.xz
linux-dev-a7c25759d8d84b64c437a78f05df7314b02934e5.zip
memory: brcmstb: dpfe: wait for DCPU to be ready
We wait for the DCPU to be ready before sending a command. Signed-off-by: Markus Mayer <mmayer@broadcom.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/brcmstb_dpfe.c12
1 files changed, 12 insertions, 0 deletions
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));