mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: Support paging for buses with reg_read()/reg_write()
@ 2023-03-24 22:58 Mark Brown
  2023-03-27 13:22 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2023-03-24 22:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Brown

We don't currently support paging for regmaps where the I/O happens through
bus provided reg_read() and reg_write() operatons, we simply ignore the
range since nothing is wired up properly. Wire things up.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index d2a54eb0efd9..7960e80edb79 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1941,6 +1941,15 @@ static int _regmap_bus_reg_write(void *context, unsigned int reg,
 				 unsigned int val)
 {
 	struct regmap *map = context;
+	struct regmap_range_node *range;
+	int ret;
+
+	range = _regmap_range_lookup(map, reg);
+	if (range) {
+		ret = _regmap_select_page(map, &reg, range, 1);
+		if (ret != 0)
+			return ret;
+	}
 
 	reg += map->reg_base;
 	reg >>= map->format.reg_downshift;
@@ -2841,6 +2850,15 @@ static int _regmap_bus_reg_read(void *context, unsigned int reg,
 				unsigned int *val)
 {
 	struct regmap *map = context;
+	struct regmap_range_node *range;
+	int ret;
+
+	range = _regmap_range_lookup(map, reg);
+	if (range) {
+		ret = _regmap_select_page(map, &reg, range, 1);
+		if (ret != 0)
+			return ret;
+	}
 
 	reg += map->reg_base;
 	reg >>= map->format.reg_downshift;

---
base-commit: e8d018dd0257f744ca50a729e3d042cf2ec9da65
change-id: 20230324-regmap-reg-read-write-page-b9b05512e8f4

Best regards,
-- 
Mark Brown <broonie@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: Support paging for buses with reg_read()/reg_write()
  2023-03-24 22:58 [PATCH] regmap: Support paging for buses with reg_read()/reg_write() Mark Brown
@ 2023-03-27 13:22 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-03-27 13:22 UTC (permalink / raw)
  To: linux-kernel, Mark Brown

On Fri, 24 Mar 2023 22:58:42 +0000, Mark Brown wrote:
> We don't currently support paging for regmaps where the I/O happens through
> bus provided reg_read() and reg_write() operatons, we simply ignore the
> range since nothing is wired up properly. Wire things up.
> 
> 

Applied to

   broonie/regmap.git for-next

Thanks!

[1/1] regmap: Support paging for buses with reg_read()/reg_write()
      commit: f18ee501e233a2b830a0c84a2e780ab02d946c04

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-27 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 22:58 [PATCH] regmap: Support paging for buses with reg_read()/reg_write() Mark Brown
2023-03-27 13:22 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®