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: 9735301 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 97EDE601C8 for ; Thu, 18 May 2017 22:09:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82C5328A33 for ; Thu, 18 May 2017 22:09:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7782E28A37; Thu, 18 May 2017 22:09:42 +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 E56E728A33 for ; Thu, 18 May 2017 22:09:41 +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=RMe1SJxJTdxEG+GQp6dEf7Oei0dDpi3cNn27kjduGGI=; b=tOOo0bwPfvqjZH hCYFnOfvHWzSMv/bnVd02DyYBisDHuJnrJlVmVKofFI9h5M7JsWEQJgXvhrwpcV6QUCqzrc6lFsRo yAM0i6KM4wMbU40D7I995AY+rDWc5/fUksBaGBYf0lPxEnomH8S0Compm24OS8l3ZiL3npvP9sdkP PtKDIL0pGON5RUOdoFwqXLI6H2fkz2K9Vbc/zznpfpOcIqm18p2gdMd3jjjqVePXuddqSHUS9c5tm XJqZz3VI0Ax1qNr8yvUjeQ/P3/QHiNAC2SEBnv72qVn1WFZxJtEeryQtHakPRFOiT5oJLj2RRigls z5c7vbyhSU4E+gyuI6Nw==; 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 1dBTc4-00067J-IN; Thu, 18 May 2017 22:09:40 +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 1dBTbq-0005su-Qu for linux-arm-kernel@lists.infradead.org; Thu, 18 May 2017 22:09:28 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_150927_024325_4D266BDF X-CRM114-Status: GOOD ( 11.39 ) 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: Robert Tivy , linux-remoteproc@vger.kernel.org, Sekhar Nori , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 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(-) 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