reset-controller.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _LINUX_RESET_CONTROLLER_H_
  2. #define _LINUX_RESET_CONTROLLER_H_
  3. #include <linux/list.h>
  4. struct reset_controller_dev;
  5. /**
  6. * struct reset_control_ops
  7. *
  8. * @reset: for self-deasserting resets, does all necessary
  9. * things to reset the device
  10. * @assert: manually assert the reset line, if supported
  11. * @deassert: manually deassert the reset line, if supported
  12. * @status: return the status of the reset line, if supported
  13. */
  14. struct reset_control_ops {
  15. int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
  16. int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
  17. int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
  18. int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
  19. };
  20. struct module;
  21. struct device_node;
  22. struct of_phandle_args;
  23. /**
  24. * struct reset_controller_dev - reset controller entity that might
  25. * provide multiple reset controls
  26. * @ops: a pointer to device specific struct reset_control_ops
  27. * @owner: kernel module of the reset controller driver
  28. * @list: internal list of reset controller devices
  29. * @reset_control_head: head of internal list of requested reset controls
  30. * @of_node: corresponding device tree node as phandle target
  31. * @of_reset_n_cells: number of cells in reset line specifiers
  32. * @of_xlate: translation function to translate from specifier as found in the
  33. * device tree to id as given to the reset control ops
  34. * @nr_resets: number of reset controls in this reset controller device
  35. */
  36. struct reset_controller_dev {
  37. const struct reset_control_ops *ops;
  38. struct module *owner;
  39. struct list_head list;
  40. struct list_head reset_control_head;
  41. struct device_node *of_node;
  42. int of_reset_n_cells;
  43. int (*of_xlate)(struct reset_controller_dev *rcdev,
  44. const struct of_phandle_args *reset_spec);
  45. unsigned int nr_resets;
  46. };
  47. int reset_controller_register(struct reset_controller_dev *rcdev);
  48. void reset_controller_unregister(struct reset_controller_dev *rcdev);
  49. struct device;
  50. int devm_reset_controller_register(struct device *dev,
  51. struct reset_controller_dev *rcdev);
  52. #endif