From: Baolin Wang <baolin.wang7@gmail.com>
To: lee.jones@linaro.org, arnd@arndb.de
Cc: broonie@kernel.org, baolin.wang7@gmail.com, orsonzhai@gmail.com,
zhang.lyra@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus
Date: Sat, 16 May 2020 18:12:28 +0800 [thread overview]
Message-ID: <db5adf754300bdc89d561ea3fb23afc4b6a3ee87.1589623456.git.baolin.wang7@gmail.com> (raw)
In-Reply-To: <cover.1589623456.git.baolin.wang7@gmail.com>
In-Reply-To: <cover.1589623456.git.baolin.wang7@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2020-05-16 10:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 10:12 [PATCH v4 0/2] Add new physical regmap bus support Baolin Wang
2020-05-16 10:12 ` Baolin Wang [this message]
2020-05-17 0:08 ` [PATCH v4 1/2] mfd: syscon: Support physical regmap bus Orson Zhai
2020-05-17 8:56 ` Baolin Wang
2020-05-19 13:18 ` Arnd Bergmann
2020-05-21 1:08 ` Orson Zhai
2020-05-16 10:12 ` [PATCH v4 2/2] soc: sprd: Add Spreadtrum special bits updating support Baolin Wang
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=db5adf754300bdc89d561ea3fb23afc4b6a3ee87.1589623456.git.baolin.wang7@gmail.com \
--to=baolin.wang7@gmail.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=zhang.lyra@gmail.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).