From patchwork Wed Mar 21 12:08:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10299335 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 A4B10602B3 for ; Wed, 21 Mar 2018 12:14:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CA1629851 for ; Wed, 21 Mar 2018 12:14:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FFCF29854; Wed, 21 Mar 2018 12:14:50 +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=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 E939B29852 for ; Wed, 21 Mar 2018 12:14:49 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=YqFV6h/h+e8/UV3pZHo6Q718FLnc3pMj2BEgmjPMakA=; b=f2NklFqOMLVSaSUb3/OLff+ExL Y591DLAhfc6TG2Oc7hqfhoPWLpEMfJ70Ez/b7hxtpUOKtLRL7j7wuZgANODlQJi1wsMjU7P6wwRRl zj/5h5zipHHNyGXpEtwkbLBNL5t5uRr8TJSaSqKZpE3v4EROXTgPYLPQvYjqSZSWpv6FQ9X6bxmJ6 vI7soPmVGaFSv1GQpITYDZT86rMdgciHctttrcFZ+dEzL3RItGzM9+VVidZeMR0tLiDKE4vC2z9sQ s2JDpavBdI1K1saKcVCy1y2WWrl4SHDL5m1a+J9Y+qxTB51EFNQP87fesMvEgXy9JDaBCMG+TcyYt eHSHc42A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eycdd-0008KI-TP; Wed, 21 Mar 2018 12:14:41 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eycXy-00041N-H7 for linux-arm-kernel@lists.infradead.org; Wed, 21 Mar 2018 12:08:59 +0000 Received: by mail-wr0-x244.google.com with SMTP id c24so4950435wrc.6 for ; Wed, 21 Mar 2018 05:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V6Ive2vizAt017ZZFd97S3Xx0o5QH1dvSwHVQ29K4io=; b=eK81Q/4QBMtTAswSEkO2WoRNXhe5DaOCsMlQqgo6GBgGJbomdj/aXHRKV2qPFT/Cjl j2i/auoODVn5tNFxQMs5HKeCBfb/0I+9ZbHOljynNLsbcYfVap5kP12lBLyrkeJCvZ1n TWsxDHrbgRVNA67r9ycJREpgfGeMVBAgJO5NFwCf4H5sRKWY9ZoHlczTj/eP2H1b29Ha tfaVQiKXsCmrpZ0IzA7oIunTzWKfDOTgwO6UisnZiqLz5KWlK1Pnj5a9W7BikKlTB4LW EW2rjj3Nq1bef/ZedDJQCm2DbHinJAjx1mHvND0VaFLUorDQjD8YUeb8BU0zg5KpLmJt h8CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V6Ive2vizAt017ZZFd97S3Xx0o5QH1dvSwHVQ29K4io=; b=s5nJ11gTLH0nbqA18mBmGIrG0QbDE2OSod3oGGNyL8roPjRb/pUw1A5tO5R73Cu4TM MHTW619WmAaWLPOJw88gzrHVKeQ7i3mwpiTxj00a/kIcGAncP1ysGD9OSWymaHl3e+40 kzkFH//iMRNZCVWj+7CbkYCQgfuz6NxPr/yqdCcmMYK8BBUexTalq4F8/NVUx8oEmD8f BwH2tBLnJU6kD/OHQhFSS+h54fesS3VhFALPMf7ty8cTeo6/G4D5X55MmL6UD9zaIuzs cQWLpZGBVOEqbcX7oI9bjzNdfQr9c6kJXzjjo4PoOBPa4e6yNMoR3xDnSxMsayrfZe+J /jrA== X-Gm-Message-State: AElRT7GIXlAUWb4Xd0dFq6dA26uIbXSpfAxbhUrM/zI7Ay7vsZRsr0cZ LUg+cKivqIgZ/5zUS7KTcj5yHA== X-Google-Smtp-Source: AG47ELshCtKdgL+RfMmMTu+URzPoCc60Nw+tk7KFgqCIRZfmy8kMSA2c1I45Oe6UFFSv2Q5s9+v7jw== X-Received: by 10.223.152.138 with SMTP id w10mr5214622wrb.34.1521634116923; Wed, 21 Mar 2018 05:08:36 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-NIC-1-208-99.w2-15.abo.wanadoo.fr. [2.15.55.99]) by smtp.gmail.com with ESMTPSA id 69sm3871018wmp.36.2018.03.21.05.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 05:08:36 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Rob Herring , Mark Rutland , Russell King , David Lechner , Michael Turquette , Stephen Boyd , Ohad Ben-Cohen , Bjorn Andersson , Philipp Zabel Subject: [PATCH 7/8] remoteproc: da8xx: use the reset framework Date: Wed, 21 Mar 2018 13:08:06 +0100 Message-Id: <20180321120807.18032-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180321120807.18032-1-brgl@bgdev.pl> References: <20180321120807.18032-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180321_050851_283163_05ACA163 X-CRM114-Status: GOOD ( 18.84 ) 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: devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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: Bartosz Golaszewski Switch to using the reset framework instead of handcoded reset routines we used so far. Signed-off-by: Bartosz Golaszewski --- drivers/remoteproc/da8xx_remoteproc.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 83f2d66ad3a9..fc29b78d0f77 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -20,8 +21,6 @@ #include #include -#include /* for davinci_clk_reset_assert/deassert() */ - #include "remoteproc_internal.h" static char *da8xx_fw_name; @@ -72,6 +71,7 @@ struct da8xx_rproc { struct da8xx_rproc_mem *mem; int num_mems; struct clk *dsp_clk; + struct reset_control *dsp_reset; void (*ack_fxn)(struct irq_data *data); struct irq_data *irq_data; void __iomem *chipsig; @@ -138,6 +138,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; + struct reset_control *dsp_reset = drproc->dsp_reset; int rv; /* hw requires the start (boot) address be on 1KB boundary */ @@ -155,7 +156,11 @@ static int da8xx_rproc_start(struct rproc *rproc) return rv; } - davinci_clk_reset_deassert(dsp_clk); + rv = reset_control_deassert(dsp_reset); + if (rv) { + dev_err(dev, "reset_control_deassert() failed: %d\n", rv); + return rv; + } return 0; } @@ -163,8 +168,15 @@ static int da8xx_rproc_start(struct rproc *rproc) static int da8xx_rproc_stop(struct rproc *rproc) { struct da8xx_rproc *drproc = rproc->priv; + int rv; + + rv = reset_control_assert(drproc->dsp_reset); + if (rv) { + dev_err(rproc->dev.parent, + "reset_control_assert() failed: %d\n", rv); + return rv; + } - davinci_clk_reset_assert(drproc->dsp_clk); clk_disable_unprepare(drproc->dsp_clk); return 0; @@ -232,6 +244,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) struct resource *bootreg_res; struct resource *chipsig_res; struct clk *dsp_clk; + struct reset_control *dsp_reset; void __iomem *chipsig; void __iomem *bootreg; int irq; @@ -268,6 +281,13 @@ static int da8xx_rproc_probe(struct platform_device *pdev) return PTR_ERR(dsp_clk); } + dsp_reset = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(dsp_reset)) { + dev_err(dev, "unable to get reset control: %ld\n", + PTR_ERR(dsp_reset)); + return PTR_ERR(dsp_reset); + } + if (dev->of_node) { ret = of_reserved_mem_device_init(dev); if (ret) { @@ -309,7 +329,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 = davinci_clk_reset_assert(drproc->dsp_clk); + ret = reset_control_assert(dsp_reset); if (ret) goto free_rproc;