dpu_hw_vbif.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DPU_HW_VBIF_H
  13. #define _DPU_HW_VBIF_H
  14. #include "dpu_hw_catalog.h"
  15. #include "dpu_hw_mdss.h"
  16. #include "dpu_hw_util.h"
  17. struct dpu_hw_vbif;
  18. /**
  19. * struct dpu_hw_vbif_ops : Interface to the VBIF hardware driver functions
  20. * Assumption is these functions will be called after clocks are enabled
  21. */
  22. struct dpu_hw_vbif_ops {
  23. /**
  24. * set_limit_conf - set transaction limit config
  25. * @vbif: vbif context driver
  26. * @xin_id: client interface identifier
  27. * @rd: true for read limit; false for write limit
  28. * @limit: outstanding transaction limit
  29. */
  30. void (*set_limit_conf)(struct dpu_hw_vbif *vbif,
  31. u32 xin_id, bool rd, u32 limit);
  32. /**
  33. * get_limit_conf - get transaction limit config
  34. * @vbif: vbif context driver
  35. * @xin_id: client interface identifier
  36. * @rd: true for read limit; false for write limit
  37. * @return: outstanding transaction limit
  38. */
  39. u32 (*get_limit_conf)(struct dpu_hw_vbif *vbif,
  40. u32 xin_id, bool rd);
  41. /**
  42. * set_halt_ctrl - set halt control
  43. * @vbif: vbif context driver
  44. * @xin_id: client interface identifier
  45. * @enable: halt control enable
  46. */
  47. void (*set_halt_ctrl)(struct dpu_hw_vbif *vbif,
  48. u32 xin_id, bool enable);
  49. /**
  50. * get_halt_ctrl - get halt control
  51. * @vbif: vbif context driver
  52. * @xin_id: client interface identifier
  53. * @return: halt control enable
  54. */
  55. bool (*get_halt_ctrl)(struct dpu_hw_vbif *vbif,
  56. u32 xin_id);
  57. /**
  58. * set_qos_remap - set QoS priority remap
  59. * @vbif: vbif context driver
  60. * @xin_id: client interface identifier
  61. * @level: priority level
  62. * @remap_level: remapped level
  63. */
  64. void (*set_qos_remap)(struct dpu_hw_vbif *vbif,
  65. u32 xin_id, u32 level, u32 remap_level);
  66. /**
  67. * set_mem_type - set memory type
  68. * @vbif: vbif context driver
  69. * @xin_id: client interface identifier
  70. * @value: memory type value
  71. */
  72. void (*set_mem_type)(struct dpu_hw_vbif *vbif,
  73. u32 xin_id, u32 value);
  74. /**
  75. * clear_errors - clear any vbif errors
  76. * This function clears any detected pending/source errors
  77. * on the VBIF interface, and optionally returns the detected
  78. * error mask(s).
  79. * @vbif: vbif context driver
  80. * @pnd_errors: pointer to pending error reporting variable
  81. * @src_errors: pointer to source error reporting variable
  82. */
  83. void (*clear_errors)(struct dpu_hw_vbif *vbif,
  84. u32 *pnd_errors, u32 *src_errors);
  85. /**
  86. * set_write_gather_en - set write_gather enable
  87. * @vbif: vbif context driver
  88. * @xin_id: client interface identifier
  89. */
  90. void (*set_write_gather_en)(struct dpu_hw_vbif *vbif, u32 xin_id);
  91. };
  92. struct dpu_hw_vbif {
  93. /* base */
  94. struct dpu_hw_blk_reg_map hw;
  95. /* vbif */
  96. enum dpu_vbif idx;
  97. const struct dpu_vbif_cfg *cap;
  98. /* ops */
  99. struct dpu_hw_vbif_ops ops;
  100. };
  101. /**
  102. * dpu_hw_vbif_init - initializes the vbif driver for the passed interface idx
  103. * @idx: Interface index for which driver object is required
  104. * @addr: Mapped register io address of MDSS
  105. * @m: Pointer to mdss catalog data
  106. */
  107. struct dpu_hw_vbif *dpu_hw_vbif_init(enum dpu_vbif idx,
  108. void __iomem *addr,
  109. const struct dpu_mdss_cfg *m);
  110. void dpu_hw_vbif_destroy(struct dpu_hw_vbif *vbif);
  111. #endif /*_DPU_HW_VBIF_H */