summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-04-13 09:51:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-04-15 11:20:56 +0200
commite7048cdc6a46a8b824438a941a74d83a9a5fa3cf (patch)
tree44dc17dd1003e23108fe408eebd81319918ecda6 /drivers/mfd
parenta2d50d5cf7c301156d1345bcef76a517ec7ba40d (diff)
downloadbarebox-e7048cdc6a46a8b824438a941a74d83a9a5fa3cf.tar.gz
barebox-e7048cdc6a46a8b824438a941a74d83a9a5fa3cf.tar.xz
mfd: syscon: implement device_node_to_regmap
Extend our syscon API with a device_node_to_regmap function that has the same semantics as upstream: __________________________________________________________________________ | Linux commit 39233b7c611248c0d05209b4854bc63e26485655 | CommitDate: Thu Aug 8 15:30:07 2019 -0700 | | mfd/syscon: Add device_node_to_regmap() | | device_node_to_regmap() is exactly like syscon_node_to_regmap(), but it | does not check that the node is compatible with "syscon", and won't | attach the first clock it finds to the regmap. | | The rationale behind this, is that one device node with a standard | compatible string "foo,bar" can be covered by multiple drivers sharing a | regmap, or by a single driver doing all the job without a regmap, but | these are implementation details which shouldn't reflect on the | devicetree. | | Signed-off-by: Paul Cercueil <paul@crapouillou.net> | Acked-by: Arnd Bergmann <arnd@arndb.de> | Signed-off-by: Paul Burton <paul.burton@mips.com> |__________________________________________________________________________ Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/syscon.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index a8bb297bd2..38b25858ed 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -154,20 +154,31 @@ void __iomem *syscon_base_lookup_by_phandle(struct device_node *np,
return syscon_node_to_base(syscon_np);
}
-struct regmap *syscon_node_to_regmap(struct device_node *np)
+static struct regmap *__device_node_to_regmap(struct device_node *np,
+ bool check_clk)
{
struct syscon *syscon;
- if (!of_device_is_compatible(np, "syscon"))
- return ERR_PTR(-EINVAL);
-
- syscon = node_to_syscon(np, true);
+ syscon = node_to_syscon(np, check_clk);
if (IS_ERR(syscon))
return ERR_CAST(syscon);
return syscon->regmap;
}
+struct regmap *device_node_to_regmap(struct device_node *np)
+{
+ return __device_node_to_regmap(np, false);
+}
+
+struct regmap *syscon_node_to_regmap(struct device_node *np)
+{
+ if (!of_device_is_compatible(np, "syscon"))
+ return ERR_PTR(-EINVAL);
+
+ return __device_node_to_regmap(np, true);
+}
+
struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
{
struct device_node *syscon_np;