reset-syscfg.h 2.3 KB

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