From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Lee Jones <lee.jones@linaro.org>, Samuel Ortiz <sameo@linux.intel.com>
Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] mfd: syscon: Make it possible to mark syscon as read only
Date: Thu, 19 Jun 2014 13:43:46 -0700 [thread overview]
Message-ID: <1403210626-4845-1-git-send-email-bjorn.andersson@sonymobile.com> (raw)
Make it possible to mark syscon as read only, so that it can be used to
expose pieces of hardware that is read only.
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
Documentation/devicetree/bindings/mfd/syscon.txt | 3 +++
drivers/mfd/syscon.c | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt
index fe8150b..163325af0 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.txt
+++ b/Documentation/devicetree/bindings/mfd/syscon.txt
@@ -13,6 +13,9 @@ Required properties:
- compatible: Should contain "syscon".
- reg: the register region can be accessed from syscon
+Optional properties:
+- read-only: the register region is read only
+
Examples:
gpr: iomuxc-gpr@020e0000 {
compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index ca15878..902579d 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -110,6 +110,11 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
}
EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_phandle);
+static bool syscon_readonly_writable(struct device *dev, unsigned int reg)
+{
+ return false;
+}
+
static const struct of_device_id of_syscon_match[] = {
{ .compatible = "syscon", },
{ },
@@ -141,6 +146,11 @@ static int syscon_probe(struct platform_device *pdev)
if (!base)
return -ENOMEM;
+ if (of_property_read_bool(dev->of_node, "read-only"))
+ syscon_regmap_config.writeable_reg = syscon_readonly_writable;
+ else
+ syscon_regmap_config.writeable_reg = NULL;
+
syscon_regmap_config.max_register = res->end - res->start - 3;
if (pdata)
syscon_regmap_config.name = pdata->label;
--
1.8.2.2
next reply other threads:[~2014-06-19 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-19 20:43 Bjorn Andersson [this message]
2014-06-20 12:17 ` [PATCH] mfd: syscon: Make it possible to mark syscon as read only Arnd Bergmann
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=1403210626-4845-1-git-send-email-bjorn.andersson@sonymobile.com \
--to=bjorn.andersson@sonymobile.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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).