reset-controller.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * @of_node: corresponding device tree node as phandle target
  30. * @of_reset_n_cells: number of cells in reset line specifiers
  31. * @of_xlate: translation function to translate from specifier as found in the
  32. * device tree to id as given to the reset control ops
  33. * @nr_resets: number of reset controls in this reset controller device
  34. */
  35. struct reset_controller_dev {
  36. const struct reset_control_ops *ops;
  37. struct module *owner;
  38. struct list_head list;
  39. struct device_node *of_node;
  40. int of_reset_n_cells;
  41. int (*of_xlate)(struct reset_controller_dev *rcdev,
  42. const struct of_phandle_args *reset_spec);
  43. unsigned int nr_resets;
  44. };
  45. int reset_controller_register(struct reset_controller_dev *rcdev);
  46. void reset_controller_unregister(struct reset_controller_dev *rcdev);
  47. #endif