cpu.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*
  2. * cpu.h
  3. *
  4. * AM33xx specific header file
  5. *
  6. * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. #ifndef _AM33XX_CPU_H
  19. #define _AM33XX_CPU_H
  20. #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
  21. #include <asm/types.h>
  22. #endif /* !(__KERNEL_STRICT_NAMES || __ASSEMBLY__) */
  23. #include <asm/arch/hardware.h>
  24. #define BIT(x) (1 << x)
  25. #define CL_BIT(x) (0 << x)
  26. /* Timer register bits */
  27. #define TCLR_ST BIT(0) /* Start=1 Stop=0 */
  28. #define TCLR_AR BIT(1) /* Auto reload */
  29. #define TCLR_PRE BIT(5) /* Pre-scaler enable */
  30. #define TCLR_PTV_SHIFT (2) /* Pre-scaler shift value */
  31. #define TCLR_PRE_DISABLE CL_BIT(5) /* Pre-scalar disable */
  32. /* device type */
  33. #define DEVICE_MASK (BIT(8) | BIT(9) | BIT(10))
  34. #define TST_DEVICE 0x0
  35. #define EMU_DEVICE 0x1
  36. #define HS_DEVICE 0x2
  37. #define GP_DEVICE 0x3
  38. /* cpu-id for AM33XX family */
  39. #define AM335X 0xB944
  40. #define DEVICE_ID 0x44E10600
  41. /* This gives the status of the boot mode pins on the evm */
  42. #define SYSBOOT_MASK (BIT(0) | BIT(1) | BIT(2)\
  43. | BIT(3) | BIT(4))
  44. /* Reset control */
  45. #ifdef CONFIG_AM335X
  46. #define PRM_RSTCTRL 0x44E00F00
  47. #endif
  48. #define PRM_RSTCTRL_RESET 0x01
  49. #ifndef __KERNEL_STRICT_NAMES
  50. #ifndef __ASSEMBLY__
  51. /* Encapsulating core pll registers */
  52. struct cm_wkuppll {
  53. unsigned int wkclkstctrl; /* offset 0x00 */
  54. unsigned int wkctrlclkctrl; /* offset 0x04 */
  55. unsigned int resv1[1];
  56. unsigned int wkl4wkclkctrl; /* offset 0x0c */
  57. unsigned int resv2[4];
  58. unsigned int idlestdpllmpu; /* offset 0x20 */
  59. unsigned int resv3[2];
  60. unsigned int clkseldpllmpu; /* offset 0x2c */
  61. unsigned int resv4[1];
  62. unsigned int idlestdpllddr; /* offset 0x34 */
  63. unsigned int resv5[2];
  64. unsigned int clkseldpllddr; /* offset 0x40 */
  65. unsigned int resv6[4];
  66. unsigned int clkseldplldisp; /* offset 0x54 */
  67. unsigned int resv7[1];
  68. unsigned int idlestdpllcore; /* offset 0x5c */
  69. unsigned int resv8[2];
  70. unsigned int clkseldpllcore; /* offset 0x68 */
  71. unsigned int resv9[1];
  72. unsigned int idlestdpllper; /* offset 0x70 */
  73. unsigned int resv10[3];
  74. unsigned int divm4dpllcore; /* offset 0x80 */
  75. unsigned int divm5dpllcore; /* offset 0x84 */
  76. unsigned int clkmoddpllmpu; /* offset 0x88 */
  77. unsigned int clkmoddpllper; /* offset 0x8c */
  78. unsigned int clkmoddpllcore; /* offset 0x90 */
  79. unsigned int clkmoddpllddr; /* offset 0x94 */
  80. unsigned int clkmoddplldisp; /* offset 0x98 */
  81. unsigned int clkseldpllper; /* offset 0x9c */
  82. unsigned int divm2dpllddr; /* offset 0xA0 */
  83. unsigned int divm2dplldisp; /* offset 0xA4 */
  84. unsigned int divm2dpllmpu; /* offset 0xA8 */
  85. unsigned int divm2dpllper; /* offset 0xAC */
  86. unsigned int resv11[1];
  87. unsigned int wkup_uart0ctrl; /* offset 0xB4 */
  88. unsigned int resv12[8];
  89. unsigned int divm6dpllcore; /* offset 0xD8 */
  90. };
  91. /**
  92. * Encapsulating peripheral functional clocks
  93. * pll registers
  94. */
  95. struct cm_perpll {
  96. unsigned int l4lsclkstctrl; /* offset 0x00 */
  97. unsigned int l3sclkstctrl; /* offset 0x04 */
  98. unsigned int l4fwclkstctrl; /* offset 0x08 */
  99. unsigned int l3clkstctrl; /* offset 0x0c */
  100. unsigned int resv1[6];
  101. unsigned int emifclkctrl; /* offset 0x28 */
  102. unsigned int ocmcramclkctrl; /* offset 0x2c */
  103. unsigned int resv2[12];
  104. unsigned int l4lsclkctrl; /* offset 0x60 */
  105. unsigned int l4fwclkctrl; /* offset 0x64 */
  106. unsigned int resv3[6];
  107. unsigned int timer2clkctrl; /* offset 0x80 */
  108. unsigned int resv4[19];
  109. unsigned int emiffwclkctrl; /* offset 0xD0 */
  110. unsigned int resv5[2];
  111. unsigned int l3instrclkctrl; /* offset 0xDC */
  112. unsigned int l3clkctrl; /* Offset 0xE0 */
  113. unsigned int resv6[14];
  114. unsigned int l4hsclkstctrl; /* offset 0x11C */
  115. unsigned int l4hsclkctrl; /* offset 0x120 */
  116. };
  117. /* Encapsulating Display pll registers */
  118. struct cm_dpll {
  119. unsigned int resv1[2];
  120. unsigned int clktimer2clk; /* offset 0x08 */
  121. };
  122. /* Watchdog timer registers */
  123. struct wd_timer {
  124. unsigned int resv1[4];
  125. unsigned int wdtwdsc; /* offset 0x010 */
  126. unsigned int wdtwdst; /* offset 0x014 */
  127. unsigned int wdtwisr; /* offset 0x018 */
  128. unsigned int wdtwier; /* offset 0x01C */
  129. unsigned int wdtwwer; /* offset 0x020 */
  130. unsigned int wdtwclr; /* offset 0x024 */
  131. unsigned int wdtwcrr; /* offset 0x028 */
  132. unsigned int wdtwldr; /* offset 0x02C */
  133. unsigned int wdtwtgr; /* offset 0x030 */
  134. unsigned int wdtwwps; /* offset 0x034 */
  135. unsigned int resv2[3];
  136. unsigned int wdtwdly; /* offset 0x044 */
  137. unsigned int wdtwspr; /* offset 0x048 */
  138. unsigned int resv3[1];
  139. unsigned int wdtwqeoi; /* offset 0x050 */
  140. unsigned int wdtwqstar; /* offset 0x054 */
  141. unsigned int wdtwqsta; /* offset 0x058 */
  142. unsigned int wdtwqens; /* offset 0x05C */
  143. unsigned int wdtwqenc; /* offset 0x060 */
  144. unsigned int resv4[39];
  145. unsigned int wdt_unfr; /* offset 0x100 */
  146. };
  147. /* Timer Registers */
  148. struct timer_reg {
  149. unsigned int resv1[4];
  150. unsigned int tiocpcfgreg; /* offset 0x10 */
  151. unsigned int resv2[9];
  152. unsigned int tclrreg; /* offset 0x38 */
  153. unsigned int tcrrreg; /* offset 0x3C */
  154. unsigned int tldrreg; /* offset 0x40 */
  155. unsigned int resv3[4];
  156. unsigned int tsicrreg; /* offset 0x54 */
  157. };
  158. /* Timer 32 bit registers */
  159. struct gptimer {
  160. unsigned int tidr; /* offset 0x00 */
  161. unsigned int res1[0xc];
  162. unsigned int tiocp_cfg; /* offset 0x10 */
  163. unsigned int res2[0xc];
  164. unsigned int tier; /* offset 0x20 */
  165. unsigned int tistatr; /* offset 0x24 */
  166. unsigned int tistat; /* offset 0x28 */
  167. unsigned int tisr; /* offset 0x2c */
  168. unsigned int tcicr; /* offset 0x30 */
  169. unsigned int twer; /* offset 0x34 */
  170. unsigned int tclr; /* offset 0x38 */
  171. unsigned int tcrr; /* offset 0x3c */
  172. unsigned int tldr; /* offset 0x40 */
  173. unsigned int ttgr; /* offset 0x44 */
  174. unsigned int twpc; /* offset 0x48 */
  175. unsigned int tmar; /* offset 0x4c */
  176. unsigned int tcar1; /* offset 0x50 */
  177. unsigned int tscir; /* offset 0x54 */
  178. unsigned int tcar2; /* offset 0x58 */
  179. };
  180. /* UART Registers */
  181. struct uart_sys {
  182. unsigned int resv1[21];
  183. unsigned int uartsyscfg; /* offset 0x54 */
  184. unsigned int uartsyssts; /* offset 0x58 */
  185. };
  186. /* VTP Registers */
  187. struct vtp_reg {
  188. unsigned int vtp0ctrlreg;
  189. };
  190. /* Control Status Register */
  191. struct ctrl_stat {
  192. unsigned int resv1[16];
  193. unsigned int statusreg; /* ofset 0x40 */
  194. };
  195. void init_timer(void);
  196. #endif /* __ASSEMBLY__ */
  197. #endif /* __KERNEL_STRICT_NAMES */
  198. #endif /* _AM33XX_CPU_H */