idt8a340_reg.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Based on 5.2.0, Family Programming Guide (Sept 30, 2020)
  4. *
  5. * Copyright (C) 2021 Integrated Device Technology, Inc., a Renesas Company.
  6. */
  7. #ifndef HAVE_IDT8A340_REG
  8. #define HAVE_IDT8A340_REG
  9. #define PAGE_ADDR_BASE 0x0000
  10. #define PAGE_ADDR 0x00fc
  11. #define HW_REVISION 0x8180
  12. #define REV_ID 0x007a
  13. #define HW_DPLL_0 (0x8a00)
  14. #define HW_DPLL_1 (0x8b00)
  15. #define HW_DPLL_2 (0x8c00)
  16. #define HW_DPLL_3 (0x8d00)
  17. #define HW_DPLL_4 (0x8e00)
  18. #define HW_DPLL_5 (0x8f00)
  19. #define HW_DPLL_6 (0x9000)
  20. #define HW_DPLL_7 (0x9100)
  21. #define HW_DPLL_TOD_SW_TRIG_ADDR__0 (0x080)
  22. #define HW_DPLL_TOD_CTRL_1 (0x089)
  23. #define HW_DPLL_TOD_CTRL_2 (0x08A)
  24. #define HW_DPLL_TOD_OVR__0 (0x098)
  25. #define HW_DPLL_TOD_OUT_0__0 (0x0B0)
  26. #define HW_Q0_Q1_CH_SYNC_CTRL_0 (0xa740)
  27. #define HW_Q0_Q1_CH_SYNC_CTRL_1 (0xa741)
  28. #define HW_Q2_Q3_CH_SYNC_CTRL_0 (0xa742)
  29. #define HW_Q2_Q3_CH_SYNC_CTRL_1 (0xa743)
  30. #define HW_Q4_Q5_CH_SYNC_CTRL_0 (0xa744)
  31. #define HW_Q4_Q5_CH_SYNC_CTRL_1 (0xa745)
  32. #define HW_Q6_Q7_CH_SYNC_CTRL_0 (0xa746)
  33. #define HW_Q6_Q7_CH_SYNC_CTRL_1 (0xa747)
  34. #define HW_Q8_CH_SYNC_CTRL_0 (0xa748)
  35. #define HW_Q8_CH_SYNC_CTRL_1 (0xa749)
  36. #define HW_Q9_CH_SYNC_CTRL_0 (0xa74a)
  37. #define HW_Q9_CH_SYNC_CTRL_1 (0xa74b)
  38. #define HW_Q10_CH_SYNC_CTRL_0 (0xa74c)
  39. #define HW_Q10_CH_SYNC_CTRL_1 (0xa74d)
  40. #define HW_Q11_CH_SYNC_CTRL_0 (0xa74e)
  41. #define HW_Q11_CH_SYNC_CTRL_1 (0xa74f)
  42. #define SYNC_SOURCE_DPLL0_TOD_PPS 0x14
  43. #define SYNC_SOURCE_DPLL1_TOD_PPS 0x15
  44. #define SYNC_SOURCE_DPLL2_TOD_PPS 0x16
  45. #define SYNC_SOURCE_DPLL3_TOD_PPS 0x17
  46. #define SYNCTRL1_MASTER_SYNC_RST BIT(7)
  47. #define SYNCTRL1_MASTER_SYNC_TRIG BIT(5)
  48. #define SYNCTRL1_TOD_SYNC_TRIG BIT(4)
  49. #define SYNCTRL1_FBDIV_FRAME_SYNC_TRIG BIT(3)
  50. #define SYNCTRL1_FBDIV_SYNC_TRIG BIT(2)
  51. #define SYNCTRL1_Q1_DIV_SYNC_TRIG BIT(1)
  52. #define SYNCTRL1_Q0_DIV_SYNC_TRIG BIT(0)
  53. #define HW_Q8_CTRL_SPARE (0xa7d4)
  54. #define HW_Q11_CTRL_SPARE (0xa7ec)
  55. /**
  56. * Select FOD5 as sync_trigger for Q8 divider.
  57. * Transition from logic zero to one
  58. * sets trigger to sync Q8 divider.
  59. *
  60. * Unused when FOD4 is driving Q8 divider (normal operation).
  61. */
  62. #define Q9_TO_Q8_SYNC_TRIG BIT(1)
  63. /**
  64. * Enable FOD5 as driver for clock and sync for Q8 divider.
  65. * Enable fanout buffer for FOD5.
  66. *
  67. * Unused when FOD4 is driving Q8 divider (normal operation).
  68. */
  69. #define Q9_TO_Q8_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK (BIT(0) | BIT(2))
  70. /**
  71. * Select FOD6 as sync_trigger for Q11 divider.
  72. * Transition from logic zero to one
  73. * sets trigger to sync Q11 divider.
  74. *
  75. * Unused when FOD7 is driving Q11 divider (normal operation).
  76. */
  77. #define Q10_TO_Q11_SYNC_TRIG BIT(1)
  78. /**
  79. * Enable FOD6 as driver for clock and sync for Q11 divider.
  80. * Enable fanout buffer for FOD6.
  81. *
  82. * Unused when FOD7 is driving Q11 divider (normal operation).
  83. */
  84. #define Q10_TO_Q11_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK (BIT(0) | BIT(2))
  85. #define RESET_CTRL 0xc000
  86. #define SM_RESET 0x0012
  87. #define SM_RESET_V520 0x0013
  88. #define SM_RESET_CMD 0x5A
  89. #define GENERAL_STATUS 0xc014
  90. #define BOOT_STATUS 0x0000
  91. #define HW_REV_ID 0x000A
  92. #define BOND_ID 0x000B
  93. #define HW_CSR_ID 0x000C
  94. #define HW_IRQ_ID 0x000E
  95. #define MAJ_REL 0x0010
  96. #define MIN_REL 0x0011
  97. #define HOTFIX_REL 0x0012
  98. #define PIPELINE_ID 0x0014
  99. #define BUILD_ID 0x0018
  100. #define JTAG_DEVICE_ID 0x001c
  101. #define PRODUCT_ID 0x001e
  102. #define OTP_SCSR_CONFIG_SELECT 0x0022
  103. #define STATUS 0xc03c
  104. #define DPLL0_STATUS 0x0018
  105. #define DPLL1_STATUS 0x0019
  106. #define DPLL2_STATUS 0x001a
  107. #define DPLL3_STATUS 0x001b
  108. #define DPLL4_STATUS 0x001c
  109. #define DPLL5_STATUS 0x001d
  110. #define DPLL6_STATUS 0x001e
  111. #define DPLL7_STATUS 0x001f
  112. #define DPLL_SYS_STATUS 0x0020
  113. #define DPLL_SYS_APLL_STATUS 0x0021
  114. #define DPLL0_FILTER_STATUS 0x0044
  115. #define DPLL1_FILTER_STATUS 0x004c
  116. #define DPLL2_FILTER_STATUS 0x0054
  117. #define DPLL3_FILTER_STATUS 0x005c
  118. #define DPLL4_FILTER_STATUS 0x0064
  119. #define DPLL5_FILTER_STATUS 0x006c
  120. #define DPLL6_FILTER_STATUS 0x0074
  121. #define DPLL7_FILTER_STATUS 0x007c
  122. #define DPLLSYS_FILTER_STATUS 0x0084
  123. #define USER_GPIO0_TO_7_STATUS 0x008a
  124. #define USER_GPIO8_TO_15_STATUS 0x008b
  125. #define GPIO_USER_CONTROL 0xc160
  126. #define GPIO0_TO_7_OUT 0x0000
  127. #define GPIO8_TO_15_OUT 0x0001
  128. #define GPIO0_TO_7_OUT_V520 0x0002
  129. #define GPIO8_TO_15_OUT_V520 0x0003
  130. #define STICKY_STATUS_CLEAR 0xc164
  131. #define GPIO_TOD_NOTIFICATION_CLEAR 0xc16c
  132. #define ALERT_CFG 0xc188
  133. #define SYS_DPLL_XO 0xc194
  134. #define SYS_APLL 0xc19c
  135. #define INPUT_0 0xc1b0
  136. #define INPUT_1 0xc1c0
  137. #define INPUT_2 0xc1d0
  138. #define INPUT_3 0xc200
  139. #define INPUT_4 0xc210
  140. #define INPUT_5 0xc220
  141. #define INPUT_6 0xc230
  142. #define INPUT_7 0xc240
  143. #define INPUT_8 0xc250
  144. #define INPUT_9 0xc260
  145. #define INPUT_10 0xc280
  146. #define INPUT_11 0xc290
  147. #define INPUT_12 0xc2a0
  148. #define INPUT_13 0xc2b0
  149. #define INPUT_14 0xc2c0
  150. #define INPUT_15 0xc2d0
  151. #define REF_MON_0 0xc2e0
  152. #define REF_MON_1 0xc2ec
  153. #define REF_MON_2 0xc300
  154. #define REF_MON_3 0xc30c
  155. #define REF_MON_4 0xc318
  156. #define REF_MON_5 0xc324
  157. #define REF_MON_6 0xc330
  158. #define REF_MON_7 0xc33c
  159. #define REF_MON_8 0xc348
  160. #define REF_MON_9 0xc354
  161. #define REF_MON_10 0xc360
  162. #define REF_MON_11 0xc36c
  163. #define REF_MON_12 0xc380
  164. #define REF_MON_13 0xc38c
  165. #define REF_MON_14 0xc398
  166. #define REF_MON_15 0xc3a4
  167. #define DPLL_0 0xc3b0
  168. #define DPLL_CTRL_REG_0 0x0002
  169. #define DPLL_CTRL_REG_1 0x0003
  170. #define DPLL_CTRL_REG_2 0x0004
  171. #define DPLL_TOD_SYNC_CFG 0x0031
  172. #define DPLL_COMBO_SLAVE_CFG_0 0x0032
  173. #define DPLL_COMBO_SLAVE_CFG_1 0x0033
  174. #define DPLL_SLAVE_REF_CFG 0x0034
  175. #define DPLL_REF_MODE 0x0035
  176. #define DPLL_PHASE_MEASUREMENT_CFG 0x0036
  177. #define DPLL_MODE 0x0037
  178. #define DPLL_MODE_V520 0x003B
  179. #define DPLL_1 0xc400
  180. #define DPLL_2 0xc438
  181. #define DPLL_2_V520 0xc43c
  182. #define DPLL_3 0xc480
  183. #define DPLL_4 0xc4b8
  184. #define DPLL_4_V520 0xc4bc
  185. #define DPLL_5 0xc500
  186. #define DPLL_6 0xc538
  187. #define DPLL_6_V520 0xc53c
  188. #define DPLL_7 0xc580
  189. #define SYS_DPLL 0xc5b8
  190. #define SYS_DPLL_V520 0xc5bc
  191. #define DPLL_CTRL_0 0xc600
  192. #define DPLL_CTRL_DPLL_MANU_REF_CFG 0x0001
  193. #define DPLL_CTRL_DPLL_FOD_FREQ 0x001c
  194. #define DPLL_CTRL_COMBO_MASTER_CFG 0x003a
  195. #define DPLL_CTRL_1 0xc63c
  196. #define DPLL_CTRL_2 0xc680
  197. #define DPLL_CTRL_3 0xc6bc
  198. #define DPLL_CTRL_4 0xc700
  199. #define DPLL_CTRL_5 0xc73c
  200. #define DPLL_CTRL_6 0xc780
  201. #define DPLL_CTRL_7 0xc7bc
  202. #define SYS_DPLL_CTRL 0xc800
  203. #define DPLL_PHASE_0 0xc818
  204. /* Signed 42-bit FFO in units of 2^(-53) */
  205. #define DPLL_WR_PHASE 0x0000
  206. #define DPLL_PHASE_1 0xc81c
  207. #define DPLL_PHASE_2 0xc820
  208. #define DPLL_PHASE_3 0xc824
  209. #define DPLL_PHASE_4 0xc828
  210. #define DPLL_PHASE_5 0xc82c
  211. #define DPLL_PHASE_6 0xc830
  212. #define DPLL_PHASE_7 0xc834
  213. #define DPLL_FREQ_0 0xc838
  214. /* Signed 42-bit FFO in units of 2^(-53) */
  215. #define DPLL_WR_FREQ 0x0000
  216. #define DPLL_FREQ_1 0xc840
  217. #define DPLL_FREQ_2 0xc848
  218. #define DPLL_FREQ_3 0xc850
  219. #define DPLL_FREQ_4 0xc858
  220. #define DPLL_FREQ_5 0xc860
  221. #define DPLL_FREQ_6 0xc868
  222. #define DPLL_FREQ_7 0xc870
  223. #define DPLL_PHASE_PULL_IN_0 0xc880
  224. #define PULL_IN_OFFSET 0x0000 /* Signed 32 bit */
  225. #define PULL_IN_SLOPE_LIMIT 0x0004 /* Unsigned 24 bit */
  226. #define PULL_IN_CTRL 0x0007
  227. #define DPLL_PHASE_PULL_IN_1 0xc888
  228. #define DPLL_PHASE_PULL_IN_2 0xc890
  229. #define DPLL_PHASE_PULL_IN_3 0xc898
  230. #define DPLL_PHASE_PULL_IN_4 0xc8a0
  231. #define DPLL_PHASE_PULL_IN_5 0xc8a8
  232. #define DPLL_PHASE_PULL_IN_6 0xc8b0
  233. #define DPLL_PHASE_PULL_IN_7 0xc8b8
  234. #define GPIO_CFG 0xc8c0
  235. #define GPIO_CFG_GBL 0x0000
  236. #define GPIO_0 0xc8c2
  237. #define GPIO_DCO_INC_DEC 0x0000
  238. #define GPIO_OUT_CTRL_0 0x0001
  239. #define GPIO_OUT_CTRL_1 0x0002
  240. #define GPIO_TOD_TRIG 0x0003
  241. #define GPIO_DPLL_INDICATOR 0x0004
  242. #define GPIO_LOS_INDICATOR 0x0005
  243. #define GPIO_REF_INPUT_DSQ_0 0x0006
  244. #define GPIO_REF_INPUT_DSQ_1 0x0007
  245. #define GPIO_REF_INPUT_DSQ_2 0x0008
  246. #define GPIO_REF_INPUT_DSQ_3 0x0009
  247. #define GPIO_MAN_CLK_SEL_0 0x000a
  248. #define GPIO_MAN_CLK_SEL_1 0x000b
  249. #define GPIO_MAN_CLK_SEL_2 0x000c
  250. #define GPIO_SLAVE 0x000d
  251. #define GPIO_ALERT_OUT_CFG 0x000e
  252. #define GPIO_TOD_NOTIFICATION_CFG 0x000f
  253. #define GPIO_CTRL 0x0010
  254. #define GPIO_CTRL_V520 0x0011
  255. #define GPIO_1 0xc8d4
  256. #define GPIO_2 0xc8e6
  257. #define GPIO_3 0xc900
  258. #define GPIO_4 0xc912
  259. #define GPIO_5 0xc924
  260. #define GPIO_6 0xc936
  261. #define GPIO_7 0xc948
  262. #define GPIO_8 0xc95a
  263. #define GPIO_9 0xc980
  264. #define GPIO_10 0xc992
  265. #define GPIO_11 0xc9a4
  266. #define GPIO_12 0xc9b6
  267. #define GPIO_13 0xc9c8
  268. #define GPIO_14 0xc9da
  269. #define GPIO_15 0xca00
  270. #define OUT_DIV_MUX 0xca12
  271. #define OUTPUT_0 0xca14
  272. #define OUTPUT_0_V520 0xca20
  273. /* FOD frequency output divider value */
  274. #define OUT_DIV 0x0000
  275. #define OUT_DUTY_CYCLE_HIGH 0x0004
  276. #define OUT_CTRL_0 0x0008
  277. #define OUT_CTRL_1 0x0009
  278. /* Phase adjustment in FOD cycles */
  279. #define OUT_PHASE_ADJ 0x000c
  280. #define OUTPUT_1 0xca24
  281. #define OUTPUT_1_V520 0xca30
  282. #define OUTPUT_2 0xca34
  283. #define OUTPUT_2_V520 0xca40
  284. #define OUTPUT_3 0xca44
  285. #define OUTPUT_3_V520 0xca50
  286. #define OUTPUT_4 0xca54
  287. #define OUTPUT_4_V520 0xca60
  288. #define OUTPUT_5 0xca64
  289. #define OUTPUT_5_V520 0xca80
  290. #define OUTPUT_6 0xca80
  291. #define OUTPUT_6_V520 0xca90
  292. #define OUTPUT_7 0xca90
  293. #define OUTPUT_7_V520 0xcaa0
  294. #define OUTPUT_8 0xcaa0
  295. #define OUTPUT_8_V520 0xcab0
  296. #define OUTPUT_9 0xcab0
  297. #define OUTPUT_9_V520 0xcac0
  298. #define OUTPUT_10 0xcac0
  299. #define OUTPUT_10_V520 0xcad0
  300. #define OUTPUT_11 0xcad0
  301. #define OUTPUT_11_V520 0xcae0
  302. #define SERIAL 0xcae0
  303. #define SERIAL_V520 0xcaf0
  304. #define PWM_ENCODER_0 0xcb00
  305. #define PWM_ENCODER_1 0xcb08
  306. #define PWM_ENCODER_2 0xcb10
  307. #define PWM_ENCODER_3 0xcb18
  308. #define PWM_ENCODER_4 0xcb20
  309. #define PWM_ENCODER_5 0xcb28
  310. #define PWM_ENCODER_6 0xcb30
  311. #define PWM_ENCODER_7 0xcb38
  312. #define PWM_DECODER_0 0xcb40
  313. #define PWM_DECODER_1 0xcb48
  314. #define PWM_DECODER_1_V520 0xcb4a
  315. #define PWM_DECODER_2 0xcb50
  316. #define PWM_DECODER_2_V520 0xcb54
  317. #define PWM_DECODER_3 0xcb58
  318. #define PWM_DECODER_3_V520 0xcb5e
  319. #define PWM_DECODER_4 0xcb60
  320. #define PWM_DECODER_4_V520 0xcb68
  321. #define PWM_DECODER_5 0xcb68
  322. #define PWM_DECODER_5_V520 0xcb80
  323. #define PWM_DECODER_6 0xcb70
  324. #define PWM_DECODER_6_V520 0xcb8a
  325. #define PWM_DECODER_7 0xcb80
  326. #define PWM_DECODER_7_V520 0xcb94
  327. #define PWM_DECODER_8 0xcb88
  328. #define PWM_DECODER_8_V520 0xcb9e
  329. #define PWM_DECODER_9 0xcb90
  330. #define PWM_DECODER_9_V520 0xcba8
  331. #define PWM_DECODER_10 0xcb98
  332. #define PWM_DECODER_10_V520 0xcbb2
  333. #define PWM_DECODER_11 0xcba0
  334. #define PWM_DECODER_11_V520 0xcbbc
  335. #define PWM_DECODER_12 0xcba8
  336. #define PWM_DECODER_12_V520 0xcbc6
  337. #define PWM_DECODER_13 0xcbb0
  338. #define PWM_DECODER_13_V520 0xcbd0
  339. #define PWM_DECODER_14 0xcbb8
  340. #define PWM_DECODER_14_V520 0xcbda
  341. #define PWM_DECODER_15 0xcbc0
  342. #define PWM_DECODER_15_V520 0xcbe4
  343. #define PWM_USER_DATA 0xcbc8
  344. #define PWM_USER_DATA_V520 0xcbf0
  345. #define TOD_0 0xcbcc
  346. #define TOD_0_V520 0xcc00
  347. /* Enable TOD counter, output channel sync and even-PPS mode */
  348. #define TOD_CFG 0x0000
  349. #define TOD_CFG_V520 0x0001
  350. #define TOD_1 0xcbce
  351. #define TOD_1_V520 0xcc02
  352. #define TOD_2 0xcbd0
  353. #define TOD_2_V520 0xcc04
  354. #define TOD_3 0xcbd2
  355. #define TOD_3_V520 0xcc06
  356. #define TOD_WRITE_0 0xcc00
  357. #define TOD_WRITE_0_V520 0xcc10
  358. /* 8-bit subns, 32-bit ns, 48-bit seconds */
  359. #define TOD_WRITE 0x0000
  360. /* Counter increments after TOD write is completed */
  361. #define TOD_WRITE_COUNTER 0x000c
  362. /* TOD write trigger configuration */
  363. #define TOD_WRITE_SELECT_CFG_0 0x000d
  364. /* TOD write trigger selection */
  365. #define TOD_WRITE_CMD 0x000f
  366. #define TOD_WRITE_1 0xcc10
  367. #define TOD_WRITE_1_V520 0xcc20
  368. #define TOD_WRITE_2 0xcc20
  369. #define TOD_WRITE_2_V520 0xcc30
  370. #define TOD_WRITE_3 0xcc30
  371. #define TOD_WRITE_3_V520 0xcc40
  372. #define TOD_READ_PRIMARY_0 0xcc40
  373. #define TOD_READ_PRIMARY_0_V520 0xcc50
  374. /* 8-bit subns, 32-bit ns, 48-bit seconds */
  375. #define TOD_READ_PRIMARY_BASE 0x0000
  376. /* Counter increments after TOD write is completed */
  377. #define TOD_READ_PRIMARY_COUNTER 0x000b
  378. /* Read trigger configuration */
  379. #define TOD_READ_PRIMARY_SEL_CFG_0 0x000c
  380. /* Read trigger selection */
  381. #define TOD_READ_PRIMARY_CMD 0x000e
  382. #define TOD_READ_PRIMARY_CMD_V520 0x000f
  383. #define TOD_READ_PRIMARY_1 0xcc50
  384. #define TOD_READ_PRIMARY_1_V520 0xcc60
  385. #define TOD_READ_PRIMARY_2 0xcc60
  386. #define TOD_READ_PRIMARY_2_V520 0xcc80
  387. #define TOD_READ_PRIMARY_3 0xcc80
  388. #define TOD_READ_PRIMARY_3_V520 0xcc90
  389. #define TOD_READ_SECONDARY_0 0xcc90
  390. #define TOD_READ_SECONDARY_0_V520 0xcca0
  391. /* 8-bit subns, 32-bit ns, 48-bit seconds */
  392. #define TOD_READ_SECONDARY_BASE 0x0000
  393. /* Counter increments after TOD write is completed */
  394. #define TOD_READ_SECONDARY_COUNTER 0x000b
  395. /* Read trigger configuration */
  396. #define TOD_READ_SECONDARY_SEL_CFG_0 0x000c
  397. /* Read trigger selection */
  398. #define TOD_READ_SECONDARY_CMD 0x000e
  399. #define TOD_READ_SECONDARY_CMD_V520 0x000f
  400. #define TOD_READ_SECONDARY_1 0xcca0
  401. #define TOD_READ_SECONDARY_1_V520 0xccb0
  402. #define TOD_READ_SECONDARY_2 0xccb0
  403. #define TOD_READ_SECONDARY_2_V520 0xccc0
  404. #define TOD_READ_SECONDARY_3 0xccc0
  405. #define TOD_READ_SECONDARY_3_V520 0xccd0
  406. #define OUTPUT_TDC_CFG 0xccd0
  407. #define OUTPUT_TDC_CFG_V520 0xcce0
  408. #define OUTPUT_TDC_0 0xcd00
  409. #define OUTPUT_TDC_1 0xcd08
  410. #define OUTPUT_TDC_2 0xcd10
  411. #define OUTPUT_TDC_3 0xcd18
  412. #define INPUT_TDC 0xcd20
  413. #define SCRATCH 0xcf50
  414. #define SCRATCH_V520 0xcf4c
  415. #define EEPROM 0xcf68
  416. #define EEPROM_V520 0xcf64
  417. #define OTP 0xcf70
  418. #define BYTE 0xcf80
  419. /* Bit definitions for the MAJ_REL register */
  420. #define MAJOR_SHIFT (1)
  421. #define MAJOR_MASK (0x7f)
  422. #define PR_BUILD BIT(0)
  423. /* Bit definitions for the USER_GPIO0_TO_7_STATUS register */
  424. #define GPIO0_LEVEL BIT(0)
  425. #define GPIO1_LEVEL BIT(1)
  426. #define GPIO2_LEVEL BIT(2)
  427. #define GPIO3_LEVEL BIT(3)
  428. #define GPIO4_LEVEL BIT(4)
  429. #define GPIO5_LEVEL BIT(5)
  430. #define GPIO6_LEVEL BIT(6)
  431. #define GPIO7_LEVEL BIT(7)
  432. /* Bit definitions for the USER_GPIO8_TO_15_STATUS register */
  433. #define GPIO8_LEVEL BIT(0)
  434. #define GPIO9_LEVEL BIT(1)
  435. #define GPIO10_LEVEL BIT(2)
  436. #define GPIO11_LEVEL BIT(3)
  437. #define GPIO12_LEVEL BIT(4)
  438. #define GPIO13_LEVEL BIT(5)
  439. #define GPIO14_LEVEL BIT(6)
  440. #define GPIO15_LEVEL BIT(7)
  441. /* Bit definitions for the GPIO0_TO_7_OUT register */
  442. #define GPIO0_DRIVE_LEVEL BIT(0)
  443. #define GPIO1_DRIVE_LEVEL BIT(1)
  444. #define GPIO2_DRIVE_LEVEL BIT(2)
  445. #define GPIO3_DRIVE_LEVEL BIT(3)
  446. #define GPIO4_DRIVE_LEVEL BIT(4)
  447. #define GPIO5_DRIVE_LEVEL BIT(5)
  448. #define GPIO6_DRIVE_LEVEL BIT(6)
  449. #define GPIO7_DRIVE_LEVEL BIT(7)
  450. /* Bit definitions for the GPIO8_TO_15_OUT register */
  451. #define GPIO8_DRIVE_LEVEL BIT(0)
  452. #define GPIO9_DRIVE_LEVEL BIT(1)
  453. #define GPIO10_DRIVE_LEVEL BIT(2)
  454. #define GPIO11_DRIVE_LEVEL BIT(3)
  455. #define GPIO12_DRIVE_LEVEL BIT(4)
  456. #define GPIO13_DRIVE_LEVEL BIT(5)
  457. #define GPIO14_DRIVE_LEVEL BIT(6)
  458. #define GPIO15_DRIVE_LEVEL BIT(7)
  459. /* Bit definitions for the DPLL_TOD_SYNC_CFG register */
  460. #define TOD_SYNC_SOURCE_SHIFT (1)
  461. #define TOD_SYNC_SOURCE_MASK (0x3)
  462. #define TOD_SYNC_EN BIT(0)
  463. /* Bit definitions for the DPLL_MODE register */
  464. #define WRITE_TIMER_MODE BIT(6)
  465. #define PLL_MODE_SHIFT (3)
  466. #define PLL_MODE_MASK (0x7)
  467. #define STATE_MODE_SHIFT (0)
  468. #define STATE_MODE_MASK (0x7)
  469. /* Bit definitions for the DPLL_MANU_REF_CFG register */
  470. #define MANUAL_REFERENCE_SHIFT (0)
  471. #define MANUAL_REFERENCE_MASK (0x1f)
  472. /* Bit definitions for the GPIO_CFG_GBL register */
  473. #define SUPPLY_MODE_SHIFT (0)
  474. #define SUPPLY_MODE_MASK (0x3)
  475. /* Bit definitions for the GPIO_DCO_INC_DEC register */
  476. #define INCDEC_DPLL_INDEX_SHIFT (0)
  477. #define INCDEC_DPLL_INDEX_MASK (0x7)
  478. /* Bit definitions for the GPIO_OUT_CTRL_0 register */
  479. #define CTRL_OUT_0 BIT(0)
  480. #define CTRL_OUT_1 BIT(1)
  481. #define CTRL_OUT_2 BIT(2)
  482. #define CTRL_OUT_3 BIT(3)
  483. #define CTRL_OUT_4 BIT(4)
  484. #define CTRL_OUT_5 BIT(5)
  485. #define CTRL_OUT_6 BIT(6)
  486. #define CTRL_OUT_7 BIT(7)
  487. /* Bit definitions for the GPIO_OUT_CTRL_1 register */
  488. #define CTRL_OUT_8 BIT(0)
  489. #define CTRL_OUT_9 BIT(1)
  490. #define CTRL_OUT_10 BIT(2)
  491. #define CTRL_OUT_11 BIT(3)
  492. #define CTRL_OUT_12 BIT(4)
  493. #define CTRL_OUT_13 BIT(5)
  494. #define CTRL_OUT_14 BIT(6)
  495. #define CTRL_OUT_15 BIT(7)
  496. /* Bit definitions for the GPIO_TOD_TRIG register */
  497. #define TOD_TRIG_0 BIT(0)
  498. #define TOD_TRIG_1 BIT(1)
  499. #define TOD_TRIG_2 BIT(2)
  500. #define TOD_TRIG_3 BIT(3)
  501. /* Bit definitions for the GPIO_DPLL_INDICATOR register */
  502. #define IND_DPLL_INDEX_SHIFT (0)
  503. #define IND_DPLL_INDEX_MASK (0x7)
  504. /* Bit definitions for the GPIO_LOS_INDICATOR register */
  505. #define REFMON_INDEX_SHIFT (0)
  506. #define REFMON_INDEX_MASK (0xf)
  507. /* Active level of LOS indicator, 0=low 1=high */
  508. #define ACTIVE_LEVEL BIT(4)
  509. /* Bit definitions for the GPIO_REF_INPUT_DSQ_0 register */
  510. #define DSQ_INP_0 BIT(0)
  511. #define DSQ_INP_1 BIT(1)
  512. #define DSQ_INP_2 BIT(2)
  513. #define DSQ_INP_3 BIT(3)
  514. #define DSQ_INP_4 BIT(4)
  515. #define DSQ_INP_5 BIT(5)
  516. #define DSQ_INP_6 BIT(6)
  517. #define DSQ_INP_7 BIT(7)
  518. /* Bit definitions for the GPIO_REF_INPUT_DSQ_1 register */
  519. #define DSQ_INP_8 BIT(0)
  520. #define DSQ_INP_9 BIT(1)
  521. #define DSQ_INP_10 BIT(2)
  522. #define DSQ_INP_11 BIT(3)
  523. #define DSQ_INP_12 BIT(4)
  524. #define DSQ_INP_13 BIT(5)
  525. #define DSQ_INP_14 BIT(6)
  526. #define DSQ_INP_15 BIT(7)
  527. /* Bit definitions for the GPIO_REF_INPUT_DSQ_2 register */
  528. #define DSQ_DPLL_0 BIT(0)
  529. #define DSQ_DPLL_1 BIT(1)
  530. #define DSQ_DPLL_2 BIT(2)
  531. #define DSQ_DPLL_3 BIT(3)
  532. #define DSQ_DPLL_4 BIT(4)
  533. #define DSQ_DPLL_5 BIT(5)
  534. #define DSQ_DPLL_6 BIT(6)
  535. #define DSQ_DPLL_7 BIT(7)
  536. /* Bit definitions for the GPIO_REF_INPUT_DSQ_3 register */
  537. #define DSQ_DPLL_SYS BIT(0)
  538. #define GPIO_DSQ_LEVEL BIT(1)
  539. /* Bit definitions for the GPIO_TOD_NOTIFICATION_CFG register */
  540. #define DPLL_TOD_SHIFT (0)
  541. #define DPLL_TOD_MASK (0x3)
  542. #define TOD_READ_SECONDARY BIT(2)
  543. #define GPIO_ASSERT_LEVEL BIT(3)
  544. /* Bit definitions for the GPIO_CTRL register */
  545. #define GPIO_FUNCTION_EN BIT(0)
  546. #define GPIO_CMOS_OD_MODE BIT(1)
  547. #define GPIO_CONTROL_DIR BIT(2)
  548. #define GPIO_PU_PD_MODE BIT(3)
  549. #define GPIO_FUNCTION_SHIFT (4)
  550. #define GPIO_FUNCTION_MASK (0xf)
  551. /* Bit definitions for the OUT_CTRL_1 register */
  552. #define OUT_SYNC_DISABLE BIT(7)
  553. #define SQUELCH_VALUE BIT(6)
  554. #define SQUELCH_DISABLE BIT(5)
  555. #define PAD_VDDO_SHIFT (2)
  556. #define PAD_VDDO_MASK (0x7)
  557. #define PAD_CMOSDRV_SHIFT (0)
  558. #define PAD_CMOSDRV_MASK (0x3)
  559. /* Bit definitions for the TOD_CFG register */
  560. #define TOD_EVEN_PPS_MODE BIT(2)
  561. #define TOD_OUT_SYNC_ENABLE BIT(1)
  562. #define TOD_ENABLE BIT(0)
  563. /* Bit definitions for the TOD_WRITE_SELECT_CFG_0 register */
  564. #define WR_PWM_DECODER_INDEX_SHIFT (4)
  565. #define WR_PWM_DECODER_INDEX_MASK (0xf)
  566. #define WR_REF_INDEX_SHIFT (0)
  567. #define WR_REF_INDEX_MASK (0xf)
  568. /* Bit definitions for the TOD_WRITE_CMD register */
  569. #define TOD_WRITE_SELECTION_SHIFT (0)
  570. #define TOD_WRITE_SELECTION_MASK (0xf)
  571. /* 4.8.7 */
  572. #define TOD_WRITE_TYPE_SHIFT (4)
  573. #define TOD_WRITE_TYPE_MASK (0x3)
  574. /* Bit definitions for the TOD_READ_PRIMARY_SEL_CFG_0 register */
  575. #define RD_PWM_DECODER_INDEX_SHIFT (4)
  576. #define RD_PWM_DECODER_INDEX_MASK (0xf)
  577. #define RD_REF_INDEX_SHIFT (0)
  578. #define RD_REF_INDEX_MASK (0xf)
  579. /* Bit definitions for the TOD_READ_PRIMARY_CMD register */
  580. #define TOD_READ_TRIGGER_MODE BIT(4)
  581. #define TOD_READ_TRIGGER_SHIFT (0)
  582. #define TOD_READ_TRIGGER_MASK (0xf)
  583. /* Bit definitions for the DPLL_CTRL_COMBO_MASTER_CFG register */
  584. #define COMBO_MASTER_HOLD BIT(0)
  585. /* Bit definitions for DPLL_SYS_STATUS register */
  586. #define DPLL_SYS_STATE_MASK (0xf)
  587. /* Bit definitions for SYS_APLL_STATUS register */
  588. #define SYS_APLL_LOSS_LOCK_LIVE_MASK BIT(0)
  589. #define SYS_APLL_LOSS_LOCK_LIVE_LOCKED 0
  590. #define SYS_APLL_LOSS_LOCK_LIVE_UNLOCKED 1
  591. /* Bit definitions for the DPLL0_STATUS register */
  592. #define DPLL_STATE_MASK (0xf)
  593. #define DPLL_STATE_SHIFT (0x0)
  594. /* Values of DPLL_N.DPLL_MODE.PLL_MODE */
  595. enum pll_mode {
  596. PLL_MODE_MIN = 0,
  597. PLL_MODE_PLL = PLL_MODE_MIN,
  598. PLL_MODE_WRITE_PHASE = 1,
  599. PLL_MODE_WRITE_FREQUENCY = 2,
  600. PLL_MODE_GPIO_INC_DEC = 3,
  601. PLL_MODE_SYNTHESIS = 4,
  602. PLL_MODE_PHASE_MEASUREMENT = 5,
  603. PLL_MODE_DISABLED = 6,
  604. PLL_MODE_MAX = PLL_MODE_DISABLED,
  605. };
  606. /* Values of DPLL_CTRL_n.DPLL_MANU_REF_CFG.MANUAL_REFERENCE */
  607. enum manual_reference {
  608. MANU_REF_MIN = 0,
  609. MANU_REF_CLK0 = MANU_REF_MIN,
  610. MANU_REF_CLK1,
  611. MANU_REF_CLK2,
  612. MANU_REF_CLK3,
  613. MANU_REF_CLK4,
  614. MANU_REF_CLK5,
  615. MANU_REF_CLK6,
  616. MANU_REF_CLK7,
  617. MANU_REF_CLK8,
  618. MANU_REF_CLK9,
  619. MANU_REF_CLK10,
  620. MANU_REF_CLK11,
  621. MANU_REF_CLK12,
  622. MANU_REF_CLK13,
  623. MANU_REF_CLK14,
  624. MANU_REF_CLK15,
  625. MANU_REF_WRITE_PHASE,
  626. MANU_REF_WRITE_FREQUENCY,
  627. MANU_REF_XO_DPLL,
  628. MANU_REF_MAX = MANU_REF_XO_DPLL,
  629. };
  630. enum hw_tod_write_trig_sel {
  631. HW_TOD_WR_TRIG_SEL_MIN = 0,
  632. HW_TOD_WR_TRIG_SEL_MSB = HW_TOD_WR_TRIG_SEL_MIN,
  633. HW_TOD_WR_TRIG_SEL_RESERVED = 1,
  634. HW_TOD_WR_TRIG_SEL_TOD_PPS = 2,
  635. HW_TOD_WR_TRIG_SEL_IRIGB_PPS = 3,
  636. HW_TOD_WR_TRIG_SEL_PWM_PPS = 4,
  637. HW_TOD_WR_TRIG_SEL_GPIO = 5,
  638. HW_TOD_WR_TRIG_SEL_FOD_SYNC = 6,
  639. WR_TRIG_SEL_MAX = HW_TOD_WR_TRIG_SEL_FOD_SYNC,
  640. };
  641. enum scsr_read_trig_sel {
  642. /* CANCEL CURRENT TOD READ; MODULE BECOMES IDLE - NO TRIGGER OCCURS */
  643. SCSR_TOD_READ_TRIG_SEL_DISABLE = 0,
  644. /* TRIGGER IMMEDIATELY */
  645. SCSR_TOD_READ_TRIG_SEL_IMMEDIATE = 1,
  646. /* TRIGGER ON RISING EDGE OF INTERNAL TOD PPS SIGNAL */
  647. SCSR_TOD_READ_TRIG_SEL_TODPPS = 2,
  648. /* TRGGER ON RISING EDGE OF SELECTED REFERENCE INPUT */
  649. SCSR_TOD_READ_TRIG_SEL_REFCLK = 3,
  650. /* TRIGGER ON RISING EDGE OF SELECTED PWM DECODER 1PPS OUTPUT */
  651. SCSR_TOD_READ_TRIG_SEL_PWMPPS = 4,
  652. SCSR_TOD_READ_TRIG_SEL_RESERVED = 5,
  653. /* TRIGGER WHEN WRITE FREQUENCY EVENT OCCURS */
  654. SCSR_TOD_READ_TRIG_SEL_WRITEFREQUENCYEVENT = 6,
  655. /* TRIGGER ON SELECTED GPIO */
  656. SCSR_TOD_READ_TRIG_SEL_GPIO = 7,
  657. SCSR_TOD_READ_TRIG_SEL_MAX = SCSR_TOD_READ_TRIG_SEL_GPIO,
  658. };
  659. /* Values STATUS.DPLL_SYS_STATUS.DPLL_SYS_STATE */
  660. enum dpll_state {
  661. DPLL_STATE_MIN = 0,
  662. DPLL_STATE_FREERUN = DPLL_STATE_MIN,
  663. DPLL_STATE_LOCKACQ = 1,
  664. DPLL_STATE_LOCKREC = 2,
  665. DPLL_STATE_LOCKED = 3,
  666. DPLL_STATE_HOLDOVER = 4,
  667. DPLL_STATE_OPEN_LOOP = 5,
  668. DPLL_STATE_MAX = DPLL_STATE_OPEN_LOOP,
  669. };
  670. /* 4.8.7 only */
  671. enum scsr_tod_write_trig_sel {
  672. SCSR_TOD_WR_TRIG_SEL_DISABLE = 0,
  673. SCSR_TOD_WR_TRIG_SEL_IMMEDIATE = 1,
  674. SCSR_TOD_WR_TRIG_SEL_REFCLK = 2,
  675. SCSR_TOD_WR_TRIG_SEL_PWMPPS = 3,
  676. SCSR_TOD_WR_TRIG_SEL_TODPPS = 4,
  677. SCSR_TOD_WR_TRIG_SEL_SYNCFOD = 5,
  678. SCSR_TOD_WR_TRIG_SEL_GPIO = 6,
  679. SCSR_TOD_WR_TRIG_SEL_MAX = SCSR_TOD_WR_TRIG_SEL_GPIO,
  680. };
  681. /* 4.8.7 only */
  682. enum scsr_tod_write_type_sel {
  683. SCSR_TOD_WR_TYPE_SEL_ABSOLUTE = 0,
  684. SCSR_TOD_WR_TYPE_SEL_DELTA_PLUS = 1,
  685. SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS = 2,
  686. SCSR_TOD_WR_TYPE_SEL_MAX = SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS,
  687. };
  688. #endif