vp.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * OMAP3/4 Voltage Processor (VP) structure and macro definitions
  3. *
  4. * Copyright (C) 2007, 2010 Texas Instruments, Inc.
  5. * Rajendra Nayak <rnayak@ti.com>
  6. * Lesly A M <x0080970@ti.com>
  7. * Thara Gopinath <thara@ti.com>
  8. *
  9. * Copyright (C) 2008, 2011 Nokia Corporation
  10. * Kalle Jokiniemi
  11. * Paul Walmsley
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License version
  15. * 2 as published by the Free Software Foundation.
  16. */
  17. #ifndef __ARCH_ARM_MACH_OMAP2_VP_H
  18. #define __ARCH_ARM_MACH_OMAP2_VP_H
  19. #include <linux/kernel.h>
  20. /* XXX document */
  21. #define VP_IDLE_TIMEOUT 200
  22. #define VP_TRANXDONE_TIMEOUT 300
  23. /**
  24. * struct omap_vp_common_data - register data common to all VDDs
  25. * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
  26. * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
  27. * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  28. * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  29. * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  30. * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  31. * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  32. * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  33. * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
  34. * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
  35. * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
  36. * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
  37. * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
  38. * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
  39. * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
  40. * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
  41. * @prm_mod: PRM module id used for PRM register access
  42. *
  43. * XXX It it not necessary to have both a mask and a shift for the same
  44. * bitfield - remove one
  45. * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
  46. */
  47. struct omap_vp_common_data {
  48. u32 vpconfig_errorgain_mask;
  49. u32 vpconfig_initvoltage_mask;
  50. u32 vpconfig_timeouten;
  51. u32 vpconfig_initvdd;
  52. u32 vpconfig_forceupdate;
  53. u32 vpconfig_vpenable;
  54. s16 prm_mod;
  55. u8 vpconfig_erroroffset_shift;
  56. u8 vpconfig_errorgain_shift;
  57. u8 vpconfig_initvoltage_shift;
  58. u8 vstepmin_stepmin_shift;
  59. u8 vstepmin_smpswaittimemin_shift;
  60. u8 vstepmax_stepmax_shift;
  61. u8 vstepmax_smpswaittimemax_shift;
  62. u8 vlimitto_vddmin_shift;
  63. u8 vlimitto_vddmax_shift;
  64. u8 vlimitto_timeout_shift;
  65. };
  66. /**
  67. * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
  68. * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
  69. * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
  70. *
  71. * XXX prm_irqst_reg does not belong here
  72. * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
  73. * hardware bug
  74. * XXX This structure is probably not needed
  75. */
  76. struct omap_vp_prm_irqst_data {
  77. u8 prm_irqst_reg;
  78. u32 tranxdone_status;
  79. };
  80. /**
  81. * struct omap_vp_instance_data - VP register offsets (per-VDD)
  82. * @vp_common: pointer to struct omap_vp_common_data * for this SoC
  83. * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
  84. * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  85. * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  86. * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  87. * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  88. * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
  89. *
  90. * XXX vp_common is probably not needed since it is per-SoC
  91. */
  92. struct omap_vp_instance_data {
  93. const struct omap_vp_common_data *vp_common;
  94. const struct omap_vp_prm_irqst_data *prm_irqst_data;
  95. u8 vpconfig;
  96. u8 vstepmin;
  97. u8 vstepmax;
  98. u8 vlimitto;
  99. u8 vstatus;
  100. u8 voltage;
  101. };
  102. /**
  103. * struct omap_vp_runtime_data - VP data populated at runtime by code
  104. * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
  105. * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
  106. * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
  107. * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
  108. * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
  109. * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
  110. * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
  111. * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
  112. * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
  113. *
  114. * XXX Is this structure really needed? Why not just program the
  115. * device directly? They are in PRM space, therefore in the WKUP
  116. * powerdomain, so register contents should not be lost in off-mode.
  117. * XXX Some of these fields are incorrectly named, e.g., vstep*
  118. */
  119. struct omap_vp_runtime_data {
  120. u32 vpconfig_erroroffset;
  121. u16 vpconfig_errorgain;
  122. u16 vstepmin_smpswaittimemin;
  123. u16 vstepmax_smpswaittimemax;
  124. u16 vlimitto_timeout;
  125. u8 vstepmin_stepmin;
  126. u8 vstepmax_stepmax;
  127. u8 vlimitto_vddmin;
  128. u8 vlimitto_vddmax;
  129. };
  130. extern struct omap_vp_instance_data omap3_vp1_data;
  131. extern struct omap_vp_instance_data omap3_vp2_data;
  132. extern struct omap_vp_instance_data omap4_vp_mpu_data;
  133. extern struct omap_vp_instance_data omap4_vp_iva_data;
  134. extern struct omap_vp_instance_data omap4_vp_core_data;
  135. #endif