From patchwork Tue Aug 29 23:13:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 111260 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp45345qge; Tue, 29 Aug 2017 16:13:44 -0700 (PDT) X-Received: by 10.99.109.206 with SMTP id i197mr1896774pgc.256.1504048424317; Tue, 29 Aug 2017 16:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504048424; cv=none; d=google.com; s=arc-20160816; b=XRTUVopZV/SU5ocpiko8gvp2cd+MsPuQxPh4n0jmMFtboPFbjy3xcwnF/un65DyXmm GLXfs0DW831Is9VOMCkjgvpiBYFlL9NOgsQxUfYvellj73z5MoVaI3JVrgfb+1aXCTD4 U3OjG9JcfHY5g03gTqVaBdylVgdP/Z9pNca5lPNV8qjQ2mzEyEsTqjHSFo/Y1AHMgJP8 n6TdI6KJFZndTaNPFSN2r77LCY1qSoaR5ZumTPdSRPM/icUvJEnY8oKWMywqgrZwEh9/ /BGWnCYBqnIoh7wmJb/efGNHVCGOE58dL/4licLWajEpHa2KouIZLWnmgs00PtbBTmBt Q05Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=zLMZ4x90uJ1e81uK+D5HP3h3chs5GenjtvUP0M+GQA4=; b=QPVGRACnuApa120EjdecJI8p3cna2szzk5b8e+wjPIsjyN8SXjjldVKucjD/SgEQPa rBkKtQH+D8FBzdmR567RwKg4TmbIYZwFSiziQtl08fXMcgJNGQIzahYQp73n/lAi2H4d 0v75AegRItM+k+SlXkmUj3cNYzJbmXdOfTg+068EbdFlYlXDyPdfUYi+FZTPPbW+nKKz /XckhPnDYtPwEZ8ZaPB0Q8O77ht+VhHTaKUMlgT4Exkch2aNfRf+OgTt7+3HBsk3fvMv VjwXoAR13z098aKav3vuoyZ6raL/EkRSl6whQrHBrzElnYEwp+UKE8GW4fNtMbnBq6LQ F2UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=emPO+uey; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si3312536plk.16.2017.08.29.16.13.43; Tue, 29 Aug 2017 16:13:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 header.s=google header.b=emPO+uey; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbdH2XNl (ORCPT + 6 others); Tue, 29 Aug 2017 19:13:41 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33360 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751275AbdH2XNk (ORCPT ); Tue, 29 Aug 2017 19:13:40 -0400 Received: by mail-pf0-f171.google.com with SMTP id r62so14296502pfj.0 for ; Tue, 29 Aug 2017 16:13:40 -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; bh=7jsynE83M/C/0gqRF5+Uew23Li91o+CvAAOUWPZutP4=; b=emPO+ueygVkVXB8vKYDPR8SW2I9M5WXPIQpostftwduPrgfZnNNicvY7H6ccasmbq/ elakDsLl3V6hvpOrN2WI9JafRQ5jBdhQs0fbymP6x47UrkcEGlOQAP+d5Nr1C6kXEVeQ jv6SbjfSIGmg2lNn3MBIAPMKU93oSMn/7cwZI= 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; bh=7jsynE83M/C/0gqRF5+Uew23Li91o+CvAAOUWPZutP4=; b=QrfmMxQgbpvCsXaPZ2/K9jSh9KGeRAx5CidUWTRm4X6CfwkA3HNLBeFLEEACw3CX6r fy5wilicNoRht5mldbl8ntfE+COBcVI3K2LYO6naoUy9YBvNcyGqAXEISrFzr5AEHaFc lS+DI23YOi278icQAz/vhDSWnsRyzzDdYXC1WKLiZ3Vc8bE9W7O8ccLstxkVXmG0J571 Rl88KyP0im8is+WcuaoRkXud8DS47sRywrL5kiZOa42OvPLPQXG6OrM0puUs9Atp6tTU R74MHNYCZ5ecAhlvE9XLHpyzAIOEsCNrkDnxQJT3nwPqXER135GSvc8fWCwaOqvOUdCv kmgQ== X-Gm-Message-State: AHYfb5iCVREDEME33tqjtno2MHKZo+zt85S2QrnPWsvN4QTNPsI6k18S i/hlm10Oa3zvF+cp X-Received: by 10.99.168.74 with SMTP id i10mr1866823pgp.259.1504048420343; Tue, 29 Aug 2017 16:13:40 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id c23sm6522879pfc.60.2017.08.29.16.13.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 16:13:39 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Rob Herring , Mark Rutland , Andy Gross , David Brown , linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Subject: [PATCH 1/2] remoteproc: qcom: adsp: Allow defining GLINK edge Date: Tue, 29 Aug 2017 16:13:35 -0700 Message-Id: <20170829231336.24454-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Introduce the GLINK subdev, which allows the definition of a GLINK edge as child of a remoteproc. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_adsp_pil.c | 3 +++ drivers/remoteproc/qcom_common.c | 49 ++++++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 11 +++++++++ 3 files changed, 63 insertions(+) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c index 49fe2f807e1d..42884ace324c 100644 --- a/drivers/remoteproc/qcom_adsp_pil.c +++ b/drivers/remoteproc/qcom_adsp_pil.c @@ -71,6 +71,7 @@ struct qcom_adsp { void *mem_region; size_t mem_size; + struct qcom_rproc_glink glink_subdev; struct qcom_rproc_subdev smd_subdev; }; @@ -401,6 +402,7 @@ static int adsp_probe(struct platform_device *pdev) goto free_rproc; } + qcom_add_glink_subdev(rproc, &adsp->glink_subdev); qcom_add_smd_subdev(rproc, &adsp->smd_subdev); ret = rproc_add(rproc); @@ -422,6 +424,7 @@ static int adsp_remove(struct platform_device *pdev) qcom_smem_state_put(adsp->state); rproc_del(adsp->rproc); + qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev); qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev); rproc_free(adsp->rproc); diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index bb90481215c6..6357f7ae9def 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -19,11 +19,13 @@ #include #include #include +#include #include #include "remoteproc_internal.h" #include "qcom_common.h" +#define to_glink_subdev(d) container_of(d, struct qcom_rproc_glink, subdev) #define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev) /** @@ -92,5 +94,52 @@ void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) } EXPORT_SYMBOL_GPL(qcom_remove_smd_subdev); +static int glink_subdev_probe(struct rproc_subdev *subdev) +{ + struct qcom_rproc_glink *glink = to_glink_subdev(subdev); + + glink->edge = qcom_glink_smem_register(glink->dev, glink->node); + + return IS_ERR(glink->edge) ? PTR_ERR(glink->edge) : 0; +} + +static void glink_subdev_remove(struct rproc_subdev *subdev) +{ + struct qcom_rproc_glink *glink = to_glink_subdev(subdev); + + qcom_glink_smem_unregister(glink->edge); + glink->edge = NULL; +} + +/** + * qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc + * @rproc: rproc handle to parent the subdevice + * @glink: reference to a GLINK subdev context + */ +void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) +{ + struct device *dev = &rproc->dev; + + glink->node = of_get_child_by_name(dev->parent->of_node, "glink-edge"); + if (!glink->node) + return; + + glink->dev = dev; + rproc_add_subdev(rproc, &glink->subdev, glink_subdev_probe, glink_subdev_remove); +} +EXPORT_SYMBOL_GPL(qcom_add_glink_subdev); + +/** + * qcom_remove_glink_subdev() - remove a GLINK subdevice from rproc + * @rproc: rproc handle + * @glink: reference to a GLINK subdev context + */ +void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) +{ + rproc_remove_subdev(rproc, &glink->subdev); + of_node_put(glink->node); +} +EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev); + MODULE_DESCRIPTION("Qualcomm Remoteproc helper driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/remoteproc/qcom_common.h b/drivers/remoteproc/qcom_common.h index db5c826d5cd4..db252b46ea8f 100644 --- a/drivers/remoteproc/qcom_common.h +++ b/drivers/remoteproc/qcom_common.h @@ -12,6 +12,14 @@ struct qcom_rproc_subdev { struct qcom_smd_edge *edge; }; +struct qcom_rproc_glink { + struct rproc_subdev subdev; + + struct device *dev; + struct device_node *node; + struct qcom_glink *edge; +}; + struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, const struct firmware *fw, int *tablesz); @@ -19,4 +27,7 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd); void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd); +void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink); +void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink); + #endif