From: Georgi Djakov <georgi.djakov@linaro.org>
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 [thread overview]
Message-ID: <20170921164940.20343-2-georgi.djakov@linaro.org> (raw)
In-Reply-To: <20170921164940.20343-1-georgi.djakov@linaro.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 <georgi.djakov@linaro.org>
---
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
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 <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/mailbox_controller.h>
#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++)
next prev parent reply other threads:[~2017-09-21 16:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 16:49 [PATCH v9 0/7] Add support for Qualcomm A53 CPU clock Georgi Djakov
2017-09-21 16:49 ` Georgi Djakov [this message]
[not found] ` <20170921164940.20343-2-georgi.djakov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-26 4:41 ` [PATCH v9 1/7] mailbox: qcom: Convert APCS IPC driver to use regmap Bjorn Andersson
[not found] ` <20170921164940.20343-1-georgi.djakov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-09-21 16:49 ` [PATCH v9 2/7] mailbox: qcom: Populate APCS child platform devices Georgi Djakov
2017-09-21 16:49 ` [PATCH v9 4/7] clk: qcom: Add A53 PLL support Georgi Djakov
2017-09-21 22:51 ` Rob Herring
2017-10-26 4:19 ` Bjorn Andersson
2017-09-21 16:49 ` [PATCH v9 5/7] clk: qcom: Add regmap mux-div clocks support Georgi Djakov
2017-09-21 16:49 ` [PATCH v9 3/7] mailbox: qcom: Move the apcs struct into a separate header Georgi Djakov
2017-10-26 4:28 ` Bjorn Andersson
2017-10-27 14:20 ` Georgi Djakov
[not found] ` <5bad4c4b-362b-ba9f-3072-1cced7a004dd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-11-14 2:12 ` Stephen Boyd
2017-11-14 4:47 ` Bjorn Andersson
2017-11-14 18:12 ` Stephen Boyd
2017-09-21 16:49 ` [PATCH v9 6/7] dt-bindings: clock: Document qcom,apcs binding Georgi Djakov
2017-10-03 21:41 ` Rob Herring
2017-10-26 4:13 ` Bjorn Andersson
2017-09-21 16:49 ` [PATCH v9 7/7] clk: qcom: Add APCS clock controller support Georgi Djakov
2017-10-26 4:39 ` Bjorn Andersson
2017-10-25 11:56 ` [PATCH v9 0/7] Add support for Qualcomm A53 CPU clock Georgi Djakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170921164940.20343-2-georgi.djakov@linaro.org \
--to=georgi.djakov@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).