From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S944364AbdEZQy0 (ORCPT ); Fri, 26 May 2017 12:54:26 -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 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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org 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 --- 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", -- 2.12.0