blob: ce6b962ffed43d892aa1bea3749e923f0032ea1f [file] [log] [blame]
Philipp Zabel61fc4132012-11-19 17:23:13 +01001#ifndef _LINUX_RESET_CONTROLLER_H_
2#define _LINUX_RESET_CONTROLLER_H_
3
4#include <linux/list.h>
5
6struct 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 Nguyen729de412014-10-10 10:21:14 -050015 * @status: return the status of the reset line, if supported
Philipp Zabel61fc4132012-11-19 17:23:13 +010016 */
17struct 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 Nguyen729de412014-10-10 10:21:14 -050021 int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
Philipp Zabel61fc4132012-11-19 17:23:13 +010022};
23
24struct module;
25struct device_node;
Stephen Boydd0d44dd2014-01-15 10:47:21 -080026struct of_phandle_args;
Philipp Zabel61fc4132012-11-19 17:23:13 +010027
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
34 * @of_node: corresponding device tree node as phandle target
35 * @of_reset_n_cells: number of cells in reset line specifiers
36 * @of_xlate: translation function to translate from specifier as found in the
37 * device tree to id as given to the reset control ops
38 * @nr_resets: number of reset controls in this reset controller device
39 */
40struct reset_controller_dev {
41 struct reset_control_ops *ops;
42 struct module *owner;
43 struct list_head list;
44 struct device_node *of_node;
45 int of_reset_n_cells;
46 int (*of_xlate)(struct reset_controller_dev *rcdev,
47 const struct of_phandle_args *reset_spec);
48 unsigned int nr_resets;
49};
50
51int reset_controller_register(struct reset_controller_dev *rcdev);
52void reset_controller_unregister(struct reset_controller_dev *rcdev);
53
54#endif