[PATCH 01/11] regmap: add support for bulk 64-bit reads and writes

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Oct 20 00:18:43 PDT 2023


The Linux implementation of regmap_bulk_read and regmap_bulk_write
supports 64-bit accesses. Have the barebox implementation follow suit.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/base/regmap/regmap.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index da20dc05828d..191217d20144 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -269,6 +269,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 		return -EINVAL;
 
 	for (i = 0; i < val_count; i++) {
+
+#ifdef CONFIG_64BIT
+		u64 *u64 = val;
+#endif
 		u32 *u32 = val;
 		u16 *u16 = val;
 		u8 *u8 = val;
@@ -278,6 +282,11 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
 			goto out;
 
 		switch (map->format.val_bytes) {
+#ifdef CONFIG_64BIT
+		case 8:
+			u64[i] = v;
+			break;
+#endif
 		case 4:
 			u32[i] = v;
 			break;
@@ -335,6 +344,11 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg,
 		case 4:
 			ival = *(u32 *)(val + (i * val_bytes));
 			break;
+#ifdef CONFIG_64BIT
+		case 8:
+			ival = *(u64 *)(val + (i * val_bytes));
+			break;
+#endif
 		default:
 			ret = -EINVAL;
 			goto out;
-- 
2.39.2




More information about the barebox mailing list