/src/barebox/drivers/base/regmap/internal.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | #ifndef REGMAP_INTERNAL_H_ |
3 | | #define REGMAP_INTERNAL_H_ |
4 | | |
5 | | #include <linux/list.h> |
6 | | #include <driver.h> |
7 | | |
8 | | struct regmap_bus; |
9 | | |
10 | | struct regmap_format { |
11 | | size_t buf_size; |
12 | | size_t reg_bytes; |
13 | | size_t pad_bytes; |
14 | | size_t val_bytes; |
15 | | void (*format_write)(struct regmap *map, |
16 | | unsigned int reg, unsigned int val); |
17 | | void (*format_reg)(void *buf, unsigned int reg, unsigned int shift); |
18 | | void (*format_val)(void *buf, unsigned int val, unsigned int shift); |
19 | | unsigned int (*parse_val)(const void *buf); |
20 | | }; |
21 | | |
22 | | struct regmap { |
23 | | struct device *dev; |
24 | | const struct regmap_bus *bus; |
25 | | const char *name; |
26 | | void *bus_context; |
27 | | struct list_head list; |
28 | | int reg_stride; |
29 | | void *work_buf; /* Scratch buffer used to format I/O */ |
30 | | struct regmap_format format; |
31 | | unsigned int read_flag_mask; |
32 | | unsigned int write_flag_mask; |
33 | | int reg_shift; |
34 | | unsigned int max_register; |
35 | | |
36 | | struct cdev cdev; |
37 | | |
38 | | int (*reg_read)(void *context, unsigned int reg, |
39 | | unsigned int *val); |
40 | | int (*reg_write)(void *context, unsigned int reg, |
41 | | unsigned int val); |
42 | | int (*reg_seal)(void *context, unsigned int reg, |
43 | | unsigned int flags); |
44 | | }; |
45 | | |
46 | | struct regmap_field { |
47 | | struct regmap *regmap; |
48 | | unsigned int mask; |
49 | | /* lsb */ |
50 | | unsigned int shift; |
51 | | unsigned int reg; |
52 | | |
53 | | unsigned int id_size; |
54 | | unsigned int id_offset; |
55 | | }; |
56 | | |
57 | | enum regmap_endian regmap_get_val_endian(struct device *dev, |
58 | | const struct regmap_bus *bus, |
59 | | const struct regmap_config *config); |
60 | | |
61 | | #ifdef CONFIG_REGMAP_FORMATTED |
62 | | int regmap_formatted_init(struct regmap *map, const struct regmap_config *); |
63 | | #else |
64 | | static inline int regmap_formatted_init(struct regmap *map, const struct regmap_config *cfg) |
65 | 0 | { |
66 | 0 | return -ENOSYS; |
67 | 0 | } Unexecuted instantiation: regmap.c:regmap_formatted_init Unexecuted instantiation: regmap-multi.c:regmap_formatted_init Unexecuted instantiation: regmap-mmio.c:regmap_formatted_init |
68 | | #endif |
69 | | |
70 | | #endif |