[PATCH RFC 12/40] regmap: add regmap_assign_bits

Casey Connolly casey.connolly at linaro.org
Thu Mar 19 21:56:34 CET 2026


This is a simple wrapper around set/clear bits used by drivers in Linux.
Add it here so it can be used by Qualcomm CCF clk drivers.

Signed-off-by: Casey Connolly <casey.connolly at linaro.org>
---
 include/regmap.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/regmap.h b/include/regmap.h
index 8c6f7c1c9b1a..eeae843bfb74 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -388,8 +388,17 @@ static inline int regmap_clear_bits(struct regmap *map, uint offset, uint bits)
 {
 	return regmap_update_bits(map, offset, bits, 0);
 }
 
+static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
+				     unsigned int bits, bool value)
+{
+	if (value)
+		return regmap_set_bits(map, reg, bits);
+	else
+		return regmap_clear_bits(map, reg, bits);
+}
+
 /**
  * regmap_init_mem() - Set up a new register map that uses memory access
  *
  * @node:	Device node that uses this map

-- 
2.51.0



More information about the U-Boot mailing list