vp.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * OMAP3/4 Voltage Processor (VP) structure and macro definitions
  4. *
  5. * Copyright (C) 2007, 2010 Texas Instruments, Inc.
  6. * Rajendra Nayak <[email protected]>
  7. * Lesly A M <[email protected]>
  8. * Thara Gopinath <[email protected]>
  9. *
  10. * Copyright (C) 2008, 2011 Nokia Corporation
  11. * Kalle Jokiniemi
  12. * Paul Walmsley
  13. */
  14. #ifndef __ARCH_ARM_MACH_OMAP2_VP_H
  15. #define __ARCH_ARM_MACH_OMAP2_VP_H
  16. #include <linux/kernel.h>
  17. struct voltagedomain;
  18. /* XXX document */
  19. #define VP_IDLE_TIMEOUT 200
  20. #define VP_TRANXDONE_TIMEOUT 300
  21. /**
  22. * struct omap_vp_ops - per-VP operations
  23. * @check_txdone: check for VP transaction done
  24. * @clear_txdone: clear VP transaction done status
  25. */
  26. struct omap_vp_ops {
  27. u32 (*check_txdone)(u8 vp_id);
  28. void (*clear_txdone)(u8 vp_id);
  29. };
  30. /**
  31. * struct omap_vp_common - register data common to all VDDs
  32. * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
  33. * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
  34. * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
  35. * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  36. * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  37. * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  38. * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  39. * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  40. * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  41. * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
  42. * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
  43. * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
  44. * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
  45. * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
  46. * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
  47. * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
  48. * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
  49. * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
  50. */
  51. struct omap_vp_common {
  52. u32 vpconfig_erroroffset_mask;
  53. u32 vpconfig_errorgain_mask;
  54. u32 vpconfig_initvoltage_mask;
  55. u8 vpconfig_timeouten;
  56. u8 vpconfig_initvdd;
  57. u8 vpconfig_forceupdate;
  58. u8 vpconfig_vpenable;
  59. u8 vstepmin_stepmin_shift;
  60. u8 vstepmin_smpswaittimemin_shift;
  61. u8 vstepmax_stepmax_shift;
  62. u8 vstepmax_smpswaittimemax_shift;
  63. u8 vlimitto_vddmin_shift;
  64. u8 vlimitto_vddmax_shift;
  65. u8 vlimitto_timeout_shift;
  66. u8 vpvoltage_mask;
  67. const struct omap_vp_ops *ops;
  68. };
  69. /**
  70. * struct omap_vp_instance - VP register offsets (per-VDD)
  71. * @common: pointer to struct omap_vp_common * for this SoC
  72. * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  73. * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  74. * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  75. * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  76. * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
  77. * @id: Unique identifier for VP instance.
  78. * @enabled: flag to keep track of whether vp is enabled or not
  79. *
  80. * XXX vp_common is probably not needed since it is per-SoC
  81. */
  82. struct omap_vp_instance {
  83. const struct omap_vp_common *common;
  84. u8 vpconfig;
  85. u8 vstepmin;
  86. u8 vstepmax;
  87. u8 vlimitto;
  88. u8 vstatus;
  89. u8 voltage;
  90. u8 id;
  91. bool enabled;
  92. };
  93. extern struct omap_vp_instance omap3_vp_mpu;
  94. extern struct omap_vp_instance omap3_vp_core;
  95. extern struct omap_vp_instance omap4_vp_mpu;
  96. extern struct omap_vp_instance omap4_vp_iva;
  97. extern struct omap_vp_instance omap4_vp_core;
  98. extern struct omap_vp_param omap3_mpu_vp_data;
  99. extern struct omap_vp_param omap3_core_vp_data;
  100. extern struct omap_vp_param omap4_mpu_vp_data;
  101. extern struct omap_vp_param omap4_iva_vp_data;
  102. extern struct omap_vp_param omap4_core_vp_data;
  103. void omap_vp_init(struct voltagedomain *voltdm);
  104. void omap_vp_enable(struct voltagedomain *voltdm);
  105. void omap_vp_disable(struct voltagedomain *voltdm);
  106. int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
  107. unsigned long target_volt);
  108. int omap_vp_update_errorgain(struct voltagedomain *voltdm,
  109. unsigned long target_volt);
  110. #endif