lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 16 May 2020 18:12:28 +0800
From:   Baolin Wang <baolin.wang7@...il.com>
To:     lee.jones@...aro.org, arnd@...db.de
Cc:     broonie@...nel.org, baolin.wang7@...il.com, orsonzhai@...il.com,
        zhang.lyra@...il.com, linux-kernel@...r.kernel.org
Subject: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus

Some platforms such as Spreadtrum platform, define a special method to
update bits of the registers instead of reading and writing, which means
we should use a physical regmap bus to define the reg_update_bits()
operation instead of the MMIO regmap bus.

Thus add a a __weak function  for the syscon driver to allow to register
a physical regmap bus to support this new requirement.

Signed-off-by: Baolin Wang <baolin.wang7@...il.com>
---
 drivers/mfd/syscon.c       |  9 ++++++++-
 include/linux/mfd/syscon.h | 11 +++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 3a97816d0cba..dc92f3177ceb 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -40,6 +40,13 @@ static const struct regmap_config syscon_regmap_config = {
 	.reg_stride = 4,
 };
 
+struct regmap * __weak syscon_regmap_init(struct device_node *np,
+					  void __iomem *base,
+					  struct regmap_config *syscon_config)
+{
+	return regmap_init_mmio(NULL, base, syscon_config);
+}
+
 static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
 {
 	struct clk *clk;
@@ -106,7 +113,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
 	syscon_config.val_bits = reg_io_width * 8;
 	syscon_config.max_register = resource_size(&res) - reg_io_width;
 
-	regmap = regmap_init_mmio(NULL, base, &syscon_config);
+	regmap = syscon_regmap_init(np, base, &syscon_config);
 	if (IS_ERR(regmap)) {
 		pr_err("regmap init failed\n");
 		ret = PTR_ERR(regmap);
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index 7f20e9b502a5..85088e44fe7c 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -13,6 +13,7 @@
 
 #include <linux/err.h>
 #include <linux/errno.h>
+#include <linux/regmap.h>
 
 struct device_node;
 
@@ -28,6 +29,9 @@ extern struct regmap *syscon_regmap_lookup_by_phandle_args(
 					const char *property,
 					int arg_count,
 					unsigned int *out_args);
+extern struct regmap *syscon_regmap_init(struct device_node *np,
+					 void __iomem *base,
+					 struct regmap_config *syscon_config);
 #else
 static inline struct regmap *device_node_to_regmap(struct device_node *np)
 {
@@ -59,6 +63,13 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_args(
 {
 	return ERR_PTR(-ENOTSUPP);
 }
+
+static inline struct regmap *syscon_regmap_init(struct device_node *np,
+						void __iomem *base,
+						struct regmap_config *syscon_config)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
 #endif
 
 #endif /* __LINUX_MFD_SYSCON_H__ */
-- 
2.17.1

Powered by blists - more mailing lists