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: 78386 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp561044qge; Wed, 19 Oct 2016 19:42:23 -0700 (PDT) X-Received: by 10.99.136.67 with SMTP id l64mr13936823pgd.115.1476931343639; Wed, 19 Oct 2016 19:42:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fg17si18505449pac.3.2016.10.19.19.42.23; Wed, 19 Oct 2016 19:42:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbcJTCmW (ORCPT + 10 others); Wed, 19 Oct 2016 22:42:22 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33736 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757467AbcJTCkU (ORCPT ); Wed, 19 Oct 2016 22:40:20 -0400 Received: by mail-pf0-f182.google.com with SMTP id 128so26592625pfz.0 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=VlEa1/9Ti9CPWA9DOremCJ2ymcKSA7R4u5U9Z4olM9r7UBva4bt2yRPc6/XtgOUqs7 7z1K5ZcBMDVGF7FiGuUuDPIgG+YNijAnJlM+XtMvgLIyNwMjZH6Gpa1Sv9/PQPpgC7hl Qw3u1GoNGRu6NYikTtTFp5IxcPXqmtCkC2RghjK3xwrzjbqLnuVnn7qIv5d1mwc6fpAs Qgh6psnGLScm8i4K0EDhIg7NODhqzPm5lv4+dgs5upkkn9DeFez+V0fIFF93gpo3J3dY zPAqb8fPXgz0qKiMhxKjC8SAvwelB7cdzJDw5Lg8BhW5090MhLsRmWtImxMjbwfb6mvV FN2A== X-Gm-Message-State: AA6/9RnbpXJkTXyqHQyf6EbhX630knxw3YvtbbPV+zjiGnwz81bHYppWiIwMTE8q7wMLRR18 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(+) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);