Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 4d8e74ad4585672489da6145b3328d415f50db82 94 lines 3.3 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_RESET_CONTROLLER_H_ 3#define _LINUX_RESET_CONTROLLER_H_ 4 5#include <linux/list.h> 6#include <linux/mutex.h> 7 8struct fwnode_handle; 9struct fwnode_reference_args; 10struct reset_controller_dev; 11 12/** 13 * struct reset_control_ops - reset controller driver callbacks 14 * 15 * @reset: for self-deasserting resets, does all necessary 16 * things to reset the device 17 * @assert: manually assert the reset line, if supported 18 * @deassert: manually deassert the reset line, if supported 19 * @status: return the status of the reset line, if supported 20 */ 21struct reset_control_ops { 22 int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); 23 int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); 24 int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); 25 int (*status)(struct reset_controller_dev *rcdev, unsigned long id); 26}; 27 28struct module; 29struct device_node; 30struct of_phandle_args; 31 32/** 33 * struct reset_controller_dev - reset controller entity that might 34 * provide multiple reset controls 35 * @ops: a pointer to device specific struct reset_control_ops 36 * @owner: kernel module of the reset controller driver 37 * @list: internal list of reset controller devices 38 * @reset_control_head: head of internal list of requested reset controls 39 * @dev: corresponding driver model device struct 40 * @of_node: corresponding device tree node as phandle target 41 * @of_reset_n_cells: number of cells in reset line specifiers 42 * @of_xlate: translation function to translate from specifier as found in the 43 * device tree to id as given to the reset control ops 44 * @fwnode: firmware node associated with this device 45 * @fwnode_reset_n_cells: number of cells in reset line specifiers 46 * @fwnode_xlate: translation function to translate from firmware specifier to 47 * id as given to the reset control ops, defaults to 48 * :c:func:`fwnode_reset_simple_xlate` 49 * @nr_resets: number of reset controls in this reset controller device 50 * @lock: protects the reset control list from concurrent access 51 */ 52struct reset_controller_dev { 53 const struct reset_control_ops *ops; 54 struct module *owner; 55 struct list_head list; 56 struct list_head reset_control_head; 57 struct device *dev; 58 struct device_node *of_node; 59 int of_reset_n_cells; 60 int (*of_xlate)(struct reset_controller_dev *rcdev, 61 const struct of_phandle_args *reset_spec); 62 struct fwnode_handle *fwnode; 63 int fwnode_reset_n_cells; 64 int (*fwnode_xlate)(struct reset_controller_dev *rcdev, 65 const struct fwnode_reference_args *reset_spec); 66 unsigned int nr_resets; 67 struct mutex lock; 68}; 69 70#if IS_ENABLED(CONFIG_RESET_CONTROLLER) 71int reset_controller_register(struct reset_controller_dev *rcdev); 72void reset_controller_unregister(struct reset_controller_dev *rcdev); 73 74struct device; 75int devm_reset_controller_register(struct device *dev, 76 struct reset_controller_dev *rcdev); 77#else 78static inline int reset_controller_register(struct reset_controller_dev *rcdev) 79{ 80 return 0; 81} 82 83static inline void reset_controller_unregister(struct reset_controller_dev *rcdev) 84{ 85} 86 87static inline int devm_reset_controller_register(struct device *dev, 88 struct reset_controller_dev *rcdev) 89{ 90 return 0; 91} 92#endif 93 94#endif