Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __REGMAP_H |
| 8 | #define __REGMAP_H |
| 9 | |
Simon Glass | c05ed00 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 10 | #include <linux/delay.h> |
| 11 | |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 12 | /** |
Mario Six | a6d4b06 | 2018-10-15 09:24:15 +0200 | [diff] [blame] | 13 | * DOC: Overview |
| 14 | * |
| 15 | * Regmaps are an abstraction mechanism that allows device drivers to access |
| 16 | * register maps irrespective of the underlying bus architecture. This entails |
| 17 | * that for devices that support multiple busses (e.g. I2C and SPI for a GPIO |
| 18 | * expander chip) only one driver has to be written. This driver will |
| 19 | * instantiate a regmap with a backend depending on the bus the device is |
| 20 | * attached to, and use the regmap API to access the register map through that |
| 21 | * bus transparently. |
| 22 | * |
| 23 | * Read and write functions are supplied, which can read/write data of |
| 24 | * arbitrary length from/to the regmap. |
| 25 | * |
| 26 | * The endianness of regmap accesses is selectable for each map through device |
| 27 | * tree settings via the boolean "little-endian", "big-endian", and |
| 28 | * "native-endian" properties. |
| 29 | * |
| 30 | * Furthermore, the register map described by a regmap can be split into |
| 31 | * multiple disjoint areas called ranges. In this way, register maps with |
| 32 | * "holes", i.e. areas of addressable memory that are not part of the register |
| 33 | * map, can be accessed in a concise manner. |
| 34 | * |
| 35 | * Currently, only a bare "mem" backend for regmaps is supported, which |
| 36 | * accesses the register map as regular IO-mapped memory. |
| 37 | */ |
| 38 | |
| 39 | /** |
Mario Six | 84ff8f6 | 2018-10-15 09:24:10 +0200 | [diff] [blame] | 40 | * enum regmap_size_t - Access sizes for regmap reads and writes |
| 41 | * |
| 42 | * @REGMAP_SIZE_8: 8-bit read/write access size |
| 43 | * @REGMAP_SIZE_16: 16-bit read/write access size |
| 44 | * @REGMAP_SIZE_32: 32-bit read/write access size |
| 45 | * @REGMAP_SIZE_64: 64-bit read/write access size |
| 46 | */ |
| 47 | enum regmap_size_t { |
| 48 | REGMAP_SIZE_8 = 1, |
| 49 | REGMAP_SIZE_16 = 2, |
| 50 | REGMAP_SIZE_32 = 4, |
| 51 | REGMAP_SIZE_64 = 8, |
| 52 | }; |
| 53 | |
| 54 | /** |
Mario Six | 9b77fe3 | 2018-10-15 09:24:14 +0200 | [diff] [blame] | 55 | * enum regmap_endianness_t - Endianness for regmap reads and writes |
| 56 | * |
| 57 | * @REGMAP_NATIVE_ENDIAN: Native endian read/write accesses |
| 58 | * @REGMAP_LITTLE_ENDIAN: Little endian read/write accesses |
| 59 | * @REGMAP_BIG_ENDIAN: Big endian read/write accesses |
| 60 | */ |
| 61 | enum regmap_endianness_t { |
| 62 | REGMAP_NATIVE_ENDIAN, |
| 63 | REGMAP_LITTLE_ENDIAN, |
| 64 | REGMAP_BIG_ENDIAN, |
| 65 | }; |
| 66 | |
| 67 | /** |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 68 | * struct regmap_range - a register map range |
| 69 | * |
| 70 | * @start: Start address |
| 71 | * @size: Size in bytes |
| 72 | */ |
| 73 | struct regmap_range { |
| 74 | ulong start; |
| 75 | ulong size; |
| 76 | }; |
| 77 | |
Jean-Jacques Hiblot | ffb22f6 | 2020-09-24 10:04:10 +0530 | [diff] [blame] | 78 | struct regmap_bus; |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 79 | |
| 80 | /** |
| 81 | * struct regmap_config - Configure the behaviour of a regmap |
| 82 | * |
| 83 | * @width: Width of the read/write operations. Defaults to |
| 84 | * REGMAP_SIZE_32 if set to 0. |
| 85 | */ |
| 86 | struct regmap_config { |
| 87 | enum regmap_size_t width; |
| 88 | }; |
Jean-Jacques Hiblot | ffb22f6 | 2020-09-24 10:04:10 +0530 | [diff] [blame] | 89 | |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 90 | /** |
| 91 | * struct regmap - a way of accessing hardware/bus registers |
| 92 | * |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 93 | * @width: Width of the read/write operations. Defaults to |
| 94 | * REGMAP_SIZE_32 if set to 0. |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 95 | * @range_count: Number of ranges available within the map |
| 96 | * @ranges: Array of ranges |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 97 | */ |
| 98 | struct regmap { |
Mario Six | 9b77fe3 | 2018-10-15 09:24:14 +0200 | [diff] [blame] | 99 | enum regmap_endianness_t endianness; |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 100 | enum regmap_size_t width; |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 101 | int range_count; |
Masahiro Yamada | 8c1de5e | 2018-04-19 12:14:01 +0900 | [diff] [blame] | 102 | struct regmap_range ranges[0]; |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | /* |
| 106 | * Interface to provide access to registers either through a direct memory |
| 107 | * bus or through a peripheral bus like I2C, SPI. |
| 108 | */ |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 109 | |
| 110 | /** |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 111 | * regmap_write() - Write a value to a regmap |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 112 | * |
| 113 | * @map: Regmap to write to |
| 114 | * @offset: Offset in the regmap to write to |
| 115 | * @val: Data to write to the regmap at the specified offset |
| 116 | * |
| 117 | * Return: 0 if OK, -ve on error |
| 118 | */ |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 119 | int regmap_write(struct regmap *map, uint offset, uint val); |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 120 | |
| 121 | /** |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 122 | * regmap_read() - Read a value from a regmap |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 123 | * |
| 124 | * @map: Regmap to read from |
| 125 | * @offset: Offset in the regmap to read from |
| 126 | * @valp: Pointer to the buffer to receive the data read from the regmap |
| 127 | * at the specified offset |
| 128 | * |
| 129 | * Return: 0 if OK, -ve on error |
| 130 | */ |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 131 | int regmap_read(struct regmap *map, uint offset, uint *valp); |
| 132 | |
Mario Six | 84ff8f6 | 2018-10-15 09:24:10 +0200 | [diff] [blame] | 133 | /** |
| 134 | * regmap_raw_write() - Write a value of specified length to a regmap |
| 135 | * |
| 136 | * @map: Regmap to write to |
| 137 | * @offset: Offset in the regmap to write to |
| 138 | * @val: Value to write to the regmap at the specified offset |
| 139 | * @val_len: Length of the data to be written to the regmap |
| 140 | * |
| 141 | * Note that this function will, as opposed to regmap_write, write data of |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 142 | * arbitrary length to the regmap, and not just the size configured in the |
| 143 | * regmap (defaults to 32-bit) and is thus a generalized version of |
| 144 | * regmap_write. |
Mario Six | 84ff8f6 | 2018-10-15 09:24:10 +0200 | [diff] [blame] | 145 | * |
| 146 | * Return: 0 if OK, -ve on error |
| 147 | */ |
| 148 | int regmap_raw_write(struct regmap *map, uint offset, const void *val, |
| 149 | size_t val_len); |
| 150 | |
| 151 | /** |
| 152 | * regmap_raw_read() - Read a value of specified length from a regmap |
| 153 | * |
| 154 | * @map: Regmap to read from |
| 155 | * @offset: Offset in the regmap to read from |
| 156 | * @valp: Pointer to the buffer to receive the data read from the regmap |
| 157 | * at the specified offset |
| 158 | * @val_len: Length of the data to be read from the regmap |
| 159 | * |
| 160 | * Note that this function will, as opposed to regmap_read, read data of |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 161 | * arbitrary length from the regmap, and not just the size configured in the |
| 162 | * regmap (defaults to 32-bit) and is thus a generalized version of |
| 163 | * regmap_read. |
Mario Six | 84ff8f6 | 2018-10-15 09:24:10 +0200 | [diff] [blame] | 164 | * |
| 165 | * Return: 0 if OK, -ve on error |
| 166 | */ |
| 167 | int regmap_raw_read(struct regmap *map, uint offset, void *valp, |
| 168 | size_t val_len); |
| 169 | |
Mario Six | d5c7bd9 | 2018-10-15 09:24:11 +0200 | [diff] [blame] | 170 | /** |
| 171 | * regmap_raw_write_range() - Write a value of specified length to a range of a |
| 172 | * regmap |
| 173 | * |
| 174 | * @map: Regmap to write to |
| 175 | * @range_num: Number of the range in the regmap to write to |
| 176 | * @offset: Offset in the regmap to write to |
| 177 | * @val: Value to write to the regmap at the specified offset |
| 178 | * @val_len: Length of the data to be written to the regmap |
| 179 | * |
| 180 | * Return: 0 if OK, -ve on error |
| 181 | */ |
| 182 | int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset, |
| 183 | const void *val, size_t val_len); |
| 184 | |
| 185 | /** |
| 186 | * regmap_raw_read_range() - Read a value of specified length from a range of a |
| 187 | * regmap |
| 188 | * |
| 189 | * @map: Regmap to read from |
| 190 | * @range_num: Number of the range in the regmap to write to |
| 191 | * @offset: Offset in the regmap to read from |
| 192 | * @valp: Pointer to the buffer to receive the data read from the regmap |
| 193 | * at the specified offset |
| 194 | * @val_len: Length of the data to be read from the regmap |
| 195 | * |
| 196 | * Return: 0 if OK, -ve on error |
| 197 | */ |
| 198 | int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset, |
| 199 | void *valp, size_t val_len); |
| 200 | |
Mario Six | e936397 | 2018-10-15 09:24:12 +0200 | [diff] [blame] | 201 | /** |
| 202 | * regmap_range_set() - Set a value in a regmap range described by a struct |
| 203 | * @map: Regmap in which a value should be set |
| 204 | * @range: Range of the regmap in which a value should be set |
| 205 | * @type: Structure type that describes the memory layout of the regmap range |
| 206 | * @member: Member of the describing structure that should be set in the regmap |
| 207 | * range |
| 208 | * @val: Value which should be written to the regmap range |
| 209 | */ |
| 210 | #define regmap_range_set(map, range, type, member, val) \ |
| 211 | do { \ |
| 212 | typeof(((type *)0)->member) __tmp = val; \ |
| 213 | regmap_raw_write_range(map, range, offsetof(type, member), \ |
| 214 | &__tmp, sizeof(((type *)0)->member)); \ |
| 215 | } while (0) |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 216 | |
Mario Six | e936397 | 2018-10-15 09:24:12 +0200 | [diff] [blame] | 217 | /** |
| 218 | * regmap_set() - Set a value in a regmap described by a struct |
| 219 | * @map: Regmap in which a value should be set |
| 220 | * @type: Structure type that describes the memory layout of the regmap |
| 221 | * @member: Member of the describing structure that should be set in the regmap |
| 222 | * @val: Value which should be written to the regmap |
| 223 | */ |
| 224 | #define regmap_set(map, type, member, val) \ |
| 225 | regmap_range_set(map, 0, type, member, val) |
| 226 | |
| 227 | /** |
| 228 | * regmap_range_get() - Get a value from a regmap range described by a struct |
| 229 | * @map: Regmap from which a value should be read |
| 230 | * @range: Range of the regmap from which a value should be read |
| 231 | * @type: Structure type that describes the memory layout of the regmap |
| 232 | * range |
| 233 | * @member: Member of the describing structure that should be read in the |
| 234 | * regmap range |
| 235 | * @valp: Variable that receives the value read from the regmap range |
| 236 | */ |
| 237 | #define regmap_range_get(map, range, type, member, valp) \ |
| 238 | regmap_raw_read_range(map, range, offsetof(type, member), \ |
| 239 | (void *)valp, sizeof(((type *)0)->member)) |
| 240 | |
| 241 | /** |
| 242 | * regmap_get() - Get a value from a regmap described by a struct |
| 243 | * @map: Regmap from which a value should be read |
| 244 | * @type: Structure type that describes the memory layout of the regmap |
| 245 | * range |
| 246 | * @member: Member of the describing structure that should be read in the |
| 247 | * regmap |
| 248 | * @valp: Variable that receives the value read from the regmap |
| 249 | */ |
| 250 | #define regmap_get(map, type, member, valp) \ |
| 251 | regmap_range_get(map, 0, type, member, valp) |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 252 | |
| 253 | /** |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 254 | * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs |
| 255 | * |
| 256 | * @map: Regmap to read from |
| 257 | * @addr: Offset to poll |
| 258 | * @val: Unsigned integer variable to read the value into |
| 259 | * @cond: Break condition (usually involving @val) |
| 260 | * @sleep_us: Maximum time to sleep between reads in us (0 tight-loops). |
| 261 | * @timeout_ms: Timeout in ms, 0 means never timeout |
Simon Glass | df9cf1c | 2018-12-09 17:11:10 -0700 | [diff] [blame] | 262 | * @test_add_time: Used for sandbox testing - amount of time to add after |
| 263 | * starting the loop (0 if not testing) |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 264 | * |
| 265 | * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read |
| 266 | * error return value in case of a error read. In the two former cases, |
| 267 | * the last read value at @addr is stored in @val. Must not be called |
| 268 | * from atomic context if sleep_us or timeout_us are used. |
| 269 | * |
| 270 | * This is modelled after the regmap_read_poll_timeout macros in linux but |
| 271 | * with millisecond timeout. |
Simon Glass | df9cf1c | 2018-12-09 17:11:10 -0700 | [diff] [blame] | 272 | * |
| 273 | * The _test version is for sandbox testing only. Do not use this in normal |
| 274 | * code as it advances the timer. |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 275 | */ |
Simon Glass | df9cf1c | 2018-12-09 17:11:10 -0700 | [diff] [blame] | 276 | #define regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \ |
| 277 | timeout_ms, test_add_time) \ |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 278 | ({ \ |
| 279 | unsigned long __start = get_timer(0); \ |
| 280 | int __ret; \ |
| 281 | for (;;) { \ |
| 282 | __ret = regmap_read((map), (addr), &(val)); \ |
| 283 | if (__ret) \ |
| 284 | break; \ |
| 285 | if (cond) \ |
| 286 | break; \ |
Simon Glass | df9cf1c | 2018-12-09 17:11:10 -0700 | [diff] [blame] | 287 | if (IS_ENABLED(CONFIG_SANDBOX) && test_add_time) \ |
Neil Armstrong | d0a9b82 | 2019-04-11 17:01:23 +0200 | [diff] [blame] | 288 | timer_test_add_offset(test_add_time); \ |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 289 | if ((timeout_ms) && get_timer(__start) > (timeout_ms)) { \ |
| 290 | __ret = regmap_read((map), (addr), &(val)); \ |
| 291 | break; \ |
| 292 | } \ |
| 293 | if ((sleep_us)) \ |
| 294 | udelay((sleep_us)); \ |
| 295 | } \ |
| 296 | __ret ?: ((cond) ? 0 : -ETIMEDOUT); \ |
| 297 | }) |
| 298 | |
Simon Glass | df9cf1c | 2018-12-09 17:11:10 -0700 | [diff] [blame] | 299 | #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_ms) \ |
| 300 | regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \ |
| 301 | timeout_ms, 0) \ |
| 302 | |
Neil Armstrong | d13801e | 2018-11-22 11:01:03 +0100 | [diff] [blame] | 303 | /** |
Neil Armstrong | 285cbcf | 2018-04-27 11:56:14 +0200 | [diff] [blame] | 304 | * regmap_update_bits() - Perform a read/modify/write using a mask |
| 305 | * |
| 306 | * @map: The map returned by regmap_init_mem*() |
| 307 | * @offset: Offset of the memory |
| 308 | * @mask: Mask to apply to the read value |
Simon Glass | 5ca5ec1 | 2019-10-11 16:16:49 -0600 | [diff] [blame] | 309 | * @val: Value to OR with the read value after masking. Note that any |
| 310 | * bits set in @val which are not set in @mask are ignored |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 311 | * Return: 0 if OK, -ve on error |
Neil Armstrong | 285cbcf | 2018-04-27 11:56:14 +0200 | [diff] [blame] | 312 | */ |
| 313 | int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val); |
| 314 | |
| 315 | /** |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 316 | * regmap_init_mem() - Set up a new register map that uses memory access |
| 317 | * |
Masahiro Yamada | d358123 | 2018-04-19 12:14:03 +0900 | [diff] [blame] | 318 | * @node: Device node that uses this map |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 319 | * @mapp: Returns allocated map |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 320 | * Return: 0 if OK, -ve on error |
| 321 | * |
| 322 | * Use regmap_uninit() to free it. |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 323 | */ |
Masahiro Yamada | d358123 | 2018-04-19 12:14:03 +0900 | [diff] [blame] | 324 | int regmap_init_mem(ofnode node, struct regmap **mapp); |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 325 | |
Simon Glass | 1e6ca1a | 2016-07-04 11:58:22 -0600 | [diff] [blame] | 326 | /** |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 327 | * regmap_init_mem_platdata() - Set up a new memory register map for |
| 328 | * of-platdata |
| 329 | * |
| 330 | * @dev: Device that uses this map |
| 331 | * @reg: List of address, size pairs |
| 332 | * @count: Number of pairs (e.g. 1 if the regmap has a single entry) |
| 333 | * @mapp: Returns allocated map |
| 334 | * Return: 0 if OK, -ve on error |
Simon Glass | 1e6ca1a | 2016-07-04 11:58:22 -0600 | [diff] [blame] | 335 | * |
| 336 | * This creates a new regmap with a list of regions passed in, rather than |
| 337 | * using the device tree. It only supports 32-bit machines. |
| 338 | * |
| 339 | * Use regmap_uninit() to free it. |
| 340 | * |
Simon Glass | 1e6ca1a | 2016-07-04 11:58:22 -0600 | [diff] [blame] | 341 | */ |
Simon Glass | c20ee0e | 2017-08-29 14:15:50 -0600 | [diff] [blame] | 342 | int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count, |
Simon Glass | 3b2a29e | 2016-07-04 11:57:59 -0600 | [diff] [blame] | 343 | struct regmap **mapp); |
| 344 | |
Faiz Abbas | 55a1a09 | 2019-06-11 00:43:33 +0530 | [diff] [blame] | 345 | int regmap_init_mem_index(ofnode node, struct regmap **mapp, int index); |
| 346 | |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 347 | /** |
Jean-Jacques Hiblot | ffb22f6 | 2020-09-24 10:04:10 +0530 | [diff] [blame] | 348 | * devm_regmap_init() - Initialise register map (device managed) |
| 349 | * |
| 350 | * @dev: Device that will be interacted with |
| 351 | * @bus: Bus-specific callbacks to use with device (IGNORED) |
| 352 | * @bus_context: Data passed to bus-specific callbacks (IGNORED) |
Pratyush Yadav | 78aaedb | 2020-09-24 10:04:12 +0530 | [diff] [blame^] | 353 | * @config: Configuration for register map |
Jean-Jacques Hiblot | ffb22f6 | 2020-09-24 10:04:10 +0530 | [diff] [blame] | 354 | * |
| 355 | * @Return a valid pointer to a struct regmap or a ERR_PTR() on error. |
| 356 | * The structure is automatically freed when the device is unbound |
| 357 | */ |
| 358 | struct regmap *devm_regmap_init(struct udevice *dev, |
| 359 | const struct regmap_bus *bus, |
| 360 | void *bus_context, |
| 361 | const struct regmap_config *config); |
| 362 | /** |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 363 | * regmap_get_range() - Obtain the base memory address of a regmap range |
| 364 | * |
| 365 | * @map: Regmap to query |
| 366 | * @range_num: Range to look up |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 367 | * Return: Pointer to the range in question if OK, NULL on error |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 368 | */ |
| 369 | void *regmap_get_range(struct regmap *map, unsigned int range_num); |
| 370 | |
| 371 | /** |
| 372 | * regmap_uninit() - free a previously inited regmap |
Mario Six | 604b669 | 2018-10-04 09:00:41 +0200 | [diff] [blame] | 373 | * |
| 374 | * @map: Regmap to free |
| 375 | * Return: 0 if OK, -ve on error |
Simon Glass | 6f98b75 | 2015-06-23 15:38:42 -0600 | [diff] [blame] | 376 | */ |
| 377 | int regmap_uninit(struct regmap *map); |
| 378 | |
| 379 | #endif |