cpu.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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_AM33XX
  46. #define PRM_RSTCTRL 0x44E00F00
  47. #define PRM_RSTST 0x44E00F08
  48. #endif
  49. #define PRM_RSTCTRL_RESET 0x01
  50. #define PRM_RSTST_WARM_RESET_MASK 0x232
  51. #ifndef __KERNEL_STRICT_NAMES
  52. #ifndef __ASSEMBLY__
  53. /* Encapsulating core pll registers */
  54. struct cm_wkuppll {
  55. unsigned int wkclkstctrl; /* offset 0x00 */
  56. unsigned int wkctrlclkctrl; /* offset 0x04 */
  57. unsigned int wkgpio0clkctrl; /* offset 0x08 */
  58. unsigned int wkl4wkclkctrl; /* offset 0x0c */
  59. unsigned int resv2[4];
  60. unsigned int idlestdpllmpu; /* offset 0x20 */
  61. unsigned int resv3[2];
  62. unsigned int clkseldpllmpu; /* offset 0x2c */
  63. unsigned int resv4[1];
  64. unsigned int idlestdpllddr; /* offset 0x34 */
  65. unsigned int resv5[2];
  66. unsigned int clkseldpllddr; /* offset 0x40 */
  67. unsigned int resv6[4];
  68. unsigned int clkseldplldisp; /* offset 0x54 */
  69. unsigned int resv7[1];
  70. unsigned int idlestdpllcore; /* offset 0x5c */
  71. unsigned int resv8[2];
  72. unsigned int clkseldpllcore; /* offset 0x68 */
  73. unsigned int resv9[1];
  74. unsigned int idlestdpllper; /* offset 0x70 */
  75. unsigned int resv10[3];
  76. unsigned int divm4dpllcore; /* offset 0x80 */
  77. unsigned int divm5dpllcore; /* offset 0x84 */
  78. unsigned int clkmoddpllmpu; /* offset 0x88 */
  79. unsigned int clkmoddpllper; /* offset 0x8c */
  80. unsigned int clkmoddpllcore; /* offset 0x90 */
  81. unsigned int clkmoddpllddr; /* offset 0x94 */
  82. unsigned int clkmoddplldisp; /* offset 0x98 */
  83. unsigned int clkseldpllper; /* offset 0x9c */
  84. unsigned int divm2dpllddr; /* offset 0xA0 */
  85. unsigned int divm2dplldisp; /* offset 0xA4 */
  86. unsigned int divm2dpllmpu; /* offset 0xA8 */
  87. unsigned int divm2dpllper; /* offset 0xAC */
  88. unsigned int resv11[1];
  89. unsigned int wkup_uart0ctrl; /* offset 0xB4 */
  90. unsigned int wkup_i2c0ctrl; /* offset 0xB8 */
  91. unsigned int resv12[7];
  92. unsigned int divm6dpllcore; /* offset 0xD8 */
  93. };
  94. /**
  95. * Encapsulating peripheral functional clocks
  96. * pll registers
  97. */
  98. struct cm_perpll {
  99. unsigned int l4lsclkstctrl; /* offset 0x00 */
  100. unsigned int l3sclkstctrl; /* offset 0x04 */
  101. unsigned int l4fwclkstctrl; /* offset 0x08 */
  102. unsigned int l3clkstctrl; /* offset 0x0c */
  103. unsigned int resv1;
  104. unsigned int cpgmac0clkctrl; /* offset 0x14 */
  105. unsigned int lcdclkctrl; /* offset 0x18 */
  106. unsigned int usb0clkctrl; /* offset 0x1C */
  107. unsigned int resv2;
  108. unsigned int tptc0clkctrl; /* offset 0x24 */
  109. unsigned int emifclkctrl; /* offset 0x28 */
  110. unsigned int ocmcramclkctrl; /* offset 0x2c */
  111. unsigned int gpmcclkctrl; /* offset 0x30 */
  112. unsigned int mcasp0clkctrl; /* offset 0x34 */
  113. unsigned int uart5clkctrl; /* offset 0x38 */
  114. unsigned int mmc0clkctrl; /* offset 0x3C */
  115. unsigned int elmclkctrl; /* offset 0x40 */
  116. unsigned int i2c2clkctrl; /* offset 0x44 */
  117. unsigned int i2c1clkctrl; /* offset 0x48 */
  118. unsigned int spi0clkctrl; /* offset 0x4C */
  119. unsigned int spi1clkctrl; /* offset 0x50 */
  120. unsigned int resv3[3];
  121. unsigned int l4lsclkctrl; /* offset 0x60 */
  122. unsigned int l4fwclkctrl; /* offset 0x64 */
  123. unsigned int mcasp1clkctrl; /* offset 0x68 */
  124. unsigned int uart1clkctrl; /* offset 0x6C */
  125. unsigned int uart2clkctrl; /* offset 0x70 */
  126. unsigned int uart3clkctrl; /* offset 0x74 */
  127. unsigned int uart4clkctrl; /* offset 0x78 */
  128. unsigned int timer7clkctrl; /* offset 0x7C */
  129. unsigned int timer2clkctrl; /* offset 0x80 */
  130. unsigned int timer3clkctrl; /* offset 0x84 */
  131. unsigned int timer4clkctrl; /* offset 0x88 */
  132. unsigned int resv4[8];
  133. unsigned int gpio1clkctrl; /* offset 0xAC */
  134. unsigned int gpio2clkctrl; /* offset 0xB0 */
  135. unsigned int gpio3clkctrl; /* offset 0xB4 */
  136. unsigned int resv5;
  137. unsigned int tpccclkctrl; /* offset 0xBC */
  138. unsigned int dcan0clkctrl; /* offset 0xC0 */
  139. unsigned int dcan1clkctrl; /* offset 0xC4 */
  140. unsigned int resv6[2];
  141. unsigned int emiffwclkctrl; /* offset 0xD0 */
  142. unsigned int resv7[2];
  143. unsigned int l3instrclkctrl; /* offset 0xDC */
  144. unsigned int l3clkctrl; /* Offset 0xE0 */
  145. unsigned int resv8[4];
  146. unsigned int mmc1clkctrl; /* offset 0xF4 */
  147. unsigned int mmc2clkctrl; /* offset 0xF8 */
  148. unsigned int resv9[8];
  149. unsigned int l4hsclkstctrl; /* offset 0x11C */
  150. unsigned int l4hsclkctrl; /* offset 0x120 */
  151. unsigned int resv10[8];
  152. unsigned int cpswclkstctrl; /* offset 0x144 */
  153. };
  154. /* Encapsulating Display pll registers */
  155. struct cm_dpll {
  156. unsigned int resv1[2];
  157. unsigned int clktimer2clk; /* offset 0x08 */
  158. };
  159. /* Watchdog timer registers */
  160. struct wd_timer {
  161. unsigned int resv1[4];
  162. unsigned int wdtwdsc; /* offset 0x010 */
  163. unsigned int wdtwdst; /* offset 0x014 */
  164. unsigned int wdtwisr; /* offset 0x018 */
  165. unsigned int wdtwier; /* offset 0x01C */
  166. unsigned int wdtwwer; /* offset 0x020 */
  167. unsigned int wdtwclr; /* offset 0x024 */
  168. unsigned int wdtwcrr; /* offset 0x028 */
  169. unsigned int wdtwldr; /* offset 0x02C */
  170. unsigned int wdtwtgr; /* offset 0x030 */
  171. unsigned int wdtwwps; /* offset 0x034 */
  172. unsigned int resv2[3];
  173. unsigned int wdtwdly; /* offset 0x044 */
  174. unsigned int wdtwspr; /* offset 0x048 */
  175. unsigned int resv3[1];
  176. unsigned int wdtwqeoi; /* offset 0x050 */
  177. unsigned int wdtwqstar; /* offset 0x054 */
  178. unsigned int wdtwqsta; /* offset 0x058 */
  179. unsigned int wdtwqens; /* offset 0x05C */
  180. unsigned int wdtwqenc; /* offset 0x060 */
  181. unsigned int resv4[39];
  182. unsigned int wdt_unfr; /* offset 0x100 */
  183. };
  184. /* Timer 32 bit registers */
  185. struct gptimer {
  186. unsigned int tidr; /* offset 0x00 */
  187. unsigned char res1[12];
  188. unsigned int tiocp_cfg; /* offset 0x10 */
  189. unsigned char res2[12];
  190. unsigned int tier; /* offset 0x20 */
  191. unsigned int tistatr; /* offset 0x24 */
  192. unsigned int tistat; /* offset 0x28 */
  193. unsigned int tisr; /* offset 0x2c */
  194. unsigned int tcicr; /* offset 0x30 */
  195. unsigned int twer; /* offset 0x34 */
  196. unsigned int tclr; /* offset 0x38 */
  197. unsigned int tcrr; /* offset 0x3c */
  198. unsigned int tldr; /* offset 0x40 */
  199. unsigned int ttgr; /* offset 0x44 */
  200. unsigned int twpc; /* offset 0x48 */
  201. unsigned int tmar; /* offset 0x4c */
  202. unsigned int tcar1; /* offset 0x50 */
  203. unsigned int tscir; /* offset 0x54 */
  204. unsigned int tcar2; /* offset 0x58 */
  205. };
  206. /* UART Registers */
  207. struct uart_sys {
  208. unsigned int resv1[21];
  209. unsigned int uartsyscfg; /* offset 0x54 */
  210. unsigned int uartsyssts; /* offset 0x58 */
  211. };
  212. /* VTP Registers */
  213. struct vtp_reg {
  214. unsigned int vtp0ctrlreg;
  215. };
  216. /* Control Status Register */
  217. struct ctrl_stat {
  218. unsigned int resv1[16];
  219. unsigned int statusreg; /* ofset 0x40 */
  220. };
  221. /* AM33XX GPIO registers */
  222. #define OMAP_GPIO_REVISION 0x0000
  223. #define OMAP_GPIO_SYSCONFIG 0x0010
  224. #define OMAP_GPIO_SYSSTATUS 0x0114
  225. #define OMAP_GPIO_IRQSTATUS1 0x002c
  226. #define OMAP_GPIO_IRQSTATUS2 0x0030
  227. #define OMAP_GPIO_CTRL 0x0130
  228. #define OMAP_GPIO_OE 0x0134
  229. #define OMAP_GPIO_DATAIN 0x0138
  230. #define OMAP_GPIO_DATAOUT 0x013c
  231. #define OMAP_GPIO_LEVELDETECT0 0x0140
  232. #define OMAP_GPIO_LEVELDETECT1 0x0144
  233. #define OMAP_GPIO_RISINGDETECT 0x0148
  234. #define OMAP_GPIO_FALLINGDETECT 0x014c
  235. #define OMAP_GPIO_DEBOUNCE_EN 0x0150
  236. #define OMAP_GPIO_DEBOUNCE_VAL 0x0154
  237. #define OMAP_GPIO_CLEARDATAOUT 0x0190
  238. #define OMAP_GPIO_SETDATAOUT 0x0194
  239. /* Control Device Register */
  240. struct ctrl_dev {
  241. unsigned int deviceid; /* offset 0x00 */
  242. unsigned int resv1[11];
  243. unsigned int macid0l; /* offset 0x30 */
  244. unsigned int macid0h; /* offset 0x34 */
  245. unsigned int macid1l; /* offset 0x38 */
  246. unsigned int macid1h; /* offset 0x3c */
  247. unsigned int resv2[4];
  248. unsigned int miisel; /* offset 0x50 */
  249. };
  250. #endif /* __ASSEMBLY__ */
  251. #endif /* __KERNEL_STRICT_NAMES */
  252. #endif /* _AM33XX_CPU_H */