summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2015-01-26 07:30:25 +0000
committerAndrey Konovalov <andrey.konovalov@linaro.org>2015-02-16 14:36:17 +0300
commitcd5bc0162d06be5efbbaf00dec44cf509659b071 (patch)
treeaf7c4fa76ab55618b101e3788152bc8ca43721bd
parent17c271fd7e1a3587b7a6d6b77395fdee1627f089 (diff)
downloadlinux-linaro-tracking-cd5bc0162d06be5efbbaf00dec44cf509659b071.tar.gz
WIP: mfd: syscon: Add register stride to DT bindings.
This patch adds register stride to dt bindings so that the consumers of the syscon could change it to there need. One of the the use case for this feature is Qualcomm qfprom which needs a byte access to regmap returned from syscon. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/mfd/syscon.txt3
-rw-r--r--drivers/mfd/syscon.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt
index fe8150bb3248..7f06ec1ff591 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:
+- stride : register address stride in bytes.
+
Examples:
gpr: iomuxc-gpr@020e0000 {
compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 176bf0fa2685..98769d554f1c 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -48,6 +48,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
struct regmap *regmap;
void __iomem *base;
int ret;
+ u32 stride;
struct regmap_config syscon_config = syscon_regmap_config;
if (!of_device_is_compatible(np, "syscon"))
@@ -69,6 +70,14 @@ static struct syscon *of_syscon_register(struct device_node *np)
else if (of_property_read_bool(np, "little-endian"))
syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE;
+ if (!of_property_read_u32(np, "stride", &stride)) {
+ if (stride > 4)
+ stride = 4;
+
+ syscon_config.reg_stride = stride;
+ syscon_config.val_bits = 8 * stride;
+ }
+
regmap = regmap_init_mmio(NULL, base, &syscon_config);
if (IS_ERR(regmap)) {
pr_err("regmap init failed\n");