From patchwork Fri May 26 16:53:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 9750825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C71FB6032C for ; Fri, 26 May 2017 16:54:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B692F26538 for ; Fri, 26 May 2017 16:54:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB0C8283AF; Fri, 26 May 2017 16:54:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 580FD26538 for ; Fri, 26 May 2017 16:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S944330AbdEZQyH (ORCPT ); Fri, 26 May 2017 12:54:07 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:56638 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbdEZQx5 (ORCPT ); Fri, 26 May 2017 12:53:57 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4QGrRha001774; Fri, 26 May 2017 11:53:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495817607; bh=vFA7Wh7AHY9tx/tRD1vmPQVIx9u5Zgr3zB/XVKXMJMA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kZ7U8H2JgakV5TjR1RVxhynZz20cTTzCN97RvkaeOUK71Sthtal1Gu6qrwsPaVRYc Aw/SCVEVa4ADwZPmm5+KgRfH859Ti/B5gF3qNWdLe22/iAopckyUOrhWAIROfEw8MJ FUnRd7On5TVytYtIDcyZ9WweLZ9ZlM/Ci68mXtE0= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4QGrRCh021749; Fri, 26 May 2017 11:53:27 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Fri, 26 May 2017 11:53:26 -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 v4QGrRNY011808; Fri, 26 May 2017 11:53:27 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.167]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v4QGrQ308435; Fri, 26 May 2017 11:53:26 -0500 (CDT) From: Suman Anna To: Bjorn Andersson , Ohad Ben-Cohen , Rob Herring CC: Santosh Shilimkar , Mark Rutland , , , , , Suman Anna , "Andrew F. Davis" , Sam Nelson Subject: [PATCH 3/3] remoteproc/keystone: ensure the DSPs are in reset in probe Date: Fri, 26 May 2017 11:53:17 -0500 Message-ID: <20170526165317.23164-4-s-anna@ti.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170526165317.23164-1-s-anna@ti.com> References: <20170526165317.23164-1-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/remoteproc/keystone_remoteproc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index d01d5e3fce28..8233664e85fa 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",