pmic_psm.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _PMIC_PSM_H_
  13. #define _PMIC_PSM_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_PMIC_PSM_BASE (0x51108700)
  17. typedef volatile struct
  18. {
  19. uint32_t psm_reg_wr_protect; // 0x00000000
  20. uint32_t psm_32k_cal_th; // 0x00000004
  21. uint32_t psm_26m_cal_dn_th; // 0x00000008
  22. uint32_t psm_26m_cal_up_th; // 0x0000000c
  23. uint32_t psm_ctrl; // 0x00000010
  24. uint32_t rtc_pwr_off_th1; // 0x00000014
  25. uint32_t rtc_pwr_off_th2; // 0x00000018
  26. uint32_t rtc_pwr_off_th3; // 0x0000001c
  27. uint32_t rtc_pwr_on_th1; // 0x00000020
  28. uint32_t rtc_pwr_on_th2; // 0x00000024
  29. uint32_t rtc_pwr_on_th3; // 0x00000028
  30. uint32_t psm_cnt_l_th; // 0x0000002c
  31. uint32_t psm_cnt_h_th; // 0x00000030
  32. uint32_t psm_alarm_cnt_l_th; // 0x00000034
  33. uint32_t psm_alarm_cnt_h_th; // 0x00000038
  34. uint32_t psm_cnt_interval_th; // 0x0000003c
  35. uint32_t psm_cnt_interval_phase; // 0x00000040
  36. uint32_t dcxo; // 0x00000044
  37. uint32_t psm_rc_clk_div; // 0x00000048
  38. uint32_t reserved_2; // 0x0000004c
  39. uint32_t reserved_3; // 0x00000050
  40. uint32_t reserved_4; // 0x00000054
  41. uint32_t reserved_5; // 0x00000058
  42. uint32_t reserved_6; // 0x0000005c
  43. uint32_t psm_cnt_update_l_value; // 0x00000060
  44. uint32_t psm_cnt_update_h_value; // 0x00000064
  45. uint32_t psm_status; // 0x00000068
  46. uint32_t psm_fsm_status; // 0x0000006c
  47. uint32_t psm_cal_cnt; // 0x00000070
  48. uint32_t pbint_1s_thd; // 0x00000074
  49. uint32_t por_timer_thd; // 0x00000078
  50. uint32_t ext_xtl_dbs_timer; // 0x0000007c
  51. uint32_t ext_xtl_en_hl; // 0x00000080
  52. uint32_t clk_32k_xtal_calibra_sel; // 0x00000084
  53. uint32_t xtal_por_1st_clk_sel; // 0x00000088
  54. uint32_t reserved23; // 0x0000008c
  55. uint32_t reserved24; // 0x00000090
  56. uint32_t reserved25; // 0x00000094
  57. uint32_t reserved26; // 0x00000098
  58. uint32_t reserved27; // 0x0000009c
  59. uint32_t reserved28; // 0x000000a0
  60. uint32_t reserved29; // 0x000000a4
  61. uint32_t rtc_reserved1; // 0x000000a8
  62. uint32_t rg_rtc_vosel; // 0x000000ac
  63. } HWP_PMIC_PSM_T;
  64. #define hwp_pmicPsm ((HWP_PMIC_PSM_T *)REG_ACCESS_ADDRESS(REG_PMIC_PSM_BASE))
  65. // psm_reg_wr_protect
  66. typedef union {
  67. uint32_t v;
  68. struct
  69. {
  70. uint32_t psm_reg_wr : 16; // [15:0]
  71. uint32_t __31_16 : 16; // [31:16]
  72. } b;
  73. } REG_PMIC_PSM_PSM_REG_WR_PROTECT_T;
  74. // psm_32k_cal_th
  75. typedef union {
  76. uint32_t v;
  77. struct
  78. {
  79. uint32_t rc_32k_cal_cnt_n : 4; // [3:0]
  80. uint32_t __7_4 : 4; // [7:4]
  81. uint32_t rc_32k_cal_pre_th : 4; // [11:8]
  82. uint32_t __31_12 : 20; // [31:12]
  83. } b;
  84. } REG_PMIC_PSM_PSM_32K_CAL_TH_T;
  85. // psm_26m_cal_dn_th
  86. typedef union {
  87. uint32_t v;
  88. struct
  89. {
  90. uint32_t rc_26m_cal_cnt_dn_th : 16; // [15:0]
  91. uint32_t __31_16 : 16; // [31:16]
  92. } b;
  93. } REG_PMIC_PSM_PSM_26M_CAL_DN_TH_T;
  94. // psm_26m_cal_up_th
  95. typedef union {
  96. uint32_t v;
  97. struct
  98. {
  99. uint32_t rc_26m_cal_cnt_up_th : 16; // [15:0]
  100. uint32_t __31_16 : 16; // [31:16]
  101. } b;
  102. } REG_PMIC_PSM_PSM_26M_CAL_UP_TH_T;
  103. // psm_ctrl
  104. typedef union {
  105. uint32_t v;
  106. struct
  107. {
  108. uint32_t psm_en : 1; // [0]
  109. uint32_t rtc_pwr_on_timeout_en : 1; // [1]
  110. uint32_t ext_int_pwr_en : 1; // [2]
  111. uint32_t pbint1_pwr_en : 1; // [3]
  112. uint32_t pbint2_pwr_en : 1; // [4]
  113. uint32_t charger_pwr_en : 1; // [5]
  114. uint32_t psm_cnt_alarm_en : 1; // [6]
  115. uint32_t psm_cnt_alm_en : 1; // [7]
  116. uint32_t psm_software_reset : 1; // [8]
  117. uint32_t psm_cnt_update : 1; // [9]
  118. uint32_t psm_cnt_en : 1; // [10]
  119. uint32_t psm_status_clr : 1; // [11]
  120. uint32_t psm_cal_en : 1; // [12]
  121. uint32_t __14_13 : 2; // [14:13]
  122. uint32_t rtc_32k_clk_sel : 1; // [15]
  123. uint32_t __31_16 : 16; // [31:16]
  124. } b;
  125. } REG_PMIC_PSM_PSM_CTRL_T;
  126. // rtc_pwr_off_th1
  127. typedef union {
  128. uint32_t v;
  129. struct
  130. {
  131. uint32_t rtc_pwr_off_clk_en_th : 8; // [7:0]
  132. uint32_t rtc_pwr_off_hold_th : 8; // [15:8]
  133. uint32_t __31_16 : 16; // [31:16]
  134. } b;
  135. } REG_PMIC_PSM_RTC_PWR_OFF_TH1_T;
  136. // rtc_pwr_off_th2
  137. typedef union {
  138. uint32_t v;
  139. struct
  140. {
  141. uint32_t rtc_pwr_off_rstn_th : 8; // [7:0]
  142. uint32_t rtc_pwr_off_pd_th : 8; // [15:8]
  143. uint32_t __31_16 : 16; // [31:16]
  144. } b;
  145. } REG_PMIC_PSM_RTC_PWR_OFF_TH2_T;
  146. // rtc_pwr_off_th3
  147. typedef union {
  148. uint32_t v;
  149. struct
  150. {
  151. uint32_t rtc_pwr_off_done_th : 8; // [7:0]
  152. uint32_t __31_8 : 24; // [31:8]
  153. } b;
  154. } REG_PMIC_PSM_RTC_PWR_OFF_TH3_T;
  155. // rtc_pwr_on_th1
  156. typedef union {
  157. uint32_t v;
  158. struct
  159. {
  160. uint32_t rtc_pwr_on_pd_th : 8; // [7:0]
  161. uint32_t rtc_pwr_on_rstn_th : 8; // [15:8]
  162. uint32_t __31_16 : 16; // [31:16]
  163. } b;
  164. } REG_PMIC_PSM_RTC_PWR_ON_TH1_T;
  165. // rtc_pwr_on_th2
  166. typedef union {
  167. uint32_t v;
  168. struct
  169. {
  170. uint32_t rtc_pwr_on_hold_th : 8; // [7:0]
  171. uint32_t rtc_pwr_on_clk_en_th : 8; // [15:8]
  172. uint32_t __31_16 : 16; // [31:16]
  173. } b;
  174. } REG_PMIC_PSM_RTC_PWR_ON_TH2_T;
  175. // rtc_pwr_on_th3
  176. typedef union {
  177. uint32_t v;
  178. struct
  179. {
  180. uint32_t rtc_pwr_on_done_th : 8; // [7:0]
  181. uint32_t rtc_pwr_on_timeout_th : 8; // [15:8]
  182. uint32_t __31_16 : 16; // [31:16]
  183. } b;
  184. } REG_PMIC_PSM_RTC_PWR_ON_TH3_T;
  185. // psm_cnt_l_th
  186. typedef union {
  187. uint32_t v;
  188. struct
  189. {
  190. uint32_t psm_cnt_th_15_0 : 16; // [15:0]
  191. uint32_t __31_16 : 16; // [31:16]
  192. } b;
  193. } REG_PMIC_PSM_PSM_CNT_L_TH_T;
  194. // psm_cnt_h_th
  195. typedef union {
  196. uint32_t v;
  197. struct
  198. {
  199. uint32_t psm_cnt_th_31_16 : 16; // [15:0]
  200. uint32_t __31_16 : 16; // [31:16]
  201. } b;
  202. } REG_PMIC_PSM_PSM_CNT_H_TH_T;
  203. // psm_alarm_cnt_l_th
  204. typedef union {
  205. uint32_t v;
  206. struct
  207. {
  208. uint32_t psm_alarm_cnt_th_15_0 : 16; // [15:0]
  209. uint32_t __31_16 : 16; // [31:16]
  210. } b;
  211. } REG_PMIC_PSM_PSM_ALARM_CNT_L_TH_T;
  212. // psm_alarm_cnt_h_th
  213. typedef union {
  214. uint32_t v;
  215. struct
  216. {
  217. uint32_t psm_alarm_cnt_th_31_16 : 16; // [15:0]
  218. uint32_t __31_16 : 16; // [31:16]
  219. } b;
  220. } REG_PMIC_PSM_PSM_ALARM_CNT_H_TH_T;
  221. // psm_cnt_interval_th
  222. typedef union {
  223. uint32_t v;
  224. struct
  225. {
  226. uint32_t psm_cnt_interval_th_15_0 : 16; // [15:0]
  227. uint32_t __31_16 : 16; // [31:16]
  228. } b;
  229. } REG_PMIC_PSM_PSM_CNT_INTERVAL_TH_T;
  230. // psm_cnt_interval_phase
  231. typedef union {
  232. uint32_t v;
  233. struct
  234. {
  235. uint32_t psm_cnt_interval_phase_15_0 : 16; // [15:0]
  236. uint32_t __31_16 : 16; // [31:16]
  237. } b;
  238. } REG_PMIC_PSM_PSM_CNT_INTERVAL_PHASE_T;
  239. // dcxo
  240. typedef union {
  241. uint32_t v;
  242. struct
  243. {
  244. uint32_t ldo_dcxo_v : 6; // [5:0]
  245. uint32_t ldo_dcxo_cl_adj : 3; // [8:6]
  246. uint32_t ldo_dcxo_rz_adj : 1; // [9]
  247. uint32_t ldo_dcxo_stb : 2; // [11:10]
  248. uint32_t ldo_dcxo_shpt_en : 1; // [12]
  249. uint32_t ldo_dcxo_discharge_en : 1; // [13]
  250. uint32_t ldo_dcxo_lp_en : 1; // [14]
  251. uint32_t psm_reg_dbnc_sel : 1; // [15]
  252. uint32_t __31_16 : 16; // [31:16]
  253. } b;
  254. } REG_PMIC_PSM_DCXO_T;
  255. // psm_rc_clk_div
  256. typedef union {
  257. uint32_t v;
  258. struct
  259. {
  260. uint32_t wdg_rst_clk_sel_en : 1; // [0]
  261. uint32_t __3_1 : 3; // [3:1]
  262. uint32_t clk_cal_64k_div_th : 4; // [7:4]
  263. uint32_t rc_32k_cal_cnt_p : 4; // [11:8]
  264. uint32_t __31_12 : 20; // [31:12]
  265. } b;
  266. } REG_PMIC_PSM_PSM_RC_CLK_DIV_T;
  267. // psm_cnt_update_l_value
  268. typedef union {
  269. uint32_t v;
  270. struct
  271. {
  272. uint32_t psm_cnt_update_value_15_0 : 16; // [15:0], read only
  273. uint32_t __31_16 : 16; // [31:16]
  274. } b;
  275. } REG_PMIC_PSM_PSM_CNT_UPDATE_L_VALUE_T;
  276. // psm_cnt_update_h_value
  277. typedef union {
  278. uint32_t v;
  279. struct
  280. {
  281. uint32_t psm_cnt_update_value_31_16 : 16; // [15:0], read only
  282. uint32_t __31_16 : 16; // [31:16]
  283. } b;
  284. } REG_PMIC_PSM_PSM_CNT_UPDATE_H_VALUE_T;
  285. // psm_status
  286. typedef union {
  287. uint32_t v;
  288. struct
  289. {
  290. uint32_t ext_int : 1; // [0], read only
  291. uint32_t pbint1_int : 1; // [1], read only
  292. uint32_t pbint2_int : 1; // [2], read only
  293. uint32_t charger_int : 1; // [3], read only
  294. uint32_t psm_req_int : 1; // [4], read only
  295. uint32_t alarm_req_int : 1; // [5], read only
  296. uint32_t psm_cnt_update_vld : 1; // [6], read only
  297. uint32_t __7_7 : 1; // [7]
  298. uint32_t ext_int_mask : 1; // [8]
  299. uint32_t pbint1_int_mask : 1; // [9]
  300. uint32_t pbint2_int_mask : 1; // [10]
  301. uint32_t charger_int_mask : 1; // [11]
  302. uint32_t psm_req_int_mask : 1; // [12]
  303. uint32_t alarm_req_int_mask : 1; // [13]
  304. uint32_t __31_14 : 18; // [31:14]
  305. } b;
  306. } REG_PMIC_PSM_PSM_STATUS_T;
  307. // psm_fsm_status
  308. typedef union {
  309. uint32_t v;
  310. struct
  311. {
  312. uint32_t psm_fsm : 15; // [14:0], read only
  313. uint32_t __31_15 : 17; // [31:15]
  314. } b;
  315. } REG_PMIC_PSM_PSM_FSM_STATUS_T;
  316. // psm_cal_cnt
  317. typedef union {
  318. uint32_t v;
  319. struct
  320. {
  321. uint32_t psm_cal_cnt : 16; // [15:0], read only
  322. uint32_t __31_16 : 16; // [31:16]
  323. } b;
  324. } REG_PMIC_PSM_PSM_CAL_CNT_T;
  325. // pbint_1s_thd
  326. typedef union {
  327. uint32_t v;
  328. struct
  329. {
  330. uint32_t pbint_1s_thd : 12; // [11:0]
  331. uint32_t __31_12 : 20; // [31:12]
  332. } b;
  333. } REG_PMIC_PSM_PBINT_1S_THD_T;
  334. // por_timer_thd
  335. typedef union {
  336. uint32_t v;
  337. struct
  338. {
  339. uint32_t ext_rst_timer_thd : 10; // [9:0]
  340. uint32_t bg_pd_timer_thd : 6; // [15:10]
  341. uint32_t __31_16 : 16; // [31:16]
  342. } b;
  343. } REG_PMIC_PSM_POR_TIMER_THD_T;
  344. // ext_xtl_dbs_timer
  345. typedef union {
  346. uint32_t v;
  347. struct
  348. {
  349. uint32_t ext_xtl_dbs_timer0 : 8; // [7:0]
  350. uint32_t ext_xtl_dbs_timer1 : 8; // [15:8]
  351. uint32_t __31_16 : 16; // [31:16]
  352. } b;
  353. } REG_PMIC_PSM_EXT_XTL_DBS_TIMER_T;
  354. // ext_xtl_en_hl
  355. typedef union {
  356. uint32_t v;
  357. struct
  358. {
  359. uint32_t ext_xtl_en_hl : 8; // [7:0]
  360. uint32_t __31_8 : 24; // [31:8]
  361. } b;
  362. } REG_PMIC_PSM_EXT_XTL_EN_HL_T;
  363. // clk_32k_xtal_calibra_sel
  364. typedef union {
  365. uint32_t v;
  366. struct
  367. {
  368. uint32_t clk_32k_xtal_calibra_sel : 1; // [0]
  369. uint32_t psm_reg_xtal32k_pon : 1; // [1]
  370. uint32_t __31_2 : 30; // [31:2]
  371. } b;
  372. } REG_PMIC_PSM_CLK_32K_XTAL_CALIBRA_SEL_T;
  373. // xtal_por_1st_clk_sel
  374. typedef union {
  375. uint32_t v;
  376. struct
  377. {
  378. uint32_t xtal_por_1st_clk_sel : 1; // [0]
  379. uint32_t __7_1 : 7; // [7:1]
  380. uint32_t xtl0 : 1; // [8], read only
  381. uint32_t xtl1 : 1; // [9], read only
  382. uint32_t xtl2 : 1; // [10], read only
  383. uint32_t xtl3 : 1; // [11], read only
  384. uint32_t xtl4 : 1; // [12], read only
  385. uint32_t xtl5 : 1; // [13], read only
  386. uint32_t xtl6 : 1; // [14], read only
  387. uint32_t xtl7 : 1; // [15], read only
  388. uint32_t __31_16 : 16; // [31:16]
  389. } b;
  390. } REG_PMIC_PSM_XTAL_POR_1ST_CLK_SEL_T;
  391. // reserved23
  392. typedef union {
  393. uint32_t v;
  394. struct
  395. {
  396. uint32_t reserved23 : 16; // [15:0]
  397. uint32_t __31_16 : 16; // [31:16]
  398. } b;
  399. } REG_PMIC_PSM_RESERVED23_T;
  400. // reserved24
  401. typedef union {
  402. uint32_t v;
  403. struct
  404. {
  405. uint32_t reserved24 : 16; // [15:0]
  406. uint32_t __31_16 : 16; // [31:16]
  407. } b;
  408. } REG_PMIC_PSM_RESERVED24_T;
  409. // reserved25
  410. typedef union {
  411. uint32_t v;
  412. struct
  413. {
  414. uint32_t reserved25 : 16; // [15:0]
  415. uint32_t __31_16 : 16; // [31:16]
  416. } b;
  417. } REG_PMIC_PSM_RESERVED25_T;
  418. // reserved26
  419. typedef union {
  420. uint32_t v;
  421. struct
  422. {
  423. uint32_t reserved26 : 16; // [15:0]
  424. uint32_t __31_16 : 16; // [31:16]
  425. } b;
  426. } REG_PMIC_PSM_RESERVED26_T;
  427. // reserved27
  428. typedef union {
  429. uint32_t v;
  430. struct
  431. {
  432. uint32_t reserved27 : 16; // [15:0]
  433. uint32_t __31_16 : 16; // [31:16]
  434. } b;
  435. } REG_PMIC_PSM_RESERVED27_T;
  436. // reserved28
  437. typedef union {
  438. uint32_t v;
  439. struct
  440. {
  441. uint32_t reserved28 : 16; // [15:0]
  442. uint32_t __31_16 : 16; // [31:16]
  443. } b;
  444. } REG_PMIC_PSM_RESERVED28_T;
  445. // reserved29
  446. typedef union {
  447. uint32_t v;
  448. struct
  449. {
  450. uint32_t reserved29 : 16; // [15:0]
  451. uint32_t __31_16 : 16; // [31:16]
  452. } b;
  453. } REG_PMIC_PSM_RESERVED29_T;
  454. // rtc_reserved1
  455. typedef union {
  456. uint32_t v;
  457. struct
  458. {
  459. uint32_t uvlo_en : 1; // [0]
  460. uint32_t vbatlow_en : 1; // [1]
  461. uint32_t pbint_pullh_enb : 1; // [2]
  462. uint32_t __7_3 : 5; // [7:3]
  463. uint32_t rtc_reserved1 : 8; // [15:8]
  464. uint32_t __31_16 : 16; // [31:16]
  465. } b;
  466. } REG_PMIC_PSM_RTC_RESERVED1_T;
  467. // rg_rtc_vosel
  468. typedef union {
  469. uint32_t v;
  470. struct
  471. {
  472. uint32_t rg_vbatbk_vosel : 3; // [2:0]
  473. uint32_t __7_3 : 5; // [7:3]
  474. uint32_t rg_rtc_vosel : 3; // [10:8]
  475. uint32_t __31_11 : 21; // [31:11]
  476. } b;
  477. } REG_PMIC_PSM_RG_RTC_VOSEL_T;
  478. // psm_reg_wr_protect
  479. #define PMIC_PSM_PSM_REG_WR(n) (((n)&0xffff) << 0)
  480. // psm_32k_cal_th
  481. #define PMIC_PSM_RC_32K_CAL_CNT_N(n) (((n)&0xf) << 0)
  482. #define PMIC_PSM_RC_32K_CAL_PRE_TH(n) (((n)&0xf) << 8)
  483. // psm_26m_cal_dn_th
  484. #define PMIC_PSM_RC_26M_CAL_CNT_DN_TH(n) (((n)&0xffff) << 0)
  485. // psm_26m_cal_up_th
  486. #define PMIC_PSM_RC_26M_CAL_CNT_UP_TH(n) (((n)&0xffff) << 0)
  487. // psm_ctrl
  488. #define PMIC_PSM_PSM_EN (1 << 0)
  489. #define PMIC_PSM_RTC_PWR_ON_TIMEOUT_EN (1 << 1)
  490. #define PMIC_PSM_EXT_INT_PWR_EN (1 << 2)
  491. #define PMIC_PSM_PBINT1_PWR_EN (1 << 3)
  492. #define PMIC_PSM_PBINT2_PWR_EN (1 << 4)
  493. #define PMIC_PSM_CHARGER_PWR_EN (1 << 5)
  494. #define PMIC_PSM_PSM_CNT_ALARM_EN (1 << 6)
  495. #define PMIC_PSM_PSM_CNT_ALM_EN (1 << 7)
  496. #define PMIC_PSM_PSM_SOFTWARE_RESET (1 << 8)
  497. #define PMIC_PSM_PSM_CNT_UPDATE (1 << 9)
  498. #define PMIC_PSM_PSM_CNT_EN (1 << 10)
  499. #define PMIC_PSM_PSM_STATUS_CLR (1 << 11)
  500. #define PMIC_PSM_PSM_CAL_EN (1 << 12)
  501. #define PMIC_PSM_RTC_32K_CLK_SEL (1 << 15)
  502. // rtc_pwr_off_th1
  503. #define PMIC_PSM_RTC_PWR_OFF_CLK_EN_TH(n) (((n)&0xff) << 0)
  504. #define PMIC_PSM_RTC_PWR_OFF_HOLD_TH(n) (((n)&0xff) << 8)
  505. // rtc_pwr_off_th2
  506. #define PMIC_PSM_RTC_PWR_OFF_RSTN_TH(n) (((n)&0xff) << 0)
  507. #define PMIC_PSM_RTC_PWR_OFF_PD_TH(n) (((n)&0xff) << 8)
  508. // rtc_pwr_off_th3
  509. #define PMIC_PSM_RTC_PWR_OFF_DONE_TH(n) (((n)&0xff) << 0)
  510. // rtc_pwr_on_th1
  511. #define PMIC_PSM_RTC_PWR_ON_PD_TH(n) (((n)&0xff) << 0)
  512. #define PMIC_PSM_RTC_PWR_ON_RSTN_TH(n) (((n)&0xff) << 8)
  513. // rtc_pwr_on_th2
  514. #define PMIC_PSM_RTC_PWR_ON_HOLD_TH(n) (((n)&0xff) << 0)
  515. #define PMIC_PSM_RTC_PWR_ON_CLK_EN_TH(n) (((n)&0xff) << 8)
  516. // rtc_pwr_on_th3
  517. #define PMIC_PSM_RTC_PWR_ON_DONE_TH(n) (((n)&0xff) << 0)
  518. #define PMIC_PSM_RTC_PWR_ON_TIMEOUT_TH(n) (((n)&0xff) << 8)
  519. // psm_cnt_l_th
  520. #define PMIC_PSM_PSM_CNT_TH_15_0(n) (((n)&0xffff) << 0)
  521. // psm_cnt_h_th
  522. #define PMIC_PSM_PSM_CNT_TH_31_16(n) (((n)&0xffff) << 0)
  523. // psm_alarm_cnt_l_th
  524. #define PMIC_PSM_PSM_ALARM_CNT_TH_15_0(n) (((n)&0xffff) << 0)
  525. // psm_alarm_cnt_h_th
  526. #define PMIC_PSM_PSM_ALARM_CNT_TH_31_16(n) (((n)&0xffff) << 0)
  527. // psm_cnt_interval_th
  528. #define PMIC_PSM_PSM_CNT_INTERVAL_TH_15_0(n) (((n)&0xffff) << 0)
  529. // psm_cnt_interval_phase
  530. #define PMIC_PSM_PSM_CNT_INTERVAL_PHASE_15_0(n) (((n)&0xffff) << 0)
  531. // dcxo
  532. #define PMIC_PSM_LDO_DCXO_V(n) (((n)&0x3f) << 0)
  533. #define PMIC_PSM_LDO_DCXO_CL_ADJ(n) (((n)&0x7) << 6)
  534. #define PMIC_PSM_LDO_DCXO_RZ_ADJ (1 << 9)
  535. #define PMIC_PSM_LDO_DCXO_STB(n) (((n)&0x3) << 10)
  536. #define PMIC_PSM_LDO_DCXO_SHPT_EN (1 << 12)
  537. #define PMIC_PSM_LDO_DCXO_DISCHARGE_EN (1 << 13)
  538. #define PMIC_PSM_LDO_DCXO_LP_EN (1 << 14)
  539. #define PMIC_PSM_PSM_REG_DBNC_SEL (1 << 15)
  540. // psm_rc_clk_div
  541. #define PMIC_PSM_WDG_RST_CLK_SEL_EN (1 << 0)
  542. #define PMIC_PSM_CLK_CAL_64K_DIV_TH(n) (((n)&0xf) << 4)
  543. #define PMIC_PSM_RC_32K_CAL_CNT_P(n) (((n)&0xf) << 8)
  544. // psm_cnt_update_l_value
  545. #define PMIC_PSM_PSM_CNT_UPDATE_VALUE_15_0(n) (((n)&0xffff) << 0)
  546. // psm_cnt_update_h_value
  547. #define PMIC_PSM_PSM_CNT_UPDATE_VALUE_31_16(n) (((n)&0xffff) << 0)
  548. // psm_status
  549. #define PMIC_PSM_EXT_INT (1 << 0)
  550. #define PMIC_PSM_PBINT1_INT (1 << 1)
  551. #define PMIC_PSM_PBINT2_INT (1 << 2)
  552. #define PMIC_PSM_CHARGER_INT (1 << 3)
  553. #define PMIC_PSM_PSM_REQ_INT (1 << 4)
  554. #define PMIC_PSM_ALARM_REQ_INT (1 << 5)
  555. #define PMIC_PSM_PSM_CNT_UPDATE_VLD (1 << 6)
  556. #define PMIC_PSM_EXT_INT_MASK (1 << 8)
  557. #define PMIC_PSM_PBINT1_INT_MASK (1 << 9)
  558. #define PMIC_PSM_PBINT2_INT_MASK (1 << 10)
  559. #define PMIC_PSM_CHARGER_INT_MASK (1 << 11)
  560. #define PMIC_PSM_PSM_REQ_INT_MASK (1 << 12)
  561. #define PMIC_PSM_ALARM_REQ_INT_MASK (1 << 13)
  562. // psm_fsm_status
  563. #define PMIC_PSM_PSM_FSM(n) (((n)&0x7fff) << 0)
  564. // psm_cal_cnt
  565. #define PMIC_PSM_PSM_CAL_CNT(n) (((n)&0xffff) << 0)
  566. // pbint_1s_thd
  567. #define PMIC_PSM_PBINT_1S_THD(n) (((n)&0xfff) << 0)
  568. // por_timer_thd
  569. #define PMIC_PSM_EXT_RST_TIMER_THD(n) (((n)&0x3ff) << 0)
  570. #define PMIC_PSM_BG_PD_TIMER_THD(n) (((n)&0x3f) << 10)
  571. // ext_xtl_dbs_timer
  572. #define PMIC_PSM_EXT_XTL_DBS_TIMER0(n) (((n)&0xff) << 0)
  573. #define PMIC_PSM_EXT_XTL_DBS_TIMER1(n) (((n)&0xff) << 8)
  574. // ext_xtl_en_hl
  575. #define PMIC_PSM_EXT_XTL_EN_HL(n) (((n)&0xff) << 0)
  576. // clk_32k_xtal_calibra_sel
  577. #define PMIC_PSM_CLK_32K_XTAL_CALIBRA_SEL (1 << 0)
  578. #define PMIC_PSM_PSM_REG_XTAL32K_PON (1 << 1)
  579. // xtal_por_1st_clk_sel
  580. #define PMIC_PSM_XTAL_POR_1ST_CLK_SEL (1 << 0)
  581. #define PMIC_PSM_XTL0 (1 << 8)
  582. #define PMIC_PSM_XTL1 (1 << 9)
  583. #define PMIC_PSM_XTL2 (1 << 10)
  584. #define PMIC_PSM_XTL3 (1 << 11)
  585. #define PMIC_PSM_XTL4 (1 << 12)
  586. #define PMIC_PSM_XTL5 (1 << 13)
  587. #define PMIC_PSM_XTL6 (1 << 14)
  588. #define PMIC_PSM_XTL7 (1 << 15)
  589. // reserved23
  590. #define PMIC_PSM_RESERVED23(n) (((n)&0xffff) << 0)
  591. // reserved24
  592. #define PMIC_PSM_RESERVED24(n) (((n)&0xffff) << 0)
  593. // reserved25
  594. #define PMIC_PSM_RESERVED25(n) (((n)&0xffff) << 0)
  595. // reserved26
  596. #define PMIC_PSM_RESERVED26(n) (((n)&0xffff) << 0)
  597. // reserved27
  598. #define PMIC_PSM_RESERVED27(n) (((n)&0xffff) << 0)
  599. // reserved28
  600. #define PMIC_PSM_RESERVED28(n) (((n)&0xffff) << 0)
  601. // reserved29
  602. #define PMIC_PSM_RESERVED29(n) (((n)&0xffff) << 0)
  603. // rtc_reserved1
  604. #define PMIC_PSM_UVLO_EN (1 << 0)
  605. #define PMIC_PSM_VBATLOW_EN (1 << 1)
  606. #define PMIC_PSM_PBINT_PULLH_ENB (1 << 2)
  607. #define PMIC_PSM_RTC_RESERVED1(n) (((n)&0xff) << 8)
  608. // rg_rtc_vosel
  609. #define PMIC_PSM_RG_VBATBK_VOSEL(n) (((n)&0x7) << 0)
  610. #define PMIC_PSM_RG_RTC_VOSEL(n) (((n)&0x7) << 8)
  611. #endif // _PMIC_PSM_H_