From patchwork Thu Nov 16 07:18:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 119020 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5255407qgn; Wed, 15 Nov 2017 23:18:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMaZzB6zeiqJEPsRe1keuVdUqQJzuR60EX8Ac76xjAZy0IkzEdCHRQS8270snHjNr11u05CZ X-Received: by 10.98.15.77 with SMTP id x74mr850293pfi.17.1510816720608; Wed, 15 Nov 2017 23:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510816720; cv=none; d=google.com; s=arc-20160816; b=IqxB1c4A6S3Iuosz3zKu/9i6TxlmiE6mNOHu1Y4WI1CNgTh7exgJHYVpeqQPiFlYMX JDkhBeh9+dsyYGvGUT1R+SL2ZBLKPZ5EhkOQ59kGJJAX9VKH/YDtX0eP69d8XP9ZebpZ iHb8Fg0y37WP+OroFfX2aFBsWtpeNri2iUN9x0v55YRR/FDkBjopYFd+vOMCY1eaT71H 6BHD1LWzzSORIxzSv7tNCRljyYZWml6m3G9gvhA35YdQxJKEPQ0apgVZj/OFk1LrG0QZ a08r5pbeuBjzphV+CHhLzex0H9DukKkAy5lUStP6wS/BoZ+yOcpkU2SZOq2JDdwunbws ru1A== 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=b+/mW7aTfbQPBaBpLDznBEQCWwRiRFNozqtXUEorD/M=; b=laCxU5Kdzz4+0cwmrXXx2kX3i5+5wJ2A8+hgCuqScGBO7+Qia+vcd1Rmb8k9Q+zv9B Q4ACFyLMxD1KAVAXiDP0j8nav5xqRZDjhwJRB7S/yOlFFHii8Xi+cwQjIMGQhcz2vZWO /jqu46VVHh0ZqO0cznLhk2IqUVsGIQeBPPjPQbD8rWM2w4UKvpUm14WIdegBm7R2cFEG 5Z2w/tCLuMq0WK+KaR23VxCBsfpYn4rxNlGYgpcEjBsaFk7rpIhGr4qVHgpxZb7SwtMt f8hHE4i4Hxy56WfxLXnHc3+SLPqYtwh+zcO5Y+Rcjl9JgRK1fXrkl6du55WJ4UwNoZVk C6/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z7TbOkUO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si11256plz.184.2017.11.15.23.18.40; Wed, 15 Nov 2017 23:18:40 -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 header.s=google header.b=Z7TbOkUO; 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 S1751064AbdKPHSh (ORCPT + 10 others); Thu, 16 Nov 2017 02:18:37 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:54208 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750886AbdKPHSg (ORCPT ); Thu, 16 Nov 2017 02:18:36 -0500 Received: by mail-pg0-f67.google.com with SMTP id r12so3202380pgu.10 for ; Wed, 15 Nov 2017 23:18:36 -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=SIlEpnnjvpzqzyMV4YFqkCsj9JWnZl3FurneD+A74a4=; b=Z7TbOkUO2hSfTEaZf5C3o8VMo7mFaZxrQxojWLyGszpxFYdnix5h9SYX1FzcZA8cpl RGLwo/Q0q8cR1ysddh5bYiDvdeXeYdbKdE3FUL0vEzVpovJoytHsiWKdjtj1w03Fro+z LslsIrDNhnza8iTN0AA17tunmu3rk/ff1Eiig= 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=SIlEpnnjvpzqzyMV4YFqkCsj9JWnZl3FurneD+A74a4=; b=W18vJ76Fucv9cqloZxULEmCtxKt2lh13IdcOVrLQ0yKfUDCFOHOUPrvIYWWfTRbIgq vcs1NgumJkGd/BzGFTxzBAVE+HqUzL+Ruepl4lIC9TY02u+fkLO/ToUVEDViFoSVwOyJ NmQAWpG6e2OtAyXqV1SSigpBlLBEjrtHqHu70fKEZvT8EbT6TEdp5jA/5ZGzxZVX6LEK sLz/qbNEsIbWy6Ts0LmrxoAIuys3W7dogqOjlafQg+aijrn9bT3EIo4XNsW5cqk/YPxY ZqmgjnI1a1X+1ppHgYz2dUiya7Od9F1UL2urQOoaHWGnNs3xclt3Yzac+wOcGTslxUl8 hzsA== X-Gm-Message-State: AJaThX5b7FrSdioiFqELbDoVK2PNJ9gy6JGIkAdWCsABNmFEusuzbdvM zgeNpSGL2PXdSAveclqQ+8YZFg== X-Received: by 10.98.156.207 with SMTP id u76mr823042pfk.211.1510816716207; Wed, 15 Nov 2017 23:18:36 -0800 (PST) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id u7sm1181691pfh.142.2017.11.15.23.18.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 23:18:35 -0800 (PST) From: Bjorn Andersson To: Andy Gross , David Brown Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: qcom: smp2p: Access APCS as mailbox client Date: Wed, 15 Nov 2017 23:18:32 -0800 Message-Id: <20171116071832.7441-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(-) -- 2.15.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/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); + 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;