From patchwork Tue Jun 13 23:45:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 105451 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp42791qgd; Tue, 13 Jun 2017 16:46:21 -0700 (PDT) X-Received: by 10.84.229.70 with SMTP id d6mr1845753pln.263.1497397581549; Tue, 13 Jun 2017 16:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497397581; cv=none; d=google.com; s=arc-20160816; b=LsHAaqMe4M62oF5N6ZFF+GFuiqwM+Bb+p4nS6ZMsczaVrEXYtpS5kyMkd1Az/m6Ajn NnApYgucSnSqaSUv7qZMsoEj2+1YFB2dLVy4k7yvpc9kRA5BtF72mkedNyaTRCWb6lvp Ufx3sBbBWGlhA4KkM4Zm1nHr4Nmw4YdDPJoEsUerce2a6rGvjQWoHcROZ91f9ZIIuddy 8UkGedqX6sGTtXw2zeQCr5CTNRu+3wD3RY6rpZJKekMIyFQey9L3ipbaGKCx/09L5ugk kbkCenZQPZJpNJOTaLaIF/32edrgODvi7a/CyPNO+yz+NNmjQCjv0PkTs3gFrdZ5kKL2 qaKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=fVQRqFsmMY6CFtXU7dHHR42EdTkmGElV1PZMvodqyeE=; b=HmHQ9bE9aP90DT2gyF33snUwatwnRMnsI96ciHr4kDJ49Yjj4XGLvlRCZYhnbpKPRz dUy1pv0vgMhV8por3Lf1RqKP3xaqWStzHngtiM0iUGdizjBeFcKCxLyA7ojEsugDbqqk C/OIY5NbYuoHja98/c+oqFMatTOL+OvuL/enjF0OHt89qnnBUBE8hBVdkF97dSdYNNfX fSKctnsnRnFiVrHXd936M+D3WsAJEiL4Us71kbUpCBGUuyR4Ab5EXe3+Y2NcyHcURoi6 dICbwGuVvt2o9D4M8oFlyXTZw3ItRksCccA8wb9HLXWGlgkV2bZvWkyBb2MiEGULjaJ6 nftQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si919133pfe.264.2017.06.13.16.46.21; Tue, 13 Jun 2017 16:46:21 -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; dkim=pass header.i=@ti.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926AbdFMXps (ORCPT + 25 others); Tue, 13 Jun 2017 19:45:48 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:45709 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752525AbdFMXpq (ORCPT ); Tue, 13 Jun 2017 19:45:46 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v5DNjFcV012840; Tue, 13 Jun 2017 18:45:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1497397515; bh=oqyxdka9PPiTRHQN0hNxm62PUe8jyGq+FqEOGcMZpB4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MXHRQgdJGaqmD5WW/Umc/CDJlNyaVgecbpy+EA671gb4f6WLXBm0qzCPxzOKx8E9d hQbsKurm5+3BHAtC0qd/wwxS6PM7lA8SG9MuvxZxKV8sUWpkid9Wcj54uGJaTKpmsI 0QKwKNP/mrsYAHjmlGiYtb+caVTbMzTxGcxPX75Q= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5DNjFjI001201; Tue, 13 Jun 2017 18:45:15 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Tue, 13 Jun 2017 18:45:15 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5DNjFx7001944; Tue, 13 Jun 2017 18:45:15 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v5DNjF323329; Tue, 13 Jun 2017 18:45:15 -0500 (CDT) From: Suman Anna To: Bjorn Andersson , Ohad Ben-Cohen CC: Rob Herring , Santosh Shilimkar , Mark Rutland , , , , , Suman Anna , "Andrew F. Davis" , Sam Nelson Subject: [PATCH v3 3/3] remoteproc/keystone: Ensure the DSPs are in reset in probe Date: Tue, 13 Jun 2017 18:45:13 -0500 Message-ID: <20170613234513.7624-4-s-anna@ti.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170613234513.7624-1-s-anna@ti.com> References: <20170613234513.7624-1-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Andrew F. Davis" The DSPs are expected to be in reset when the driver probes a device. If the DSPs are out of reset in probe, the system may crash when the firmware is being loaded. So, add a check to make sure the DSP resets are asserted, and if not, throw a eye-catchy warning and assert the resets specifically. Signed-off-by: Andrew F. Davis [s-anna@ti.com: replace warning with a WARN] Signed-off-by: Suman Anna Acked-by: Santosh Shilimkar --- v3: No code changes, picked up Santosh's Ack v2: https://patchwork.kernel.org/patch/9773679/ drivers/remoteproc/keystone_remoteproc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.13.1 diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 6e09ef76f7c7..5f776bfd674a 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -456,6 +456,16 @@ static int keystone_rproc_probe(struct platform_device *pdev) if (of_reserved_mem_device_init(dev)) dev_warn(dev, "device does not have specific CMA pool\n"); + /* ensure the DSP is in reset before loading firmware */ + ret = reset_control_status(ksproc->reset); + if (ret < 0) { + dev_err(dev, "failed to get reset status, status = %d\n", ret); + goto release_mem; + } else if (ret == 0) { + WARN(1, "device is not in reset\n"); + keystone_rproc_dsp_reset(ksproc); + } + ret = rproc_add(rproc); if (ret) { dev_err(dev, "failed to add register device with remoteproc core, status = %d\n",