From patchwork Mon Oct 26 11:10:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 11856745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A837FC4363A for ; Mon, 26 Oct 2020 11:14:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5065C22263 for ; Mon, 26 Oct 2020 11:14:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uaQaqcM5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5065C22263 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=6DhsJpoLZktM6V2Ypq//CI9eVDGRLMjLj7rpxlFFLpA=; b=uaQaqcM5pHSAsUhQCh/ieul6J FET5MIYdbWFJS/5AnGD4MYjv9lUPwAcxHWLBgNcINCgP/q+qQjVc8wV4ZAQXfn/BwE4cUESt7JaYZ wI0KfHc00mfT4E1kP8zXyIRWtKYTGStL5e/m455GFWV4fr1EPAQuMh1+hxmWcIHMDzL4oZ3s+kajr OeKqZRXwVP4OTm+N6bMjNKAihqyXC/zPaeXxIIaq9eCtIM6nsdm0BZmz9LMnNsoLPqiLhQ+Nd8pdx QmEyk5zL+kJBFqSABdxGCcU700EEeo94olkV7/40OOEhMEEUQzf1FECq3O6xhCCVJK7K/bzl4j8iK J9eunC4kQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX0QM-0007YR-4o; Mon, 26 Oct 2020 11:12:26 +0000 Received: from muru.com ([72.249.23.125]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX0PU-0007Ed-Oe for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 11:11:34 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 68F4281A0; Mon, 26 Oct 2020 11:11:34 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Subject: [PATCH 9/9] remoteproc/wkup_m3: Use reset control driver if available Date: Mon, 26 Oct 2020 13:10:49 +0200 Message-Id: <20201026111049.54835-10-tony@atomide.com> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201026111049.54835-1-tony@atomide.com> References: <20201026111049.54835-1-tony@atomide.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_071132_954841_4E25C939 X-CRM114-Status: GOOD ( 19.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Tero Kristo , Grygorii Strashko , Dave Gerlach , Stephen Boyd , Keerthy , Michael Turquette , Santosh Shilimkar , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, "Andrew F . Davis" , Peter Ujfalusi , Faiz Abbas , Bjorn Andersson , Philipp Zabel , Greg Kroah-Hartman , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to move wkup_m3 to probe without platform data, let's add support for using optional reset control driver if configured in the dts. With this change and the related dts change, we can start dropping the platform data for am335x. And once wkup_m3 no longer needs platform data, we can simply drop the related legacy reset platform data callbacks from wkup_m3 driver later on after also am437x no longer depends on it. Cc: linux-remoteproc@vger.kernel.org Cc: Bjorn Andersson Cc: Dave Gerlach Cc: Philipp Zabel Cc: Suman Anna Signed-off-by: Tony Lindgren --- Please review and ack if no issues. If you guys instead want to set up an immutable remoteproc branch with just this patch in it against v5.10-rc1 that works too :) --- drivers/remoteproc/wkup_m3_rproc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/wkup_m3_rproc.c b/drivers/remoteproc/wkup_m3_rproc.c --- a/drivers/remoteproc/wkup_m3_rproc.c +++ b/drivers/remoteproc/wkup_m3_rproc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -43,11 +44,13 @@ struct wkup_m3_mem { * @rproc: rproc handle * @pdev: pointer to platform device * @mem: WkupM3 memory information + * @rsts: reset control */ struct wkup_m3_rproc { struct rproc *rproc; struct platform_device *pdev; struct wkup_m3_mem mem[WKUPM3_MEM_MAX]; + struct reset_control *rsts; }; static int wkup_m3_rproc_start(struct rproc *rproc) @@ -57,6 +60,9 @@ static int wkup_m3_rproc_start(struct rproc *rproc) struct device *dev = &pdev->dev; struct wkup_m3_platform_data *pdata = dev_get_platdata(dev); + if (wkupm3->rsts) + return reset_control_deassert(wkupm3->rsts); + if (pdata->deassert_reset(pdev, pdata->reset_name)) { dev_err(dev, "Unable to reset wkup_m3!\n"); return -ENODEV; @@ -72,6 +78,9 @@ static int wkup_m3_rproc_stop(struct rproc *rproc) struct device *dev = &pdev->dev; struct wkup_m3_platform_data *pdata = dev_get_platdata(dev); + if (wkupm3->rsts) + return reset_control_assert(wkupm3->rsts); + if (pdata->assert_reset(pdev, pdata->reset_name)) { dev_err(dev, "Unable to assert reset of wkup_m3!\n"); return -ENODEV; @@ -132,12 +141,6 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev) int ret; int i; - if (!(pdata && pdata->deassert_reset && pdata->assert_reset && - pdata->reset_name)) { - dev_err(dev, "Platform data missing!\n"); - return -ENODEV; - } - ret = of_property_read_string(dev->of_node, "ti,pm-firmware", &fw_name); if (ret) { @@ -165,6 +168,17 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev) wkupm3->rproc = rproc; wkupm3->pdev = pdev; + wkupm3->rsts = devm_reset_control_get_optional_shared(dev, "rstctrl"); + if (PTR_ERR_OR_ZERO(wkupm3->rsts)) { + if (!(pdata && pdata->deassert_reset && pdata->assert_reset && + pdata->reset_name)) { + dev_err(dev, "Platform data missing!\n"); + ret = -ENODEV; + goto err_put_rproc; + } + wkupm3->rsts = NULL; + } + for (i = 0; i < ARRAY_SIZE(mem_names); i++) { res = platform_get_resource_byname(pdev, IORESOURCE_MEM, mem_names[i]); @@ -173,7 +187,7 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "devm_ioremap_resource failed for resource %d\n", i); ret = PTR_ERR(wkupm3->mem[i].cpu_addr); - goto err; + goto err_put_rproc; } wkupm3->mem[i].bus_addr = res->start; wkupm3->mem[i].size = resource_size(res);