From patchwork Thu May 18 22:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 100141 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp44977qge; Thu, 18 May 2017 15:09:52 -0700 (PDT) X-Received: by 10.99.109.9 with SMTP id i9mr6659955pgc.56.1495145392584; Thu, 18 May 2017 15:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495145392; cv=none; d=google.com; s=arc-20160816; b=TsdmOFtmnifXPLIgksscCPyQ3cmbrAf9fd8fCm1VSFDcHnxqG40tkkTu/75OwzIhBh vFfEIpjO2X3Y1k1AYoBCe4kw76DVAVtK/+pxlv0JNuBB1LMEpTNgmydrmHTWWKBXiQ6+ DF8BkuSmU67Z2sZPDWAP6fNWJnIzQgkp6zqIJOngkfJvNXCfkZMNbzM7BRJ3Gl9c0h7G UoBXiKUHc5utBJYruPBTjBadwi/XWW7lNWloCdaTC6d6X5DI3XEdNwa8xtM/8TiG+SyR 31DWluEzeB6R7ymALy5hx0KGLFfKuZSUrSrIZflLUQ8rbH1JqtEzhDqIEVzCtw1BLb3a /kjg== 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=iH487NHJxNRUH2i1v4L1he4ZsTYQ86WncpfnnaMAEhU=; b=DAS72SjcpH+IY4kWAucDxPg6hKcvQOmlMF9fHrAq3DIaQsMTT16+CNv2au4dMUYyhW CoPh3KlV4QF+/Toyj9yHjU0zLlOfv6dVAaR+cVT68AJVAeYadUBDIadMvzyV+k6BkO2R c6MqbuQx3DH6VYsxcxlryEOimD+pKaK1f/cM8xbCu4/pNJbrfOVRV2RE6jA6OD+4Akw1 88quK8lGQOJOU3EnRpjpzGk4tKvNC6RTlXi80r2xtFsm2rtitu1O7t19LQfi/8m8ocuS H6RQ3IMx8V4zJ6YtHOQYVSW7KGTKVHm9p/bBh1MBWf81LAFDytTEIys1QxzZIBbEGOBL fayA== 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 y133si6394390pfg.257.2017.05.18.15.09.52; Thu, 18 May 2017 15:09:52 -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 S932386AbdERWJg (ORCPT + 25 others); Thu, 18 May 2017 18:09:36 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:19343 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932325AbdERWJc (ORCPT ); Thu, 18 May 2017 18:09:32 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4IM94gd028488; Thu, 18 May 2017 17:09:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495145344; bh=Aeu5gcGz3/ndZqNYwNDOBNuSIlT4jM/Pql1soH0O2g4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FzQGzzOwBZ99gIoXrT2ZhXw1gBHC3+KRBaqtzDAtiqZxpRqBa/wIUOfUvvssdIeRy wnCMi1STj+X53r67pKS8WcfNGi/s60ByzrMtpQEN19ROS00Qd2IIwhX+stIX82r2uH SSXQgZm5jxOosKfE9Z9PQWMw5jIWO3bFZXxHMH50= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4IM94qv008783; Thu, 18 May 2017 17:09:04 -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; Thu, 18 May 2017 17:09:04 -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 v4IM943F023203; Thu, 18 May 2017 17:09:04 -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 v4IM93323047; Thu, 18 May 2017 17:09:03 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: , Sekhar Nori , Robert Tivy , , , Suman Anna , Arnd Bergmann Subject: [PATCH 1/4] remoteproc/davinci: Update Kconfig to depend on DMA_CMA Date: Thu, 18 May 2017 17:08:59 -0500 Message-ID: <20170518220902.2846-2-s-anna@ti.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170518220902.2846-1-s-anna@ti.com> References: <20170518220902.2846-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 The davinci remoteproc driver requires a CMA pool for allocating memory for virtio vrings/buffers and other sections of the firmware image. The allocations are done using the DMA API. The CMA option is currently selected automatically on systems with MMU when davinci remoteproc is enabled, switch this to a saner depends on dependency convention. The dependency is also updated to use the DMA_CMA kconfig symbol that is used for CMA allocations using the DMA API, the CMA dependency is inherited implicitly. Cc: Arnd Bergmann Signed-off-by: Suman Anna --- drivers/remoteproc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.12.0 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index faad69a1a597..0aafb0d0e9fd 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -52,7 +52,7 @@ config DA8XX_REMOTEPROC tristate "DA8xx/OMAP-L13x remoteproc support" depends on ARCH_DAVINCI_DA8XX depends on REMOTEPROC - select CMA if MMU + depends on DMA_CMA select RPMSG_VIRTIO help Say y here to support DA8xx/OMAP-L13x remote processors via the From patchwork Thu May 18 22:09:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 100140 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp44973qge; Thu, 18 May 2017 15:09:52 -0700 (PDT) X-Received: by 10.84.236.4 with SMTP id q4mr1411921plk.10.1495145392238; Thu, 18 May 2017 15:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495145392; cv=none; d=google.com; s=arc-20160816; b=g12sgK8fs9Gjq9BwxuIHtnbIsOBFBjzyBYKX6h1Ukcv35H+WV61kAXvte7NQ95Km3C bysuJSHopQZ0/om6EgMzFXJkGrQi6AARpZ9HYzOUcnPGhbhnz078dtBNwJsfP5l7foOO uww5Hv7j0FVVjTtSLhr/xKBFVxPUGVg4/zaLFatbrJX108nkax8H8jniqqsHGrYIq9nM 5sw0tEj0sqrHTwoyjQH7C3+ql7yud/lS//lIPoOSDjEGiaotidi+OrII/NqIhgX6403A Hc0+TZkdhgqUDKKu+6eFQmnb2qjHIwxnlcn7Zb67Z1NZwfTYvnJ5QD9w+4RNoNNMqBUQ IuKA== 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=iXwm0HrCrzbybVVuAaueLD3qOIKGJ//KPZjfshCsevM=; b=jnNmr9vQLQyVNfoxwqBhaW/1wUcF9fOIkzlrEa8MuWkM80PKcgRQY1wVtiZGE/i/nJ FNnofReDVEPhVnVnI9uyfgYM6CGPtANKPwvatJ+5OONV89JkOQClLePoBGRDLyWP0gqC oyi1F3X7FtDn/URTEj2sVSytQUkfG7lZvPexVp2MjDwHHwF+zLx3kNh6CZk9dA9H6GVg oUS4vhVHoZIxU7skOa5rjpsUqqRD9iYfIXGTVNyIUwY+bJ2xp08Dabo0mlZqmIjf0+Yg Lht93/7T+HdXFtT19UpEqeieQacQ52JpZebWpJd+zY/xmU2HeRSpUpIUWTkNGYW2MZTP 19fA== 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 y133si6394390pfg.257.2017.05.18.15.09.51; Thu, 18 May 2017 15:09:52 -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 S932350AbdERWJe (ORCPT + 25 others); Thu, 18 May 2017 18:09:34 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:45638 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756148AbdERWJ3 (ORCPT ); Thu, 18 May 2017 18:09:29 -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 v4IM94jS008820; Thu, 18 May 2017 17:09:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495145344; bh=3XVOSfybEYVtQ34A2jLm0YfC5wtyTIjVbgAx7flWfGc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fr2IsHNm+qkUyXdwmfjkOYvq5R7/ypbHIinHT1ppVxb2MpF3P8pTJRLLCSSfZ0m5o NJhf/o9z/LSVWgzwhAIiPztpv7JL8TrJh/flOeSfq+z3yOV1X/Vk7lCjmTMSchC5Mt W6V563ADlgcV7eyb8M75cpm8B40mQP/Q4Y84HjGs= 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 v4IM94T4008791; Thu, 18 May 2017 17:09:04 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Thu, 18 May 2017 17:09:04 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4IM94lL031332; Thu, 18 May 2017 17:09:04 -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 v4IM94323051; Thu, 18 May 2017 17:09:04 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: , Sekhar Nori , Robert Tivy , , , Suman Anna Subject: [PATCH 2/4] remoteproc/davinci: simplify the reset function Date: Thu, 18 May 2017 17:09:00 -0500 Message-ID: <20170518220902.2846-3-s-anna@ti.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170518220902.2846-1-s-anna@ti.com> References: <20170518220902.2846-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 The reset_assert() function is used to make sure the DSP remote processor is in a reset state regardless of its previous state. The driver relies on davinci_clk_reset_{assert,deassert}() functions for reset management which take in a clock parameter. The assert_reset() performs a clk_get()/clk_put() cycle to acquire the clock handle to use with this function. This is totally unnecessary and the code can be simplified to use the clock acquired during probe and directly use the reset functions, so simplify this logic. Signed-off-by: Suman Anna --- drivers/remoteproc/da8xx_remoteproc.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) -- 2.12.0 diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 3814de28599c..fcd3cecb4967 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -157,22 +157,6 @@ static const struct rproc_ops da8xx_rproc_ops = { .kick = da8xx_rproc_kick, }; -static int reset_assert(struct device *dev) -{ - struct clk *dsp_clk; - - dsp_clk = clk_get(dev, NULL); - if (IS_ERR(dsp_clk)) { - dev_err(dev, "clk_get error: %ld\n", PTR_ERR(dsp_clk)); - return PTR_ERR(dsp_clk); - } - - davinci_clk_reset_assert(dsp_clk); - clk_put(dsp_clk); - - return 0; -} - static int da8xx_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -223,6 +207,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) drproc = rproc->priv; drproc->rproc = rproc; + drproc->dsp_clk = dsp_clk; rproc->has_iommu = false; platform_set_drvdata(pdev, rproc); @@ -241,7 +226,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) * *not* in reset, but da8xx_rproc_start() needs the DSP to be * held in reset at the time it is called. */ - ret = reset_assert(dev); + ret = davinci_clk_reset_assert(drproc->dsp_clk); if (ret) goto free_rproc; @@ -250,7 +235,6 @@ static int da8xx_rproc_probe(struct platform_device *pdev) drproc->ack_fxn = irq_data->chip->irq_ack; drproc->irq_data = irq_data; drproc->irq = irq; - drproc->dsp_clk = dsp_clk; ret = rproc_add(rproc); if (ret) { @@ -268,7 +252,6 @@ static int da8xx_rproc_probe(struct platform_device *pdev) static int da8xx_rproc_remove(struct platform_device *pdev) { - struct device *dev = &pdev->dev; struct rproc *rproc = platform_get_drvdata(pdev); struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv; @@ -280,7 +263,7 @@ static int da8xx_rproc_remove(struct platform_device *pdev) * Without the reset, the DSP can lockup permanently when it * begins executing garbage. */ - reset_assert(dev); + davinci_clk_reset_assert(drproc->dsp_clk); /* * The devm subsystem might end up releasing things before From patchwork Thu May 18 22:09:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 100142 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp45143qge; Thu, 18 May 2017 15:10:24 -0700 (PDT) X-Received: by 10.84.222.131 with SMTP id x3mr7601403pls.33.1495145423983; Thu, 18 May 2017 15:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495145423; cv=none; d=google.com; s=arc-20160816; b=aSPlo1EvZ9rnE4bgrDtV+2fCTHGEUOuWAwmTyPIuWmMhMlBWJfZR4sC8pL4w+QpYUi 91+wdwwYg78TEmp9d/FJUBO2Y7cUTpOSt5P9JG+czqnMugCfqPh7VV4+h1kmFekZE2K2 GICecQlckwPtvUl0fVgF5wyfAPe9QIf6N1fuVVYE601JnQg9aHP8aonqOs712FomB7QO hjyFAhHI8HAZfVRpG0uHvUlbjJKxkTiqibrEJZ8nZiy5lVcDC1InGm7UxxVm5ZFY18fa re9uTjOHY5z/UmDykjQzMqszSDR4rrolJVPOVdvbyMrdnBPeshwjT2jlkp5BNZ8fLrHi ZM2Q== 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=GMGIQ21yoONUoUvD0kJILTnrW5CZ+3YhpjqxGn0aqVo=; b=K4h7U73gCOsJ1o4O77ZhTEKtwUbRskPE1HJbXM3cy3ULu7fmU0gXO8+wabTAEzGTaI HcobVJGA8waJSVFctktJlYm4O8WR5VBQ5LNH4neHeKUW0ZKU4/2LBoShBBhirgf+TcZW 7fkE7L+liYq5cfEXB03pVJGWZg0A+0Q0rZD3ED80+yHvKZ9C2B2lpL06bUrS0L8YagTk Sa2ZdlKecIcbkZ3p5rlyKA16nJ1TChNNSip68/qjoTUdGeQ/g331qEolm1I0TfSoYknj V5T0dala2h2VAyEYJSb5+/gogPOgwlaFhhwM0tg1aR0sFSvaEzlA/D2Qt/vTHDH2rDb7 PenA== 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 d71si4810907pgc.68.2017.05.18.15.10.23; Thu, 18 May 2017 15:10:23 -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 S1756293AbdERWKE (ORCPT + 25 others); Thu, 18 May 2017 18:10:04 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:45639 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932145AbdERWJb (ORCPT ); Thu, 18 May 2017 18:09:31 -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 v4IM95Kj008824; Thu, 18 May 2017 17:09:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495145345; bh=us/i3oELNmG9FuuM/VzjTGT2aGfv2B4ZmifMmpItzGw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xMHDQz36X2P9w1k+tG1/8rthCvMkoUZVvtBhU5hoOx1Wg77384YhWx569k7dvA7yi mxHkFTlCfpvh8JCWbd5Kx94lw2AseJhsf4BK3VCKkP0p0Nwg3JdlNYKjTXNnUbx0MC iJon/oA/+ui0GUogHVPj8y9fjPEKg2tOVeR2gVmg= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4IM95n6008802; Thu, 18 May 2017 17:09:05 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Thu, 18 May 2017 17:09:04 -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 v4IM94g1023208; Thu, 18 May 2017 17:09:04 -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 v4IM94323055; Thu, 18 May 2017 17:09:04 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: , Sekhar Nori , Robert Tivy , , , Suman Anna Subject: [PATCH 3/4] remoteproc/davinci: fix unbalanced reset between start and stop ops Date: Thu, 18 May 2017 17:09:01 -0500 Message-ID: <20170518220902.2846-4-s-anna@ti.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170518220902.2846-1-s-anna@ti.com> References: <20170518220902.2846-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 The davinci remoteproc driver is currently de-asserting the reset in its rproc .start() ops, but is not asserting the reset in its .stop() ops. This leaves the remote processor to not boot properly when using the sysfs 'state' variable between multiple start and stop operations. On the other hand, a reset is being asserted unconditionally in the driver remove function to alleviate some of these issues. Move this reset assertion logic into the .stop() ops implementation to fix the sysfs state-machine and the unbalanced reset. The logic from remove is still effective since .stop() ops will be invoked during the remove due to the enabled 'auto-boot' support. The probe already has support for asserting the reset in case the DSP is not in reset for some reason. Signed-off-by: Suman Anna --- drivers/remoteproc/da8xx_remoteproc.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.12.0 diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index fcd3cecb4967..99539cec1329 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -137,6 +137,7 @@ static int da8xx_rproc_stop(struct rproc *rproc) { struct da8xx_rproc *drproc = rproc->priv; + davinci_clk_reset_assert(drproc->dsp_clk); clk_disable(drproc->dsp_clk); return 0; @@ -256,16 +257,6 @@ static int da8xx_rproc_remove(struct platform_device *pdev) struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv; /* - * It's important to place the DSP in reset before going away, - * since a subsequent insmod of this module may enable the DSP's - * clock before its program/boot-address has been loaded and - * before this module's probe has had a chance to reset the DSP. - * Without the reset, the DSP can lockup permanently when it - * begins executing garbage. - */ - davinci_clk_reset_assert(drproc->dsp_clk); - - /* * The devm subsystem might end up releasing things before * freeing the irq, thus allowing an interrupt to sneak in while * the device is being removed. This should prevent that. From patchwork Thu May 18 22:09:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 100143 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp45189qge; Thu, 18 May 2017 15:10:31 -0700 (PDT) X-Received: by 10.84.134.34 with SMTP id 31mr7307905plg.178.1495145431468; Thu, 18 May 2017 15:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495145431; cv=none; d=google.com; s=arc-20160816; b=e0/LgZoN1h3GWEiQwDTvm7okrMqWLtab0PIY0aagBK1XRmDrQD0b8SC5x0vhiwHIiH pJPSMgSKXu0Yabe6luwH7HHDEQMfFZANI0OwhyqGLZ5EEMZxWxy27nDeEB2BqK+24EeN u+3Y9Rj/xM8jODmXXLO+Xn33fw3rV5IVG9FEEKAM53+nQfCujicOmO0TaYzyzRMKtnxF 0v02nwcLg9ik4Tm/Fz1MdMyOxHMb8RTCwYDZdSClonb5tPVjv89CT69jvzMUCBtJqtz+ 5bsPcKazQ0VkaFQ53G09FS/FoU5O7ZJyIvIiO41YR5z/s5/13CeOlkzJ7qhOKvBu+dma g8jw== 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=ujc+1YX7fscA03RGhPUEIfPQ/wknw2LgW0Ernl6nDdI=; b=ipqyTnH+yl9FcNNwKFsyINrI8Pt6vjNJtjRZ529yP2dz41E3kGd+hYI0aZLWgpeb1W QrxEpIYBP4mglxRwJ8PHp69DLi/4RHHypfsRtWtk6UnEbBPa2PharsycfP0+7jAzLCf4 0EIkUC5Um2L0okJXhxIne6QgqkelQufMiKjWxrPXLZZX1RqSLB1sFmDlRVTRn+AsH2fh Oh8/S3Ha64x+Lb6sKmhuPuqAtP5extliMRslBabhpn97/AfBK1B7iIVgjcWDFSXuGP8g OereAFLqv4z8/gz+InKdYtlRcJ/lMOCujeK5iP4KMp6118yNMZd8SoFzC6IZ4Hmag0rc 39fw== 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 80si6201083pga.162.2017.05.18.15.10.31; Thu, 18 May 2017 15:10:31 -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 S932405AbdERWKX (ORCPT + 25 others); Thu, 18 May 2017 18:10:23 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:62149 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756326AbdERWKV (ORCPT ); Thu, 18 May 2017 18:10:21 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4IM9A7P001524; Thu, 18 May 2017 17:09:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495145350; bh=WWUDfSCELqNChhwXA/M4rmH/OWcj4RIsjgxlLx6cpoM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Cw+7l6nvp/oQm+xw1r9TLFu2aE+Es2oWL+byV8YYcafSmuJ3wQX64prRAnyvgtbDn 6Y/k0sn3cdgoZJ8p4nWvmaKPjQPm4/bghGCJ7XYDrB6JwIiPPtifMJ8w9CO/B1QA6B Vz2hXoedOiwXNVCtqae88xfHgdE0IsHPQaOoqpm8= 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 v4IM95Oa008811; Thu, 18 May 2017 17:09:05 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Thu, 18 May 2017 17:09:04 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4IM9495031346; Thu, 18 May 2017 17:09:04 -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 v4IM94323059; Thu, 18 May 2017 17:09:04 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: , Sekhar Nori , Robert Tivy , , , Suman Anna Subject: [PATCH 4/4] remoteproc/davinci: streamline the interrupt management Date: Thu, 18 May 2017 17:09:02 -0500 Message-ID: <20170518220902.2846-5-s-anna@ti.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170518220902.2846-1-s-anna@ti.com> References: <20170518220902.2846-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 The davinci remoteproc driver is currently requesting its interrupt that deals with the virtio kicks in probe, and that too before all the associated variables used by the handler are initialized. This is a lot in advance before the DSP remote processor is even loaded and booted and is not essential. Streamline the interrupt request and freeing operations instead alongside the boot and shutdown of the remote processor. Signed-off-by: Suman Anna --- drivers/remoteproc/da8xx_remoteproc.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) -- 2.12.0 diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 99539cec1329..c7ad818f7a48 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -117,6 +117,7 @@ static int da8xx_rproc_start(struct rproc *rproc) struct device *dev = rproc->dev.parent; struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv; struct clk *dsp_clk = drproc->dsp_clk; + int ret; /* hw requires the start (boot) address be on 1KB boundary */ if (rproc->bootaddr & 0x3ff) { @@ -125,6 +126,14 @@ static int da8xx_rproc_start(struct rproc *rproc) return -EINVAL; } + /* everything the ISR needs is now setup, so hook it up */ + ret = request_threaded_irq(drproc->irq, da8xx_rproc_callback, + handle_event, 0, "da8xx-remoteproc", rproc); + if (ret) { + dev_err(dev, "request_threaded_irq error: %d\n", ret); + return ret; + } + writel(rproc->bootaddr, drproc->bootreg); clk_enable(dsp_clk); @@ -140,6 +149,8 @@ static int da8xx_rproc_stop(struct rproc *rproc) davinci_clk_reset_assert(drproc->dsp_clk); clk_disable(drproc->dsp_clk); + free_irq(drproc->irq, rproc); + return 0; } @@ -213,15 +224,6 @@ static int da8xx_rproc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rproc); - /* everything the ISR needs is now setup, so hook it up */ - ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback, - handle_event, 0, "da8xx-remoteproc", - rproc); - if (ret) { - dev_err(dev, "devm_request_threaded_irq error: %d\n", ret); - goto free_rproc; - } - /* * rproc_add() can end up enabling the DSP's clk with the DSP * *not* in reset, but da8xx_rproc_start() needs the DSP to be @@ -254,14 +256,6 @@ static int da8xx_rproc_probe(struct platform_device *pdev) static int da8xx_rproc_remove(struct platform_device *pdev) { struct rproc *rproc = platform_get_drvdata(pdev); - struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv; - - /* - * The devm subsystem might end up releasing things before - * freeing the irq, thus allowing an interrupt to sneak in while - * the device is being removed. This should prevent that. - */ - disable_irq(drproc->irq); rproc_del(rproc); rproc_free(rproc);