cpu.h 11 KB

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