]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
memory: brcmstb: dpfe: wait for DCPU to be ready
authorMarkus Mayer <mmayer@broadcom.com>
Tue, 2 Apr 2019 23:01:00 +0000 (16:01 -0700)
committerFlorian Fainelli <f.fainelli@gmail.com>
Mon, 20 May 2019 16:32:35 +0000 (09:32 -0700)
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>
drivers/memory/brcmstb_dpfe.c

index c67774a4fe8bbd419dc5ce6a792990a42728e78b..f8d05a8266c35e16aef05451f64222e0b5399c16 100644 (file)
@@ -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));