Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_RESET_CONTROLLER_H_ |
| 2 | #define _LINUX_RESET_CONTROLLER_H_ |
| 3 | |
| 4 | #include <linux/list.h> |
| 5 | |
| 6 | struct reset_controller_dev; |
| 7 | |
| 8 | /** |
| 9 | * struct reset_control_ops |
| 10 | * |
| 11 | * @reset: for self-deasserting resets, does all necessary |
| 12 | * things to reset the device |
| 13 | * @assert: manually assert the reset line, if supported |
| 14 | * @deassert: manually deassert the reset line, if supported |
| 15 | */ |
| 16 | struct reset_control_ops { |
| 17 | int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); |
| 18 | int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); |
| 19 | int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); |
| 20 | }; |
| 21 | |
| 22 | struct module; |
| 23 | struct device_node; |
Stephen Boyd | d0d44dd | 2014-01-15 10:47:21 -0800 | [diff] [blame] | 24 | struct of_phandle_args; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * struct reset_controller_dev - reset controller entity that might |
| 28 | * provide multiple reset controls |
| 29 | * @ops: a pointer to device specific struct reset_control_ops |
| 30 | * @owner: kernel module of the reset controller driver |
| 31 | * @list: internal list of reset controller devices |
| 32 | * @of_node: corresponding device tree node as phandle target |
| 33 | * @of_reset_n_cells: number of cells in reset line specifiers |
| 34 | * @of_xlate: translation function to translate from specifier as found in the |
| 35 | * device tree to id as given to the reset control ops |
| 36 | * @nr_resets: number of reset controls in this reset controller device |
| 37 | */ |
| 38 | struct reset_controller_dev { |
| 39 | struct reset_control_ops *ops; |
| 40 | struct module *owner; |
| 41 | struct list_head list; |
| 42 | struct device_node *of_node; |
| 43 | int of_reset_n_cells; |
| 44 | int (*of_xlate)(struct reset_controller_dev *rcdev, |
| 45 | const struct of_phandle_args *reset_spec); |
| 46 | unsigned int nr_resets; |
| 47 | }; |
| 48 | |
| 49 | int reset_controller_register(struct reset_controller_dev *rcdev); |
| 50 | void reset_controller_unregister(struct reset_controller_dev *rcdev); |
| 51 | |
| 52 | #endif |