Received: by 10.223.164.202 with SMTP id h10csp1922119wrb; Thu, 16 Nov 2017 06:36:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMYSUi9PRLQdqy71PmJJtYqimRFnQqlLEP/LxId1lYCqGgKXFn1u9LlSV0G1gT7qHFBjetns X-Received: by 10.98.144.129 with SMTP id q1mr2110982pfk.38.1510842976916; Thu, 16 Nov 2017 06:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510842976; cv=none; d=google.com; s=arc-20160816; b=UTMe/TvBrcikSNUxt3oWCAX0ePhn9mGNx5lO/5KSttlOVvF8HSJmT2DTwZk4/ovSWF T/vixyxInafvtM8BaL26or9Cq23vGnl8hOUlYf1hB3clH2xzcyHqx340+3qWrv4XJ62X P5QWCu135e4Z7d04GqHb7zL1GhItoG3+uDzsWALY7QKRPtqG+XLM8/CG4eXpn3mdaBY+ sP7WlWnZ6svhVhlIbJMqfybvxaihl0le2ivmoUjzpD98gQOziwFxuwJ2gfBha3xqe4fV PQwg9HnbyKiSDwHdoCVNsqDLjUUqGhPJ6v57s8YaDP43zFLXDsds3tOh9YBJLS9PcsBk b/vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=98hRssqf4XNAPEgs0q64k2Dda/EO6/CJw9j2asjfXLU=; b=iEEMOTiBQyG4GKLrkNdPGWaXcM0XJVQr7WBWtKF5zLDkONDAeg59ps+27iuW1IOGRb rnxaJenSE81Gk5paZov2XTUVzO9tKyYxYdRyA1/Hj+1ihGxbf+jmaihlw/TzwrV1O2JH REzk4Usc1ZgUZ0ofla9j76X93h6SokUIE6obfeZ3h2Q+KrNzgfc3IG13M4ChChk9iWWV BlM0y5EIUoJtk//8Iqh3q32i02neYVMhF/WsyMN7Q+uLZ7prnR+4lpNsjILo89mUWGAl cr36HVUTe6r0WFKOgw0gqtrXNBNPqY4RTm/Y2T9G1hMm011lZBL3J4QJkK5/+FnMi9+b EE9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RiCs6AVr; dkim=pass header.i=@codeaurora.org header.s=default header.b=pNwSnd+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si959686pgu.564.2017.11.16.06.36.03; Thu, 16 Nov 2017 06:36:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RiCs6AVr; dkim=pass header.i=@codeaurora.org header.s=default header.b=pNwSnd+0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934368AbdKPMJz (ORCPT + 91 others); Thu, 16 Nov 2017 07:09:55 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:46348 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933753AbdKPMJr (ORCPT ); Thu, 16 Nov 2017 07:09:47 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8AB49607DC; Thu, 16 Nov 2017 12:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510834186; bh=BPPLsCjjC0GHhFqpdLIYThZ6MNsc1rGLXM3rfal36IA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RiCs6AVrW51pd9pHAMwpxykOwptB9S2u2eWDn4tL+Gg6xeiT7ogqYrVWukxv5wJzT DRxJBsqiruK1RcNwkwsPEKYfw0VWOQlEBmgmapZ1GfLpd+8WUsd5zwP7DeetI9brOi DtHOZIF08LB1XFvcmpxsOJbnH5OUnG788/nXOH4A= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.24.45] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id ECFEF601C4; Thu, 16 Nov 2017 12:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510834185; bh=BPPLsCjjC0GHhFqpdLIYThZ6MNsc1rGLXM3rfal36IA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pNwSnd+06Pc2M7k3gOYU1gWZX/kj+uavpNZu7ZrthzCgmKhsWV4fq23GtNCd3WojC uR5aVzpeASIwg0bZxaqEIkqSHHU+3urvpDRSkgl2jVZZK8UoMAo7lK2AtC0nelXJ37 vlRoA7HjGxDw9xWOfjH1cSn9LUcRIKySfQ89tmWA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org ECFEF601C4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org Subject: Re: [PATCH] rpmsg: qcom_smd: Access APCS through mailbox framework To: Bjorn Andersson , Ohad Ben-Cohen Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20171116070842.6362-1-bjorn.andersson@linaro.org> From: Arun Kumar Neelakantam Message-ID: Date: Thu, 16 Nov 2017 17:39:41 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171116070842.6362-1-bjorn.andersson@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/16/2017 12:38 PM, Bjorn Andersson wrote: > Attempt to acquire the APCS IPC through the mailbox framework and fall > back to the old syscon based approach, to allow us to move away from > using the syscon. > > Signed-off-by: Bjorn Andersson Reviewed-by: Arun Kumar Neelakantam > --- > drivers/rpmsg/qcom_smd.c | 62 +++++++++++++++++++++++++++++++++--------------- > 1 file changed, 43 insertions(+), 19 deletions(-) > > diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c > index b01774e9fac0..ef2a526ebc8f 100644 > --- a/drivers/rpmsg/qcom_smd.c > +++ b/drivers/rpmsg/qcom_smd.c > @@ -14,6 +14,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -107,6 +108,8 @@ static const struct { > * @ipc_regmap: regmap handle holding the outgoing ipc register > * @ipc_offset: offset within @ipc_regmap of the register for ipc > * @ipc_bit: bit in the register at @ipc_offset of @ipc_regmap > + * @mbox_client: mailbox client handle > + * @mbox_chan: apcs ipc mailbox channel handle > * @channels: list of all channels detected on this edge > * @channels_lock: guard for modifications of @channels > * @allocated: array of bitmaps representing already allocated channels > @@ -129,6 +132,9 @@ struct qcom_smd_edge { > int ipc_offset; > int ipc_bit; > > + struct mbox_client mbox_client; > + struct mbox_chan *mbox_chan; > + > struct list_head channels; > spinlock_t channels_lock; > > @@ -365,7 +371,12 @@ static void qcom_smd_signal_channel(struct qcom_smd_channel *channel) > { > struct qcom_smd_edge *edge = channel->edge; > > - regmap_write(edge->ipc_regmap, edge->ipc_offset, BIT(edge->ipc_bit)); > + if (edge->mbox_chan) { > + mbox_send_message(edge->mbox_chan, NULL); > + mbox_client_txdone(edge->mbox_chan, 0); > + } else { > + regmap_write(edge->ipc_regmap, edge->ipc_offset, BIT(edge->ipc_bit)); > + } > } > > /* > @@ -1268,27 +1279,37 @@ static int qcom_smd_parse_edge(struct device *dev, > key = "qcom,remote-pid"; > of_property_read_u32(node, key, &edge->remote_pid); > > - syscon_np = of_parse_phandle(node, "qcom,ipc", 0); > - if (!syscon_np) { > - dev_err(dev, "no qcom,ipc node\n"); > - return -ENODEV; > - } > + edge->mbox_client.dev = dev; > + edge->mbox_client.knows_txdone = true; > + edge->mbox_chan = mbox_request_channel(&edge->mbox_client, 0); > + if (IS_ERR(edge->mbox_chan)) { > + if (PTR_ERR(edge->mbox_chan) != -ENODEV) > + return PTR_ERR(edge->mbox_chan); > > - edge->ipc_regmap = syscon_node_to_regmap(syscon_np); > - if (IS_ERR(edge->ipc_regmap)) > - return PTR_ERR(edge->ipc_regmap); > + edge->mbox_chan = NULL; > > - key = "qcom,ipc"; > - ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset); > - if (ret < 0) { > - dev_err(dev, "no offset in %s\n", key); > - return -EINVAL; > - } > + syscon_np = of_parse_phandle(node, "qcom,ipc", 0); > + if (!syscon_np) { > + dev_err(dev, "no qcom,ipc node\n"); > + return -ENODEV; > + } > > - ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit); > - if (ret < 0) { > - dev_err(dev, "no bit in %s\n", key); > - return -EINVAL; > + edge->ipc_regmap = syscon_node_to_regmap(syscon_np); > + if (IS_ERR(edge->ipc_regmap)) > + return PTR_ERR(edge->ipc_regmap); > + > + key = "qcom,ipc"; > + ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset); > + if (ret < 0) { > + dev_err(dev, "no offset in %s\n", key); > + return -EINVAL; > + } > + > + ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit); > + if (ret < 0) { > + dev_err(dev, "no bit in %s\n", key); > + return -EINVAL; > + } > } > > ret = of_property_read_string(node, "label", &edge->name); > @@ -1394,6 +1415,8 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent, > return edge; > > unregister_dev: > + if (!IS_ERR_OR_NULL(edge->mbox_chan)) > + mbox_free_channel(edge->mbox_chan); > put_device(&edge->dev); > return ERR_PTR(ret); > } > @@ -1422,6 +1445,7 @@ int qcom_smd_unregister_edge(struct qcom_smd_edge *edge) > if (ret) > dev_warn(&edge->dev, "can't remove smd device: %d\n", ret); > > + mbox_free_channel(edge->mbox_chan); > device_unregister(&edge->dev); > > return 0; From 1584207178096643790@xxx Thu Nov 16 07:34:57 +0000 2017 X-GM-THRID: 1584207178096643790 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread