Received: by 10.223.164.202 with SMTP id h10csp1785338wrb; Thu, 16 Nov 2017 04:24:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMb43scCk9F6tofG4uhZ48M8HSpokOaagORQLalCjoUWDtVadg/qbzcznxMlvZkohOY88A2U X-Received: by 10.98.71.144 with SMTP id p16mr1658166pfi.15.1510835058623; Thu, 16 Nov 2017 04:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510835058; cv=none; d=google.com; s=arc-20160816; b=wMEQh9NElCBL35n9wJ8oIsVnn4Hh8lopdjN/DP/7VZoL+NRorxCQatHzUW5v8DHPHd HXwbYHtogpYTQBUNxqB3l3iwsrseSvzhX4JBCz1yGqK9qgbMFxrt934kbjTDYBVmuoWT s9zIrmeO9avQjVZCgyWO7Dn+4oQ5IVJefYMu+9eBti8d4Q5rjkiXqHwsQYqoPm8ocaRK S092zhWZtP4J7DYoVDFBtYLsXj0ZUea2sfunO5ZnGjQZoacXuJU3zVGiBDoEmLusrEFo 6kcYsoyJKvLFV9QP3qrLx2I+Rtox6fKkTJ1AaRcB7DOikhfYnXQaWitMPhIlfZLOHxzN ljDA== 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=9Ax7/S3ZX6ndn9dA35Haz6gbszOIAYxjUHSVWCqKABo=; b=E0uV8e5n0ZzHFPsb/RR/izg26xTUlPLA+IiM7xcBhQFgNPcIcQOEDRGuGHxMPe5zwS gZ7dTUc/y5gB2R8PF9fvKBpCWgQVk0ZN8QqgECGNxfbfuLrOFVMRgID8PcYuoFRDiwNo 0LWf+fpnr/XPNDtv3DxQmlZm8K6ILdDXTC7ebkoku3H+XbD6mPcjkuToqVrfDl5jAaAS jSqSRiGasYezXgf/eMxc63EI+FFrIRa/V+HfjjIFBUspcsr/zowUeDj/uBLcwK8tvFzc D9gwze5FgDHXinx6v4dSMrHNyg3i62AVdJiRlpdTKPrSK2wqPErC0LBigUrHL9yIt/Lw eTFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VmKk3WZN; dkim=pass header.i=@codeaurora.org header.s=default header.b=mRvmUXQD; 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 v8si810616plp.5.2017.11.16.04.24.05; Thu, 16 Nov 2017 04:24:18 -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=VmKk3WZN; dkim=pass header.i=@codeaurora.org header.s=default header.b=mRvmUXQD; 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 S933474AbdKPMRr (ORCPT + 91 others); Thu, 16 Nov 2017 07:17:47 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51480 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934661AbdKPMRj (ORCPT ); Thu, 16 Nov 2017 07:17:39 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C39936080C; Thu, 16 Nov 2017 12:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510834658; bh=ra4AFYxH07ou7XoYzEaMQdbH1wo2PvEi4OP7PznJLMk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=VmKk3WZNLqGSj6Zimm17bvhq/KO30hHqsMiP77+3PJObqBAtWME7AP9taFzHKFffW jlfwC9QbDB3fL/pTpcncm4MlybGCPoqeCLnHeF4qXIsbwhUQkv/tkC1Tp2bJn2LaF3 wFH1Itb4Wt9OZBVGjPcsnrvywhJU5rMm/7UPjDzQ= 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 1980660584; Thu, 16 Nov 2017 12:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510834657; bh=ra4AFYxH07ou7XoYzEaMQdbH1wo2PvEi4OP7PznJLMk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=mRvmUXQD2XWv3sqfNAdBbJhHaF5fVzAjZgoUWXjae6SgesWCaFD40pdSxVsIW5hT3 JtjP9NN8JgHFh/OByxKMmpLAXiuQncpn0fWhQywElkL/mq9iUHBW4gCbKp1k9aRuup 2q5wFAaLYYKlSc7rbsvm2QnaS0GLilR2LFM9dQVY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1980660584 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] soc: qcom: smp2p: Access APCS as mailbox client To: Bjorn Andersson , Andy Gross , David Brown Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20171116071832.7441-1-bjorn.andersson@linaro.org> From: Arun Kumar Neelakantam Message-ID: Date: Thu, 16 Nov 2017 17:47:32 +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: <20171116071832.7441-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:48 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 > --- > drivers/soc/qcom/Kconfig | 1 + > drivers/soc/qcom/smp2p.c | 38 ++++++++++++++++++++++++++++++++------ > 2 files changed, 33 insertions(+), 6 deletions(-) > > diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig > index b00bccddcd3b..e67d9534fca0 100644 > --- a/drivers/soc/qcom/Kconfig > +++ b/drivers/soc/qcom/Kconfig > @@ -64,6 +64,7 @@ config QCOM_SMEM_STATE > > config QCOM_SMP2P > tristate "Qualcomm Shared Memory Point to Point support" > + depends on MAILBOX > depends on QCOM_SMEM > select QCOM_SMEM_STATE > help > diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c > index f51fb2ea7200..7fdbb64142a0 100644 > --- a/drivers/soc/qcom/smp2p.c > +++ b/drivers/soc/qcom/smp2p.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -126,6 +127,8 @@ struct smp2p_entry { > * @ipc_regmap: regmap for the outbound ipc > * @ipc_offset: offset within the regmap > * @ipc_bit: bit in regmap@offset to kick to signal remote processor > + * @mbox_client: mailbox client handle > + * @mbox_chan: apcs ipc mailbox channel handle > * @inbound: list of inbound entries > * @outbound: list of outbound entries > */ > @@ -146,6 +149,9 @@ struct qcom_smp2p { > int ipc_offset; > int ipc_bit; > > + struct mbox_client mbox_client; > + struct mbox_chan *mbox_chan; > + > struct list_head inbound; > struct list_head outbound; > }; > @@ -154,7 +160,13 @@ static void qcom_smp2p_kick(struct qcom_smp2p *smp2p) > { > /* Make sure any updated data is written before the kick */ > wmb(); > - regmap_write(smp2p->ipc_regmap, smp2p->ipc_offset, BIT(smp2p->ipc_bit)); > + > + if (smp2p->mbox_chan) { > + mbox_send_message(smp2p->mbox_chan, NULL); > + mbox_client_txdone(smp2p->mbox_chan, 0); > + } else { > + regmap_write(smp2p->ipc_regmap, smp2p->ipc_offset, BIT(smp2p->ipc_bit)); > + } > } > > /** > @@ -453,10 +465,6 @@ static int qcom_smp2p_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, smp2p); > > - ret = smp2p_parse_ipc(smp2p); > - if (ret) > - return ret; > - > key = "qcom,smem"; > ret = of_property_read_u32_array(pdev->dev.of_node, key, > smp2p->smem_items, 2); > @@ -483,9 +491,22 @@ static int qcom_smp2p_probe(struct platform_device *pdev) > return irq; > } > > + smp2p->mbox_client.dev = &pdev->dev; > + smp2p->mbox_chan = mbox_request_channel(&smp2p->mbox_client, 0); any reason why we are not using "knows_txdone = true" for SMP2P but using for only SMD drivers > + if (IS_ERR(smp2p->mbox_chan)) { > + if (PTR_ERR(smp2p->mbox_chan) != -ENODEV) > + return PTR_ERR(smp2p->mbox_chan); > + > + smp2p->mbox_chan = NULL; > + > + ret = smp2p_parse_ipc(smp2p); > + if (ret) > + return ret; > + } > + > ret = qcom_smp2p_alloc_outbound_item(smp2p); > if (ret < 0) > - return ret; > + goto release_mbox; > > for_each_available_child_of_node(pdev->dev.of_node, node) { > entry = devm_kzalloc(&pdev->dev, sizeof(*entry), GFP_KERNEL); > @@ -540,6 +561,9 @@ static int qcom_smp2p_probe(struct platform_device *pdev) > > smp2p->out->valid_entries = 0; > > +release_mbox: > + mbox_free_channel(smp2p->mbox_chan); > + > return ret; > } > > @@ -554,6 +578,8 @@ static int qcom_smp2p_remove(struct platform_device *pdev) > list_for_each_entry(entry, &smp2p->outbound, node) > qcom_smem_state_unregister(entry->state); > > + mbox_free_channel(smp2p->mbox_chan); > + > smp2p->out->valid_entries = 0; > > return 0; From 1584207296070832094@xxx Thu Nov 16 07:36:50 +0000 2017 X-GM-THRID: 1584207296070832094 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread