From patchwork Fri Mar 23 13:04:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10304615 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 98F8E60385 for ; Fri, 23 Mar 2018 13:05:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88D2A28DFB for ; Fri, 23 Mar 2018 13:05:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CFE928E62; Fri, 23 Mar 2018 13:05:47 +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=unavailable 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 18F9A28E5C for ; Fri, 23 Mar 2018 13:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752206AbeCWNFp (ORCPT ); Fri, 23 Mar 2018 09:05:45 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39936 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbeCWNFM (ORCPT ); Fri, 23 Mar 2018 09:05:12 -0400 Received: by mail-wm0-f67.google.com with SMTP id t6so3405782wmt.5 for ; Fri, 23 Mar 2018 06:05:11 -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=8AVHAjaKsQ1vDsLJD+KSRnbKYcoIDu3IbDdhPfKUTF0=; b=ySTMGPusbR/mCZkEH+qlPjOFTu4a+UNG93WJkJSvAQOk66v1bn6V1DX9x72Sk0zN0j rC8JDMBHBjoP8uE4qd2xN+VZTbvfLgq5CM3r+blRTlGh/mRvjuBspdgCZBuupJyMbxs9 YiwwH+UnsNuNze4gVygvuR7CicT+pCHOPKxVWKgSrVr4eoiD6mr9BvbTNy7uBoz/QbRR ysU9BMdB4zziYufihzzkoRTVX4YsPODzxQ+D0TGA/ouMOk5jrH+kGrmgoUOCkTCQKtsu wphYeoJVWuWT4pldrmVU4AmfysRyLmwZZb04rLKJBWE/HsOVk1Xal52d2Q1e4ky/EZ6P Au6Q== 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=8AVHAjaKsQ1vDsLJD+KSRnbKYcoIDu3IbDdhPfKUTF0=; b=e+bkhOSrthypMG5TYc2bASqX/bPteFBgNiX+XBvVGrQPR7+xN1TeEaU9ksNmeKzDK3 epcXIhI56K/wFicQH3h/bKwr7uxZJXRqShG57FC4bOuGsHnDYsUQlxSP0cq6Yf7XbX5c 7Uyx4tFBeW4VohYUEXzBkYK+o3KGn00jFV1aM88ZdkdnWaUZdiB89jX68yeyjfHRM1k6 fugg/t7Qz1k9KaGj5Yr6SQ6fpU/LHrat8fh5DM1BG1EU8qLMTwTAn/5zDlu27ffOBgaE B0Y4xws56EdZPw0G/JzDYcFKhgxIoS3gK2UReL0N+mTA2tVt6w5DHtxo6pPtAgDdlwR4 j2lQ== X-Gm-Message-State: AElRT7H5XGgR5DFwKOipHY/wWy0Gs2sR3vOAbWTcDv3PVQpel3UBwdXt ha1nP+HRdMybYUZgs0yrUzXRwg== X-Google-Smtp-Source: AG47ELuZq87VInZY3Twl7/mYvsc8EeqSAL1y85+9d7mRzWOO03SPF/SlFDsMV23CxA1M+gwGP4ULAw== X-Received: by 10.28.114.20 with SMTP id n20mr6670061wmc.56.1521810310484; Fri, 23 Mar 2018 06:05:10 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-1-7086-217.w90-116.abo.wanadoo.fr. [90.116.254.217]) by smtp.gmail.com with ESMTPSA id x67sm7069964wma.5.2018.03.23.06.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 06:05:09 -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 v4 7/8] remoteproc: da8xx: use the reset framework Date: Fri, 23 Mar 2018 14:04:54 +0100 Message-Id: <20180323130455.11470-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180323130455.11470-1-brgl@bgdev.pl> References: <20180323130455.11470-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 | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index f134192922e0..3689473f8b49 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 ret; /* hw requires the start (boot) address be on 1KB boundary */ @@ -155,7 +156,11 @@ static int da8xx_rproc_start(struct rproc *rproc) return ret; } - davinci_clk_reset_deassert(dsp_clk); + ret = reset_control_deassert(dsp_reset); + if (ret) { + dev_err(dev, "reset_control_deassert() failed: %d\n", ret); + return ret; + } 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 ret; + + ret = reset_control_assert(drproc->dsp_reset); + if (ret) { + dev_err(rproc->dev.parent, + "reset_control_assert() failed: %d\n", ret); + return ret; + } - 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,15 @@ 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)) { + if (PTR_ERR(dsp_reset) != -EPROBE_DEFER) + 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 +331,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;