cm.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #ifndef __ARCH_ASM_MACH_OMAP2_CM_H
  2. #define __ARCH_ASM_MACH_OMAP2_CM_H
  3. /*
  4. * OMAP2/3 Clock Management (CM) register definitions
  5. *
  6. * Copyright (C) 2007-2009 Texas Instruments, Inc.
  7. * Copyright (C) 2007-2009 Nokia Corporation
  8. *
  9. * Written by Paul Walmsley
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include "prcm-common.h"
  16. #define OMAP2420_CM_REGADDR(module, reg) \
  17. OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
  18. #define OMAP2430_CM_REGADDR(module, reg) \
  19. OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
  20. #define OMAP34XX_CM_REGADDR(module, reg) \
  21. OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
  22. #define OMAP44XX_CM1_REGADDR(module, reg) \
  23. OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
  24. #define OMAP44XX_CM2_REGADDR(module, reg) \
  25. OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
  26. #include "cm44xx.h"
  27. /*
  28. * Architecture-specific global CM registers
  29. * Use cm_{read,write}_reg() with these registers.
  30. * These registers appear once per CM module.
  31. */
  32. #define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
  33. #define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
  34. #define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
  35. #define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
  36. #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
  37. /*
  38. * Module specific CM registers from CM_BASE + domain offset
  39. * Use cm_{read,write}_mod_reg() with these registers.
  40. * These register offsets generally appear in more than one PRCM submodule.
  41. */
  42. /* Common between 24xx and 34xx */
  43. #define CM_FCLKEN 0x0000
  44. #define CM_FCLKEN1 CM_FCLKEN
  45. #define CM_CLKEN CM_FCLKEN
  46. #define CM_ICLKEN 0x0010
  47. #define CM_ICLKEN1 CM_ICLKEN
  48. #define CM_ICLKEN2 0x0014
  49. #define CM_ICLKEN3 0x0018
  50. #define CM_IDLEST 0x0020
  51. #define CM_IDLEST1 CM_IDLEST
  52. #define CM_IDLEST2 0x0024
  53. #define CM_AUTOIDLE 0x0030
  54. #define CM_AUTOIDLE1 CM_AUTOIDLE
  55. #define CM_AUTOIDLE2 0x0034
  56. #define CM_AUTOIDLE3 0x0038
  57. #define CM_CLKSEL 0x0040
  58. #define CM_CLKSEL1 CM_CLKSEL
  59. #define CM_CLKSEL2 0x0044
  60. #define OMAP2_CM_CLKSTCTRL 0x0048
  61. #define OMAP4_CM_CLKSTCTRL 0x0000
  62. /* Architecture-specific registers */
  63. #define OMAP24XX_CM_FCLKEN2 0x0004
  64. #define OMAP24XX_CM_ICLKEN4 0x001c
  65. #define OMAP24XX_CM_AUTOIDLE4 0x003c
  66. #define OMAP2430_CM_IDLEST3 0x0028
  67. #define OMAP3430_CM_CLKEN_PLL 0x0004
  68. #define OMAP3430ES2_CM_CLKEN2 0x0004
  69. #define OMAP3430ES2_CM_FCLKEN3 0x0008
  70. #define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
  71. #define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
  72. #define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
  73. #define OMAP3430_CM_CLKSEL1 CM_CLKSEL
  74. #define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
  75. #define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
  76. #define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
  77. #define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
  78. #define OMAP3430_CM_CLKSTST 0x004c
  79. #define OMAP3430ES2_CM_CLKSEL4 0x004c
  80. #define OMAP3430ES2_CM_CLKSEL5 0x0050
  81. #define OMAP3430_CM_CLKSEL2_EMU 0x0050
  82. #define OMAP3430_CM_CLKSEL3_EMU 0x0054
  83. /* CM2.CEFUSE_CM2 register offsets */
  84. /* OMAP4 modulemode control */
  85. #define OMAP4430_MODULEMODE_HWCTRL 0
  86. #define OMAP4430_MODULEMODE_SWCTRL 1
  87. /* Clock management domain register get/set */
  88. #ifndef __ASSEMBLER__
  89. extern u32 cm_read_mod_reg(s16 module, u16 idx);
  90. extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
  91. extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
  92. extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
  93. u8 idlest_shift);
  94. extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
  95. static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
  96. {
  97. return cm_rmw_mod_reg_bits(bits, bits, module, idx);
  98. }
  99. static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
  100. {
  101. return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
  102. }
  103. #endif
  104. /* CM register bits shared between 24XX and 3430 */
  105. /* CM_CLKSEL_GFX */
  106. #define OMAP_CLKSEL_GFX_SHIFT 0
  107. #define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
  108. /* CM_ICLKEN_GFX */
  109. #define OMAP_EN_GFX_SHIFT 0
  110. #define OMAP_EN_GFX_MASK (1 << 0)
  111. /* CM_IDLEST_GFX */
  112. #define OMAP_ST_GFX_MASK (1 << 0)
  113. /* CM_IDLEST indicator */
  114. #define OMAP24XX_CM_IDLEST_VAL 0
  115. #define OMAP34XX_CM_IDLEST_VAL 1
  116. /*
  117. * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
  118. * PRCM to request that a module exit the inactive state in the case of
  119. * OMAP2 & 3.
  120. * In the case of OMAP4 this is the max duration in microseconds for the
  121. * module to reach the functionnal state from an inactive state.
  122. */
  123. #define MAX_MODULE_READY_TIME 2000
  124. #endif