]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
regmap: add regmap_assign_bits
authorCasey Connolly <casey.connolly@linaro.org>
Wed, 1 Apr 2026 14:15:25 +0000 (16:15 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 21 Apr 2026 17:19:49 +0000 (11:19 -0600)
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@linaro.org>
include/regmap.h

index 8c6f7c1c9b1a6f7ee694ead29a25a8b3e8349915..eeae843bfb74927da6e85235dae6b32cfe7b663f 100644 (file)
@@ -389,6 +389,15 @@ 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
  *