0001
0002 #ifndef _LINUX_RESET_CONTROLLER_H_
0003 #define _LINUX_RESET_CONTROLLER_H_
0004
0005 #include <linux/list.h>
0006
0007 struct reset_controller_dev;
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 struct reset_control_ops {
0019 int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
0020 int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
0021 int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
0022 int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
0023 };
0024
0025 struct module;
0026 struct device_node;
0027 struct of_phandle_args;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 struct reset_control_lookup {
0039 struct list_head list;
0040 const char *provider;
0041 unsigned int index;
0042 const char *dev_id;
0043 const char *con_id;
0044 };
0045
0046 #define RESET_LOOKUP(_provider, _index, _dev_id, _con_id) \
0047 { \
0048 .provider = _provider, \
0049 .index = _index, \
0050 .dev_id = _dev_id, \
0051 .con_id = _con_id, \
0052 }
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 struct reset_controller_dev {
0070 const struct reset_control_ops *ops;
0071 struct module *owner;
0072 struct list_head list;
0073 struct list_head reset_control_head;
0074 struct device *dev;
0075 struct device_node *of_node;
0076 int of_reset_n_cells;
0077 int (*of_xlate)(struct reset_controller_dev *rcdev,
0078 const struct of_phandle_args *reset_spec);
0079 unsigned int nr_resets;
0080 };
0081
0082 #if IS_ENABLED(CONFIG_RESET_CONTROLLER)
0083 int reset_controller_register(struct reset_controller_dev *rcdev);
0084 void reset_controller_unregister(struct reset_controller_dev *rcdev);
0085
0086 struct device;
0087 int devm_reset_controller_register(struct device *dev,
0088 struct reset_controller_dev *rcdev);
0089
0090 void reset_controller_add_lookup(struct reset_control_lookup *lookup,
0091 unsigned int num_entries);
0092 #else
0093 static inline int reset_controller_register(struct reset_controller_dev *rcdev)
0094 {
0095 return 0;
0096 }
0097
0098 static inline void reset_controller_unregister(struct reset_controller_dev *rcdev)
0099 {
0100 }
0101
0102 static inline int devm_reset_controller_register(struct device *dev,
0103 struct reset_controller_dev *rcdev)
0104 {
0105 return 0;
0106 }
0107
0108 static inline void reset_controller_add_lookup(struct reset_control_lookup *lookup,
0109 unsigned int num_entries)
0110 {
0111 }
0112 #endif
0113
0114 #endif