qnoc-qos.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. *
  5. */
  6. #ifndef __DRIVERS_INTERCONNECT_QCOM_QNOC_QOS_H__
  7. #define __DRIVERS_INTERCONNECT_QCOM_QNOC_QOS_H__
  8. #define QOSGEN_OFF_MAX_REGS 6
  9. #define ICC_QNOC_QOS_MAX_TYPE 1
  10. enum {
  11. ICC_QNOC_QOSGEN_TYPE_RPMH,
  12. };
  13. enum {
  14. QOSGEN_OFF_MAINCTL_LO,
  15. QOSGEN_OFF_LIMITBW_LO,
  16. QOSGEN_OFF_SHAPING_LO,
  17. QOSGEN_OFF_SHAPING_HI,
  18. QOSGEN_OFF_REGUL0CTL_LO,
  19. QOSGEN_OFF_REGUL0BW_LO,
  20. };
  21. extern const u8 icc_qnoc_qos_regs[ICC_QNOC_QOS_MAX_TYPE][QOSGEN_OFF_MAX_REGS];
  22. struct qcom_icc_noc_ops {
  23. void (*set_qos)(struct qcom_icc_node *node);
  24. };
  25. struct qos_config {
  26. u32 prio;
  27. u32 urg_fwd;
  28. bool prio_fwd_disable;
  29. };
  30. struct qcom_icc_qosbox {
  31. u32 num_ports;
  32. const u8 *regs;
  33. struct qos_config *config;
  34. u32 offsets[];
  35. };
  36. #define DEFINE_QNODE_QOS(_name, _prio, _urg_fwd, _num_ports, ...) \
  37. static struct qos_config _name##_qos_cfg = { \
  38. .prio = _prio, \
  39. .urg_fwd = _urg_fwd, \
  40. }; \
  41. static struct qcom_icc_qosbox _name##_qos = { \
  42. .num_ports = _num_ports, \
  43. .config = &_name##_qos_cfg, \
  44. .regs = icc_qnoc_qos_regs[ICC_QNOC_QOSGEN_TYPE_RPMH], \
  45. .offsets = {__VA_ARGS__}, \
  46. } \
  47. extern const struct qcom_icc_noc_ops qcom_qnoc4_ops;
  48. #endif