cpu.h 12 KB

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