Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_RESET_H_ |
| 2 | #define _LINUX_RESET_H_ |
| 3 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 4 | #include <linux/device.h> |
| 5 | |
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 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 15 | struct reset_control *__of_reset_control_get(struct device_node *node, |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 16 | const char *id, int index, bool shared, |
| 17 | bool optional); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 18 | void reset_control_put(struct reset_control *rstc); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 19 | struct reset_control *__devm_reset_control_get(struct device *dev, |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 20 | const char *id, int index, bool shared, |
| 21 | bool optional); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 22 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 23 | int __must_check device_reset(struct device *dev); |
| 24 | |
| 25 | static inline int device_reset_optional(struct device *dev) |
| 26 | { |
| 27 | return device_reset(dev); |
| 28 | } |
| 29 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 30 | #else |
| 31 | |
| 32 | static inline int reset_control_reset(struct reset_control *rstc) |
| 33 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | static inline int reset_control_assert(struct reset_control *rstc) |
| 38 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | static inline int reset_control_deassert(struct reset_control *rstc) |
| 43 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 44 | return 0; |
| 45 | } |
| 46 | |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 47 | static inline int reset_control_status(struct reset_control *rstc) |
| 48 | { |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 49 | return 0; |
| 50 | } |
| 51 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 52 | static inline void reset_control_put(struct reset_control *rstc) |
| 53 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 54 | } |
| 55 | |
Daniel Lezcano | 4113652 | 2016-04-01 21:38:16 +0200 | [diff] [blame] | 56 | static inline int __must_check device_reset(struct device *dev) |
| 57 | { |
| 58 | WARN_ON(1); |
| 59 | return -ENOTSUPP; |
| 60 | } |
| 61 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 62 | static inline int device_reset_optional(struct device *dev) |
| 63 | { |
Philipp Zabel | 39b4da7 | 2015-10-29 09:55:00 +0100 | [diff] [blame] | 64 | return -ENOTSUPP; |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 65 | } |
| 66 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 67 | static inline struct reset_control *__of_reset_control_get( |
| 68 | struct device_node *node, |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 69 | const char *id, int index, bool shared, |
| 70 | bool optional) |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 71 | { |
Philipp Zabel | 7be2600 | 2017-03-20 11:25:16 +0100 | [diff] [blame^] | 72 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 73 | } |
| 74 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 75 | static inline struct reset_control *__devm_reset_control_get( |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 76 | struct device *dev, const char *id, |
| 77 | int index, bool shared, bool optional) |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 78 | { |
Philipp Zabel | 7be2600 | 2017-03-20 11:25:16 +0100 | [diff] [blame^] | 79 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | #endif /* CONFIG_RESET_CONTROLLER */ |
| 83 | |
| 84 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 85 | * reset_control_get_exclusive - Lookup and obtain an exclusive reference |
| 86 | * to a reset controller. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 87 | * @dev: device to be reset by the controller |
| 88 | * @id: reset line name |
| 89 | * |
| 90 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 91 | * If this function is called more then once for the same reset_control it will |
| 92 | * return -EBUSY. |
| 93 | * |
| 94 | * See reset_control_get_shared for details on shared references to |
| 95 | * reset-controls. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 96 | * |
| 97 | * Use of id names is optional. |
| 98 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 99 | static inline struct reset_control * |
| 100 | __must_check reset_control_get_exclusive(struct device *dev, const char *id) |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 101 | { |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 102 | #ifndef CONFIG_RESET_CONTROLLER |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 103 | WARN_ON(1); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 104 | #endif |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 105 | return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, |
| 106 | false); |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 107 | } |
| 108 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 109 | /** |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 110 | * reset_control_get_shared - Lookup and obtain a shared reference to a |
| 111 | * reset controller. |
| 112 | * @dev: device to be reset by the controller |
| 113 | * @id: reset line name |
| 114 | * |
| 115 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 116 | * This function is intended for use with reset-controls which are shared |
| 117 | * between hardware-blocks. |
| 118 | * |
| 119 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 120 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 121 | * and only (re-)assert the reset after reset_control_assert has been called |
| 122 | * as many times as reset_control_deassert was called. Also see the remark |
| 123 | * about shared reset-controls in the reset_control_assert docs. |
| 124 | * |
| 125 | * Calling reset_control_assert without first calling reset_control_deassert |
| 126 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 127 | * also not allowed on a shared reset control. |
| 128 | * |
| 129 | * Use of id names is optional. |
| 130 | */ |
| 131 | static inline struct reset_control *reset_control_get_shared( |
| 132 | struct device *dev, const char *id) |
| 133 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 134 | return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, |
| 135 | false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 136 | } |
| 137 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 138 | static inline struct reset_control *reset_control_get_optional_exclusive( |
Lee Jones | 3c35f6e | 2016-06-06 16:56:49 +0100 | [diff] [blame] | 139 | struct device *dev, const char *id) |
| 140 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 141 | return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, |
| 142 | true); |
Lee Jones | 3c35f6e | 2016-06-06 16:56:49 +0100 | [diff] [blame] | 143 | } |
| 144 | |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 145 | static inline struct reset_control *reset_control_get_optional_shared( |
| 146 | struct device *dev, const char *id) |
| 147 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 148 | return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, |
| 149 | true); |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 150 | } |
| 151 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 152 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 153 | * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference |
| 154 | * to a reset controller. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 155 | * @node: device to be reset by the controller |
| 156 | * @id: reset line name |
| 157 | * |
| 158 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 159 | * |
| 160 | * Use of id names is optional. |
| 161 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 162 | static inline struct reset_control *of_reset_control_get_exclusive( |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 163 | struct device_node *node, const char *id) |
| 164 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 165 | return __of_reset_control_get(node, id, 0, false, false); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | /** |
Lee Jones | 40faee8 | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 169 | * of_reset_control_get_shared - Lookup and obtain an shared reference |
| 170 | * to a reset controller. |
| 171 | * @node: device to be reset by the controller |
| 172 | * @id: reset line name |
| 173 | * |
| 174 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 175 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 176 | * and only (re-)assert the reset after reset_control_assert has been called |
| 177 | * as many times as reset_control_deassert was called. Also see the remark |
| 178 | * about shared reset-controls in the reset_control_assert docs. |
| 179 | * |
| 180 | * Calling reset_control_assert without first calling reset_control_deassert |
| 181 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 182 | * also not allowed on a shared reset control. |
| 183 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 184 | * |
| 185 | * Use of id names is optional. |
| 186 | */ |
| 187 | static inline struct reset_control *of_reset_control_get_shared( |
| 188 | struct device_node *node, const char *id) |
| 189 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 190 | return __of_reset_control_get(node, id, 0, true, false); |
Lee Jones | 40faee8 | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 194 | * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive |
| 195 | * reference to a reset controller |
| 196 | * by index. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 197 | * @node: device to be reset by the controller |
| 198 | * @index: index of the reset controller |
| 199 | * |
| 200 | * This is to be used to perform a list of resets for a device or power domain |
| 201 | * in whatever order. Returns a struct reset_control or IS_ERR() condition |
| 202 | * containing errno. |
| 203 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 204 | static inline struct reset_control *of_reset_control_get_exclusive_by_index( |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 205 | struct device_node *node, int index) |
| 206 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 207 | return __of_reset_control_get(node, NULL, index, false, false); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | /** |
Lee Jones | 40faee8 | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 211 | * of_reset_control_get_shared_by_index - Lookup and obtain an shared |
| 212 | * reference to a reset controller |
| 213 | * by index. |
| 214 | * @node: device to be reset by the controller |
| 215 | * @index: index of the reset controller |
| 216 | * |
| 217 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 218 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 219 | * and only (re-)assert the reset after reset_control_assert has been called |
| 220 | * as many times as reset_control_deassert was called. Also see the remark |
| 221 | * about shared reset-controls in the reset_control_assert docs. |
| 222 | * |
| 223 | * Calling reset_control_assert without first calling reset_control_deassert |
| 224 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 225 | * also not allowed on a shared reset control. |
| 226 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 227 | * |
| 228 | * This is to be used to perform a list of resets for a device or power domain |
| 229 | * in whatever order. Returns a struct reset_control or IS_ERR() condition |
| 230 | * containing errno. |
| 231 | */ |
| 232 | static inline struct reset_control *of_reset_control_get_shared_by_index( |
| 233 | struct device_node *node, int index) |
| 234 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 235 | return __of_reset_control_get(node, NULL, index, true, false); |
Lee Jones | 40faee8 | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 239 | * devm_reset_control_get_exclusive - resource managed |
| 240 | * reset_control_get_exclusive() |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 241 | * @dev: device to be reset by the controller |
| 242 | * @id: reset line name |
| 243 | * |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 244 | * Managed reset_control_get_exclusive(). For reset controllers returned |
| 245 | * from this function, reset_control_put() is called automatically on driver |
| 246 | * detach. |
| 247 | * |
| 248 | * See reset_control_get_exclusive() for more information. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 249 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 250 | static inline struct reset_control * |
| 251 | __must_check devm_reset_control_get_exclusive(struct device *dev, |
| 252 | const char *id) |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 253 | { |
| 254 | #ifndef CONFIG_RESET_CONTROLLER |
| 255 | WARN_ON(1); |
| 256 | #endif |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 257 | return __devm_reset_control_get(dev, id, 0, false, false); |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 258 | } |
| 259 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 260 | /** |
| 261 | * devm_reset_control_get_shared - resource managed reset_control_get_shared() |
| 262 | * @dev: device to be reset by the controller |
| 263 | * @id: reset line name |
| 264 | * |
| 265 | * Managed reset_control_get_shared(). For reset controllers returned from |
| 266 | * this function, reset_control_put() is called automatically on driver detach. |
| 267 | * See reset_control_get_shared() for more information. |
| 268 | */ |
| 269 | static inline struct reset_control *devm_reset_control_get_shared( |
| 270 | struct device *dev, const char *id) |
| 271 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 272 | return __devm_reset_control_get(dev, id, 0, true, false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 273 | } |
| 274 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 275 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 276 | struct device *dev, const char *id) |
| 277 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 278 | return __devm_reset_control_get(dev, id, 0, false, true); |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 279 | } |
| 280 | |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 281 | static inline struct reset_control *devm_reset_control_get_optional_shared( |
| 282 | struct device *dev, const char *id) |
| 283 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 284 | return __devm_reset_control_get(dev, id, 0, true, true); |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 285 | } |
| 286 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 287 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 288 | * devm_reset_control_get_exclusive_by_index - resource managed |
| 289 | * reset_control_get_exclusive() |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 290 | * @dev: device to be reset by the controller |
| 291 | * @index: index of the reset controller |
| 292 | * |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 293 | * Managed reset_control_get_exclusive(). For reset controllers returned from |
| 294 | * this function, reset_control_put() is called automatically on driver |
| 295 | * detach. |
| 296 | * |
| 297 | * See reset_control_get_exclusive() for more information. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 298 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 299 | static inline struct reset_control * |
| 300 | devm_reset_control_get_exclusive_by_index(struct device *dev, int index) |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 301 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 302 | return __devm_reset_control_get(dev, NULL, index, false, false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 303 | } |
| 304 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 305 | /** |
| 306 | * devm_reset_control_get_shared_by_index - resource managed |
| 307 | * reset_control_get_shared |
| 308 | * @dev: device to be reset by the controller |
| 309 | * @index: index of the reset controller |
| 310 | * |
| 311 | * Managed reset_control_get_shared(). For reset controllers returned from |
| 312 | * this function, reset_control_put() is called automatically on driver detach. |
| 313 | * See reset_control_get_shared() for more information. |
| 314 | */ |
Lee Jones | 0bcc0ea | 2016-06-06 16:56:53 +0100 | [diff] [blame] | 315 | static inline struct reset_control * |
| 316 | devm_reset_control_get_shared_by_index(struct device *dev, int index) |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 317 | { |
Ramiro Oliveira | ca58e3b | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 318 | return __devm_reset_control_get(dev, NULL, index, true, false); |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 319 | } |
| 320 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 321 | /* |
| 322 | * TEMPORARY calls to use during transition: |
| 323 | * |
| 324 | * of_reset_control_get() => of_reset_control_get_exclusive() |
| 325 | * |
| 326 | * These inline function calls will be removed once all consumers |
| 327 | * have been moved over to the new explicit API. |
| 328 | */ |
| 329 | static inline struct reset_control *reset_control_get( |
| 330 | struct device *dev, const char *id) |
| 331 | { |
| 332 | return reset_control_get_exclusive(dev, id); |
| 333 | } |
| 334 | |
| 335 | static inline struct reset_control *reset_control_get_optional( |
| 336 | struct device *dev, const char *id) |
| 337 | { |
| 338 | return reset_control_get_optional_exclusive(dev, id); |
| 339 | } |
| 340 | |
| 341 | static inline struct reset_control *of_reset_control_get( |
| 342 | struct device_node *node, const char *id) |
| 343 | { |
| 344 | return of_reset_control_get_exclusive(node, id); |
| 345 | } |
| 346 | |
| 347 | static inline struct reset_control *of_reset_control_get_by_index( |
| 348 | struct device_node *node, int index) |
| 349 | { |
| 350 | return of_reset_control_get_exclusive_by_index(node, index); |
| 351 | } |
| 352 | |
| 353 | static inline struct reset_control *devm_reset_control_get( |
| 354 | struct device *dev, const char *id) |
| 355 | { |
| 356 | return devm_reset_control_get_exclusive(dev, id); |
| 357 | } |
| 358 | |
| 359 | static inline struct reset_control *devm_reset_control_get_optional( |
| 360 | struct device *dev, const char *id) |
| 361 | { |
| 362 | return devm_reset_control_get_optional_exclusive(dev, id); |
| 363 | |
| 364 | } |
| 365 | |
| 366 | static inline struct reset_control *devm_reset_control_get_by_index( |
| 367 | struct device *dev, int index) |
| 368 | { |
| 369 | return devm_reset_control_get_exclusive_by_index(dev, index); |
| 370 | } |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 371 | #endif |