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 |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 15 | * @status: return the status of the reset line, if supported |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 16 | */ |
| 17 | struct reset_control_ops { |
| 18 | int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); |
| 19 | int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); |
| 20 | int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 21 | int (*status)(struct reset_controller_dev *rcdev, unsigned long id); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | struct module; |
| 25 | struct device_node; |
Stephen Boyd | d0d44dd | 2014-01-15 10:47:21 -0800 | [diff] [blame] | 26 | struct of_phandle_args; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * struct reset_controller_dev - reset controller entity that might |
| 30 | * provide multiple reset controls |
| 31 | * @ops: a pointer to device specific struct reset_control_ops |
| 32 | * @owner: kernel module of the reset controller driver |
| 33 | * @list: internal list of reset controller devices |
Hans de Goede | c15ddec | 2016-02-23 18:46:25 +0100 | [diff] [blame] | 34 | * @reset_control_head: head of internal list of requested reset controls |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 35 | * @of_node: corresponding device tree node as phandle target |
| 36 | * @of_reset_n_cells: number of cells in reset line specifiers |
| 37 | * @of_xlate: translation function to translate from specifier as found in the |
| 38 | * device tree to id as given to the reset control ops |
| 39 | * @nr_resets: number of reset controls in this reset controller device |
| 40 | */ |
| 41 | struct reset_controller_dev { |
Maxime Ripard | 203d4f3 | 2016-01-14 16:24:45 +0100 | [diff] [blame] | 42 | const struct reset_control_ops *ops; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 43 | struct module *owner; |
| 44 | struct list_head list; |
Hans de Goede | c15ddec | 2016-02-23 18:46:25 +0100 | [diff] [blame] | 45 | struct list_head reset_control_head; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 46 | struct device_node *of_node; |
| 47 | int of_reset_n_cells; |
| 48 | int (*of_xlate)(struct reset_controller_dev *rcdev, |
| 49 | const struct of_phandle_args *reset_spec); |
| 50 | unsigned int nr_resets; |
| 51 | }; |
| 52 | |
| 53 | int reset_controller_register(struct reset_controller_dev *rcdev); |
| 54 | void reset_controller_unregister(struct reset_controller_dev *rcdev); |
| 55 | |
| 56 | #endif |