From patchwork Thu Oct 20 02:40:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9385801 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 38B11608A7 for ; Thu, 20 Oct 2016 02:42:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AA592993D for ; Thu, 20 Oct 2016 02:42:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ED712998F; Thu, 20 Oct 2016 02:42:24 +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 C6DF42993D for ; Thu, 20 Oct 2016 02:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbcJTCmW (ORCPT ); Wed, 19 Oct 2016 22:42:22 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36034 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757471AbcJTCkU (ORCPT ); Wed, 19 Oct 2016 22:40:20 -0400 Received: by mail-pf0-f179.google.com with SMTP id e6so26526124pfk.3 for ; Wed, 19 Oct 2016 19:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bklNyysfc5f4/w3svhPtkgAcef2KJgDRmFEYtMzew9U=; b=OZv0OoILnB1bW5oQZTJ+opJ+nmAF+9uR8B9S0ix584eYnbINHWXFfYOtCFPtwOi7gQ 9FpuLo4iYV6T62I0fYD77GIkx1KQdyjjNaHsibES+JNIjfFyE4XC8W3WexXgGE+k1PqA Ml2HKBAl1kSWo+PiAHZRLYI4fKXSX8npC+OoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bklNyysfc5f4/w3svhPtkgAcef2KJgDRmFEYtMzew9U=; b=Byy5jM0Ny2LnNIBq2302TYLH5mlth2HO4UhakFgfElYszIj9MRndkIGfM8ZG+MGa6b 1mJ9m95oo+700fqS/w30RfjsO/WuFLmJhpQ0dQXZS07huVX2vRemR/uJDhBNZeLV7ySY 8h2XTI7Wxr1yEV9l6/nMDRJFqRmKhGbcNc0w6/xTu43HZUmdGYUG9QkPXvWi/9p+Hgsu OsSaaU+Re1KO3tilulIUoWEe4AC8f/+GQzEvPghrn7ZULEp6ESXC1vY16ESyVjGqcOK1 lxFCNB1zkZWs41+faf9/6uBcL8W3xr55rv+vc+68EVcsnCKf5/Iq1NOHZsG6Tf3Bv8x3 3TyQ== X-Gm-Message-State: AA6/9RlScXvmipGSxHoSjoWYmCsT7Kh1HS5MIVRrojSd+8VLxEv7PKDdi4+wp3Ra9/mHpKhy X-Received: by 10.98.66.77 with SMTP id p74mr17116614pfa.15.1476931219948; Wed, 19 Oct 2016 19:40:19 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id s85sm66780616pfi.17.2016.10.19.19.40.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Oct 2016 19:40:18 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Sarangdhar Joshi , linux-arm-msm@vger.kernel.org Subject: [PATCH 03/11] remoteproc: wcnss: Bond SMD edge to remoteproc Date: Wed, 19 Oct 2016 19:40:04 -0700 Message-Id: <1476931212-1806-4-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1476931212-1806-1-git-send-email-bjorn.andersson@linaro.org> References: <1476931212-1806-1-git-send-email-bjorn.andersson@linaro.org> 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 Allow the wcnss smd edge to be described as a child of the wcnss remoteproc node and make the edge life cycle follow the running state of the remoteproc. This bond is necessary to clean up the smd state when the remote processor is suddenly removed, and in some cases even when it shut down in a controlled fasion. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_wcnss.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index f5cedeaafba1..0c47fa286794 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "qcom_mdt_loader.h" #include "remoteproc_internal.h" @@ -94,6 +95,10 @@ struct qcom_wcnss { phys_addr_t mem_reloc; void *mem_region; size_t mem_size; + + struct device_node *smd_node; + struct qcom_smd_edge *smd_edge; + struct rproc_subdev smd_subdev; }; static const struct wcnss_data riva_data = { @@ -396,6 +401,23 @@ static irqreturn_t wcnss_stop_ack_interrupt(int irq, void *dev) return IRQ_HANDLED; } +static int wcnss_smd_probe(struct rproc_subdev *subdev) +{ + struct qcom_wcnss *wcnss = container_of(subdev, struct qcom_wcnss, smd_subdev); + + wcnss->smd_edge = qcom_smd_register_edge(wcnss->dev, wcnss->smd_node); + + return IS_ERR(wcnss->smd_edge) ? PTR_ERR(wcnss->smd_edge) : 0; +} + +static void wcnss_smd_remove(struct rproc_subdev *subdev) +{ + struct qcom_wcnss *wcnss = container_of(subdev, struct qcom_wcnss, smd_subdev); + + qcom_smd_unregister_edge(wcnss->smd_edge); + wcnss->smd_edge = NULL; +} + static int wcnss_init_regulators(struct qcom_wcnss *wcnss, const struct wcnss_vreg_info *info, int num_vregs) @@ -578,6 +600,10 @@ static int wcnss_probe(struct platform_device *pdev) } } + wcnss->smd_node = of_get_child_by_name(pdev->dev.of_node, "smd-edge"); + if (wcnss->smd_node) + rproc_add_subdev(rproc, &wcnss->smd_subdev, wcnss_smd_probe, wcnss_smd_remove); + ret = rproc_add(rproc); if (ret) goto free_rproc; @@ -596,6 +622,7 @@ static int wcnss_remove(struct platform_device *pdev) of_platform_depopulate(&pdev->dev); + of_node_put(wcnss->smd_node); qcom_smem_state_put(wcnss->state); rproc_del(wcnss->rproc); rproc_free(wcnss->rproc);