vp.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. *
  42. * XXX It it not necessary to have both a mask and a shift for the same
  43. * bitfield - remove one
  44. * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
  45. */
  46. struct omap_vp_common_data {
  47. u32 vpconfig_errorgain_mask;
  48. u32 vpconfig_initvoltage_mask;
  49. u32 vpconfig_timeouten;
  50. u32 vpconfig_initvdd;
  51. u32 vpconfig_forceupdate;
  52. u32 vpconfig_vpenable;
  53. u8 vpconfig_erroroffset_shift;
  54. u8 vpconfig_errorgain_shift;
  55. u8 vpconfig_initvoltage_shift;
  56. u8 vstepmin_stepmin_shift;
  57. u8 vstepmin_smpswaittimemin_shift;
  58. u8 vstepmax_stepmax_shift;
  59. u8 vstepmax_smpswaittimemax_shift;
  60. u8 vlimitto_vddmin_shift;
  61. u8 vlimitto_vddmax_shift;
  62. u8 vlimitto_timeout_shift;
  63. };
  64. /**
  65. * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
  66. * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
  67. * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
  68. *
  69. * XXX prm_irqst_reg does not belong here
  70. * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
  71. * hardware bug
  72. * XXX This structure is probably not needed
  73. */
  74. struct omap_vp_prm_irqst_data {
  75. u8 prm_irqst_reg;
  76. u32 tranxdone_status;
  77. };
  78. /**
  79. * struct omap_vp_instance_data - VP register offsets (per-VDD)
  80. * @vp_common: pointer to struct omap_vp_common_data * for this SoC
  81. * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
  82. * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  83. * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  84. * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  85. * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  86. * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
  87. *
  88. * XXX vp_common is probably not needed since it is per-SoC
  89. */
  90. struct omap_vp_instance_data {
  91. const struct omap_vp_common_data *vp_common;
  92. const struct omap_vp_prm_irqst_data *prm_irqst_data;
  93. u8 vpconfig;
  94. u8 vstepmin;
  95. u8 vstepmax;
  96. u8 vlimitto;
  97. u8 vstatus;
  98. u8 voltage;
  99. };
  100. /**
  101. * struct omap_vp_runtime_data - VP data populated at runtime by code
  102. * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
  103. * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
  104. * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
  105. * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
  106. * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
  107. * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
  108. * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
  109. * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
  110. * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
  111. *
  112. * XXX Is this structure really needed? Why not just program the
  113. * device directly? They are in PRM space, therefore in the WKUP
  114. * powerdomain, so register contents should not be lost in off-mode.
  115. * XXX Some of these fields are incorrectly named, e.g., vstep*
  116. */
  117. struct omap_vp_runtime_data {
  118. u32 vpconfig_erroroffset;
  119. u16 vpconfig_errorgain;
  120. u16 vstepmin_smpswaittimemin;
  121. u16 vstepmax_smpswaittimemax;
  122. u16 vlimitto_timeout;
  123. u8 vstepmin_stepmin;
  124. u8 vstepmax_stepmax;
  125. u8 vlimitto_vddmin;
  126. u8 vlimitto_vddmax;
  127. };
  128. extern struct omap_vp_instance_data omap3_vp1_data;
  129. extern struct omap_vp_instance_data omap3_vp2_data;
  130. extern struct omap_vp_instance_data omap4_vp_mpu_data;
  131. extern struct omap_vp_instance_data omap4_vp_iva_data;
  132. extern struct omap_vp_instance_data omap4_vp_core_data;
  133. #endif