Received: by 10.213.65.68 with SMTP id h4csp1195381imn; Wed, 21 Mar 2018 05:11:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELvgy+warss8axitRvAZC8/VlB0/rm5Sps0AcfXCWdxHLk15N33Hb2uc3UhzgsIjK9qaY0JX X-Received: by 10.98.130.140 with SMTP id w134mr7373664pfd.127.1521634273657; Wed, 21 Mar 2018 05:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521634273; cv=none; d=google.com; s=arc-20160816; b=hoV+3CsAsnHpR6oQOZk6BnPpyzVKsNOWYsWFeAU/3HfXBvJ9whp4WyCUCHBzZ2d9AZ XtoZCn9quDd3I5Fn7PZZn+w09ope8TtDdML07JVTXbxiMdZDZAQXGY8y0EMWWurRBCuD GxfTJksnQt3yhFc0rVXq0CYjO7f5p0gWIkB5xo5MUVaRuEZCGDZ4u+X9IJNNrpbo2PN7 z7dv+2+kOvGemDo16xrEPlsoUGwpbqr+/wxUTQIXsUfmPgV6iCsryhsW6vVGBePMMXvV EHjPZYR+9Iuxb0SRDPj6bp0bWpvZHnSGlI40fw/B0CuS+3y1B4yX7OOy0IqZC0BdNiB8 B1ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=V6Ive2vizAt017ZZFd97S3Xx0o5QH1dvSwHVQ29K4io=; b=1Ebma3AnL6xlc2dzeWgtXIUwxzqwWflSqtYRcXcyvtTdvQ/svhtyXSbt9m/IJBPlyH oyGGLlRQuJOm4HaslQpVPCtWApX4sh+DePo7A7lqlkigkxDV16I7YuDvj/7n5OflJYML USCL5ERWrzhWk/gNduKInrqLDUI1n+4gGLG693WgoPTR2OFo9zDPVh1/oTdTZBhVbbZ5 xPTTNl/WnQi52SmShNv35bCsQKmSdew8xTtz0SPn3LHgmn9hEJ9J6pysetU1e/krC44D 4ajmbWbpKuDzRUJNvboEuMTu39ATEn6t+11qkG/EJElzWgDQvyfSSQ6J55j0Db0XGueF FWIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=eK81Q/4Q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36-v6si3895776pla.163.2018.03.21.05.10.59; Wed, 21 Mar 2018 05:11:13 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=eK81Q/4Q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999AbeCUMJQ (ORCPT + 99 others); Wed, 21 Mar 2018 08:09:16 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:41396 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbeCUMIi (ORCPT ); Wed, 21 Mar 2018 08:08:38 -0400 Received: by mail-wr0-f196.google.com with SMTP id f14so4934710wre.8 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=Sw2iQYkthSxTdmV++Xj+whseSR0Q+6um4a6cGJpz5yF2e+8cDYDrFxpyqqVyVolcqn N57yRHJ44stdLWnHQBqCDwrOWv2gNTt0smaC0do5xfPtanlFnoPzkIxoxCf8IYp2uTDV 0pBrold2N1AEEJ76HgFkiDO4mwyvTlCAyut7zLMbDl+VhaFKMluzCdTKcn3RVNaxicRc SXILOSHrZzNtv4tE9HZSq+UoBhvh+c406yZRGv1ATSg0oWTlnh06OhEcls75Ykbf3lz3 5TmsOU+S+RCmYGjQOFkuJa35E2b3hm7JPeih1JgoDji+1s6ix+ilWB+DrJ4XZnpkSTjS DkQA== X-Gm-Message-State: AElRT7F44AzfyhZbgC+k6Ga4rB8z+jqkXPq3P1F93WhqOCjHT0Ftn7t5 KADLoOcGkxuS+4NUjxyb6Yh1TVe1WmY= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.16.1