From patchwork Thu Sep 21 16:49:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 113881 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp2093755edb; Thu, 21 Sep 2017 09:52:16 -0700 (PDT) X-Received: by 10.98.155.220 with SMTP id e89mr6452173pfk.120.1506012736074; Thu, 21 Sep 2017 09:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506012736; cv=none; d=google.com; s=arc-20160816; b=DBHfoUh72eNQNVlTVJF+sUgajWEUUs4ACzuDgo9cSfZj/J10dH8WXWwmEO7rZeGWOy q0FeRw/7XlUiV/I+KVhG/N1WgwYCOWMEm9S558dz0PQLUYjDEWCZzHSV9CZhf7Tk4ugX /I5GWmajQ4B/njLjMkQy9csX0QYY0KExQzxSw+eborqURdDnfaLcGSQQp1HmBQM2bwAm HEexDdxn8oPT5Gw2QSp7VdrMdFRT9PxORkC/kGl7FH7vMk+VZu56B+cmQvwhYvIsHwtC JUUeoWhxVySZ5fUeJZwNgZ8pBG0o9JmVoqGV+2MjrQDXiOUmCrHWuKO0DII4QoXgwVX1 pTRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1QIZ9fOhgp+Mwd8ZF/LzSbbyEXZYeItAy+5XESFmLxQ=; b=EACeGJ9f44QDfq/WwMTKNF4GF9+FGYwNBIvFChtHFqsx6opJkCDSz+0pSd3Sk3cVEu LhS+BqoEDExfmDHPzXESOSseZEvziuMRV+kRKey4x/LirwsBZl/6k7als4uPnTQue1tl 27hkFa0IED3p5UDI+wZ9JAhh/KXuZajDVud7sKVqwVotRwdjrQH5VzYj6AFbxUIZVUhF /d4jwZiUFPf8I0bCoDRYYlEB+Ci+N6m8Sjd7tjXnxD53R31ajzzOdjfx00qSjrkypKvd nca4dXbHOiTAUx6zcrD7GcXlM78HZend/WPG7AV8JxIArbiQgo5Y2FTParaQ7XHA/9Kn psvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LrZ8NMy0; 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 z15si1200144pfd.587.2017.09.21.09.52.15; Thu, 21 Sep 2017 09:52:16 -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=LrZ8NMy0; 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 S1751718AbdIUQwO (ORCPT + 6 others); Thu, 21 Sep 2017 12:52:14 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:45387 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751786AbdIUQto (ORCPT ); Thu, 21 Sep 2017 12:49:44 -0400 Received: by mail-wm0-f45.google.com with SMTP id q124so3600393wmb.0 for ; Thu, 21 Sep 2017 09:49:44 -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:in-reply-to:references; bh=cQ6nctdD3xxvI++h3kyzuAgAJ5SWN5qaOMScnTFfGOQ=; b=LrZ8NMy0MAU7MMlVlDnnkJjM/n33CxY93PA/M3Up54hiMr9pj/i89w7Yg0J/1scQ/i SduY73Erni+ypc6aLbLyh7S+aqA43mmjxledHegW/SByLAtm2tyqgdifFjHx6K5h+f6N 5zUk/EQKqh31ufeHmcMZ3CccB/4PMULkQYhkg= 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=cQ6nctdD3xxvI++h3kyzuAgAJ5SWN5qaOMScnTFfGOQ=; b=Z4IwZtZJyYtBu8anYtw7wghJfpz4KcDBDttnxLueDI8RplWz3OlbazKr0h/GxKrKQf hr1GKvNu75QbVrEbHULKE3Y+8TEOZlXZDLeruoZ4Ta7Gzu57cZTOOCBC2dCdccmjutpX M5YzOQy//gsl//KGdKtLNqw0rDYn0OzpFvYuC6tLj+E6P9m/bbdOBxIeuo52Q6GBmHyw 9r/D/pDLi7foa49ZST9jxoZ9BkAnHt18GtEzoqiHFEkMtB+a4m6lBJfeB4aI800/zQC5 NrBbk5EWuBKz727lNsKreUT0Zkcu+VdyeY4BOzwy2i10AITl3PYJbu8xivZ7rVRHlvVF uwCA== X-Gm-Message-State: AHPjjUhB9dxPaKYI1oG/f0WQQxAfca+JfNDCSrdQJG5P3xJRdd61SnEm yWmUQkcn2oPpzjXc0H98rKb/Pw== X-Google-Smtp-Source: AOwi7QBHW5sX2jrgiRnwl55Mt7pbHNSSZaNrqqf4pwgZPBTfj854Kv4ll7v0IqssNslMYmbxV6Mf3w== X-Received: by 10.80.241.92 with SMTP id z28mr1864936edl.294.1506012583652; Thu, 21 Sep 2017 09:49:43 -0700 (PDT) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i16sm993311edj.29.2017.09.21.09.49.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 09:49:42 -0700 (PDT) From: Georgi Djakov To: sboyd@codeaurora.org, jassisinghbrar@gmail.com, bjorn.andersson@linaro.org, robh+dt@kernel.org Cc: mturquette@baylibre.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v9 1/7] mailbox: qcom: Convert APCS IPC driver to use regmap Date: Thu, 21 Sep 2017 19:49:34 +0300 Message-Id: <20170921164940.20343-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170921164940.20343-1-georgi.djakov@linaro.org> References: <20170921164940.20343-1-georgi.djakov@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This hardware block provides more functionalities that just IPC. Convert it to regmap to allow other child platform devices to use the same regmap. Signed-off-by: Georgi Djakov --- drivers/mailbox/qcom-apcs-ipc-mailbox.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) -- 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/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c index 9924c6d7f05d..ab344bc6fa63 100644 --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #define QCOM_APCS_IPC_BITS 32 @@ -26,19 +27,25 @@ struct qcom_apcs_ipc { struct mbox_controller mbox; struct mbox_chan mbox_chans[QCOM_APCS_IPC_BITS]; - void __iomem *reg; + struct regmap *regmap; unsigned long offset; }; +static const struct regmap_config apcs_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .max_register = 0x1000, + .fast_io = true, +}; + static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data) { struct qcom_apcs_ipc *apcs = container_of(chan->mbox, struct qcom_apcs_ipc, mbox); unsigned long idx = (unsigned long)chan->con_priv; - writel(BIT(idx), apcs->reg); - - return 0; + return regmap_write(apcs->regmap, apcs->offset, BIT(idx)); } static const struct mbox_chan_ops qcom_apcs_ipc_ops = { @@ -47,7 +54,9 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = { static int qcom_apcs_ipc_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct qcom_apcs_ipc *apcs; + struct regmap *regmap; struct resource *res; unsigned long offset; void __iomem *base; @@ -63,9 +72,14 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); + regmap = devm_regmap_init_mmio(&pdev->dev, base, &apcs_regmap_config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + offset = (unsigned long)of_device_get_match_data(&pdev->dev); - apcs->reg = base + offset; + apcs->regmap = regmap; + apcs->offset = offset; /* Initialize channel identifiers */ for (i = 0; i < ARRAY_SIZE(apcs->mbox_chans); i++)