Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
61fc4131 PZ |
2 | #ifndef _LINUX_RESET_CONTROLLER_H_ |
3 | #define _LINUX_RESET_CONTROLLER_H_ | |
4 | ||
5 | #include <linux/list.h> | |
6 | ||
7 | struct reset_controller_dev; | |
8 | ||
9 | /** | |
10 | * struct reset_control_ops | |
11 | * | |
12 | * @reset: for self-deasserting resets, does all necessary | |
13 | * things to reset the device | |
14 | * @assert: manually assert the reset line, if supported | |
15 | * @deassert: manually deassert the reset line, if supported | |
729de41b | 16 | * @status: return the status of the reset line, if supported |
61fc4131 PZ |
17 | */ |
18 | struct reset_control_ops { | |
19 | int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); | |
20 | int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); | |
21 | int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); | |
729de41b | 22 | int (*status)(struct reset_controller_dev *rcdev, unsigned long id); |
61fc4131 PZ |
23 | }; |
24 | ||
25 | struct module; | |
26 | struct device_node; | |
d0d44dd4 | 27 | struct of_phandle_args; |
61fc4131 PZ |
28 | |
29 | /** | |
30 | * struct reset_controller_dev - reset controller entity that might | |
31 | * provide multiple reset controls | |
32 | * @ops: a pointer to device specific struct reset_control_ops | |
33 | * @owner: kernel module of the reset controller driver | |
34 | * @list: internal list of reset controller devices | |
c15ddec2 | 35 | * @reset_control_head: head of internal list of requested reset controls |
61fc4131 PZ |
36 | * @of_node: corresponding device tree node as phandle target |
37 | * @of_reset_n_cells: number of cells in reset line specifiers | |
38 | * @of_xlate: translation function to translate from specifier as found in the | |
39 | * device tree to id as given to the reset control ops | |
40 | * @nr_resets: number of reset controls in this reset controller device | |
41 | */ | |
42 | struct reset_controller_dev { | |
203d4f34 | 43 | const struct reset_control_ops *ops; |
61fc4131 PZ |
44 | struct module *owner; |
45 | struct list_head list; | |
c15ddec2 | 46 | struct list_head reset_control_head; |
61fc4131 PZ |
47 | struct device_node *of_node; |
48 | int of_reset_n_cells; | |
49 | int (*of_xlate)(struct reset_controller_dev *rcdev, | |
50 | const struct of_phandle_args *reset_spec); | |
51 | unsigned int nr_resets; | |
52 | }; | |
53 | ||
54 | int reset_controller_register(struct reset_controller_dev *rcdev); | |
55 | void reset_controller_unregister(struct reset_controller_dev *rcdev); | |
56 | ||
8d5b5d5c MY |
57 | struct device; |
58 | int devm_reset_controller_register(struct device *dev, | |
59 | struct reset_controller_dev *rcdev); | |
60 | ||
61fc4131 | 61 | #endif |