cpu.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /*
  2. * (C) Copyright 2006-2008
  3. * Texas Instruments, <www.ti.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. */
  24. #ifndef _CPU_H
  25. #define _CPU_H
  26. /* Register offsets of common modules */
  27. /* Control */
  28. #ifndef __ASSEMBLY__
  29. typedef struct ctrl {
  30. unsigned char res1[0xC0];
  31. unsigned short gpmc_nadv_ale; /* 0xC0 */
  32. unsigned short gpmc_noe; /* 0xC2 */
  33. unsigned short gpmc_nwe; /* 0xC4 */
  34. unsigned char res2[0x22A];
  35. unsigned int status; /* 0x2F0 */
  36. unsigned int gpstatus; /* 0x2F4 */
  37. unsigned char res3[0x08];
  38. unsigned int rpubkey_0; /* 0x300 */
  39. unsigned int rpubkey_1; /* 0x304 */
  40. unsigned int rpubkey_2; /* 0x308 */
  41. unsigned int rpubkey_3; /* 0x30C */
  42. unsigned int rpubkey_4; /* 0x310 */
  43. unsigned char res4[0x04];
  44. unsigned int randkey_0; /* 0x318 */
  45. unsigned int randkey_1; /* 0x31C */
  46. unsigned int randkey_2; /* 0x320 */
  47. unsigned int randkey_3; /* 0x324 */
  48. unsigned char res5[0x124];
  49. unsigned int ctrl_omap_stat; /* 0x44C */
  50. } ctrl_t;
  51. #else /* __ASSEMBLY__ */
  52. #define CONTROL_STATUS 0x2F0
  53. #endif /* __ASSEMBLY__ */
  54. /* cpu type */
  55. #define OMAP3503 0x5c00
  56. #define OMAP3515 0x1c00
  57. #define OMAP3525 0x4c00
  58. #define OMAP3530 0x0c00
  59. /* device type */
  60. #define DEVICE_MASK (0x7 << 8)
  61. #define SYSBOOT_MASK 0x1F
  62. #define TST_DEVICE 0x0
  63. #define EMU_DEVICE 0x1
  64. #define HS_DEVICE 0x2
  65. #define GP_DEVICE 0x3
  66. /* GPMC CS3/cs4/cs6 not avaliable */
  67. #define GPMC_BASE (OMAP34XX_GPMC_BASE)
  68. #define GPMC_CONFIG_CS0 0x60
  69. #define GPMC_CONFIG_CS6 0x150
  70. #define GPMC_CONFIG_CS0_BASE (GPMC_BASE + GPMC_CONFIG_CS0)
  71. #define GPMC_CONFIG_CS6_BASE (GPMC_BASE + GPMC_CONFIG_CS6)
  72. #define GPMC_CONFIG_WP 0x10
  73. #define GPMC_CONFIG_WIDTH 0x30
  74. #ifndef __ASSEMBLY__
  75. typedef struct gpmc {
  76. unsigned char res1[0x10];
  77. unsigned int sysconfig; /* 0x10 */
  78. unsigned char res2[0x4];
  79. unsigned int irqstatus; /* 0x18 */
  80. unsigned int irqenable; /* 0x1C */
  81. unsigned char res3[0x20];
  82. unsigned int timeout_control; /* 0x40 */
  83. unsigned char res4[0xC];
  84. unsigned int config; /* 0x50 */
  85. unsigned int status; /* 0x54 */
  86. unsigned char res5[0x19C];
  87. unsigned int ecc_config; /* 0x1F4 */
  88. unsigned int ecc_control; /* 0x1F8 */
  89. unsigned int ecc_size_config; /* 0x1FC */
  90. unsigned int ecc1_result; /* 0x200 */
  91. unsigned int ecc2_result; /* 0x204 */
  92. unsigned int ecc3_result; /* 0x208 */
  93. unsigned int ecc4_result; /* 0x20C */
  94. unsigned int ecc5_result; /* 0x210 */
  95. unsigned int ecc6_result; /* 0x214 */
  96. unsigned int ecc7_result; /* 0x218 */
  97. unsigned int ecc8_result; /* 0x21C */
  98. unsigned int ecc9_result; /* 0x220 */
  99. } gpmc_t;
  100. typedef struct gpmc_csx {
  101. unsigned int config1; /* 0x00 */
  102. unsigned int config2; /* 0x04 */
  103. unsigned int config3; /* 0x08 */
  104. unsigned int config4; /* 0x0C */
  105. unsigned int config5; /* 0x10 */
  106. unsigned int config6; /* 0x14 */
  107. unsigned int config7; /* 0x18 */
  108. unsigned int nand_cmd; /* 0x1C */
  109. unsigned int nand_adr; /* 0x20 */
  110. unsigned int nand_dat; /* 0x24 */
  111. } gpmc_csx_t;
  112. #else /* __ASSEMBLY__ */
  113. #define GPMC_CONFIG1 0x00
  114. #define GPMC_CONFIG2 0x04
  115. #define GPMC_CONFIG3 0x08
  116. #define GPMC_CONFIG4 0x0C
  117. #define GPMC_CONFIG5 0x10
  118. #define GPMC_CONFIG6 0x14
  119. #define GPMC_CONFIG7 0x18
  120. #endif /* __ASSEMBLY__ */
  121. /* GPMC Mapping */
  122. #define FLASH_BASE 0x10000000 /* NOR flash, */
  123. /* aligned to 256 Meg */
  124. #define FLASH_BASE_SDPV1 0x04000000 /* NOR flash, */
  125. /* aligned to 64 Meg */
  126. #define FLASH_BASE_SDPV2 0x10000000 /* NOR flash, */
  127. /* aligned to 256 Meg */
  128. #define DEBUG_BASE 0x08000000 /* debug board */
  129. #define NAND_BASE 0x30000000 /* NAND addr */
  130. /* (actual size small port) */
  131. #define PISMO2_BASE 0x18000000 /* PISMO2 CS1/2 */
  132. #define ONENAND_MAP 0x20000000 /* OneNand addr */
  133. /* (actual size small port) */
  134. /* SMS */
  135. #ifndef __ASSEMBLY__
  136. typedef struct sms {
  137. unsigned char res1[0x10];
  138. unsigned int sysconfig; /* 0x10 */
  139. unsigned char res2[0x34];
  140. unsigned int rg_att0; /* 0x48 */
  141. unsigned char res3[0x84];
  142. unsigned int class_arb0; /* 0xD0 */
  143. } sms_t;
  144. #endif /* __ASSEMBLY__ */
  145. #define BURSTCOMPLETE_GROUP7 (0x1 << 31)
  146. /* SDRC */
  147. #ifndef __ASSEMBLY__
  148. typedef struct sdrc_cs {
  149. unsigned int mcfg; /* 0x80 || 0xB0 */
  150. unsigned int mr; /* 0x84 || 0xB4 */
  151. unsigned char res1[0x4];
  152. unsigned int emr2; /* 0x8C || 0xBC */
  153. unsigned char res2[0x14];
  154. unsigned int rfr_ctrl; /* 0x84 || 0xD4 */
  155. unsigned int manual; /* 0xA8 || 0xD8 */
  156. unsigned char res3[0x4];
  157. } sdrc_cs_t;
  158. typedef struct sdrc_actim {
  159. unsigned int ctrla; /* 0x9C || 0xC4 */
  160. unsigned int ctrlb; /* 0xA0 || 0xC8 */
  161. } sdrc_actim_t;
  162. typedef struct sdrc {
  163. unsigned char res1[0x10];
  164. unsigned int sysconfig; /* 0x10 */
  165. unsigned int status; /* 0x14 */
  166. unsigned char res2[0x28];
  167. unsigned int cs_cfg; /* 0x40 */
  168. unsigned int sharing; /* 0x44 */
  169. unsigned char res3[0x18];
  170. unsigned int dlla_ctrl; /* 0x60 */
  171. unsigned int dlla_status; /* 0x64 */
  172. unsigned int dllb_ctrl; /* 0x68 */
  173. unsigned int dllb_status; /* 0x6C */
  174. unsigned int power; /* 0x70 */
  175. unsigned char res4[0xC];
  176. sdrc_cs_t cs[2]; /* 0x80 || 0xB0 */
  177. } sdrc_t;
  178. #endif /* __ASSEMBLY__ */
  179. #define DLLPHASE_90 (0x1 << 1)
  180. #define LOADDLL (0x1 << 2)
  181. #define ENADLL (0x1 << 3)
  182. #define DLL_DELAY_MASK 0xFF00
  183. #define DLL_NO_FILTER_MASK ((0x1 << 9) | (0x1 << 8))
  184. #define PAGEPOLICY_HIGH (0x1 << 0)
  185. #define SRFRONRESET (0x1 << 7)
  186. #define WAKEUPPROC (0x1 << 26)
  187. #define DDR_SDRAM (0x1 << 0)
  188. #define DEEPPD (0x1 << 3)
  189. #define B32NOT16 (0x1 << 4)
  190. #define BANKALLOCATION (0x2 << 6)
  191. #define RAMSIZE_128 (0x40 << 8) /* RAM size in 2MB chunks */
  192. #define ADDRMUXLEGACY (0x1 << 19)
  193. #define CASWIDTH_10BITS (0x5 << 20)
  194. #define RASWIDTH_13BITS (0x2 << 24)
  195. #define BURSTLENGTH4 (0x2 << 0)
  196. #define CASL3 (0x3 << 4)
  197. #define SDRC_ACTIM_CTRL0_BASE (OMAP34XX_SDRC_BASE + 0x9C)
  198. #define SDRC_ACTIM_CTRL1_BASE (OMAP34XX_SDRC_BASE + 0xC4)
  199. #define ARE_ARCV_1 (0x1 << 0)
  200. #define ARCV (0x4e2 << 8) /* Autorefresh count */
  201. #define OMAP34XX_SDRC_CS0 0x80000000
  202. #define OMAP34XX_SDRC_CS1 0xA0000000
  203. #define CMD_NOP 0x0
  204. #define CMD_PRECHARGE 0x1
  205. #define CMD_AUTOREFRESH 0x2
  206. #define CMD_ENTR_PWRDOWN 0x3
  207. #define CMD_EXIT_PWRDOWN 0x4
  208. #define CMD_ENTR_SRFRSH 0x5
  209. #define CMD_CKE_HIGH 0x6
  210. #define CMD_CKE_LOW 0x7
  211. #define SOFTRESET (0x1 << 1)
  212. #define SMART_IDLE (0x2 << 3)
  213. #define REF_ON_IDLE (0x1 << 6)
  214. /* timer regs offsets (32 bit regs) */
  215. #ifndef __ASSEMBLY__
  216. typedef struct gptimer {
  217. unsigned int tidr; /* 0x00 r */
  218. unsigned char res[0xc];
  219. unsigned int tiocp_cfg; /* 0x10 rw */
  220. unsigned int tistat; /* 0x14 r */
  221. unsigned int tisr; /* 0x18 rw */
  222. unsigned int tier; /* 0x1c rw */
  223. unsigned int twer; /* 0x20 rw */
  224. unsigned int tclr; /* 0x24 rw */
  225. unsigned int tcrr; /* 0x28 rw */
  226. unsigned int tldr; /* 0x2c rw */
  227. unsigned int ttgr; /* 0x30 rw */
  228. unsigned int twpc; /* 0x34 r*/
  229. unsigned int tmar; /* 0x38 rw*/
  230. unsigned int tcar1; /* 0x3c r */
  231. unsigned int tcicr; /* 0x40 rw */
  232. unsigned int tcar2; /* 0x44 r */
  233. } gptimer_t;
  234. #endif /* __ASSEMBLY__ */
  235. /* enable sys_clk NO-prescale /1 */
  236. #define GPT_EN ((0x0 << 2) | (0x1 << 1) | (0x1 << 0))
  237. /* Watchdog */
  238. #ifndef __ASSEMBLY__
  239. typedef struct watchdog {
  240. unsigned char res1[0x34];
  241. unsigned int wwps; /* 0x34 r */
  242. unsigned char res2[0x10];
  243. unsigned int wspr; /* 0x48 rw */
  244. } watchdog_t;
  245. #endif /* __ASSEMBLY__ */
  246. #define WD_UNLOCK1 0xAAAA
  247. #define WD_UNLOCK2 0x5555
  248. /* PRCM */
  249. #define PRCM_BASE 0x48004000
  250. #ifndef __ASSEMBLY__
  251. typedef struct prcm {
  252. unsigned int fclken_iva2; /* 0x00 */
  253. unsigned int clken_pll_iva2; /* 0x04 */
  254. unsigned char res1[0x1c];
  255. unsigned int idlest_pll_iva2; /* 0x24 */
  256. unsigned char res2[0x18];
  257. unsigned int clksel1_pll_iva2 ; /* 0x40 */
  258. unsigned int clksel2_pll_iva2; /* 0x44 */
  259. unsigned char res3[0x8bc];
  260. unsigned int clken_pll_mpu; /* 0x904 */
  261. unsigned char res4[0x1c];
  262. unsigned int idlest_pll_mpu; /* 0x924 */
  263. unsigned char res5[0x18];
  264. unsigned int clksel1_pll_mpu; /* 0x940 */
  265. unsigned int clksel2_pll_mpu; /* 0x944 */
  266. unsigned char res6[0xb8];
  267. unsigned int fclken1_core; /* 0xa00 */
  268. unsigned char res7[0xc];
  269. unsigned int iclken1_core; /* 0xa10 */
  270. unsigned int iclken2_core; /* 0xa14 */
  271. unsigned char res8[0x28];
  272. unsigned int clksel_core; /* 0xa40 */
  273. unsigned char res9[0xbc];
  274. unsigned int fclken_gfx; /* 0xb00 */
  275. unsigned char res10[0xc];
  276. unsigned int iclken_gfx; /* 0xb10 */
  277. unsigned char res11[0x2c];
  278. unsigned int clksel_gfx; /* 0xb40 */
  279. unsigned char res12[0xbc];
  280. unsigned int fclken_wkup; /* 0xc00 */
  281. unsigned char res13[0xc];
  282. unsigned int iclken_wkup; /* 0xc10 */
  283. unsigned char res14[0xc];
  284. unsigned int idlest_wkup; /* 0xc20 */
  285. unsigned char res15[0x1c];
  286. unsigned int clksel_wkup; /* 0xc40 */
  287. unsigned char res16[0xbc];
  288. unsigned int clken_pll; /* 0xd00 */
  289. unsigned char res17[0x1c];
  290. unsigned int idlest_ckgen; /* 0xd20 */
  291. unsigned char res18[0x1c];
  292. unsigned int clksel1_pll; /* 0xd40 */
  293. unsigned int clksel2_pll; /* 0xd44 */
  294. unsigned int clksel3_pll; /* 0xd48 */
  295. unsigned char res19[0xb4];
  296. unsigned int fclken_dss; /* 0xe00 */
  297. unsigned char res20[0xc];
  298. unsigned int iclken_dss; /* 0xe10 */
  299. unsigned char res21[0x2c];
  300. unsigned int clksel_dss; /* 0xe40 */
  301. unsigned char res22[0xbc];
  302. unsigned int fclken_cam; /* 0xf00 */
  303. unsigned char res23[0xc];
  304. unsigned int iclken_cam; /* 0xf10 */
  305. unsigned char res24[0x2c];
  306. unsigned int clksel_cam; /* 0xf40 */
  307. unsigned char res25[0xbc];
  308. unsigned int fclken_per; /* 0x1000 */
  309. unsigned char res26[0xc];
  310. unsigned int iclken_per; /* 0x1010 */
  311. unsigned char res27[0x2c];
  312. unsigned int clksel_per; /* 0x1040 */
  313. unsigned char res28[0xfc];
  314. unsigned int clksel1_emu; /* 0x1140 */
  315. } prcm_t;
  316. #else /* __ASSEMBLY__ */
  317. #define CM_CLKSEL_CORE 0x48004a40
  318. #define CM_CLKSEL_GFX 0x48004b40
  319. #define CM_CLKSEL_WKUP 0x48004c40
  320. #define CM_CLKEN_PLL 0x48004d00
  321. #define CM_CLKSEL1_PLL 0x48004d40
  322. #define CM_CLKSEL1_EMU 0x48005140
  323. #endif /* __ASSEMBLY__ */
  324. #define PRM_BASE 0x48306000
  325. #ifndef __ASSEMBLY__
  326. typedef struct prm {
  327. unsigned char res1[0xd40];
  328. unsigned int clksel; /* 0xd40 */
  329. unsigned char res2[0x50c];
  330. unsigned int rstctrl; /* 0x1250 */
  331. unsigned char res3[0x1c];
  332. unsigned int clksrc_ctrl; /* 0x1270 */
  333. } prm_t;
  334. #else /* __ASSEMBLY__ */
  335. #define PRM_RSTCTRL 0x48307250
  336. #endif /* __ASSEMBLY__ */
  337. #define SYSCLKDIV_1 (0x1 << 6)
  338. #define SYSCLKDIV_2 (0x1 << 7)
  339. #define CLKSEL_GPT1 (0x1 << 0)
  340. #define EN_GPT1 (0x1 << 0)
  341. #define EN_32KSYNC (0x1 << 2)
  342. #define ST_WDT2 (0x1 << 5)
  343. #define ST_MPU_CLK (0x1 << 0)
  344. #define ST_CORE_CLK (0x1 << 0)
  345. #define ST_PERIPH_CLK (0x1 << 1)
  346. #define ST_IVA2_CLK (0x1 << 0)
  347. #define RESETDONE (0x1 << 0)
  348. #define TCLR_ST (0x1 << 0)
  349. #define TCLR_AR (0x1 << 1)
  350. #define TCLR_PRE (0x1 << 5)
  351. /* SMX-APE */
  352. #define PM_RT_APE_BASE_ADDR_ARM (SMX_APE_BASE + 0x10000)
  353. #define PM_GPMC_BASE_ADDR_ARM (SMX_APE_BASE + 0x12400)
  354. #define PM_OCM_RAM_BASE_ADDR_ARM (SMX_APE_BASE + 0x12800)
  355. #define PM_IVA2_BASE_ADDR_ARM (SMX_APE_BASE + 0x14000)
  356. #ifndef __ASSEMBLY__
  357. typedef struct pm {
  358. unsigned char res1[0x48];
  359. unsigned int req_info_permission_0; /* 0x48 */
  360. unsigned char res2[0x4];
  361. unsigned int read_permission_0; /* 0x50 */
  362. unsigned char res3[0x4];
  363. unsigned int wirte_permission_0; /* 0x58 */
  364. unsigned char res4[0x4];
  365. unsigned int addr_match_1; /* 0x58 */
  366. unsigned char res5[0x4];
  367. unsigned int req_info_permission_1; /* 0x68 */
  368. unsigned char res6[0x14];
  369. unsigned int addr_match_2; /* 0x80 */
  370. } pm_t;
  371. #endif /*__ASSEMBLY__ */
  372. /* Permission values for registers -Full fledged permissions to all */
  373. #define UNLOCK_1 0xFFFFFFFF
  374. #define UNLOCK_2 0x00000000
  375. #define UNLOCK_3 0x0000FFFF
  376. #define NOT_EARLY 0
  377. /* I2C base */
  378. #define I2C_BASE1 (OMAP34XX_CORE_L4_IO_BASE + 0x70000)
  379. #define I2C_BASE2 (OMAP34XX_CORE_L4_IO_BASE + 0x72000)
  380. #define I2C_BASE3 (OMAP34XX_CORE_L4_IO_BASE + 0x60000)
  381. #endif /* _CPU_H */