cpu.h 13 KB

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