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: 10299267 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 106B06055B for ; Wed, 21 Mar 2018 12:09:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C92D29830 for ; Wed, 21 Mar 2018 12:09:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0130A29832; Wed, 21 Mar 2018 12:09:18 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7F129831 for ; Wed, 21 Mar 2018 12:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbeCUMJP (ORCPT ); Wed, 21 Mar 2018 08:09:15 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:45896 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbeCUMIi (ORCPT ); Wed, 21 Mar 2018 08:08:38 -0400 Received: by mail-wr0-f195.google.com with SMTP id h2so4936004wre.12 for ; Wed, 21 Mar 2018 05:08:37 -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=XQpTLvrZ2tukg99EWOwqiN+tGMW2giNdzTAg/FHDrJqgaFoijgyY/18iXYc3iMRwMn wUxZ9yEx+85aocKvF/3TpgxcgQNvMwhVb6H5AbV0INijC35dXJeS/YpQ5D2lqYIyFG39 p3hzAj/Gs9hOTbavZrf8QbseXX8MMGjIX1U9o5xHmJ766XCFkOLJe4hYsgcIaUAp1Hir fLGY1jy5SxL918ey1g7Qo3zaa6X5ADpUW6sTdHvsx3I6D3lJq3HqKRw7ErXCJTlemcci wfQmho+os70QVgWlrLqndU1AUHa2AIrMY8yJcQODhJgF+j2+Srv/bGWS5/229BevXjz5 8yxw== X-Gm-Message-State: AElRT7G7YZc4GYvx5tzrL8G0QZ6JWy17mBWzu+yPOQ/USxm0zKtIpv4n 3ji+scAdp1hGAV2rY+Ve2JdeRw== 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 Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-remoteproc@vger.kernel.org, Bartosz Golaszewski 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> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.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;