vp.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. struct voltagedomain;
  21. /* XXX document */
  22. #define VP_IDLE_TIMEOUT 200
  23. #define VP_TRANXDONE_TIMEOUT 300
  24. /**
  25. * struct omap_vp_ops - per-VP operations
  26. * @check_txdone: check for VP transaction done
  27. * @clear_txdone: clear VP transaction done status
  28. */
  29. struct omap_vp_ops {
  30. u32 (*check_txdone)(u8 vp_id);
  31. void (*clear_txdone)(u8 vp_id);
  32. };
  33. /**
  34. * struct omap_vp_common - register data common to all VDDs
  35. * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
  36. * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
  37. * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
  38. * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  39. * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  40. * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  41. * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  42. * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  43. * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  44. * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
  45. * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
  46. * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
  47. * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
  48. * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
  49. * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
  50. * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
  51. * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
  52. * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
  53. */
  54. struct omap_vp_common {
  55. u32 vpconfig_erroroffset_mask;
  56. u32 vpconfig_errorgain_mask;
  57. u32 vpconfig_initvoltage_mask;
  58. u8 vpconfig_timeouten;
  59. u8 vpconfig_initvdd;
  60. u8 vpconfig_forceupdate;
  61. u8 vpconfig_vpenable;
  62. u8 vstepmin_stepmin_shift;
  63. u8 vstepmin_smpswaittimemin_shift;
  64. u8 vstepmax_stepmax_shift;
  65. u8 vstepmax_smpswaittimemax_shift;
  66. u8 vlimitto_vddmin_shift;
  67. u8 vlimitto_vddmax_shift;
  68. u8 vlimitto_timeout_shift;
  69. u8 vpvoltage_mask;
  70. const struct omap_vp_ops *ops;
  71. };
  72. /**
  73. * struct omap_vp_instance - VP register offsets (per-VDD)
  74. * @common: pointer to struct omap_vp_common * for this SoC
  75. * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  76. * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  77. * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  78. * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  79. * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
  80. * @id: Unique identifier for VP instance.
  81. * @enabled: flag to keep track of whether vp is enabled or not
  82. *
  83. * XXX vp_common is probably not needed since it is per-SoC
  84. */
  85. struct omap_vp_instance {
  86. const struct omap_vp_common *common;
  87. u8 vpconfig;
  88. u8 vstepmin;
  89. u8 vstepmax;
  90. u8 vlimitto;
  91. u8 vstatus;
  92. u8 voltage;
  93. u8 id;
  94. bool enabled;
  95. };
  96. extern struct omap_vp_instance omap3_vp_mpu;
  97. extern struct omap_vp_instance omap3_vp_core;
  98. extern struct omap_vp_instance omap4_vp_mpu;
  99. extern struct omap_vp_instance omap4_vp_iva;
  100. extern struct omap_vp_instance omap4_vp_core;
  101. extern struct omap_vp_param omap3_mpu_vp_data;
  102. extern struct omap_vp_param omap3_core_vp_data;
  103. extern struct omap_vp_param omap4_mpu_vp_data;
  104. extern struct omap_vp_param omap4_iva_vp_data;
  105. extern struct omap_vp_param omap4_core_vp_data;
  106. void omap_vp_init(struct voltagedomain *voltdm);
  107. void omap_vp_enable(struct voltagedomain *voltdm);
  108. void omap_vp_disable(struct voltagedomain *voltdm);
  109. int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
  110. unsigned long target_volt);
  111. int omap_vp_update_errorgain(struct voltagedomain *voltdm,
  112. unsigned long target_volt);
  113. #endif