Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_RESET_H_ |
| 2 | #define _LINUX_RESET_H_ |
| 3 | |
| 4 | struct device; |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 5 | struct device_node; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 6 | struct reset_control; |
| 7 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 8 | #ifdef CONFIG_RESET_CONTROLLER |
| 9 | |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 10 | int reset_control_reset(struct reset_control *rstc); |
| 11 | int reset_control_assert(struct reset_control *rstc); |
| 12 | int reset_control_deassert(struct reset_control *rstc); |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 13 | int reset_control_status(struct reset_control *rstc); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 14 | |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 15 | struct reset_control *reset_control_get(struct device *dev, const char *id); |
| 16 | void reset_control_put(struct reset_control *rstc); |
| 17 | struct reset_control *devm_reset_control_get(struct device *dev, const char *id); |
| 18 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 19 | int __must_check device_reset(struct device *dev); |
| 20 | |
| 21 | static inline int device_reset_optional(struct device *dev) |
| 22 | { |
| 23 | return device_reset(dev); |
| 24 | } |
| 25 | |
| 26 | static inline struct reset_control *reset_control_get_optional( |
| 27 | struct device *dev, const char *id) |
| 28 | { |
| 29 | return reset_control_get(dev, id); |
| 30 | } |
| 31 | |
| 32 | static inline struct reset_control *devm_reset_control_get_optional( |
| 33 | struct device *dev, const char *id) |
| 34 | { |
| 35 | return devm_reset_control_get(dev, id); |
| 36 | } |
| 37 | |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 38 | struct reset_control *of_reset_control_get(struct device_node *node, |
| 39 | const char *id); |
| 40 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 41 | #else |
| 42 | |
| 43 | static inline int reset_control_reset(struct reset_control *rstc) |
| 44 | { |
| 45 | WARN_ON(1); |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | static inline int reset_control_assert(struct reset_control *rstc) |
| 50 | { |
| 51 | WARN_ON(1); |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | static inline int reset_control_deassert(struct reset_control *rstc) |
| 56 | { |
| 57 | WARN_ON(1); |
| 58 | return 0; |
| 59 | } |
| 60 | |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 61 | static inline int reset_control_status(struct reset_control *rstc) |
| 62 | { |
| 63 | WARN_ON(1); |
| 64 | return 0; |
| 65 | } |
| 66 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 67 | static inline void reset_control_put(struct reset_control *rstc) |
| 68 | { |
| 69 | WARN_ON(1); |
| 70 | } |
| 71 | |
| 72 | static inline int device_reset_optional(struct device *dev) |
| 73 | { |
| 74 | return -ENOSYS; |
| 75 | } |
| 76 | |
| 77 | static inline struct reset_control *reset_control_get_optional( |
| 78 | struct device *dev, const char *id) |
| 79 | { |
| 80 | return ERR_PTR(-ENOSYS); |
| 81 | } |
| 82 | |
| 83 | static inline struct reset_control *devm_reset_control_get_optional( |
| 84 | struct device *dev, const char *id) |
| 85 | { |
| 86 | return ERR_PTR(-ENOSYS); |
| 87 | } |
| 88 | |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 89 | static inline struct reset_control *of_reset_control_get( |
| 90 | struct device_node *node, const char *id) |
| 91 | { |
| 92 | return ERR_PTR(-ENOSYS); |
| 93 | } |
| 94 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 95 | #endif /* CONFIG_RESET_CONTROLLER */ |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 96 | |
| 97 | #endif |