aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r--include/linux/regmap.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 56af22ec9aba..5f69d4ad3eb1 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -14,12 +14,14 @@
14 */ 14 */
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h>
17 18
18struct module; 19struct module;
19struct device; 20struct device;
20struct i2c_client; 21struct i2c_client;
21struct spi_device; 22struct spi_device;
22struct regmap; 23struct regmap;
24struct regmap_range_cfg;
23 25
24/* An enum of all the supported cache types */ 26/* An enum of all the supported cache types */
25enum regcache_type { 27enum regcache_type {
@@ -84,6 +86,9 @@ struct reg_default {
84 * @reg_defaults_raw: Power on reset values for registers (for use with 86 * @reg_defaults_raw: Power on reset values for registers (for use with
85 * register cache support). 87 * register cache support).
86 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. 88 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
89 *
90 * @ranges: Array of configuration entries for virtual address ranges.
91 * @num_ranges: Number of range configuration entries.
87 */ 92 */
88struct regmap_config { 93struct regmap_config {
89 const char *name; 94 const char *name;
@@ -109,6 +114,40 @@ struct regmap_config {
109 u8 write_flag_mask; 114 u8 write_flag_mask;
110 115
111 bool use_single_rw; 116 bool use_single_rw;
117
118 const struct regmap_range_cfg *ranges;
119 unsigned int n_ranges;
120};
121
122/**
123 * Configuration for indirectly accessed or paged registers.
124 * Registers, mapped to this virtual range, are accessed in two steps:
125 * 1. page selector register update;
126 * 2. access through data window registers.
127 *
128 * @range_min: Address of the lowest register address in virtual range.
129 * @range_max: Address of the highest register in virtual range.
130 *
131 * @page_sel_reg: Register with selector field.
132 * @page_sel_mask: Bit shift for selector value.
133 * @page_sel_shift: Bit mask for selector value.
134 *
135 * @window_start: Address of first (lowest) register in data window.
136 * @window_len: Number of registers in data window.
137 */
138struct regmap_range_cfg {
139 /* Registers of virtual address range */
140 unsigned int range_min;
141 unsigned int range_max;
142
143 /* Page selector for indirect addressing */
144 unsigned int selector_reg;
145 unsigned int selector_mask;
146 int selector_shift;
147
148 /* Data window (per each page) */
149 unsigned int window_start;
150 unsigned int window_len;
112}; 151};
113 152
114typedef int (*regmap_hw_write)(void *context, const void *data, 153typedef int (*regmap_hw_write)(void *context, const void *data,