cpu.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. struct gpmc_cs {
  54. u32 config1; /* 0x00 */
  55. u32 config2; /* 0x04 */
  56. u32 config3; /* 0x08 */
  57. u32 config4; /* 0x0C */
  58. u32 config5; /* 0x10 */
  59. u32 config6; /* 0x14 */
  60. u32 config7; /* 0x18 */
  61. u32 nand_cmd; /* 0x1C */
  62. u32 nand_adr; /* 0x20 */
  63. u32 nand_dat; /* 0x24 */
  64. u8 res[8]; /* blow up to 0x30 byte */
  65. };
  66. struct bch_res_0_3 {
  67. u32 bch_result_x[4];
  68. };
  69. struct gpmc {
  70. u8 res1[0x10];
  71. u32 sysconfig; /* 0x10 */
  72. u8 res2[0x4];
  73. u32 irqstatus; /* 0x18 */
  74. u32 irqenable; /* 0x1C */
  75. u8 res3[0x20];
  76. u32 timeout_control; /* 0x40 */
  77. u8 res4[0xC];
  78. u32 config; /* 0x50 */
  79. u32 status; /* 0x54 */
  80. u8 res5[0x8]; /* 0x58 */
  81. struct gpmc_cs cs[8]; /* 0x60, 0x90, .. */
  82. u8 res6[0x14]; /* 0x1E0 */
  83. u32 ecc_config; /* 0x1F4 */
  84. u32 ecc_control; /* 0x1F8 */
  85. u32 ecc_size_config; /* 0x1FC */
  86. u32 ecc1_result; /* 0x200 */
  87. u32 ecc2_result; /* 0x204 */
  88. u32 ecc3_result; /* 0x208 */
  89. u32 ecc4_result; /* 0x20C */
  90. u32 ecc5_result; /* 0x210 */
  91. u32 ecc6_result; /* 0x214 */
  92. u32 ecc7_result; /* 0x218 */
  93. u32 ecc8_result; /* 0x21C */
  94. u32 ecc9_result; /* 0x220 */
  95. u8 res7[12]; /* 0x224 */
  96. u32 testmomde_ctrl; /* 0x230 */
  97. u8 res8[12]; /* 0x234 */
  98. struct bch_res_0_3 bch_result_0_3[2]; /* 0x240 */
  99. };
  100. /* Used for board specific gpmc initialization */
  101. extern struct gpmc *gpmc_cfg;
  102. /* Encapsulating core pll registers */
  103. struct cm_wkuppll {
  104. unsigned int wkclkstctrl; /* offset 0x00 */
  105. unsigned int wkctrlclkctrl; /* offset 0x04 */
  106. unsigned int wkgpio0clkctrl; /* offset 0x08 */
  107. unsigned int wkl4wkclkctrl; /* offset 0x0c */
  108. unsigned int resv2[4];
  109. unsigned int idlestdpllmpu; /* offset 0x20 */
  110. unsigned int resv3[2];
  111. unsigned int clkseldpllmpu; /* offset 0x2c */
  112. unsigned int resv4[1];
  113. unsigned int idlestdpllddr; /* offset 0x34 */
  114. unsigned int resv5[2];
  115. unsigned int clkseldpllddr; /* offset 0x40 */
  116. unsigned int resv6[4];
  117. unsigned int clkseldplldisp; /* offset 0x54 */
  118. unsigned int resv7[1];
  119. unsigned int idlestdpllcore; /* offset 0x5c */
  120. unsigned int resv8[2];
  121. unsigned int clkseldpllcore; /* offset 0x68 */
  122. unsigned int resv9[1];
  123. unsigned int idlestdpllper; /* offset 0x70 */
  124. unsigned int resv10[3];
  125. unsigned int divm4dpllcore; /* offset 0x80 */
  126. unsigned int divm5dpllcore; /* offset 0x84 */
  127. unsigned int clkmoddpllmpu; /* offset 0x88 */
  128. unsigned int clkmoddpllper; /* offset 0x8c */
  129. unsigned int clkmoddpllcore; /* offset 0x90 */
  130. unsigned int clkmoddpllddr; /* offset 0x94 */
  131. unsigned int clkmoddplldisp; /* offset 0x98 */
  132. unsigned int clkseldpllper; /* offset 0x9c */
  133. unsigned int divm2dpllddr; /* offset 0xA0 */
  134. unsigned int divm2dplldisp; /* offset 0xA4 */
  135. unsigned int divm2dpllmpu; /* offset 0xA8 */
  136. unsigned int divm2dpllper; /* offset 0xAC */
  137. unsigned int resv11[1];
  138. unsigned int wkup_uart0ctrl; /* offset 0xB4 */
  139. unsigned int wkup_i2c0ctrl; /* offset 0xB8 */
  140. unsigned int resv12[7];
  141. unsigned int divm6dpllcore; /* offset 0xD8 */
  142. };
  143. /**
  144. * Encapsulating peripheral functional clocks
  145. * pll registers
  146. */
  147. struct cm_perpll {
  148. unsigned int l4lsclkstctrl; /* offset 0x00 */
  149. unsigned int l3sclkstctrl; /* offset 0x04 */
  150. unsigned int l4fwclkstctrl; /* offset 0x08 */
  151. unsigned int l3clkstctrl; /* offset 0x0c */
  152. unsigned int resv1;
  153. unsigned int cpgmac0clkctrl; /* offset 0x14 */
  154. unsigned int lcdclkctrl; /* offset 0x18 */
  155. unsigned int usb0clkctrl; /* offset 0x1C */
  156. unsigned int resv2;
  157. unsigned int tptc0clkctrl; /* offset 0x24 */
  158. unsigned int emifclkctrl; /* offset 0x28 */
  159. unsigned int ocmcramclkctrl; /* offset 0x2c */
  160. unsigned int gpmcclkctrl; /* offset 0x30 */
  161. unsigned int mcasp0clkctrl; /* offset 0x34 */
  162. unsigned int uart5clkctrl; /* offset 0x38 */
  163. unsigned int mmc0clkctrl; /* offset 0x3C */
  164. unsigned int elmclkctrl; /* offset 0x40 */
  165. unsigned int i2c2clkctrl; /* offset 0x44 */
  166. unsigned int i2c1clkctrl; /* offset 0x48 */
  167. unsigned int spi0clkctrl; /* offset 0x4C */
  168. unsigned int spi1clkctrl; /* offset 0x50 */
  169. unsigned int resv3[3];
  170. unsigned int l4lsclkctrl; /* offset 0x60 */
  171. unsigned int l4fwclkctrl; /* offset 0x64 */
  172. unsigned int mcasp1clkctrl; /* offset 0x68 */
  173. unsigned int uart1clkctrl; /* offset 0x6C */
  174. unsigned int uart2clkctrl; /* offset 0x70 */
  175. unsigned int uart3clkctrl; /* offset 0x74 */
  176. unsigned int uart4clkctrl; /* offset 0x78 */
  177. unsigned int timer7clkctrl; /* offset 0x7C */
  178. unsigned int timer2clkctrl; /* offset 0x80 */
  179. unsigned int timer3clkctrl; /* offset 0x84 */
  180. unsigned int timer4clkctrl; /* offset 0x88 */
  181. unsigned int resv4[8];
  182. unsigned int gpio1clkctrl; /* offset 0xAC */
  183. unsigned int gpio2clkctrl; /* offset 0xB0 */
  184. unsigned int gpio3clkctrl; /* offset 0xB4 */
  185. unsigned int resv5;
  186. unsigned int tpccclkctrl; /* offset 0xBC */
  187. unsigned int dcan0clkctrl; /* offset 0xC0 */
  188. unsigned int dcan1clkctrl; /* offset 0xC4 */
  189. unsigned int resv6[2];
  190. unsigned int emiffwclkctrl; /* offset 0xD0 */
  191. unsigned int resv7[2];
  192. unsigned int l3instrclkctrl; /* offset 0xDC */
  193. unsigned int l3clkctrl; /* Offset 0xE0 */
  194. unsigned int resv8[4];
  195. unsigned int mmc1clkctrl; /* offset 0xF4 */
  196. unsigned int mmc2clkctrl; /* offset 0xF8 */
  197. unsigned int resv9[8];
  198. unsigned int l4hsclkstctrl; /* offset 0x11C */
  199. unsigned int l4hsclkctrl; /* offset 0x120 */
  200. unsigned int resv10[8];
  201. unsigned int cpswclkstctrl; /* offset 0x144 */
  202. };
  203. /* Encapsulating Display pll registers */
  204. struct cm_dpll {
  205. unsigned int resv1[2];
  206. unsigned int clktimer2clk; /* offset 0x08 */
  207. };
  208. /* Control Module RTC registers */
  209. struct cm_rtc {
  210. unsigned int rtcclkctrl; /* offset 0x0 */
  211. unsigned int clkstctrl; /* offset 0x4 */
  212. };
  213. /* Watchdog timer registers */
  214. struct wd_timer {
  215. unsigned int resv1[4];
  216. unsigned int wdtwdsc; /* offset 0x010 */
  217. unsigned int wdtwdst; /* offset 0x014 */
  218. unsigned int wdtwisr; /* offset 0x018 */
  219. unsigned int wdtwier; /* offset 0x01C */
  220. unsigned int wdtwwer; /* offset 0x020 */
  221. unsigned int wdtwclr; /* offset 0x024 */
  222. unsigned int wdtwcrr; /* offset 0x028 */
  223. unsigned int wdtwldr; /* offset 0x02C */
  224. unsigned int wdtwtgr; /* offset 0x030 */
  225. unsigned int wdtwwps; /* offset 0x034 */
  226. unsigned int resv2[3];
  227. unsigned int wdtwdly; /* offset 0x044 */
  228. unsigned int wdtwspr; /* offset 0x048 */
  229. unsigned int resv3[1];
  230. unsigned int wdtwqeoi; /* offset 0x050 */
  231. unsigned int wdtwqstar; /* offset 0x054 */
  232. unsigned int wdtwqsta; /* offset 0x058 */
  233. unsigned int wdtwqens; /* offset 0x05C */
  234. unsigned int wdtwqenc; /* offset 0x060 */
  235. unsigned int resv4[39];
  236. unsigned int wdt_unfr; /* offset 0x100 */
  237. };
  238. /* Timer 32 bit registers */
  239. struct gptimer {
  240. unsigned int tidr; /* offset 0x00 */
  241. unsigned char res1[12];
  242. unsigned int tiocp_cfg; /* offset 0x10 */
  243. unsigned char res2[12];
  244. unsigned int tier; /* offset 0x20 */
  245. unsigned int tistatr; /* offset 0x24 */
  246. unsigned int tistat; /* offset 0x28 */
  247. unsigned int tisr; /* offset 0x2c */
  248. unsigned int tcicr; /* offset 0x30 */
  249. unsigned int twer; /* offset 0x34 */
  250. unsigned int tclr; /* offset 0x38 */
  251. unsigned int tcrr; /* offset 0x3c */
  252. unsigned int tldr; /* offset 0x40 */
  253. unsigned int ttgr; /* offset 0x44 */
  254. unsigned int twpc; /* offset 0x48 */
  255. unsigned int tmar; /* offset 0x4c */
  256. unsigned int tcar1; /* offset 0x50 */
  257. unsigned int tscir; /* offset 0x54 */
  258. unsigned int tcar2; /* offset 0x58 */
  259. };
  260. /* RTC Registers */
  261. struct rtc_regs {
  262. unsigned int res[21];
  263. unsigned int osc; /* offset 0x54 */
  264. unsigned int res2[5];
  265. unsigned int kick0r; /* offset 0x6c */
  266. unsigned int kick1r; /* offset 0x70 */
  267. };
  268. /* UART Registers */
  269. struct uart_sys {
  270. unsigned int resv1[21];
  271. unsigned int uartsyscfg; /* offset 0x54 */
  272. unsigned int uartsyssts; /* offset 0x58 */
  273. };
  274. /* VTP Registers */
  275. struct vtp_reg {
  276. unsigned int vtp0ctrlreg;
  277. };
  278. /* Control Status Register */
  279. struct ctrl_stat {
  280. unsigned int resv1[16];
  281. unsigned int statusreg; /* ofset 0x40 */
  282. unsigned int resv2[51];
  283. unsigned int secure_emif_sdram_config; /* offset 0x0110 */
  284. };
  285. /* AM33XX GPIO registers */
  286. #define OMAP_GPIO_REVISION 0x0000
  287. #define OMAP_GPIO_SYSCONFIG 0x0010
  288. #define OMAP_GPIO_SYSSTATUS 0x0114
  289. #define OMAP_GPIO_IRQSTATUS1 0x002c
  290. #define OMAP_GPIO_IRQSTATUS2 0x0030
  291. #define OMAP_GPIO_CTRL 0x0130
  292. #define OMAP_GPIO_OE 0x0134
  293. #define OMAP_GPIO_DATAIN 0x0138
  294. #define OMAP_GPIO_DATAOUT 0x013c
  295. #define OMAP_GPIO_LEVELDETECT0 0x0140
  296. #define OMAP_GPIO_LEVELDETECT1 0x0144
  297. #define OMAP_GPIO_RISINGDETECT 0x0148
  298. #define OMAP_GPIO_FALLINGDETECT 0x014c
  299. #define OMAP_GPIO_DEBOUNCE_EN 0x0150
  300. #define OMAP_GPIO_DEBOUNCE_VAL 0x0154
  301. #define OMAP_GPIO_CLEARDATAOUT 0x0190
  302. #define OMAP_GPIO_SETDATAOUT 0x0194
  303. /* Control Device Register */
  304. struct ctrl_dev {
  305. unsigned int deviceid; /* offset 0x00 */
  306. unsigned int resv1[11];
  307. unsigned int macid0l; /* offset 0x30 */
  308. unsigned int macid0h; /* offset 0x34 */
  309. unsigned int macid1l; /* offset 0x38 */
  310. unsigned int macid1h; /* offset 0x3c */
  311. unsigned int resv2[4];
  312. unsigned int miisel; /* offset 0x50 */
  313. };
  314. #endif /* __ASSEMBLY__ */
  315. #endif /* __KERNEL_STRICT_NAMES */
  316. #endif /* _AM33XX_CPU_H */