Received: by 10.213.65.68 with SMTP id h4csp447069imn; Fri, 30 Mar 2018 08:32:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pb0AGgcrhvhWdEUt3HTZlYFSJj31QWj8Loz/ETkV3v2I6y6P5zVRq8NyE763lNvaTvN0y X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr13751408plb.143.1522423936457; Fri, 30 Mar 2018 08:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522423936; cv=none; d=google.com; s=arc-20160816; b=p0u/YZHGwruyluxffHKVhKM0T7O2pOG9jawL/ddS1WzmmB0mNNIA5n0AXFjEkLoHaH wokt7slNqJx4LjSjjpPS3qVKbkCdLU0beWyURTgEBBAeQbf3aXsSTvdSVdDJi5RZ4MdQ QN1G++tvXfJYR1diKqVT/JZAz7tHgtvhuYXPoSWRh+rnl8c/1kfXnNrQ31+ZaHyV/lCe jgzA8I5qoFhOi7oZP7bvUVZ8VDkrxWSioeQRGdJ9C+QH4VPOATCxNOo98w0Lv4CYRyQR V8dl4oar+VmYrkOABPR7PbV9+U4WV8CIFERt+Vk4QXKDjmrXOD0C89NitbhgCiLv5KtR colg== 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=4aOE1cBJK6+a3WSpuJdQVMX+6l4vKRSi1H4WXYh1kT8=; b=IYm/w7k75TzPaMRJJQgyw4hKgWQRfDoD6xdQQf5TyWoSs8NLTPfcMxIMhF/SmnhQ54 8vHSOX4JW9q2cR6Ckieg9/ZXucKXCUnlAycXAkUJbiE3yVyUZAO7txX/SucbXe2ayymm G9vgGc8xBaly0y85OnK8qu4xfVLwOfF0dUPsv5fwriXIZADrv89UoyOgyb1Zn+l9T0ka J3DdlZvBMoGo7IHNhd+KRgDrTeyjurAx4U6vPiK7MDtXe3s4b8EC/m9EAMde4X9j6PEA q5wZ6vymrQFJ+vjeh3ZhueKQMO+DAjxrkIc9XSVGMk8AVwpdmvH3YzNPA6+oPJQOPbVW Ztfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=sOuJ9/S3; 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 r26si5801604pgu.422.2018.03.30.08.32.02; Fri, 30 Mar 2018 08:32:16 -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=sOuJ9/S3; 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 S1752586AbeC3PaH (ORCPT + 99 others); Fri, 30 Mar 2018 11:30:07 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40516 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbeC3P3K (ORCPT ); Fri, 30 Mar 2018 11:29:10 -0400 Received: by mail-wm0-f68.google.com with SMTP id x4so17219119wmh.5 for ; Fri, 30 Mar 2018 08:29:10 -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=4aOE1cBJK6+a3WSpuJdQVMX+6l4vKRSi1H4WXYh1kT8=; b=sOuJ9/S3QNJLsc9+nLbvYSZa2z29/Vu35K2gglPWJyHboBzEoKOVbYCSDsXUp/CHzg XTP6T25rwAgpjLxWztuFzICI2n0pwNXVCwTIeZ+0Cd0WAEUXunQQsozkGepuBNiKQOdo vqg30Pe5TPYKc3bcvsIbvhPbLbfXV84KwuqRur2GSEMhRvvwzxK3doP2FxvKJp2y7dCo 12j1QSHX7punzmk8aHrrdojOmFJbdWiYfv9ac9FfwjBv1CJjZY8iTjd7CZ8kzCsz/SLu PZuS5jZlnieib0WWLTOB3mphKlcf1Fgw++8sBDJUOmESwTWkjpaWfLGdtJFRYiwNCSmg 6xjQ== 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=4aOE1cBJK6+a3WSpuJdQVMX+6l4vKRSi1H4WXYh1kT8=; b=CbyoRbTvgkNpWIBwvNXaYfan7XDdlgtCPFGznLD1VfGqLqzPDWDA0mYc0BVMxYwd/p m/G1rG3g47DEOSR6N5C5e4q02nHoJkXMfw39Q5/FzJPbEFu1dVaMbYq14TmzRgX/NTDB ufG4l26WVo5yJB3iH72x7HPojyO8sICiFj60SIUujbrcLJ7AvmVuG2YkyKmp0CNdGSES TeO2jcEbZbw5TEv/TujJXlRR9aZrogleyl6vNo0NbYie/6vtvC7YlCVoDh7L9EwF8kGT bJvctXvdAbAWYIHyZV/rBwCCWM+fGGkUc7eyefnimo1dpRIMoGEwraaHxEVNdWAockU2 3l5A== X-Gm-Message-State: AElRT7EtTvNKczIbm5fYIqV7Xq4ki2bh2lUgK2PHJvyTLhKX/NShjVk7 5Zr227Y3SW5L+oSwA3zOE2Q/uQ== X-Received: by 10.28.177.215 with SMTP id a206mr2567359wmf.142.1522423749309; Fri, 30 Mar 2018 08:29:09 -0700 (PDT) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n49sm14429881wrn.90.2018.03.30.08.29.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Mar 2018 08:29:08 -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 v5 7/8] remoteproc/davinci: use the reset framework Date: Fri, 30 Mar 2018 17:28:55 +0200 Message-Id: <20180330152856.12297-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180330152856.12297-1-brgl@bgdev.pl> References: <20180330152856.12297-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 | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index b668e32996e2..76c06b70a1c6 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,12 @@ 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); + clk_disable_unprepare(dsp_clk); + return ret; + } return 0; } @@ -163,8 +169,15 @@ static int da8xx_rproc_start(struct rproc *rproc) static int da8xx_rproc_stop(struct rproc *rproc) { struct da8xx_rproc *drproc = rproc->priv; + struct device *dev = rproc->dev.parent; + int ret; + + ret = reset_control_assert(drproc->dsp_reset); + if (ret) { + dev_err(dev, "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 +245,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 +282,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) { @@ -287,6 +310,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) drproc = rproc->priv; drproc->rproc = rproc; drproc->dsp_clk = dsp_clk; + drproc->dsp_reset = dsp_reset; rproc->has_iommu = false; ret = da8xx_rproc_get_internal_memories(pdev, drproc); @@ -309,7 +333,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.3