cpu.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /*
  2. * (C) Copyright 2006-2008
  3. * Texas Instruments, <www.ti.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _CPU_H
  8. #define _CPU_H
  9. #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
  10. #include <asm/types.h>
  11. #endif /* !(__KERNEL_STRICT_NAMES || __ASSEMBLY__) */
  12. /* Register offsets of common modules */
  13. /* Control */
  14. #ifndef __KERNEL_STRICT_NAMES
  15. #ifndef __ASSEMBLY__
  16. struct ctrl {
  17. u8 res1[0xC0];
  18. u16 gpmc_nadv_ale; /* 0xC0 */
  19. u16 gpmc_noe; /* 0xC2 */
  20. u16 gpmc_nwe; /* 0xC4 */
  21. u8 res2[0x22A];
  22. u32 status; /* 0x2F0 */
  23. u32 gpstatus; /* 0x2F4 */
  24. u8 res3[0x08];
  25. u32 rpubkey_0; /* 0x300 */
  26. u32 rpubkey_1; /* 0x304 */
  27. u32 rpubkey_2; /* 0x308 */
  28. u32 rpubkey_3; /* 0x30C */
  29. u32 rpubkey_4; /* 0x310 */
  30. u8 res4[0x04];
  31. u32 randkey_0; /* 0x318 */
  32. u32 randkey_1; /* 0x31C */
  33. u32 randkey_2; /* 0x320 */
  34. u32 randkey_3; /* 0x324 */
  35. u8 res5[0x124];
  36. u32 ctrl_omap_stat; /* 0x44C */
  37. };
  38. #else /* __ASSEMBLY__ */
  39. #define CONTROL_STATUS 0x2F0
  40. #endif /* __ASSEMBLY__ */
  41. #endif /* __KERNEL_STRICT_NAMES */
  42. #ifndef __KERNEL_STRICT_NAMES
  43. #ifndef __ASSEMBLY__
  44. struct ctrl_id {
  45. u8 res1[0x4];
  46. u32 idcode; /* 0x04 */
  47. u32 prod_id; /* 0x08 */
  48. u32 sku_id; /* 0x0c */
  49. u8 res2[0x08];
  50. u32 die_id_0; /* 0x18 */
  51. u32 die_id_1; /* 0x1C */
  52. u32 die_id_2; /* 0x20 */
  53. u32 die_id_3; /* 0x24 */
  54. };
  55. #endif /* __ASSEMBLY__ */
  56. #endif /* __KERNEL_STRICT_NAMES */
  57. /* device type */
  58. #define DEVICE_MASK (0x7 << 8)
  59. #define SYSBOOT_MASK 0x1F
  60. #define TST_DEVICE 0x0
  61. #define EMU_DEVICE 0x1
  62. #define HS_DEVICE 0x2
  63. #define GP_DEVICE 0x3
  64. /* device speed */
  65. #define SKUID_CLK_MASK 0xf
  66. #define SKUID_CLK_600MHZ 0x0
  67. #define SKUID_CLK_720MHZ 0x8
  68. #define GPMC_BASE (OMAP34XX_GPMC_BASE)
  69. #define GPMC_CONFIG_CS0 0x60
  70. #define GPMC_CONFIG_CS0_BASE (GPMC_BASE + GPMC_CONFIG_CS0)
  71. #ifndef __KERNEL_STRICT_NAMES
  72. #ifdef __ASSEMBLY__
  73. #define GPMC_CONFIG1 0x00
  74. #define GPMC_CONFIG2 0x04
  75. #define GPMC_CONFIG3 0x08
  76. #define GPMC_CONFIG4 0x0C
  77. #define GPMC_CONFIG5 0x10
  78. #define GPMC_CONFIG6 0x14
  79. #define GPMC_CONFIG7 0x18
  80. #endif /* __ASSEMBLY__ */
  81. #endif /* __KERNEL_STRICT_NAMES */
  82. /* GPMC Mapping */
  83. #define FLASH_BASE 0x10000000 /* NOR flash, */
  84. /* aligned to 256 Meg */
  85. #define FLASH_BASE_SDPV1 0x04000000 /* NOR flash, */
  86. /* aligned to 64 Meg */
  87. #define FLASH_BASE_SDPV2 0x10000000 /* NOR flash, */
  88. /* aligned to 256 Meg */
  89. #define DEBUG_BASE 0x08000000 /* debug board */
  90. #define NAND_BASE 0x30000000 /* NAND addr */
  91. /* (actual size small port) */
  92. #define PISMO2_BASE 0x18000000 /* PISMO2 CS1/2 */
  93. #define ONENAND_MAP 0x20000000 /* OneNand addr */
  94. /* (actual size small port) */
  95. /* SMS */
  96. #ifndef __KERNEL_STRICT_NAMES
  97. #ifndef __ASSEMBLY__
  98. struct sms {
  99. u8 res1[0x10];
  100. u32 sysconfig; /* 0x10 */
  101. u8 res2[0x34];
  102. u32 rg_att0; /* 0x48 */
  103. u8 res3[0x84];
  104. u32 class_arb0; /* 0xD0 */
  105. };
  106. #endif /* __ASSEMBLY__ */
  107. #endif /* __KERNEL_STRICT_NAMES */
  108. #define BURSTCOMPLETE_GROUP7 (0x1 << 31)
  109. /* SDRC */
  110. #ifndef __KERNEL_STRICT_NAMES
  111. #ifndef __ASSEMBLY__
  112. struct sdrc_cs {
  113. u32 mcfg; /* 0x80 || 0xB0 */
  114. u32 mr; /* 0x84 || 0xB4 */
  115. u8 res1[0x4];
  116. u32 emr2; /* 0x8C || 0xBC */
  117. u8 res2[0x14];
  118. u32 rfr_ctrl; /* 0x84 || 0xD4 */
  119. u32 manual; /* 0xA8 || 0xD8 */
  120. u8 res3[0x4];
  121. };
  122. struct sdrc_actim {
  123. u32 ctrla; /* 0x9C || 0xC4 */
  124. u32 ctrlb; /* 0xA0 || 0xC8 */
  125. };
  126. struct sdrc {
  127. u8 res1[0x10];
  128. u32 sysconfig; /* 0x10 */
  129. u32 status; /* 0x14 */
  130. u8 res2[0x28];
  131. u32 cs_cfg; /* 0x40 */
  132. u32 sharing; /* 0x44 */
  133. u8 res3[0x18];
  134. u32 dlla_ctrl; /* 0x60 */
  135. u32 dlla_status; /* 0x64 */
  136. u32 dllb_ctrl; /* 0x68 */
  137. u32 dllb_status; /* 0x6C */
  138. u32 power; /* 0x70 */
  139. u8 res4[0xC];
  140. struct sdrc_cs cs[2]; /* 0x80 || 0xB0 */
  141. };
  142. /* EMIF4 */
  143. typedef struct emif4 {
  144. unsigned int emif_mod_id_rev;
  145. unsigned int sdram_sts;
  146. unsigned int sdram_config;
  147. unsigned int res1;
  148. unsigned int sdram_refresh_ctrl;
  149. unsigned int sdram_refresh_ctrl_shdw;
  150. unsigned int sdram_time1;
  151. unsigned int sdram_time1_shdw;
  152. unsigned int sdram_time2;
  153. unsigned int sdram_time2_shdw;
  154. unsigned int sdram_time3;
  155. unsigned int sdram_time3_shdw;
  156. unsigned char res2[8];
  157. unsigned int sdram_pwr_mgmt;
  158. unsigned int sdram_pwr_mgmt_shdw;
  159. unsigned char res3[32];
  160. unsigned int sdram_iodft_tlgc;
  161. unsigned char res4[128];
  162. unsigned int ddr_phyctrl1;
  163. unsigned int ddr_phyctrl1_shdw;
  164. unsigned int ddr_phyctrl2;
  165. } emif4_t;
  166. #endif /* __ASSEMBLY__ */
  167. #endif /* __KERNEL_STRICT_NAMES */
  168. #define DLLPHASE_90 (0x1 << 1)
  169. #define LOADDLL (0x1 << 2)
  170. #define ENADLL (0x1 << 3)
  171. #define DLL_DELAY_MASK 0xFF00
  172. #define DLL_NO_FILTER_MASK ((0x1 << 9) | (0x1 << 8))
  173. #define PAGEPOLICY_HIGH (0x1 << 0)
  174. #define SRFRONRESET (0x1 << 7)
  175. #define PWDNEN (0x1 << 2)
  176. #define WAKEUPPROC (0x1 << 26)
  177. #define DDR_SDRAM (0x1 << 0)
  178. #define DEEPPD (0x1 << 3)
  179. #define B32NOT16 (0x1 << 4)
  180. #define BANKALLOCATION (0x2 << 6)
  181. #define RAMSIZE_128 (0x40 << 8) /* RAM size in 2MB chunks */
  182. #define ADDRMUXLEGACY (0x1 << 19)
  183. #define CASWIDTH_10BITS (0x5 << 20)
  184. #define RASWIDTH_13BITS (0x2 << 24)
  185. #define BURSTLENGTH4 (0x2 << 0)
  186. #define CASL3 (0x3 << 4)
  187. #define SDRC_ACTIM_CTRL0_BASE (OMAP34XX_SDRC_BASE + 0x9C)
  188. #define SDRC_ACTIM_CTRL1_BASE (OMAP34XX_SDRC_BASE + 0xC4)
  189. #define ARE_ARCV_1 (0x1 << 0)
  190. #define ARCV (0x4e2 << 8) /* Autorefresh count */
  191. #define OMAP34XX_SDRC_CS0 0x80000000
  192. #define OMAP34XX_SDRC_CS1 0xA0000000
  193. #define CMD_NOP 0x0
  194. #define CMD_PRECHARGE 0x1
  195. #define CMD_AUTOREFRESH 0x2
  196. #define CMD_ENTR_PWRDOWN 0x3
  197. #define CMD_EXIT_PWRDOWN 0x4
  198. #define CMD_ENTR_SRFRSH 0x5
  199. #define CMD_CKE_HIGH 0x6
  200. #define CMD_CKE_LOW 0x7
  201. #define SOFTRESET (0x1 << 1)
  202. #define SMART_IDLE (0x2 << 3)
  203. #define REF_ON_IDLE (0x1 << 6)
  204. /* DMA */
  205. #ifndef __KERNEL_STRICT_NAMES
  206. #ifndef __ASSEMBLY__
  207. struct dma4_chan {
  208. u32 ccr;
  209. u32 clnk_ctrl;
  210. u32 cicr;
  211. u32 csr;
  212. u32 csdp;
  213. u32 cen;
  214. u32 cfn;
  215. u32 cssa;
  216. u32 cdsa;
  217. u32 csel;
  218. u32 csfl;
  219. u32 cdel;
  220. u32 cdfl;
  221. u32 csac;
  222. u32 cdac;
  223. u32 ccen;
  224. u32 ccfn;
  225. u32 color;
  226. };
  227. struct dma4 {
  228. u32 revision;
  229. u8 res1[0x4];
  230. u32 irqstatus_l[0x4];
  231. u32 irqenable_l[0x4];
  232. u32 sysstatus;
  233. u32 ocp_sysconfig;
  234. u8 res2[0x34];
  235. u32 caps_0;
  236. u8 res3[0x4];
  237. u32 caps_2;
  238. u32 caps_3;
  239. u32 caps_4;
  240. u32 gcr;
  241. u8 res4[0x4];
  242. struct dma4_chan chan[32];
  243. };
  244. #endif /*__ASSEMBLY__ */
  245. #endif /* __KERNEL_STRICT_NAMES */
  246. /* timer regs offsets (32 bit regs) */
  247. #ifndef __KERNEL_STRICT_NAMES
  248. #ifndef __ASSEMBLY__
  249. struct gptimer {
  250. u32 tidr; /* 0x00 r */
  251. u8 res[0xc];
  252. u32 tiocp_cfg; /* 0x10 rw */
  253. u32 tistat; /* 0x14 r */
  254. u32 tisr; /* 0x18 rw */
  255. u32 tier; /* 0x1c rw */
  256. u32 twer; /* 0x20 rw */
  257. u32 tclr; /* 0x24 rw */
  258. u32 tcrr; /* 0x28 rw */
  259. u32 tldr; /* 0x2c rw */
  260. u32 ttgr; /* 0x30 rw */
  261. u32 twpc; /* 0x34 r*/
  262. u32 tmar; /* 0x38 rw*/
  263. u32 tcar1; /* 0x3c r */
  264. u32 tcicr; /* 0x40 rw */
  265. u32 tcar2; /* 0x44 r */
  266. };
  267. #endif /* __ASSEMBLY__ */
  268. #endif /* __KERNEL_STRICT_NAMES */
  269. /* enable sys_clk NO-prescale /1 */
  270. #define GPT_EN ((0x0 << 2) | (0x1 << 1) | (0x1 << 0))
  271. /* Watchdog */
  272. #ifndef __KERNEL_STRICT_NAMES
  273. #ifndef __ASSEMBLY__
  274. struct watchdog {
  275. u8 res1[0x34];
  276. u32 wwps; /* 0x34 r */
  277. u8 res2[0x10];
  278. u32 wspr; /* 0x48 rw */
  279. };
  280. #endif /* __ASSEMBLY__ */
  281. #endif /* __KERNEL_STRICT_NAMES */
  282. #define WD_UNLOCK1 0xAAAA
  283. #define WD_UNLOCK2 0x5555
  284. /* PRCM */
  285. #define PRCM_BASE 0x48004000
  286. #ifndef __KERNEL_STRICT_NAMES
  287. #ifndef __ASSEMBLY__
  288. struct prcm {
  289. u32 fclken_iva2; /* 0x00 */
  290. u32 clken_pll_iva2; /* 0x04 */
  291. u8 res1[0x1c];
  292. u32 idlest_pll_iva2; /* 0x24 */
  293. u8 res2[0x18];
  294. u32 clksel1_pll_iva2 ; /* 0x40 */
  295. u32 clksel2_pll_iva2; /* 0x44 */
  296. u8 res3[0x8bc];
  297. u32 clken_pll_mpu; /* 0x904 */
  298. u8 res4[0x1c];
  299. u32 idlest_pll_mpu; /* 0x924 */
  300. u8 res5[0x18];
  301. u32 clksel1_pll_mpu; /* 0x940 */
  302. u32 clksel2_pll_mpu; /* 0x944 */
  303. u8 res6[0xb8];
  304. u32 fclken1_core; /* 0xa00 */
  305. u32 res_fclken2_core;
  306. u32 fclken3_core; /* 0xa08 */
  307. u8 res7[0x4];
  308. u32 iclken1_core; /* 0xa10 */
  309. u32 iclken2_core; /* 0xa14 */
  310. u32 iclken3_core; /* 0xa18 */
  311. u8 res8[0x24];
  312. u32 clksel_core; /* 0xa40 */
  313. u8 res9[0xbc];
  314. u32 fclken_gfx; /* 0xb00 */
  315. u8 res10[0xc];
  316. u32 iclken_gfx; /* 0xb10 */
  317. u8 res11[0x2c];
  318. u32 clksel_gfx; /* 0xb40 */
  319. u8 res12[0xbc];
  320. u32 fclken_wkup; /* 0xc00 */
  321. u8 res13[0xc];
  322. u32 iclken_wkup; /* 0xc10 */
  323. u8 res14[0xc];
  324. u32 idlest_wkup; /* 0xc20 */
  325. u8 res15[0x1c];
  326. u32 clksel_wkup; /* 0xc40 */
  327. u8 res16[0xbc];
  328. u32 clken_pll; /* 0xd00 */
  329. u32 clken2_pll; /* 0xd04 */
  330. u8 res17[0x18];
  331. u32 idlest_ckgen; /* 0xd20 */
  332. u32 idlest2_ckgen; /* 0xd24 */
  333. u8 res18[0x18];
  334. u32 clksel1_pll; /* 0xd40 */
  335. u32 clksel2_pll; /* 0xd44 */
  336. u32 clksel3_pll; /* 0xd48 */
  337. u32 clksel4_pll; /* 0xd4c */
  338. u32 clksel5_pll; /* 0xd50 */
  339. u8 res19[0xac];
  340. u32 fclken_dss; /* 0xe00 */
  341. u8 res20[0xc];
  342. u32 iclken_dss; /* 0xe10 */
  343. u8 res21[0x2c];
  344. u32 clksel_dss; /* 0xe40 */
  345. u8 res22[0xbc];
  346. u32 fclken_cam; /* 0xf00 */
  347. u8 res23[0xc];
  348. u32 iclken_cam; /* 0xf10 */
  349. u8 res24[0x2c];
  350. u32 clksel_cam; /* 0xf40 */
  351. u8 res25[0xbc];
  352. u32 fclken_per; /* 0x1000 */
  353. u8 res26[0xc];
  354. u32 iclken_per; /* 0x1010 */
  355. u8 res27[0x2c];
  356. u32 clksel_per; /* 0x1040 */
  357. u8 res28[0xfc];
  358. u32 clksel1_emu; /* 0x1140 */
  359. u8 res29[0x2bc];
  360. u32 fclken_usbhost; /* 0x1400 */
  361. u8 res30[0xc];
  362. u32 iclken_usbhost; /* 0x1410 */
  363. };
  364. #else /* __ASSEMBLY__ */
  365. #define CM_CLKSEL_CORE 0x48004a40
  366. #define CM_CLKSEL_GFX 0x48004b40
  367. #define CM_CLKSEL_WKUP 0x48004c40
  368. #define CM_CLKEN_PLL 0x48004d00
  369. #define CM_CLKSEL1_PLL 0x48004d40
  370. #define CM_CLKSEL1_EMU 0x48005140
  371. #endif /* __ASSEMBLY__ */
  372. #endif /* __KERNEL_STRICT_NAMES */
  373. #define PRM_BASE 0x48306000
  374. #ifndef __KERNEL_STRICT_NAMES
  375. #ifndef __ASSEMBLY__
  376. struct prm {
  377. u8 res1[0xd40];
  378. u32 clksel; /* 0xd40 */
  379. u8 res2[0x50c];
  380. u32 rstctrl; /* 0x1250 */
  381. u8 res3[0x1c];
  382. u32 clksrc_ctrl; /* 0x1270 */
  383. };
  384. #endif /* __ASSEMBLY__ */
  385. #endif /* __KERNEL_STRICT_NAMES */
  386. #define PRM_RSTCTRL 0x48307250
  387. #define PRM_RSTCTRL_RESET 0x04
  388. #define PRM_RSTST 0x48307258
  389. #define PRM_RSTST_WARM_RESET_MASK 0x7D2
  390. #define SYSCLKDIV_1 (0x1 << 6)
  391. #define SYSCLKDIV_2 (0x1 << 7)
  392. #define CLKSEL_GPT1 (0x1 << 0)
  393. #define EN_GPT1 (0x1 << 0)
  394. #define EN_32KSYNC (0x1 << 2)
  395. #define ST_WDT2 (0x1 << 5)
  396. #define ST_MPU_CLK (0x1 << 0)
  397. #define ST_CORE_CLK (0x1 << 0)
  398. #define ST_PERIPH_CLK (0x1 << 1)
  399. #define ST_IVA2_CLK (0x1 << 0)
  400. #define RESETDONE (0x1 << 0)
  401. #define TCLR_ST (0x1 << 0)
  402. #define TCLR_AR (0x1 << 1)
  403. #define TCLR_PRE (0x1 << 5)
  404. /* SMX-APE */
  405. #define PM_RT_APE_BASE_ADDR_ARM (SMX_APE_BASE + 0x10000)
  406. #define PM_GPMC_BASE_ADDR_ARM (SMX_APE_BASE + 0x12400)
  407. #define PM_OCM_RAM_BASE_ADDR_ARM (SMX_APE_BASE + 0x12800)
  408. #define PM_IVA2_BASE_ADDR_ARM (SMX_APE_BASE + 0x14000)
  409. #ifndef __KERNEL_STRICT_NAMES
  410. #ifndef __ASSEMBLY__
  411. struct pm {
  412. u8 res1[0x48];
  413. u32 req_info_permission_0; /* 0x48 */
  414. u8 res2[0x4];
  415. u32 read_permission_0; /* 0x50 */
  416. u8 res3[0x4];
  417. u32 wirte_permission_0; /* 0x58 */
  418. u8 res4[0x4];
  419. u32 addr_match_1; /* 0x58 */
  420. u8 res5[0x4];
  421. u32 req_info_permission_1; /* 0x68 */
  422. u8 res6[0x14];
  423. u32 addr_match_2; /* 0x80 */
  424. };
  425. #endif /*__ASSEMBLY__ */
  426. #endif /* __KERNEL_STRICT_NAMES */
  427. /* Permission values for registers -Full fledged permissions to all */
  428. #define UNLOCK_1 0xFFFFFFFF
  429. #define UNLOCK_2 0x00000000
  430. #define UNLOCK_3 0x0000FFFF
  431. #define NOT_EARLY 0
  432. /* I2C base */
  433. #define I2C_BASE1 (OMAP34XX_CORE_L4_IO_BASE + 0x70000)
  434. #define I2C_BASE2 (OMAP34XX_CORE_L4_IO_BASE + 0x72000)
  435. #define I2C_BASE3 (OMAP34XX_CORE_L4_IO_BASE + 0x60000)
  436. /* MUSB base */
  437. #define MUSB_BASE (OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
  438. /* OMAP3 GPIO registers */
  439. #define OMAP_GPIO_REVISION 0x0000
  440. #define OMAP_GPIO_SYSCONFIG 0x0010
  441. #define OMAP_GPIO_SYSSTATUS 0x0014
  442. #define OMAP_GPIO_IRQSTATUS1 0x0018
  443. #define OMAP_GPIO_IRQSTATUS2 0x0028
  444. #define OMAP_GPIO_IRQENABLE2 0x002c
  445. #define OMAP_GPIO_IRQENABLE1 0x001c
  446. #define OMAP_GPIO_WAKE_EN 0x0020
  447. #define OMAP_GPIO_CTRL 0x0030
  448. #define OMAP_GPIO_OE 0x0034
  449. #define OMAP_GPIO_DATAIN 0x0038
  450. #define OMAP_GPIO_DATAOUT 0x003c
  451. #define OMAP_GPIO_LEVELDETECT0 0x0040
  452. #define OMAP_GPIO_LEVELDETECT1 0x0044
  453. #define OMAP_GPIO_RISINGDETECT 0x0048
  454. #define OMAP_GPIO_FALLINGDETECT 0x004c
  455. #define OMAP_GPIO_DEBOUNCE_EN 0x0050
  456. #define OMAP_GPIO_DEBOUNCE_VAL 0x0054
  457. #define OMAP_GPIO_CLEARIRQENABLE1 0x0060
  458. #define OMAP_GPIO_SETIRQENABLE1 0x0064
  459. #define OMAP_GPIO_CLEARWKUENA 0x0080
  460. #define OMAP_GPIO_SETWKUENA 0x0084
  461. #define OMAP_GPIO_CLEARDATAOUT 0x0090
  462. #define OMAP_GPIO_SETDATAOUT 0x0094
  463. #endif /* _CPU_H */