From patchwork Mon Jan 30 17:26:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92934 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1713894qgi; Mon, 30 Jan 2017 17:25:36 -0800 (PST) X-Received: by 10.99.184.18 with SMTP id p18mr27702711pge.20.1485825936148; Mon, 30 Jan 2017 17:25:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si14313978pll.65.2017.01.30.17.25.35; Mon, 30 Jan 2017 17:25:36 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753548AbdAaBZY (ORCPT + 9 others); Mon, 30 Jan 2017 20:25:24 -0500 Received: from mail-it0-f44.google.com ([209.85.214.44]:38666 "EHLO mail-it0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbdAaBZW (ORCPT ); Mon, 30 Jan 2017 20:25:22 -0500 Received: by mail-it0-f44.google.com with SMTP id c7so115103900itd.1 for ; Mon, 30 Jan 2017 17:25:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2EBlsMr8Cp8MJgGPfSayrZanppAthdCpf4NxwEjGf0E=; b=QJ9NxdNDdPBrJcoi5vOMdcINJQUbvauI4B7+aVK+nXLweh5NU2gyb4u3amDozBZSyZ nOmzw5ZliI4gSNtFmj4MX4UTXt8oIdtYj9nwoXvoY79xWsNOD9M0yZlhtySatfC0qXns VECwrmvEOhbGyLTx7x1yPcWj7f4WJ+mgyiYRI= 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=2EBlsMr8Cp8MJgGPfSayrZanppAthdCpf4NxwEjGf0E=; b=Zdzkgk/NCm923F1u6h7IniconoOdnCehXtit9XKqru7enNIXjN1EIYOTcJxU5s1twy ktQYXhJcusQ2b2LGsdiFyC+prtBZqN24xWiYHlG5tH1sJO5nVz5m9tXFozI7EHdfsZh2 Tm5osu/RxW8sHlwJZvumCZblzm5n/iRPsUKxV0uY7y89ewnm81RBKw3Sf8GdSVpcwyHE j870ifQzd+khiz4f+h3wdtnVJo56p+49FNu69FhY6xTY0ksiT8W23Z5vQqfx2Og2koii P+bOf59DjQsa7Or8AI5NBPMpwpiL1aGKTyp+Ih606/zZgwNeLlA+v+OoLQ8S18o5uNn1 7sPw== X-Gm-Message-State: AIkVDXIYs1ps5I1U8R/34kIY+cktbThDP8hh4Kr2JvYh9oFmbOXkjhTu5+OuT+fGxgfiui2p X-Received: by 10.99.188.10 with SMTP id q10mr27188675pge.106.1485825914473; Mon, 30 Jan 2017 17:25:14 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id q64sm19436198pga.0.2017.01.30.17.25.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jan 2017 17:25:13 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 1/3] remoteproc: qcom-common: Extract non-mdt related helper Date: Mon, 30 Jan 2017 09:26:21 -0800 Message-Id: <20170130172623.4894-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for moving the mdt loader out of remoteproc let's move the somewhat unrelated resource table dummy helper to a Qualcomm "common" file. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/Kconfig | 6 +++++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_adsp_pil.c | 1 + drivers/remoteproc/qcom_common.c | 46 ++++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 11 +++++++++ drivers/remoteproc/qcom_mdt_loader.c | 19 --------------- drivers/remoteproc/qcom_mdt_loader.h | 1 - drivers/remoteproc/qcom_q6v5_pil.c | 1 + drivers/remoteproc/qcom_wcnss.c | 1 + 9 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 drivers/remoteproc/qcom_common.c create mode 100644 drivers/remoteproc/qcom_common.h -- 2.11.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/Kconfig b/drivers/remoteproc/Kconfig index a5e888043f1f..14e57b3e86dc 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -78,11 +78,15 @@ config QCOM_ADSP_PIL depends on QCOM_SMEM select MFD_SYSCON select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the TrustZone based Peripherial Image Loader for the Qualcomm ADSP remote processors. +config QCOM_RPROC_COMMON + tristate + config QCOM_MDT_LOADER tristate @@ -93,6 +97,7 @@ config QCOM_Q6V5_PIL depends on REMOTEPROC select MFD_SYSCON select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the Qualcomm Peripherial Image Loader for the @@ -105,6 +110,7 @@ config QCOM_WCNSS_PIL depends on QCOM_SMEM depends on REMOTEPROC select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the Peripheral Image Loader for the Qualcomm diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile index 0938ea3c41ba..d4f9525a226d 100644 --- a/drivers/remoteproc/Makefile +++ b/drivers/remoteproc/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o obj-$(CONFIG_QCOM_ADSP_PIL) += qcom_adsp_pil.o obj-$(CONFIG_QCOM_MDT_LOADER) += qcom_mdt_loader.o +obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o qcom_wcnss_pil-y += qcom_wcnss.o diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c index 43a4ed2f346c..284546fedb4d 100644 --- a/drivers/remoteproc/qcom_adsp_pil.c +++ b/drivers/remoteproc/qcom_adsp_pil.c @@ -29,6 +29,7 @@ #include #include +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include "remoteproc_internal.h" diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c new file mode 100644 index 000000000000..bd400336e209 --- /dev/null +++ b/drivers/remoteproc/qcom_common.c @@ -0,0 +1,46 @@ +/* + * Qualcomm Peripheral Image Loader helpers + * + * Copyright (C) 2016 Linaro Ltd + * Copyright (C) 2015 Sony Mobile Communications Inc + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include "remoteproc_internal.h" +#include "qcom_common.h" + +/** + * qcom_mdt_find_rsc_table() - provide dummy resource table for remoteproc + * @rproc: remoteproc handle + * @fw: firmware header + * @tablesz: outgoing size of the table + * + * Returns a dummy table. + */ +struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, + const struct firmware *fw, + int *tablesz) +{ + static struct resource_table table = { .ver = 1, }; + + *tablesz = sizeof(table); + return &table; +} +EXPORT_SYMBOL_GPL(qcom_mdt_find_rsc_table); + +MODULE_DESCRIPTION("Qualcomm Remoteproc helper driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/remoteproc/qcom_common.h b/drivers/remoteproc/qcom_common.h new file mode 100644 index 000000000000..caecf27c4ffa --- /dev/null +++ b/drivers/remoteproc/qcom_common.h @@ -0,0 +1,11 @@ +#ifndef __RPROC_QCOM_COMMON_H__ +#define __RPROC_QCOM_COMMON_H__ + +struct resource_table; +struct rproc; + +struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, + const struct firmware *fw, + int *tablesz); + +#endif diff --git a/drivers/remoteproc/qcom_mdt_loader.c b/drivers/remoteproc/qcom_mdt_loader.c index 2ff18cd6c096..897e14512123 100644 --- a/drivers/remoteproc/qcom_mdt_loader.c +++ b/drivers/remoteproc/qcom_mdt_loader.c @@ -27,25 +27,6 @@ #include "qcom_mdt_loader.h" /** - * qcom_mdt_find_rsc_table() - provide dummy resource table for remoteproc - * @rproc: remoteproc handle - * @fw: firmware header - * @tablesz: outgoing size of the table - * - * Returns a dummy table. - */ -struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, - const struct firmware *fw, - int *tablesz) -{ - static struct resource_table table = { .ver = 1, }; - - *tablesz = sizeof(table); - return &table; -} -EXPORT_SYMBOL_GPL(qcom_mdt_find_rsc_table); - -/** * qcom_mdt_parse() - extract useful parameters from the mdt header * @fw: firmware handle * @fw_addr: optional reference for base of the firmware's memory region diff --git a/drivers/remoteproc/qcom_mdt_loader.h b/drivers/remoteproc/qcom_mdt_loader.h index c5d7122755b6..e513548e52ec 100644 --- a/drivers/remoteproc/qcom_mdt_loader.h +++ b/drivers/remoteproc/qcom_mdt_loader.h @@ -5,7 +5,6 @@ #define QCOM_MDT_TYPE_HASH (2 << 24) #define QCOM_MDT_RELOCATABLE BIT(27) -struct resource_table * qcom_mdt_find_rsc_table(struct rproc *rproc, const struct firmware *fw, int *tablesz); int qcom_mdt_load(struct rproc *rproc, const struct firmware *fw, const char *fw_name); int qcom_mdt_parse(const struct firmware *fw, phys_addr_t *fw_addr, size_t *fw_size, bool *fw_relocate); diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 9a5149573298..cb2073242506 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -33,6 +33,7 @@ #include #include "remoteproc_internal.h" +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index ebd61f5d18bb..f158f8243b04 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -32,6 +32,7 @@ #include #include +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include "remoteproc_internal.h" #include "qcom_wcnss.h" From patchwork Mon Jan 30 17:26:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92933 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1713890qgi; Mon, 30 Jan 2017 17:25:35 -0800 (PST) X-Received: by 10.99.138.201 with SMTP id y192mr26922811pgd.146.1485825935836; Mon, 30 Jan 2017 17:25:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si14313978pll.65.2017.01.30.17.25.35; Mon, 30 Jan 2017 17:25:35 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753891AbdAaBZY (ORCPT + 9 others); Mon, 30 Jan 2017 20:25:24 -0500 Received: from mail-it0-f46.google.com ([209.85.214.46]:35168 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbdAaBZW (ORCPT ); Mon, 30 Jan 2017 20:25:22 -0500 Received: by mail-it0-f46.google.com with SMTP id 203so207305202ith.0 for ; Mon, 30 Jan 2017 17:25:17 -0800 (PST) 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=wv5uBNJ+QtydGlW/E0vxNWrGXjyru5jbmtZCOKbrjT4=; b=abJf4ypZFZF3zD/Wgp+H53/PpkrzUsFb7f2CiYvgL+Fdzuxyo697cvSS0QcUs1AACW lF/q9U16UyGRVmw3FNGJSFt9AAfkpECISp/uduOVCXQmTTcPmLWVngj9LNAhTgQGVYZ9 iWP7jF6g9+RvQglTzKbMOL2nt8nH2pjQApppg= 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=wv5uBNJ+QtydGlW/E0vxNWrGXjyru5jbmtZCOKbrjT4=; b=shmwd5cpRi2r8Y/JQxCxHRb5v810HEedQX1LYvGlghIlD42WH4WMq8Snb90Asv5suI unNeawbzL/i9cxG417L94dqO9SW+W6pw1irl1+fwLiaUfrliTd1ERJu5g18kJX5n9EIr Pm0puL87qdZ+g93qpkddipC7yyInh6hkTWO/rbO9RgrecY+Eq5z/pApV1jkbYUyFor7Q M6VRHEnqrBo6kM+V71JEiyOIXNAvyV+Ne8Ez7w+Lzc2MA7RCue0sK/t6+JC9AzouC38Y ZTt7aBKmvBtpJomnTqftL08wjr1H9QBdJIpT4gdY1DjJYzsgaDYz1GAsAAA4ET7rNjtG 7blw== X-Gm-Message-State: AIkVDXJWOmTi8Qx7tbxX5jD+T60Qq8kNbClsKqiKRD7bMfxjzZOIXauyuieQepyi1sH2BVF+ X-Received: by 10.99.147.18 with SMTP id b18mr8166636pge.22.1485825916720; Mon, 30 Jan 2017 17:25:16 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id q64sm19436198pga.0.2017.01.30.17.25.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jan 2017 17:25:15 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/3] remoteproc: qcom: wcnss: Make SMD handling common Date: Mon, 30 Jan 2017 09:26:22 -0800 Message-Id: <20170130172623.4894-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170130172623.4894-1-bjorn.andersson@linaro.org> References: <20170130172623.4894-1-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 Move the SMD edge handling to the Qualcomm common file to make it reusable for other Qualcomm remoteproc drivers. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_common.c | 50 ++++++++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 15 ++++++++++-- drivers/remoteproc/qcom_wcnss.c | 28 ++++------------------ 3 files changed, 67 insertions(+), 26 deletions(-) -- 2.11.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_common.c b/drivers/remoteproc/qcom_common.c index bd400336e209..bb90481215c6 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -19,10 +19,13 @@ #include #include #include +#include #include "remoteproc_internal.h" #include "qcom_common.h" +#define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev) + /** * qcom_mdt_find_rsc_table() - provide dummy resource table for remoteproc * @rproc: remoteproc handle @@ -42,5 +45,52 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, } EXPORT_SYMBOL_GPL(qcom_mdt_find_rsc_table); +static int smd_subdev_probe(struct rproc_subdev *subdev) +{ + struct qcom_rproc_subdev *smd = to_smd_subdev(subdev); + + smd->edge = qcom_smd_register_edge(smd->dev, smd->node); + + return IS_ERR(smd->edge) ? PTR_ERR(smd->edge) : 0; +} + +static void smd_subdev_remove(struct rproc_subdev *subdev) +{ + struct qcom_rproc_subdev *smd = to_smd_subdev(subdev); + + qcom_smd_unregister_edge(smd->edge); + smd->edge = NULL; +} + +/** + * qcom_add_smd_subdev() - try to add a SMD subdevice to rproc + * @rproc: rproc handle to parent the subdevice + * @smd: reference to a Qualcomm subdev context + */ +void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) +{ + struct device *dev = &rproc->dev; + + smd->node = of_get_child_by_name(dev->parent->of_node, "smd-edge"); + if (!smd->node) + return; + + smd->dev = dev; + rproc_add_subdev(rproc, &smd->subdev, smd_subdev_probe, smd_subdev_remove); +} +EXPORT_SYMBOL_GPL(qcom_add_smd_subdev); + +/** + * qcom_remove_smd_subdev() - remove the smd subdevice from rproc + * @rproc: rproc handle + * @smd: the SMD subdevice to remove + */ +void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) +{ + rproc_remove_subdev(rproc, &smd->subdev); + of_node_put(smd->node); +} +EXPORT_SYMBOL_GPL(qcom_remove_smd_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 caecf27c4ffa..db5c826d5cd4 100644 --- a/drivers/remoteproc/qcom_common.h +++ b/drivers/remoteproc/qcom_common.h @@ -1,11 +1,22 @@ #ifndef __RPROC_QCOM_COMMON_H__ #define __RPROC_QCOM_COMMON_H__ -struct resource_table; -struct rproc; +#include +#include "remoteproc_internal.h" + +struct qcom_rproc_subdev { + struct rproc_subdev subdev; + + struct device *dev; + struct device_node *node; + struct qcom_smd_edge *edge; +}; struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, const struct firmware *fw, int *tablesz); +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); + #endif diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index f158f8243b04..42ef6f3ebb2e 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -97,9 +97,7 @@ struct qcom_wcnss { void *mem_region; size_t mem_size; - struct device_node *smd_node; - struct qcom_smd_edge *smd_edge; - struct rproc_subdev smd_subdev; + struct qcom_rproc_subdev smd_subdev; }; static const struct wcnss_data riva_data = { @@ -401,23 +399,6 @@ 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) @@ -600,9 +581,7 @@ 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); + qcom_add_smd_subdev(rproc, &wcnss->smd_subdev); ret = rproc_add(rproc); if (ret) @@ -622,9 +601,10 @@ 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); + + qcom_remove_smd_subdev(wcnss->rproc, &wcnss->smd_subdev); rproc_free(wcnss->rproc); return 0; From patchwork Mon Jan 30 17:26:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92932 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1713886qgi; Mon, 30 Jan 2017 17:25:35 -0800 (PST) X-Received: by 10.99.241.83 with SMTP id o19mr26716288pgk.195.1485825935091; Mon, 30 Jan 2017 17:25:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si14313978pll.65.2017.01.30.17.25.34; Mon, 30 Jan 2017 17:25:35 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753845AbdAaBZX (ORCPT + 9 others); Mon, 30 Jan 2017 20:25:23 -0500 Received: from mail-it0-f44.google.com ([209.85.214.44]:36990 "EHLO mail-it0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbdAaBZW (ORCPT ); Mon, 30 Jan 2017 20:25:22 -0500 Received: by mail-it0-f44.google.com with SMTP id r185so115416089ita.0 for ; Mon, 30 Jan 2017 17:25:19 -0800 (PST) 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=wSTZhc/5Ne7p/EPJpuchAHXt5tBttD91M5MFZbRFaFs=; b=G16L7F1clFr2Fq1QXpkVUegBtJ5t7P1ZJh320HBK1SEVps+Lq0r2ZIX30XOH5TlZqi /wnW9eKIPopSA++BFC1Jdfv7kf2l3buIjprYv0NkuLX/GUQCqnrVhl8q6a6RXh7LSmhm oLGyx8qSHG9wnuYmq68U3lHrrWjuTh4tr09d8= 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=wSTZhc/5Ne7p/EPJpuchAHXt5tBttD91M5MFZbRFaFs=; b=jAXOEihw58uqUufsNCZv93mUfXdgWZiUAtdTr3Fpzd6BEbutbM+IPCgyFYwuqP/2s+ 11IRJCL48Y9Xcwn1V76lwzSF8PItvHEf5XsfV4pbESBnCLbHdmP2zFIDkGFanhuMZKkZ fe1GVRWTi7FiZFdnR02C+ZhQgkw4oUbTwUUAsfwmfprkOgvY2aeqs4/TtxM60FFT6e3Q 7pT5xknQF9qD+/0GEjej78eU0zw5c0IbCWm7uPOoJOp0EVT9TqnJXf+ekOaDVeeY/INE Yvb99kP4rEN46tbLERqQXRFUgzssqpLn3ihS0CI1hWFuMmeTG0kogM0wm0QnmBAvym/Q 7pAA== X-Gm-Message-State: AIkVDXK0zmFqqwT3f8kX5HmLP4WxZHBmBue2M9/Q64jCDrNgMWngdF6YCogI7DXC3u5W0hBT X-Received: by 10.84.253.23 with SMTP id z23mr36209968pll.0.1485825918971; Mon, 30 Jan 2017 17:25:18 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id q64sm19436198pga.0.2017.01.30.17.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jan 2017 17:25:17 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/3] remoteproc: qcom: Use common SMD edge handler Date: Mon, 30 Jan 2017 09:26:23 -0800 Message-Id: <20170130172623.4894-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170130172623.4894-1-bjorn.andersson@linaro.org> References: <20170130172623.4894-1-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 Call the common SMD edge handler to instantiate subdevices to bring associated SMD edges up and down as the remoteproc is started and stopped. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/Kconfig | 2 ++ drivers/remoteproc/qcom_adsp_pil.c | 6 ++++++ drivers/remoteproc/qcom_q6v5_pil.c | 6 ++++++ 3 files changed, 14 insertions(+) -- 2.11.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/Kconfig b/drivers/remoteproc/Kconfig index 14e57b3e86dc..2c61bd3f73c5 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -76,6 +76,7 @@ config QCOM_ADSP_PIL depends on OF && ARCH_QCOM depends on REMOTEPROC depends on QCOM_SMEM + depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) select MFD_SYSCON select QCOM_MDT_LOADER select QCOM_RPROC_COMMON @@ -95,6 +96,7 @@ config QCOM_Q6V5_PIL depends on OF && ARCH_QCOM depends on QCOM_SMEM depends on REMOTEPROC + depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) select MFD_SYSCON select QCOM_MDT_LOADER select QCOM_RPROC_COMMON diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c index 284546fedb4d..f941a56b233f 100644 --- a/drivers/remoteproc/qcom_adsp_pil.c +++ b/drivers/remoteproc/qcom_adsp_pil.c @@ -61,6 +61,8 @@ struct qcom_adsp { phys_addr_t mem_reloc; void *mem_region; size_t mem_size; + + struct qcom_rproc_subdev smd_subdev; }; static int adsp_load(struct rproc *rproc, const struct firmware *fw) @@ -385,6 +387,8 @@ static int adsp_probe(struct platform_device *pdev) goto free_rproc; } + qcom_add_smd_subdev(rproc, &adsp->smd_subdev); + ret = rproc_add(rproc); if (ret) goto free_rproc; @@ -403,6 +407,8 @@ static int adsp_remove(struct platform_device *pdev) qcom_smem_state_put(adsp->state); rproc_del(adsp->rproc); + + qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev); rproc_free(adsp->rproc); return 0; diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index cb2073242506..0f197fa103e0 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -153,6 +153,8 @@ struct q6v5 { phys_addr_t mpss_reloc; void *mpss_region; size_t mpss_size; + + struct qcom_rproc_subdev smd_subdev; }; static int q6v5_regulator_init(struct device *dev, struct reg_info *regs, @@ -998,6 +1000,8 @@ static int q6v5_probe(struct platform_device *pdev) goto free_rproc; } + qcom_add_smd_subdev(rproc, &qproc->smd_subdev); + ret = rproc_add(rproc); if (ret) goto free_rproc; @@ -1015,6 +1019,8 @@ static int q6v5_remove(struct platform_device *pdev) struct q6v5 *qproc = platform_get_drvdata(pdev); rproc_del(qproc->rproc); + + qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); rproc_free(qproc->rproc); return 0;