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);