Received: by 2002:a17:90a:8582:0:0:0:0 with SMTP id m2csp2416989pjn; Tue, 2 Apr 2019 16:08:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxy4208rP8gSLX1U91+K2J8DtqpWT0ceg1ehM3sZOCANcqoJ3X52RY9NzY4Ypo6gcS01emh X-Received: by 2002:a62:14d7:: with SMTP id 206mr42953401pfu.162.1554246539719; Tue, 02 Apr 2019 16:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554246539; cv=none; d=google.com; s=arc-20160816; b=CrMNYaJzWuIfoQMgc40OKQNPHzCkYWSyoROSUcPeOOHz26SQOebPCPxOoaWS9d8Ejz io0ujPdgJ57cQjR7X8/7ztY+ZS6KhwjzqQCDJHoafFoypuoqIZ7sjMjrZ2KTQpIWIlPg LdGAsFwhZeJZlqQrV/mGinVFcaTDam0HkvBcQacJdqmp4f9M6Q3V0fhvvmGOUf3fiurI Y1gCVfBDfHMbirVC5B75vOK45/f5evX3fd8sFH7Vyc5rlbaIwvCrtOfCfZZ1vJj9Ehgz UFCJX9p2aSxxUX8HF1opBC8suCOp86bzqMYULCLCBoWBVbmnNFkRDVIYzSGkCZt2LbQs fd7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2mpA6cHXkAqL1VnTw0bCsYSoiOKS4JC9eTSx4lpNipk=; b=Op+Gg2BsQ+dZQFsRQHymKk8BO0cSsahr5JeJkx3LF3p5ZoSDehW0n5e8d1WeUbX9G5 S/2T1rDhLVuNzp+UO9jKILvQAoKK4w9cQ2he+wjXq+64b7kYnWFr45DWcmTbIV63wxS8 LkRwgckZ6zyZ8yA7UAOSlE6qNCoWVz9J1V/FGSZ3gjZ/zfekA3nSJoIBi9FyV8ImtC4+ Z1aDCsSv3r8bGnTR72gDiUhitIMRYzFz3CAiy0Qch1Js6Cen1H3ku3QOzvt3gOD+t3rh nqVcp/7/YhFmVNzpeNZbjd2j/LeIdYK/QqLxfoEZRN0qHgcZsY/P27DnzZh7BrBkS3M5 n0zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r35si12222804pgm.179.2019.04.02.16.08.43; Tue, 02 Apr 2019 16:08:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbfDBXHP (ORCPT + 99 others); Tue, 2 Apr 2019 19:07:15 -0400 Received: from smtp-out-no.shaw.ca ([64.59.134.12]:35384 "EHLO smtp-out-no.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbfDBXHP (ORCPT ); Tue, 2 Apr 2019 19:07:15 -0400 X-Greylist: delayed 303 seconds by postgrey-1.27 at vger.kernel.org; Tue, 02 Apr 2019 19:07:06 EDT Received: from tethys.mmayer.net ([70.68.144.247]) by shaw.ca with ESMTP id BSQGhVnLFldkPBSQHhKth3; Tue, 02 Apr 2019 17:02:29 -0600 X-Authority-Analysis: v=2.3 cv=Ko4zJleN c=1 sm=1 tr=0 a=5Vvn7CJLxh9yo+qVPaC6cg==:117 a=5Vvn7CJLxh9yo+qVPaC6cg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=oexKYjalfGEA:10 a=Q-fNiiVtAAAA:8 a=dE1nd1RK7gJplRNs3mEA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by tethys.mmayer.net (Postfix, from userid 501) id 1A2503010142F7; Tue, 2 Apr 2019 16:02:28 -0700 (PDT) From: Markus Mayer To: Brian Norris , Florian Fainelli , Gregory Fong Cc: Markus Mayer , Broadcom Kernel List , ARM Kernel List , Linux Kernel Mailing List Subject: [PATCH 3/6] memory: brcmstb: dpfe: wait for DCPU to be ready Date: Tue, 2 Apr 2019 16:01:00 -0700 Message-Id: <20190402230103.25491-4-code@mmayer.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190402230103.25491-1-code@mmayer.net> References: <20190402230103.25491-1-code@mmayer.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfDMB4UP1Ylg08TW5VgvcgNtKFN1remx5H/3G2T0ggol9J7OQfUNX3GgF2tbDvDJ2BqFCukxZ9mHtx0P2pewDxES31lXfM8Mf/IvRge2TzONrWflszaql lWXxxvvwRkPsfaimMtx1kYl8+A1eJrar/bKtHGBXvJT5W6r2jZlufDbGw6+cWt0A+OSeWgd6rw/rnZjOaMz7/dqJwxQEwqGw4HnBzyHrp2wTklUk3z4aAU+6 4zXN6BS87nYP+hapSkLtqql6oFQe3ipes8HUQPRQ9DvhlYYUTJ4kGmEeca4p4872EaF9dBYZLFFsyNK856bM+g5UkUsNr70LXabRugupLznxA81tulbxf34s 9V7KrI57ZPheIRaWt8Aa/SlDW9nNsH0xwfgIt6RoPRRuYiqeaLtassUgdnhClEG2F9wRilvRqE2RhAtw4UKT/sVezt2YNA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Mayer We wait for the DCPU to be ready before sending a command. Signed-off-by: Markus Mayer --- 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