From patchwork Tue Dec 5 15:46:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 120703 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5908290qgn; Tue, 5 Dec 2017 07:49:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMYdhoQ/ZF28dlPj64aHbToNznsAFSUsbHSuBlkmD+D5WGwmtVhoOUfu+6m/wJvt/jpVFh1/ X-Received: by 10.99.7.143 with SMTP id 137mr17614181pgh.158.1512488966632; Tue, 05 Dec 2017 07:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512488966; cv=none; d=google.com; s=arc-20160816; b=jWGPW4AecSPjDg6RXo/RFjZGKeG/nscO7gWCTcefUMeARq4AkjJe2OO0DrMtj8Wy4D /+vO8SxhRhMql+6SbowCF3RllAK8FuQRl/GDOoORT3gjhEtEsjS8zkq5aiCVplnSfMy/ Tsvz9LTVVSJZYk63DkQbGafSpawetSpaElqcMwFf38fFkEkpYO4evBF6Uvt+sQzK+VuU LNJUrFJCgDXBGh9eDy+Jj/ft90XGwO/JAzBm2dYh9g4GZQvifSj45fvZmK3R9C9jSV49 eu2MP7EsdiR0kVkhtCEmryJGYymyUFrYCxW4yaLjOIZR8llWxLqeh85AQkZTeJmnS9J/ +2nQ== 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=4/m2bSrJvVMYtkngL4dLcHzNOiP+AeyxF7s2sCAaf5I=; b=LBgRu1FweTqHmxyGgtchqi7nN7pAhn76lBZpFuy5KKJBZzllEtzjp1kvN0RmE2/BmV FtIZ16h0p+R7aX0Hud4izE4N168ngv3qUNPBHIhiycWd+qf0wbu3NjN6MRBCVUK9OZlb ba1fHL1L5TfW1EaIkqyMuSjBrnwGKBhUtERmrOQKEFcmkRqzfvr3O0H0zPS2ArjIYvs1 w1G3rIOTkoRbZeZxWksy1aAu4dlKljxahoc+2iI98UJyh699MJZ5dP4t1gvGuV0ZD8gU OH2h429X6Iq5py4NyFKnJc11Hk25qjVGi2lsJ7xfjya2T4tBqBNP+TGHsX7QOCP3hVK4 aAEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GOHv8wp0; 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 m63si245092pld.343.2017.12.05.07.49.26; Tue, 05 Dec 2017 07:49:26 -0800 (PST) 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=GOHv8wp0; 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 S1753110AbdLEPtZ (ORCPT + 6 others); Tue, 5 Dec 2017 10:49:25 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44706 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816AbdLEPrG (ORCPT ); Tue, 5 Dec 2017 10:47:06 -0500 Received: by mail-wr0-f194.google.com with SMTP id l22so772074wrc.11 for ; Tue, 05 Dec 2017 07:47:05 -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:in-reply-to:references; bh=zE82+lMa7W1gP3c+4riT4gc5BAemK6rhdR0Rq7j3jPA=; b=GOHv8wp0tm2axkaP+Rd0MSqM6TtRzlFEmvcfxJ4UOYnUh7f3RSBIBhd1knrWqhqXY5 CRi3pSM6ka5Bq/jpj0jN/4Gz/ID/R+4YbL/nh2ceW/HkpojTYGxBgJOTwhdVT+MKB+zW k6C9tLPYNQh8RJjbSmds20J+RdJ395AFmGuvI= 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=zE82+lMa7W1gP3c+4riT4gc5BAemK6rhdR0Rq7j3jPA=; b=ZgQqnfjl1o7E/NXybPHS06qMaNBE0C/pQLZWV93OPO8l42KnhBF91Je48fm9rLxOCP EXnYd6kpA+F7yBKRFqRtTTvl7WZi3EOUFCgln53g6LXoUrnV/Q7csEKNfvlkf5FoaQVW 5PW9GDz99cj+JgHdZWfHRRy1YQfj5uiTxi7UGh5/07Eth50Dpmh/838nRDImcz5O+Ob2 eFHh60HLYYLdMCV+XZPjUoUN9yuj8JMJvymK4Kaw79NozDcPlxX/mPisdHbNLFDIjCvp F8QqEtSJYgn9vHVhfeFPmrbIlS/qpJm+INUrkR/8ym0WClTjkFOgFeq669xv1rMcguth KmxA== X-Gm-Message-State: AKGB3mIMMgSgst/skaMOuI4iaZjcZTPxhR7tAYiBck+V+KOFAl1QmH3A EKIEMgNPGgsj/pK6fT4Enwh+bQ== X-Received: by 10.223.177.131 with SMTP id q3mr740017wra.269.1512488825322; Tue, 05 Dec 2017 07:47:05 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id v47sm500946wrc.13.2017.12.05.07.47.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Dec 2017 07:47:04 -0800 (PST) From: Georgi Djakov To: sboyd@codeaurora.org, jassisinghbrar@gmail.com, bjorn.andersson@linaro.org Cc: mturquette@baylibre.com, robh@kernel.org, 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 v11 1/6] mailbox: qcom: Convert APCS IPC driver to use regmap Date: Tue, 5 Dec 2017 17:46:56 +0200 Message-Id: <20171205154701.27730-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171205154701.27730-1-georgi.djakov@linaro.org> References: <20171205154701.27730-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 Acked-by: Bjorn Andersson --- 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++)