mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 4/6] mfd: syscon: use regmap-mmio as backend
Date: Tue, 18 Feb 2020 15:23:03 +0100	[thread overview]
Message-ID: <20200218142305.26992-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200218142305.26992-1-a.fatoum@pengutronix.de>

Linux supports a clocks property in syscon nodes to indicate that access
should only occur with the clock active. The new regmap-mmio supports
this, thus port syscon over, so it can make use of it in a later commit.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mfd/syscon.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 809941937857..adc263c6e6da 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -31,27 +31,6 @@ struct syscon {
 	struct regmap *regmap;
 };
 
-static int syscon_reg_write(void *context, unsigned int reg,
-			    unsigned int val)
-{
-	struct syscon *syscon = context;
-	writel(val, syscon->base + reg);
-	return 0;
-}
-
-static int syscon_reg_read(void *context, unsigned int reg,
-			   unsigned int *val)
-{
-	struct syscon *syscon = context;
-	*val = readl(syscon->base + reg);
-	return 0;
-}
-
-static const struct regmap_bus syscon_regmap_bus = {
-	.reg_write = syscon_reg_write,
-	.reg_read  = syscon_reg_read,
-};
-
 static const struct regmap_config syscon_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
@@ -79,10 +58,8 @@ static struct syscon *of_syscon_register(struct device_node *np)
 
 	list_add_tail(&syscon->list, &syscon_list);
 
-	syscon->regmap = regmap_init(NULL,
-				     &syscon_regmap_bus,
-				     syscon,
-				     &syscon_regmap_config);
+	syscon->regmap = of_regmap_init_mmio_clk(np, NULL, syscon->base,
+					     &syscon_regmap_config);
 	return syscon;
 
 err_map:
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-02-18 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 14:22 [PATCH 0/6] ARM: stm32mp: fix Ethernet after dts/ update Ahmad Fatoum
2020-02-18 14:23 ` [PATCH 1/6] ARM: dts: stm32mp: align barebox dtsi name with upstream Ahmad Fatoum
2020-02-18 14:23 ` [PATCH 2/6] regmap: make internal.h a self-contained header Ahmad Fatoum
2020-02-18 14:23 ` [PATCH 3/6] regmap: add support for regmap_init_mmio_clk Ahmad Fatoum
2020-02-18 14:23 ` Ahmad Fatoum [this message]
2020-02-18 14:23 ` [PATCH 5/6] mfd: syscon: clock peripheral if specified in device tree Ahmad Fatoum
2020-02-18 14:23 ` [PATCH 6/6] net: designware: eqos: stm32: drop no longer needed syscfg-clk Ahmad Fatoum
2020-02-19  8:03 ` [PATCH 0/6] ARM: stm32mp: fix Ethernet after dts/ update Sascha Hauer

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=20200218142305.26992-5-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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