reset-syscfg.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2013 STMicroelectronics (R&D) Limited
  4. * Author: Stephen Gallimore <[email protected]>
  5. */
  6. #ifndef __STI_RESET_SYSCFG_H
  7. #define __STI_RESET_SYSCFG_H
  8. #include <linux/device.h>
  9. #include <linux/regmap.h>
  10. #include <linux/reset-controller.h>
  11. /**
  12. * Reset channel description for a system configuration register based
  13. * reset controller.
  14. *
  15. * @compatible: Compatible string of the syscon regmap containing this
  16. * channel's control and ack (status) bits.
  17. * @reset: Regmap field description of the channel's reset bit.
  18. * @ack: Regmap field description of the channel's acknowledge bit.
  19. */
  20. struct syscfg_reset_channel_data {
  21. const char *compatible;
  22. struct reg_field reset;
  23. struct reg_field ack;
  24. };
  25. #define _SYSCFG_RST_CH(_c, _rr, _rb, _ar, _ab) \
  26. { .compatible = _c, \
  27. .reset = REG_FIELD(_rr, _rb, _rb), \
  28. .ack = REG_FIELD(_ar, _ab, _ab), }
  29. #define _SYSCFG_RST_CH_NO_ACK(_c, _rr, _rb) \
  30. { .compatible = _c, \
  31. .reset = REG_FIELD(_rr, _rb, _rb), }
  32. /**
  33. * Description of a system configuration register based reset controller.
  34. *
  35. * @wait_for_ack: The controller will wait for reset assert and de-assert to
  36. * be "ack'd" in a channel's ack field.
  37. * @active_low: Are the resets in this controller active low, i.e. clearing
  38. * the reset bit puts the hardware into reset.
  39. * @nr_channels: The number of reset channels in this controller.
  40. * @channels: An array of reset channel descriptions.
  41. */
  42. struct syscfg_reset_controller_data {
  43. bool wait_for_ack;
  44. bool active_low;
  45. int nr_channels;
  46. const struct syscfg_reset_channel_data *channels;
  47. };
  48. /**
  49. * syscfg_reset_probe(): platform device probe function used by syscfg
  50. * reset controller drivers. This registers a reset
  51. * controller configured by the OF match data for
  52. * the compatible device which should be of type
  53. * "struct syscfg_reset_controller_data".
  54. *
  55. * @pdev: platform device
  56. */
  57. int syscfg_reset_probe(struct platform_device *pdev);
  58. #endif /* __STI_RESET_SYSCFG_H */