regmap: add regmap_update_bits() helper
Add the regmap_update_bits() to simply the read/modify/write of registers
in a single command. The function is taken from Linux regmap
implementation.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/include/regmap.h b/include/regmap.h
index e96c79d..6a574ea 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -43,6 +43,16 @@
regmap_read(map, (uint32_t *)(ptr)->member - (uint32_t *)(ptr), valp)
/**
+ * regmap_update_bits() - Perform a read/modify/write using a mask
+ *
+ * @map: The map returned by regmap_init_mem*()
+ * @offset: Offset of the memory
+ * @mask: Mask to apply to the read value
+ * @val: Value to apply to the value to write
+ */
+int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val);
+
+/**
* regmap_init_mem() - Set up a new register map that uses memory access
*
* Use regmap_uninit() to free it.