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: 9784981 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 727BB602DC for ; Tue, 13 Jun 2017 23:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6459B2684F for ; Tue, 13 Jun 2017 23:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5939327853; Tue, 13 Jun 2017 23:45:57 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E48D2684F for ; Tue, 13 Jun 2017 23:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cbrf2CU53GfU6McQYEPjOhvCaL4FAqIG92wj5vh8K/M=; b=Xn94bWc/hmA/DA qYllYZ4a2wavSyDSrkC2fvfhirS+BSN9zh1vhPAlyntKDwOINGKJlaHm6Oiv9fuOPYmMOKX4i+fed zwrPa0ykpmGp8YmwcuVtmP7gwyjWl5A/TZ9rDoEo3SAyC1cc7BYEl3dRwb00vKfJLQuTMuCTNCA0k unzSb2rb2mY/rsfMl69jP/DKiV/kULcuSea5w+CJRI/3Z97DV+SK+i+JXh5SOXlLXXQ6AhBYh0SgG Rl0m6AtAuFIq/D3fxJLBO+HrvyH1C9E+eU1JaLTo9jZBy8BgnYO9ql3ZZTr1FrwPOg45gLVSozEAf NUW11bMFYwCzMRYwo0Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKvVU-00064a-1W; Tue, 13 Jun 2017 23:45:56 +0000 Received: from lelnx193.ext.ti.com ([198.47.27.77]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKvVH-0005sr-1p for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2017 23:45:45 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170613_164543_254718_A34EDE2A X-CRM114-Status: GOOD ( 10.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, "Andrew F. Davis" , Rob Herring , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, Sam Nelson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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(+) 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",