no-OS
ad9144.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef AD9144_H_
40 #define AD9144_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_delay.h"
47 #include "no_os_spi.h"
48 #include "no_os_util.h"
49 #include "jesd204.h"
50 
51 /******************************************************************************/
52 /********************** Macros and Constants Definitions **********************/
53 /******************************************************************************/
54 #define REG_SPI_INTFCONFA 0x000 /* Interface configuration A */
55 #define REG_SPI_INTFCONFB 0x001 /* Interface configuration B */
56 #define REG_SPI_DEVCONF 0x002 /* Device Configuration */
57 #define REG_SPI_PRODIDL 0x004 /* Product Identification Low Byte */
58 #define REG_SPI_PRODIDH 0x005 /* Product Identification High Byte */
59 #define REG_SPI_CHIPGRADE 0x006 /* Chip Grade */
60 #define REG_SPI_PAGEINDX 0x008 /* Page Pointer or Device Index */
61 #define REG_SPI_DEVINDX2 0x009 /* Secondary Device Index */
62 #define REG_SPI_SCRATCHPAD 0x00A /* Scratch Pad */
63 #define REG_SPI_MS_UPDATE 0x00F /* Master/Slave Update Bit */
64 #define REG_PWRCNTRL0 0x011 /* Power Control Reg 1 */
65 #define REG_TXENMASK1 0x012 /* TXenable masks */
66 #define REG_PWRCNTRL3 0x013 /* Power control register 3 */
67 #define REG_COARSE_GROUP_DLY 0x014 /* Coarse Group Delay Adjustment */
68 #define REG_IRQ_ENABLE0 0x01F /* Interrupt Enable */
69 #define REG_IRQ_ENABLE1 0x020 /* Interrupt Enable */
70 #define REG_IRQ_ENABLE2 0x021 /* Interrupt Enable */
71 #define REG_IRQ_ENABLE3 0x022 /* Interrupt Enable */
72 #define REG_IRQ_STATUS0 0x023 /* Interrupt Status */
73 #define REG_IRQ_STATUS1 0x024 /* Interrupt Status */
74 #define REG_IRQ_STATUS2 0x025 /* Interrupt Status */
75 #define REG_IRQ_STATUS3 0x026 /* Interrupt Status */
76 #define REG_JESD_CHECKS 0x030 /* JESD Parameter Checking */
77 #define REG_SYNC_TESTCTRL 0x031 /* Sync Control Reg0 */
78 #define REG_SYNC_DACDELAY_L 0x032 /* Sync Logic DacDelay [7:0] */
79 #define REG_SYNC_DACDELAY_H 0x033 /* Sync Logic DacDelay [8] */
80 #define REG_SYNC_ERRWINDOW 0x034 /* Sync Error Window */
81 #define REG_SYNC_DLYCOUNT 0x035 /* Sync Control Ref Delay Count */
82 #define REG_SYNC_REFCOUNT 0x036 /* Sync SysRef InActive Interval */
83 #define REG_SYNC_LASTERR_L 0x038 /* SyncLASTerror_L */
84 #define REG_SYNC_LASTERR_H 0x039 /* SyncLASTerror_H */
85 #define REG_SYNC_CTRL 0x03A /* Sync Mode Control */
86 #define REG_SYNC_STATUS 0x03B /* Sync Alignment Flags */
87 #define REG_SYNC_CURRERR_L 0x03C /* Sync Alignment Error[7:0] */
88 #define REG_SYNC_CURRERR_H 0x03D /* Sync Alignment Error[8] */
89 #define REG_ERROR_THERM 0x03E /* Sync Error Thermometer */
90 #define REG_DACGAIN0_1 0x040 /* MSBs of Full Scale Adjust DAC */
91 #define REG_DACGAIN0_0 0x041 /* LSBs of Full Scale Adjust DAC */
92 #define REG_DACGAIN1_1 0x042 /* MSBs of Full Scale Adjust DAC */
93 #define REG_DACGAIN1_0 0x043 /* LSBs of Full Scale Adjust DAC */
94 #define REG_DACGAIN2_1 0x044 /* MSBs of Full Scale Adjust DAC */
95 #define REG_DACGAIN2_0 0x045 /* LSBs of Full Scale Adjust DAC */
96 #define REG_DACGAIN3_1 0x046 /* MSBs of Full Scale Adjust DAC */
97 #define REG_DACGAIN3_0 0x047 /* LSBs of Full Scale Adjust DAC */
98 #define REG_PD_DACLDO 0x048 /* Powerdown DAC LDOs */
99 #define REG_STAT_DACLDO 0x049 /* DAC LDO Status */
100 #define REG_DECODE_CTRL0 0x04B /* Decoder Control */
101 #define REG_DECODE_CTRL1 0x04C /* Decoder Control */
102 #define REG_DECODE_CTRL2 0x04D /* Decoder Control */
103 #define REG_DECODE_CTRL3 0x04E /* Decoder Control */
104 #define REG_NCO_CLRMODE 0x050 /* NCO CLR Mode */
105 #define REG_NCOKEY_ILSB 0x051 /* NCO Clear on Data Key I lsb */
106 #define REG_NCOKEY_IMSB 0x052 /* NCO Clear on Data Key I msb */
107 #define REG_NCOKEY_QLSB 0x053 /* NCO Clear on Data Key Q lsb */
108 #define REG_NCOKEY_QMSB 0x054 /* NCO Clear on Data Key Q msb */
109 #define REG_PA_THRES0 0x060 /* PDP Threshold */
110 #define REG_PA_THRES1 0x061 /* PDP Threshold */
111 #define REG_PA_AVG_TIME 0x062 /* PDP Control */
112 #define REG_PA_POWER0 0x063 /* PDP Power */
113 #define REG_PA_POWER1 0x064 /* PDP Power */
114 #define REG_CLKCFG0 0x080 /* Clock Configuration */
115 #define REG_SYSREF_ACTRL0 0x081 /* SYSREF Analog Control 0 */
116 #define REG_SYSREF_ACTRL1 0x082 /* SYSREF Analog Control 1 */
117 #define REG_DACPLLCNTRL 0x083 /* Top Level Control DAC Clock PLL */
118 #define REG_DACPLLSTATUS 0x084 /* DAC PLL Status Bits */
119 #define REG_DACINTEGERWORD0 0x085 /* Feedback divider tuning word */
120 #define REG_DACLOOPFILT1 0x087 /* C1 and C2 control */
121 #define REG_DACLOOPFILT2 0x088 /* R1 and C3 control */
122 #define REG_DACLOOPFILT3 0x089 /* Bypass and R2 control */
123 #define REG_DACCPCNTRL 0x08A /* Charge Pump/Cntrl Voltage */
124 #define REG_DACLOGENCNTRL 0x08B /* Logen Control */
125 #define REG_DACLDOCNTRL1 0x08C /* LDO Control1 + Reference Divider */
126 #define REG_CAL_DAC_ERR 0x0E0 /* Report DAC Cal errors */
127 #define REG_CAL_MSB_THRES 0x0E1 /* MSB sweep Threshold definition */
128 #define REG_CAL_CTRL_GLOBAL 0x0E2 /* Global Calibration DAC Control */
129 #define REG_CAL_MSBHILVL 0x0E3 /* High Level for MSB level compare */
130 #define REG_CAL_MSBLOLVL 0x0E4 /* Low Level for MSB level compare */
131 #define REG_CAL_THRESH 0x0E5 /* TAC Threshold definition */
132 #define REG_CAL_AVG_CNT 0x0E6 /* CAL DAC Number of averages */
133 #define REG_CAL_CLKDIV 0x0E7 /* Calibration DAC clock divide */
134 #define REG_CAL_INDX 0x0E8 /* Calibration DAC Select */
135 #define REG_CAL_CTRL 0x0E9 /* Calibration DAC Control */
136 #define REG_CAL_ADDR 0x0EA /* Calibration DAC Address */
137 #define REG_CAL_DATA 0x0EB /* Calibration DAC Data */
138 #define REG_CAL_UPDATE 0x0EC /* Calibration DAC Write Update */
139 #define REG_CAL_INIT 0x0ED /* Calibration init */
140 #define REG_DATA_FORMAT 0x110 /* Data format */
141 #define REG_DATAPATH_CTRL 0x111 /* Datapath Control */
142 #define REG_INTERP_MODE 0x112 /* Interpolation Mode */
143 #define REG_NCO_FTW_UPDATE 0x113 /* NCO Frequency Tuning Word Update */
144 #define REG_FTW0 0x114 /* NCO Frequency Tuning Word LSB */
145 #define REG_FTW1 0x115 /* NCO Frequency Tuning Word */
146 #define REG_FTW2 0x116 /* NCO Frequency Tuning Word */
147 #define REG_FTW3 0x117 /* NCO Frequency Tuning Word */
148 #define REG_FTW4 0x118 /* NCO Frequency Tuning Word */
149 #define REG_FTW5 0x119 /* NCO Frequency Tuning Word MSB */
150 #define REG_NCO_PHASE_OFFSET0 0x11A /* NCO Phase Offset LSB */
151 #define REG_NCO_PHASE_OFFSET1 0x11B /* NCO Phase Offset MSB */
152 #define REG_NCO_PHASE_ADJ0 0x11C /* I/Q Phase Adjust LSB */
153 #define REG_NCO_PHASE_ADJ1 0x11D /* I/Q Phase Adjust MSB */
154 #define REG_TXEN_FUNC 0x11E /* Transmit Enable function */
155 #define REG_TXEN_SM_0 0x11F /* Transmit enable power control state machine */
156 #define REG_TXEN_SM_1 0x120 /* Rise and fall */
157 #define REG_TXEN_SM_2 0x121 /* Transmit enable maximum A */
158 #define REG_TXEN_SM_3 0x122 /* Transmit enable maximum B */
159 #define REG_TXEN_SM_4 0x123 /* Transmit enable maximum C */
160 #define REG_TXEN_SM_5 0x124 /* Transmit enable maximum D */
161 #define REG_DACOUT_ON_DOWN 0x125 /* DAC out down control and on trigger */
162 #define REG_DACOFF 0x12C /* DAC Shutdown Source */
163 #define REG_DATA_PATH_FLUSH_COUNT0 0x12D /* Data path flush counter LSB */
164 #define REG_DATA_PATH_FLUSH_COUNT1 0x12E /* Data path flush counter MSB */
165 #define REG_DIE_TEMP_CTRL0 0x12F /* Die Temp Range Control */
166 #define REG_DIE_TEMP_CTRL1 0x130 /* Die temperature control register */
167 #define REG_DIE_TEMP_CTRL2 0x131 /* Die temperature control register */
168 #define REG_DIE_TEMP0 0x132 /* Die temp LSB */
169 #define REG_DIE_TEMP1 0x133 /* Die Temp MSB */
170 #define REG_DIE_TEMP_UPDATE 0x134 /* Die temperature update */
171 #define REG_DC_OFFSET_CTRL 0x135 /* DC Offset Control */
172 #define REG_IPATH_DC_OFFSET_1PART0 0x136 /* LSB of first part of DC Offset value for I path */
173 #define REG_IPATH_DC_OFFSET_1PART1 0x137 /* MSB of first part of DC Offset value for I path */
174 #define REG_QPATH_DC_OFFSET_1PART0 0x138 /* LSB of first part of DC Offset value for Q path */
175 #define REG_QPATH_DC_OFFSET_1PART1 0x139 /* MSB of first part of DC Offset value for Q path */
176 #define REG_IPATH_DC_OFFSET_2PART 0x13A /* Second part of DC Offset value for I path */
177 #define REG_QPATH_DC_OFFSET_2PART 0x13B /* Second part of DC Offset value for Q path */
178 #define REG_IDAC_DIG_GAIN0 0x13C /* I DAC Gain LSB */
179 #define REG_IDAC_DIG_GAIN1 0x13D /* I DAC Gain MSB */
180 #define REG_QDAC_DIG_GAIN0 0x13E /* Q DAC Gain LSB */
181 #define REG_QDAC_DIG_GAIN1 0x13F /* Q DAC Gain MSB */
182 #define REG_GAIN_RAMP_UP_STP0 0x140 /* LSB of digital gain rises */
183 #define REG_GAIN_RAMP_UP_STP1 0x141 /* MSB of digital gain rises */
184 #define REG_GAIN_RAMP_DOWN_STP0 0x142 /* LSB of digital gain drops */
185 #define REG_GAIN_RAMP_DOWN_STP1 0x143 /* MSB of digital gain drops */
186 #define REG_BLSM_CTRL 0x146 /* Blanking SM control and func */
187 #define REG_BLSM_STAT 0x147 /* Blanking SM control and func */
188 #define REG_PRBS 0x14B /* PRBS Input Data Checker */
189 #define REG_PRBS_ERROR_I 0x14C /* PRBS Error Counter Real */
190 #define REG_PRBS_ERROR_Q 0x14D /* PRBS Error Counter Imaginary */
191 #define REG_DACPLLT5 0x1B5 /* ALC/Varactor control */
192 #define REG_DACPLLTB 0x1BB /* VCO Bias Control */
193 #define REG_DACPLLTD 0x1BD /* VCO Cal control */
194 #define REG_DACPLLT17 0x1C4 /* Varactor Control 1 */
195 #define REG_DACPLLT18 0x1C5 /* Varactor Control 2 */
196 #define REG_ASPI_SPARE0 0x1C6 /* Spare Register 0 */
197 #define REG_ASPI_SPARE1 0x1C7 /* Spare Register 1 */
198 #define REG_SPISTRENGTH 0x1DF /* Reg 70 Description */
199 #define REG_CLK_TEST 0x1EB /* Clock related control signaling */
200 #define REG_ATEST_VOLTS 0x1EC /* Analog Test Voltage Extraction */
201 #define REG_ASPI_CLKSRC 0x1ED /* Analog Spi clock source for PD machines */
202 #define REG_MASTER_PD 0x200 /* Master power down for Receiver PHYx */
203 #define REG_PHY_PD 0x201 /* Power down for individual Receiver PHYx */
204 #define REG_GENERIC_PD 0x203 /* Miscellaneous power down controls */
205 #define REG_CDR_RESET 0x206 /* CDR Reset control */
206 #define REG_CDR_OPERATING_MODE_REG_0 0x230 /* Clock and data recovery operating modes */
207 #define REG_CONFIG_REG3 0x232 /* SERDES interface configuration */
208 #define REG_EQ_CONFIG_PHY_0_1 0x250 /* Equalizer configuration for PHY 0 and PHY 1 */
209 #define REG_EQ_CONFIG_PHY_2_3 0x251 /* Equalizer configuration for PHY 2 and PHY 3 */
210 #define REG_EQ_CONFIG_PHY_4_5 0x252 /* Equalizer configuration for PHY 4 and PHY 5 */
211 #define REG_EQ_CONFIG_PHY_6_7 0x253 /* Equalizer configuration for PHY 6 and PHY 7 */
212 #define REG_EQ_BIAS_REG 0x268 /* Equalizer bias control */
213 #define REG_SYNTH_ENABLE_CNTRL 0x280 /* Rx PLL enable controls */
214 #define REG_PLL_STATUS 0x281 /* Rx PLL status readbacks */
215 #define REG_REF_CLK_DIVIDER_LDO 0x289 /* Rx PLL LDO control */
216 #define REG_SERDES_PLL_CTRL 0x291 /* Serdes PLL control */
217 #define REG_SERDES_PLL_CP3 0x29c /* Serdes PLL charge pump */
218 #define REG_SERDES_PLL_VAR3 0x29f /* Serdes PLL VCO varactor */
219 #define REG_DEV_CONFIG_8 0x2A4 /* To control the clock configuration */
220 #define REG_TERM_BLK1_CTRLREG0 0x2A7 /* Termination controls for PHYs 0, 1, 6, and 7 */
221 #define REG_TERM_BLK1_CTRLREG1 0x2A8 /* Termination controls for PHYs 0, 1, 6, and 7 */
222 #define REG_DEV_CONFIG_9 0x2AA /* SERDES interface termination settings */
223 #define REG_DEV_CONFIG_10 0x2AB /* SERDES interface termination settings */
224 #define REG_TERM_BLK2_CTRLREG0 0x2AE /* Termination controls for PHYs 2, 3, 4, and 5 */
225 #define REG_TERM_BLK2_CTRLREG1 0x2AF /* Termination controls for PHYs 2, 3, 4, and 5 */
226 #define REG_DEV_CONFIG_11 0x2B1 /* SERDES interface termination settings */
227 #define REG_DEV_CONFIG_12 0x2B2 /* SERDES interface termination settings */
228 #define REG_GENERAL_JRX_CTRL_0 0x300 /* General JRX Control Register 0 */
229 #define REG_GENERAL_JRX_CTRL_1 0x301 /* General JRX Control Register 1 */
230 #define REG_DYN_LINK_LATENCY_0 0x302 /* Register 1 description */
231 #define REG_DYN_LINK_LATENCY_1 0x303 /* Register 2 description */
232 #define REG_LMFC_DELAY_0 0x304 /* Register 3 description */
233 #define REG_LMFC_DELAY_1 0x305 /* Register 4 description */
234 #define REG_LMFC_VAR_0 0x306 /* Register 5 description */
235 #define REG_LMFC_VAR_1 0x307 /* Register 6 description */
236 #define REG_XBAR(x) (0x308 +(x)) /* Register 7 description */
237 #define REG_FIFO_STATUS_REG_0 0x30C /* Register 11 description */
238 #define REG_FIFO_STATUS_REG_1 0x30D /* Register 12 description */
239 #define REG_FIFO_STATUS_REG_2 0x30E /* Register 13 description */
240 #define REG_SYNCB_GEN_0 0x311 /* Register 16 description */
241 #define REG_SYNCB_GEN_1 0x312 /* Register 17 description */
242 #define REG_SYNCB_GEN_3 0x313 /* Register 18 description */
243 #define REG_SERDES_SPI_REG 0x314 /* SERDES SPI configuration */
244 #define REG_PHY_PRBS_TEST_EN 0x315 /* PHY PRBS TEST ENABLE FOR INDIVIDUAL LANES */
245 #define REG_PHY_PRBS_TEST_CTRL 0x316 /* Reg 20 Description */
246 #define REG_PHY_PRBS_TEST_THRESH_LOBITS 0x317 /* Reg 21 Description */
247 #define REG_PHY_PRBS_TEST_THRESH_MIDBITS 0x318 /* Reg 22 Description */
248 #define REG_PHY_PRBS_TEST_THRESH_HIBITS 0x319 /* Reg 23 Description */
249 #define REG_PHY_PRBS_TEST_ERRCNT_LOBITS 0x31A /* Reg 24 Description */
250 #define REG_PHY_PRBS_TEST_ERRCNT_MIDBITS 0x31B /* Reg 25 Description */
251 #define REG_PHY_PRBS_TEST_ERRCNT_HIBITS 0x31C /* Reg 26 Description */
252 #define REG_PHY_PRBS_TEST_STATUS 0x31D /* Reg 27 Description */
253 #define REG_SHORT_TPL_TEST_0 0x32C /* Reg 46 Description */
254 #define REG_SHORT_TPL_TEST_1 0x32D /* Reg 47 Description */
255 #define REG_SHORT_TPL_TEST_2 0x32E /* Reg 48 Description */
256 #define REG_SHORT_TPL_TEST_3 0x32F /* Reg 49 Description */
257 #define REG_DEVICE_CONFIG_REG_13 0x333 /* SERDES interface configuration */
258 #define REG_JESD_BIT_INVERSE_CTRL 0x334 /* Reg 42 Description */
259 #define REG_DID_REG 0x400 /* Reg 0 Description */
260 #define REG_BID_REG 0x401 /* Reg 1 Description */
261 #define REG_LID0_REG 0x402 /* Reg 2 Description */
262 #define REG_SCR_L_REG 0x403 /* Reg 3 Description */
263 #define REG_F_REG 0x404 /* Reg 4 Description */
264 #define REG_K_REG 0x405 /* Reg 5 Description */
265 #define REG_M_REG 0x406 /* Reg 6 Description */
266 #define REG_CS_N_REG 0x407 /* Reg 7 Description */
267 #define REG_NP_REG 0x408 /* Reg 8 Description */
268 #define REG_S_REG 0x409 /* Reg 9 Description */
269 #define REG_HD_CF_REG 0x40A /* Reg 10 Description */
270 #define REG_RES1_REG 0x40B /* Reg 11 Description */
271 #define REG_RES2_REG 0x40C /* Reg 12 Description */
272 #define REG_CHECKSUM_REG 0x40D /* Reg 13 Description */
273 #define REG_COMPSUM0_REG 0x40E /* Reg 14 Description */
274 #define REG_LID1_REG 0x412 /* Reg 18 Description */
275 #define REG_CHECKSUM1_REG 0x415 /* Reg 19 Description */
276 #define REG_COMPSUM1_REG 0x416 /* Reg 22 Description */
277 #define REG_LID2_REG 0x41A /* Reg 26 Description */
278 #define REG_CHECKSUM2_REG 0x41D /* Reg 29 Description */
279 #define REG_COMPSUM2_REG 0x41E /* Reg 30 Description */
280 #define REG_LID3_REG 0x422 /* Reg 34 Description */
281 #define REG_CHECKSUM3_REG 0x425 /* Reg 37 Description */
282 #define REG_COMPSUM3_REG 0x426 /* Reg 38 Description */
283 #define REG_LID4_REG 0x42A /* Reg 34 Description */
284 #define REG_CHECKSUM4_REG 0x42D /* Reg 37 Description */
285 #define REG_COMPSUM4_REG 0x42E /* Reg 38 Description */
286 #define REG_LID5_REG 0x432 /* Reg 34 Description */
287 #define REG_CHECKSUM5_REG 0x435 /* Reg 37 Description */
288 #define REG_COMPSUM5_REG 0x436 /* Reg 38 Description */
289 #define REG_LID6_REG 0x43A /* Reg 34 Description */
290 #define REG_CHECKSUM6_REG 0x43D /* Reg 37 Description */
291 #define REG_COMPSUM6_REG 0x43E /* Reg 38 Description */
292 #define REG_LID7_REG 0x442 /* Reg 34 Description */
293 #define REG_CHECKSUM7_REG 0x445 /* Reg 37 Description */
294 #define REG_COMPSUM7_REG 0x446 /* Reg 38 Description */
295 #define REG_ILS_DID 0x450 /* Reg 80 Description */
296 #define REG_ILS_BID 0x451 /* Reg 81 Description */
297 #define REG_ILS_LID0 0x452 /* Reg 82 Description */
298 #define REG_ILS_SCR_L 0x453 /* Reg 83 Description */
299 #define REG_ILS_F 0x454 /* Reg 84 Description */
300 #define REG_ILS_K 0x455 /* Reg 85 Description */
301 #define REG_ILS_M 0x456 /* Reg 86 Description */
302 #define REG_ILS_CS_N 0x457 /* Reg 87 Description */
303 #define REG_ILS_NP 0x458 /* Reg 88 Description */
304 #define REG_ILS_S 0x459 /* Reg 89 Description */
305 #define REG_ILS_HD_CF 0x45A /* Reg 90 Description */
306 #define REG_ILS_RES1 0x45B /* Reg 91 Description */
307 #define REG_ILS_RES2 0x45C /* Reg 92 Description */
308 #define REG_ILS_CHECKSUM 0x45D /* Reg 93 Description */
309 #define REG_ERRCNTRMON 0x46B /* Reg 107 Description */
310 #define REG_LANEDESKEW 0x46C /* Reg 108 Description */
311 #define REG_BADDISPARITY 0x46D /* Reg 109 Description */
312 #define REG_NITDISPARITY 0x46E /* Reg 110 Description */
313 #define REG_UNEXPECTEDKCHAR 0x46F /* Reg 111 Description */
314 #define REG_CODEGRPSYNCFLG 0x470 /* Reg 112 Description */
315 #define REG_FRAMESYNCFLG 0x471 /* Reg 113 Description */
316 #define REG_GOODCHKSUMFLG 0x472 /* Reg 114 Description */
317 #define REG_INITLANESYNCFLG 0x473 /* Reg 115 Description */
318 #define REG_CTRLREG1 0x476 /* Reg 118 Description */
319 #define REG_CTRLREG2 0x477 /* Reg 119 Description */
320 #define REG_KVAL 0x478 /* Reg 120 Description */
321 #define REG_IRQVECTOR 0x47A /* Reg 122 Description */
322 #define REG_SYNCASSERTIONMASK 0x47B /* Reg 123 Description */
323 #define REG_ERRORTHRES 0x47C /* Reg 124 Description */
324 #define REG_LANEENABLE 0x47D /* Reg 125 Description */
325 
326 /*
327  * REG_SPI_INTFCONFA
328  */
329 #define SOFTRESET_M (1 << 7) /* Soft Reset (Mirror) */
330 #define LSBFIRST_M (1 << 6) /* LSB First (Mirror) */
331 #define ADDRINC_M (1 << 5) /* Address Increment (Mirror) */
332 #define SDOACTIVE_M (1 << 4) /* SDO Active (Mirror) */
333 #define SDOACTIVE (1 << 3) /* SDO Active */
334 #define ADDRINC (1 << 2) /* Address Increment */
335 #define LSBFIRST (1 << 1) /* LSB First */
336 #define SOFTRESET (1 << 0) /* Soft Reset */
337 
338 /*
339  * REG_SPI_INTFCONFB
340  */
341 #define SINGLEINS (1 << 7) /* Single Instruction */
342 #define CSBSTALL (1 << 6) /* CSb Stalling */
343 
344 /*
345  * REG_SPI_DEVCONF
346  */
347 #define DEVSTATUS(x) (((x) & 0xF) << 4) /* Device Status */
348 #define CUSTOPMODE(x) (((x) & 0x3) << 2) /* Customer Operating Mode */
349 #define SYSOPMODE(x) (((x) & 0x3) << 0) /* System Operating Mode */
350 
351 /*
352  * REG_SPI_CHIPGRADE
353  */
354 #define PROD_GRADE(x) (((x) & 0xF) << 4) /* Product Grade */
355 #define DEV_REVISION(x) (((x) & 0xF) << 0) /* Device Revision */
356 
357 /*
358  * REG_SPI_PAGEINDX
359  */
360 #define PAGEINDX(x) (((x) & 0x3) << 0) /* Page or Index Pointer */
361 
362 /*
363  * REG_SPI_MS_UPDATE
364  */
365 #define SLAVEUPDATE (1 << 0) /* M/S Update Bit */
366 
367 /*
368  * REG_PWRCNTRL0
369  */
370 #define PD_BG (1 << 7) /* Reference PowerDown */
371 #define PD_DAC_0 (1 << 6) /* PD Ichannel DAC 0 */
372 #define PD_DAC_1 (1 << 5) /* PD Qchannel DAC 1 */
373 #define PD_DAC_2 (1 << 4) /* PD Ichannel DAC 2 */
374 #define PD_DAC_3 (1 << 3) /* PD Qchannel DAC 3 */
375 #define PD_DACM (1 << 2) /* PD Dac master Bias */
376 
377 /*
378  * REG_TXENMASK1
379  */
380 #define SYS_MASK (1 << 2) /* SYSREF Receiver TXen mask */
381 #define DACB_MASK (1 << 1) /* Dual B Dac TXen1 mask */
382 #define DACA_MASK (1 << 0) /* Dual A Dac TXen0 mask */
383 
384 /*
385  * REG_PWRCNTRL3
386  */
387 #define ENA_PA_CTRL_FROM_PAPROT_ERR (1 << 6) /* Control PDP enable from PAProt block */
388 #define ENA_PA_CTRL_FROM_TXENSM (1 << 5) /* Control PDP enable from Txen State machine */
389 #define ENA_PA_CTRL_FROM_BLSM (1 << 4) /* Control PDP enable from Blanking state machine */
390 #define ENA_PA_CTRL_FROM_SPI (1 << 3) /* Control PDP enable via SPI */
391 #define SPI_PA_CTRL (1 << 2) /* PDP on/off via SPI */
392 #define ENA_SPI_TXEN (1 << 1) /* TXEN from SPI control */
393 #define SPI_TXEN (1 << 0) /* Spi TXEN */
394 
395 /*
396  * REG_COARSE_GROUP_DLY
397  */
398 #define COARSE_GROUP_DLY(x) (((x) & 0xF) << 0) /* Coarse group delay */
399 
400 /*
401  * REG_IRQ_ENABLE0
402  */
403 #define EN_CALPASS (1 << 7) /* Enable Calib PASS detection */
404 #define EN_CALFAIL (1 << 6) /* Enable Calib FAIL detection */
405 #define EN_DACPLLLOST (1 << 5) /* Enable DAC Pll Lost detection */
406 #define EN_DACPLLLOCK (1 << 4) /* Enable DAC Pll Lock detection */
407 #define EN_SERPLLLOST (1 << 3) /* Enable Serdes PLL Lost detection */
408 #define EN_SERPLLLOCK (1 << 2) /* Enable Serdes PLL Lock detection */
409 #define EN_LANEFIFOERR (1 << 1) /* Enable Lane FIFO Error detection */
410 #define EN_DRDLFIFOERR (1 << 0) /* Enable DRDL FIFO Error detection */
411 
412 /*
413  * REG_IRQ_ENABLE1
414  */
415 #define EN_PARMBAD (1 << 7) /* enable BAD Parameter interrupt */
416 #define EN_PRBSQ1 (1 << 3) /* enable PRBS imag DAC B interrupt */
417 #define EN_PRBSI1 (1 << 2) /* enable PRBS real DAC B interrupt */
418 #define EN_PRBSQ0 (1 << 1) /* enable PRBS imag DAC A interrupt */
419 #define EN_PRBSI0 (1 << 0) /* enable PRBS real DAC A interrupt */
420 
421 /*
422  * REG_IRQ_ENABLE2
423  */
424 #define EN_PAERR0 (1 << 7) /* Link A PA Error */
425 #define EN_BIST_DONE0 (1 << 6) /* Link A BIST done */
426 #define EN_BLNKDONE0 (1 << 5) /* Link A Blanking done */
427 #define EN_REFNCOCLR0 (1 << 4) /* Link A Nco Clear Tripped */
428 #define EN_REFLOCK0 (1 << 3) /* Link A Alignment Locked */
429 #define EN_REFROTA0 (1 << 2) /* Link A Alignment Rotate */
430 #define EN_REFWLIM0 (1 << 1) /* Link A Over/Under Threshold */
431 #define EN_REFTRIP0 (1 << 0) /* Link A Alignment Trip */
432 
433 /*
434  * REG_IRQ_ENABLE3
435  */
436 #define EN_PAERR1 (1 << 7) /* Link B PA Error */
437 #define EN_BIST_DONE1 (1 << 6) /* Link B BIST done */
438 #define EN_BLNKDONE1 (1 << 5) /* Link B Blanking done */
439 #define EN_REFNCOCLR1 (1 << 4) /* Link B Nco Clear Tripped */
440 #define EN_REFLOCK1 (1 << 3) /* Link B Alignment Locked */
441 #define EN_REFROTA1 (1 << 2) /* Link B Alignment Rotate */
442 #define EN_REFWLIM1 (1 << 1) /* Link B Over/Under Threshold */
443 #define EN_REFTRIP1 (1 << 0) /* Link B Alignment Trip */
444 
445 /*
446  * REG_IRQ_STATUS0
447  */
448 #define IRQ_CALPASS (1 << 7) /* Calib PASS detection */
449 #define IRQ_CALFAIL (1 << 6) /* Calib FAIL detection */
450 #define IRQ_DACPLLLOST (1 << 5) /* DAC PLL Lost */
451 #define IRQ_DACPLLLOCK (1 << 4) /* DAC PLL Lock */
452 #define IRQ_SERPLLLOST (1 << 3) /* Serdes PLL Lost */
453 #define IRQ_SERPLLLOCK (1 << 2) /* Serdes PLL Lock */
454 #define IRQ_LANEFIFOERR (1 << 1) /* Lane Fifo Error */
455 #define IRQ_DRDLFIFOERR (1 << 0) /* DRDL Fifo Error */
456 
457 /*
458  * REG_IRQ_STATUS1
459  */
460 #define IRQ_PARMBAD (1 << 7) /* BAD Parameter interrupt */
461 #define IRQ_PRBSQ1 (1 << 3) /* PRBS data check error DAC 1 imag */
462 #define IRQ_PRBSI1 (1 << 2) /* PRBS data check error DAC 1 real */
463 #define IRQ_PRBSQ0 (1 << 1) /* PRBS data check error DAC 0 imag */
464 #define IRQ_PRBSI0 (1 << 0) /* PRBS data check error DAC 0 real */
465 
466 /*
467  * REG_IRQ_STATUS2
468  */
469 #define IRQ_PAERR0 (1 << 7) /* Link A PA Error */
470 #define IRQ_BIST_DONE0 (1 << 6) /* Link A BIST done */
471 #define IRQ_BLNKDONE0 (1 << 5) /* Link A Blanking Done */
472 #define IRQ_REFNCOCLR0 (1 << 4) /* Link A Alignment UnderRange */
473 #define IRQ_REFLOCK0 (1 << 3) /* Link A BIST done */
474 #define IRQ_REFROTA0 (1 << 2) /* Link A Alignment Trip */
475 #define IRQ_REFWLIM0 (1 << 1) /* Link A Alignment Lock */
476 #define IRQ_REFTRIP0 (1 << 0) /* Link A Alignment Rotate */
477 
478 /*
479  * REG_IRQ_STATUS3
480  */
481 #define IRQ_PAERR1 (1 << 7) /* Link B PA Error */
482 #define IRQ_BIST_DONE1 (1 << 6) /* Link B BIST done */
483 #define IRQ_BLNKDONE1 (1 << 5) /* Link A Blanking Done */
484 #define IRQ_REFNCOCLR1 (1 << 4) /* Link B Alignment UnderRange */
485 #define IRQ_REFLOCK1 (1 << 3) /* Link B BIST done */
486 #define IRQ_REFROTA1 (1 << 2) /* Link B Alignment Trip */
487 #define IRQ_REFWLIM1 (1 << 1) /* Link B Alignment Lock */
488 #define IRQ_REFTRIP1 (1 << 0) /* Link B Alignment Rotate */
489 
490 /*
491  * REG_JESD_CHECKS
492  */
493 #define ERR_DLYOVER (1 << 5) /* LMFC_Delay > JESD_K parameter */
494 #define ERR_WINLIMIT (1 << 4) /* Unsupported Window Limit */
495 #define ERR_JESDBAD (1 << 3) /* Unsupported M/L/S/F selection */
496 #define ERR_KUNSUPP (1 << 2) /* Unsupported K values */
497 #define ERR_SUBCLASS (1 << 1) /* Unsupported SubClassv value */
498 #define ERR_INTSUPP (1 << 0) /* Unsupported Interpolation rate factor */
499 
500 /*
501  * REG_SYNC_TESTCTRL
502  */
503 #define TARRFAPHAZ (1 << 0) /* Target Polarity of Rf Divider */
504 #define SYNCBYPASS(x) (((x) & 0x3) << 6) /* Sync Bypass handshaking */
505 
506 /*
507  * REG_SYNC_DACDELAY_H
508  */
509 #define DAC_DELAY_H (1 << 0) /* Dac Delay[8] */
510 
511 /*
512  * REG_SYNC_ERRWINDOW
513  */
514 #define ERRWINDOW(x) (((x) & 0x7) << 0) /* Sync Error Window */
515 
516 /*
517  * REG_SYNC_LASTERR_H
518  */
519 #define LASTUNDER (1 << 7) /* Sync Last Error Under Flag */
520 #define LASTOVER (1 << 6) /* Sync Last Error Over Flag */
521 #define LASTERROR_H (1 << 0) /* Sync Last Error[8] and Flags */
522 
523 /*
524  * REG_SYNC_CTRL
525  */
526 #define SYNCENABLE (1 << 7) /* SyncLogic Enable */
527 #define SYNCARM (1 << 6) /* Sync Arming Strobe */
528 #define SYNCCLRSTKY (1 << 5) /* Sync Sticky Bit Clear */
529 #define SYNCCLRLAST (1 << 4) /* Sync Clear LAST_ */
530 #define SYNCMODE(x) (((x) & 0xF) << 0) /* Sync Mode */
531 
532 /*
533  * REG_SYNC_STATUS
534  */
535 #define REFBUSY (1 << 7) /* Sync Machine Busy */
536 #define REFLOCK (1 << 3) /* Sync Alignment Locked */
537 #define REFROTA (1 << 2) /* Sync Rotated */
538 #define REFWLIM (1 << 1) /* Sync Alignment Limit Range */
539 #define REFTRIP (1 << 0) /* Sync Tripped after Arming */
540 
541 /*
542  * REG_SYNC_CURRERR_H
543  */
544 #define CURRUNDER (1 << 7) /* Sync Current Error Under Flag */
545 #define CURROVER (1 << 6) /* Sync Current Error Over Flag */
546 #define CURRERROR_H (1 << 0) /* SyncCurrent Error[8] */
547 
548 /*
549  * REG_ERROR_THERM
550  */
551 #define THRMOLD (1 << 7) /* Error is from a prior sample */
552 #define THRMOVER (1 << 4) /* Error > +WinLimit */
553 #define THRMPOS (1 << 3) /* Sync Current Error Under Flag */
554 #define THRMZERO (1 << 2) /* Error = 0 */
555 #define THRMNEG (1 << 1) /* Error < 0 */
556 #define THRMUNDER (1 << 0) /* Error < -WinLimit */
557 
558 /*
559  * REG_DACGAIN0_1
560  */
561 #define DACGAIN_IM0(x) (((x) & 0x3) << 0) /* I Channel DAC gain <9:8> Dual A */
562 
563 /*
564  * REG_DACGAIN1_1
565  */
566 #define DACGAIN_IM1(x) (((x) & 0x3) << 0) /* Q Channel DAC gain <9:8> Dual A */
567 
568 /*
569  * REG_DACGAIN2_1
570  */
571 #define DACGAIN_IM2(x) (((x) & 0x3) << 0) /* I Channel DAC gain <9:8> Dual B */
572 
573 /*
574  * REG_DACGAIN3_1
575  */
576 #define DACGAIN_IM3(x) (((x) & 0x3) << 0) /* Q Channel DAC gain <9:8> Dual B */
577 
578 /*
579  * REG_PD_DACLDO
580  */
581 #define ENB_DACLDO3 (1 << 7) /* Disable DAC3 ldo */
582 #define ENB_DACLDO2 (1 << 6) /* Disable DAC2 ldo */
583 #define ENB_DACLDO1 (1 << 5) /* Disable DAC1 ldo */
584 #define ENB_DACLDO0 (1 << 4) /* Disable DAC0 ldo */
585 
586 /*
587  * REG_STAT_DACLDO
588  */
589 #define STAT_LDO3 (1 << 3) /* DAC3 LDO status */
590 #define STAT_LDO2 (1 << 2) /* DAC2 LDO status */
591 #define STAT_LDO1 (1 << 1) /* DAC1 LDO status */
592 #define STAT_LDO0 (1 << 0) /* DAC0 LDO status */
593 
594 /*
595  * REG_DECODE_CTRL0
596  */
597 #define SHUFFLE_MSB0 (1 << 2) /* MSB shuffling mode */
598 #define SHUFFLE_ISB0 (1 << 1) /* ISB shuffling mode */
599 
600 /*
601  * REG_DECODE_CTRL1
602  */
603 #define SHUFFLE_MSB1 (1 << 2) /* MSB shuffling mode */
604 #define SHUFFLE_ISB1 (1 << 1) /* ISB shuffling mode */
605 
606 /*
607  * REG_DECODE_CTRL2
608  */
609 #define SHUFFLE_MSB2 (1 << 2) /* MSB shuffling mod */
610 #define SHUFFLE_ISB2 (1 << 1) /* ISB shuffling mode */
611 
612 /*
613  * REG_DECODE_CTRL3
614  */
615 #define SHUFFLE_MSB3 (1 << 2) /* MSB shuffling mode */
616 #define SHUFFLE_ISB3 (1 << 1) /* ISB shuffling mode */
617 
618 /*
619  * REG_NCO_CLRMODE
620  */
621 #define NCOCLRARM (1 << 7) /* Arm NCO Clear */
622 #define NCOCLRMTCH (1 << 5) /* NCO Clear Data Match */
623 #define NCOCLRPASS (1 << 4) /* NCO Clear PASSed */
624 #define NCOCLRFAIL (1 << 3) /* NCO Clear FAILed */
625 #define NCOCLRMODE(x) (((x) & 0x3) << 0) /* NCO Clear Mode */
626 
627 /*
628  * REG_PA_THRES1
629  */
630 #define PA_THRESH_MSB(x) (((x) & 0x1F) << 0) /* Average power threshold for comparison. */
631 
632 /*
633  * REG_PA_AVG_TIME
634  */
635 #define PA_ENABLE (1 << 7) /* 1 = Enable average power calculation and error detection */
636 #define PA_BUS_SWAP (1 << 6) /* Swap channelA or channelB databus for power calculation */
637 #define PA_AVG_TIME(x) (((x) & 0xF) << 0) /* Set power average time */
638 
639 /*
640  * REG_PA_POWER1
641  */
642 #define PA_POWER_MSB(x) (((x) & 0x1F) << 0) /* average power bus = I^2+Q^2 (I/Q use 6MSB of databus) */
643 
644 /*
645  * REG_CLKCFG0
646  */
647 #define PD_CLK01 (1 << 7) /* Powerdown clock for Dual A */
648 #define PD_CLK23 (1 << 6) /* Powerdown clock for Dual B */
649 #define PD_CLK_DIG (1 << 5) /* Powerdown clocks to all DACs */
650 #define PD_PCLK (1 << 4) /* Cal reference/Serdes PLL clock powerdown */
651 #define PD_CLK_REC (1 << 3) /* Clock reciever powerdown */
652 
653 /*
654  * REG_SYSREF_ACTRL0
655  */
656 #define PD_SYSREF (1 << 4) /* Powerdown SYSREF buffer */
657 #define HYS_ON (1 << 3) /* Hysteresis enabled */
658 #define SYSREF_RISE (1 << 2) /* Use SYSREF rising edge */
659 #define HYS_CNTRL1(x) (((x) & 0x3) << 0) /* Hysteresis control bits <9:8> */
660 
661 /*
662  * REG_DACPLLCNTRL
663  */
664 #define SYNTH_RECAL (1 << 7) /* Recalibrate VCO Band */
665 #define ENABLE_SYNTH (1 << 4) /* Synthesizer Enable */
666 
667 /*
668  * REG_DACPLLSTATUS
669  */
670 #define CP_CAL_VALID (1 << 5) /* Charge Pump Cal Valid */
671 #define RFPLL_LOCK (1 << 1) /* PLL Lock bit */
672 
673 /*
674  * REG_DACLOOPFILT1
675  */
676 #define LF_C2_WORD(x) (((x) & 0xF) << 4) /* C2 control word */
677 #define LF_C1_WORD(x) (((x) & 0xF) << 0) /* C1 control word */
678 
679 /*
680  * REG_DACLOOPFILT2
681  */
682 #define LF_R1_WORD(x) (((x) & 0xF) << 4) /* R1 control word */
683 #define LF_C3_WORD(x) (((x) & 0xF) << 0) /* C3 control word */
684 
685 /*
686  * REG_DACLOOPFILT3
687  */
688 #define LF_BYPASS_R3 (1 << 7) /* Bypass R3 res */
689 #define LF_BYPASS_R1 (1 << 6) /* Bypass R1 res */
690 #define LF_BYPASS_C2 (1 << 5) /* Bypass C2 cap */
691 #define LF_BYPASS_C1 (1 << 4) /* Bypass C1 cap */
692 #define LF_R3_WORD(x) (((x) & 0xF) << 0) /* R3 Control Word */
693 
694 /*
695  * REG_DACCPCNTRL
696  */
697 #define CP_CURRENT(x) (((x) & 0x3F) << 0) /* Charge Pump Current Control */
698 
699 /*
700  * REG_DACLOGENCNTRL
701  */
702 #define LO_DIV_MODE(x) (((x) & 0x3) << 0) /* Logen_Division */
703 
704 /*
705  * REG_DACLDOCNTRL1
706  */
707 #define REF_DIVRATE(x) (((x) & 0x7) << 0) /* Reference Clock Division Ratio */
708 
709 /*
710  * REG_CAL_DAC_ERR
711  */
712 #define INIT_SWEEP_ERR_DAC (1 << 1) /* Initial setup sweep failed */
713 #define MSB_SWEEP_ERR_DAC (1 << 0) /* MSB sweep failed */
714 
715 /*
716  * REG_CAL_MSB_THRES
717  */
718 #define CAL_MSB_TAC(x) (((x) & 0x7) << 0) /* MSB sweep TAC */
719 
720 /*
721  * REG_CAL_CTRL_GLOBAL
722  */
723 #define CAL_START_GL (1 << 1) /* Global Calibration start */
724 #define CAL_EN_GL (1 << 0) /* Global Calibration enable */
725 
726 /*
727  * REG_CAL_MSBHILVL
728  */
729 #define CAL_MSBLVLHI(x) (((x) & 0x3F) << 0) /* High level limit for msb sweep average */
730 
731 /*
732  * REG_CAL_MSBLOLVL
733  */
734 #define CAL_MSBLVLLO(x) (((x) & 0x3F) << 0) /* Low level limit for msb sweep average */
735 
736 /*
737  * REG_CAL_THRESH
738  */
739 #define CAL_LTAC_THRES(x) (((x) & 0x7) << 3) /* Long TAC threshold */
740 #define CAL_TAC_THRES(x) (((x) & 0x7) << 0) /* TAC threshold */
741 
742 /*
743  * REG_CAL_AVG_CNT
744  */
745 #define MSB_GLOBAL_SUBAVG(x) (((x) & 0x3) << 6) /* Local Averages for MSB in Global Calibration */
746 #define GLOBAL_AVG_CNT(x) (((x) & 0x7) << 3) /* Global avg Terminal count */
747 #define LOCAL_AVRG_CNT(x) (((x) & 0x7) << 0) /* Local avg terminal count */
748 
749 /*
750  * REG_CAL_CLKDIV
751  */
752 #define CAL_CLKDIV(x) (((x) & 0xF) << 0) /* Calibration clock divider */
753 
754 /*
755  * REG_CAL_INDX
756  */
757 #define CAL_INDX(x) (((x) & 0xF) << 0) /* DAC Calibration Index paging bits */
758 
759 /*
760  * REG_CAL_CTRL
761  */
762 #define CAL_FIN (1 << 7) /* Calibration finished */
763 #define CAL_ACTIVE (1 << 6) /* Calibration active */
764 #define CAL_ERRHI (1 << 5) /* SAR data error: too hi */
765 #define CAL_ERRLO (1 << 4) /* SAR data error: too lo */
766 #define CAL_TXDACBYDAC (1 << 3) /* Calibration of TXDAC by TXDAC */
767 #define CAL_START (1 << 1) /* Calibration start */
768 #define CAL_EN (1 << 0) /* Calibration enable */
769 
770 /*
771  * REG_CAL_ADDR
772  */
773 #define CAL_ADDR(x) (((x) & 0x3F) << 0) /* Calibration DAC address */
774 
775 /*
776  * REG_CAL_DATA
777  */
778 #define CAL_DATA(x) (((x) & 0x3F) << 0) /* Calibration DAC Coefficient Data */
779 
780 /*
781  * REG_CAL_UPDATE
782  */
783 #define CAL_UPDATE (1 << 7) /* Calibration DAC Coefficient Update */
784 
785 /*
786  * REG_DATA_FORMAT
787  */
788 #define BINARY_FORMAT (1 << 7) /* Binary or 2's complementary format on DATA bus */
789 
790 /*
791  * REG_DATAPATH_CTRL
792  */
793 #define INVSINC_ENABLE (1 << 7) /* 1 = Enable inver sinc filter */
794 #define DIG_GAIN_ENABLE (1 << 5) /* 1 = Enable digital gain */
795 #define PHASE_ADJ_ENABLE (1 << 4) /* 1 = Enable phase compensation */
796 #define SEL_SIDEBAND (1 << 1) /* 1 = Select upper or lower sideband from modulation result */
797 #define I_TO_Q (1 << 0) /* 1 = send I datapath into Q DAC */
798 #define MODULATION_TYPE(x) (((x) & 0x3) << 2) /* selects type of modulation operation */
799 #define MODULATION_TYPE_MASK (0x03 << 2)
800 
801 /*
802  * REG_INTERP_MODE
803  */
804 #define INTERP_MODE(x) (((x) & 0x7) << 0) /* Interpolation Mode */
805 
806 /*
807  * REG_NCO_FTW_UPDATE
808  */
809 #define FTW_UPDATE_ACK (1 << 1) /* Frequency Tuning Word Update Acknowledge */
810 #define FTW_UPDATE_REQ (1 << 0) /* Frequency Tuning Word Update Request from SPI */
811 
812 /*
813  * REG_TXEN_FUNC
814  */
815 #define TX_DIG_CLK_PD (1 << 0) /* 1 = Digital clocks will be shut down when Tx_enable pin is low. */
816 
817 /*
818  * REG_TXEN_SM_0
819  */
820 #define GP_PA_ON_INVERT (1 << 2) /* External Modulator polarity invert */
821 #define GP_PA_CTRL (1 << 1) /* External PA control */
822 #define TXEN_SM_EN (1 << 0) /* Enable TXEN state machine */
823 #define PA_FALL(x) (((x) & 0x3) << 6) /* PA fall control */
824 #define PA_RISE(x) (((x) & 0x3) << 4) /* PA rises control */
825 
826 /*
827  * REG_TXEN_SM_1
828  */
829 #define DIG_FALL(x) (((x) & 0x3) << 6) /* DIG_FALL */
830 #define DIG_RISE(x) (((x) & 0x3) << 4) /* DIG_RISE */
831 #define DAC_FALL(x) (((x) & 0x3) << 2) /* DAC_FALL */
832 #define DAC_RISE(x) (((x) & 0x3) << 0) /* DAC_RISE */
833 
834 /*
835  * REG_DACOUT_ON_DOWN
836  */
837 #define DACOUT_SHUTDOWN (1 << 1) /* Shut down DAC output. 1 means DAC get shut down manually. */
838 #define DACOUT_ON_TRIGGER (1 << 0) /* Turn on DAC output manually. Self clear signal. */
839 
840 /*
841  * REG_DACOFF
842  */
843 #define PROTECT_MODE (1 << 7) /* PROTECT_MODE */
844 #define DACOFF_AVG_PW (1 << 0) /* DACOFF_AVG_PW */
845 
846 /*
847  * REG_DIE_TEMP_CTRL0
848  */
849 #define ADC_TESTMODE (1 << 7) /* ADC_TESTMODE */
850 #define AUXADC_ENABLE (1 << 0) /* AUXADC_ENABLE */
851 #define FS_CURRENT(x) (((x) & 0x7) << 4) /* FS_CURRENT */
852 #define REF_CURRENT(x) (((x) & 0x7) << 1) /* REF_CURRENT */
853 
854 /*
855  * REG_DIE_TEMP_CTRL1
856  */
857 #define SELECT_CLKDIG (1 << 3) /* SELECT_CLKDIG */
858 #define EN_DIV2 (1 << 2) /* EN_DIV2 */
859 #define INCAP_CTRL(x) (((x) & 0x3) << 0) /* INCAP_CTRL */
860 
861 /*
862  * REG_DIE_TEMP_UPDATE
863  */
864 #define DIE_TEMP_UPDATE (1 << 0) /* Die temperature update */
865 
866 /*
867  * REG_DC_OFFSET_CTRL
868  */
869 #define DISABLE_NOISE (1 << 1) /* DISABLE_NOISE */
870 #define DC_OFFSET_ON (1 << 0) /* DC_OFFSET_ON */
871 
872 /*
873  * REG_IPATH_DC_OFFSET_2PART
874  */
875 #define IPATH_DC_OFFSET_2PART(x) (((x) & 0x1F) << 0) /* second part of DC Offset value for I path */
876 
877 /*
878  * REG_QPATH_DC_OFFSET_2PART
879  */
880 #define QPATH_DC_OFFSET_2PART(x) (((x) & 0x1F) << 0) /* second part of DC Offset value for Q path */
881 
882 /*
883  * REG_IDAC_DIG_GAIN1
884  */
885 #define IDAC_DIG_GAIN1(x) (((x) & 0xF) << 0) /* MSB of I DAC digital gain */
886 
887 /*
888  * REG_QDAC_DIG_GAIN1
889  */
890 #define QDAC_DIG_GAIN1(x) (((x) & 0xF) << 0) /* MSB of Q DAC digital gain */
891 
892 /*
893  * REG_GAIN_RAMP_UP_STP1
894  */
895 #define GAIN_RAMP_UP_STP1(x) (((x) & 0xF) << 0) /* MSB of digital gain rises */
896 
897 /*
898  * REG_GAIN_RAMP_DOWN_STP1
899  */
900 #define GAIN_RAMP_DOWN_STP1(x) (((x) & 0xF) << 0) /* MSB of digital gain drops */
901 
902 /*
903  * REG_BLSM_CTRL
904  */
905 #define RESET_BLSM (1 << 7) /* Soft rest to the new Blanking SM */
906 #define EN_FORCE_GAIN_SOFT_OFF (1 << 4) /* Enable forcing gan_soft_off from SPI */
907 #define GAIN_SOFT_OFF (1 << 3) /* gain_soft_off forced value */
908 #define GAIN_SOFT_ON (1 << 2) /* gain_soft_on forced value */
909 #define EN_FORCE_GAIN_SOFT_ON (1 << 1) /* Force the gain_soft_on from SPI */
910 
911 /*
912  * REG_BLSM_STAT
913  */
914 #define SOFT_OFF_DONE (1 << 5) /* Blanking SoftOff Enable */
915 #define SOFT_ON_DONE (1 << 4) /* Blanking SoftOn Done */
916 #define GAIN_SOFT_OFF_RB (1 << 3) /* gain soft off readback */
917 #define GAIN_SOFT_ON_RB (1 << 2) /* gain soft on readback */
918 #define SOFT_OFF_EN_RB (1 << 1) /* Blanking SM soft Off read back */
919 #define SOFT_ON_EN_RB (1 << 0) /* Blanking SM soft On read back */
920 #define SOFTBLANKRB(x) (((x) & 0x3) << 6) /* Blanking State */
921 
922 /*
923  * REG_PRBS
924  */
925 #define PRBS_GOOD_Q (1 << 7) /* Good data indicator imaginary channel */
926 #define PRBS_GOOD_I (1 << 6) /* Good data indicator real channel */
927 #define PRBS_INV_Q (1 << 4) /* Data Inversion imaginary channel */
928 #define PRBS_INV_I (1 << 3) /* Data Inversion real channel */
929 #define PRBS_MODE (1 << 2) /* Polynomial Select */
930 #define PRBS_RESET (1 << 1) /* Reset Error Counters */
931 #define PRBS_EN (1 << 0) /* Enable PRBS Checker */
932 
933 /*
934  * REG_DACPLLT5
935  */
936 #define VCO_VAR(x) (((x) & 0xF) << 0) /* Varactor KVO setting */
937 
938 /*
939  * REG_DACPLLTB
940  */
941 #define VCO_BIAS_REF(x) (((x) & 0x7) << 0) /* VCO Bias control */
942 
943 /*
944  * REG_DACPLLTD
945  */
946 #define VCO_CAL_REF_MON (1 << 3) /* Sent control voltage to outside world */
947 #define VCO_CAL_REF_TCF(x) (((x) & 0x7) << 0) /* TempCo for cal ref */
948 
949 /*
950  * REG_DACPLLT17
951  */
952 #define VCO_VAR_REF_TCF(x) (((x) & 0x7) << 4) /* Varactor Reference TempCo */
953 #define VCO_VAR_OFF(x) (((x) & 0xF) << 0) /* Varactor Offset */
954 
955 /*
956  * REG_SPISTRENGTH
957  */
958 #define SPIDRV(x) (((x) & 0xF) << 0) /* Slew and drive strength for cmos interface */
959 
960 /*
961  * REG_CLK_TEST
962  */
963 #define DUTYCYCLEON (1 << 0) /* Clock Duty Cycle Control On */
964 
965 /*
966  * REG_ATEST_VOLTS
967  */
968 #define ATEST_EN (1 << 0) /* Enable Analog Test Mode */
969 #define ATEST_TOPVSEL(x) (((x) & 0x3) << 5) /* Which source at analog top to use */
970 #define ATEST_DACSEL(x) (((x) & 0x3) << 3) /* DAC from which to get voltage */
971 #define ATEST_VSEL(x) (((x) & 0x3) << 1) /* DAC Voltage to Select */
972 
973 /*
974  * REG_ASPI_CLKSRC
975  */
976 #define EN_CLKDIV (1 << 3) /* Enable the fdac/8 clock path to generate PD timing clock */
977 #define ASPI_OSC_RATE (1 << 2) /* Aspi Oscillator Rate */
978 #define ASPI_CLK_SRC (1 << 1) /* Choose Aspi Clock Source */
979 #define EN_ASPI_OSC (1 << 0) /* Enable Aspi Oscillator clock */
980 
981 /*
982  * REG_MASTER_PD
983  */
984 #define SPI_PD_MASTER (1 << 0)
985 
986 /*
987  * REG_GENERIC_PD
988  */
989 #define SPI_SYNC1_PD (1 << 1)
990 #define SPI_SYNC2_PD (1 << 0)
991 
992 /*
993  * REG_CDR_OPERATING_MODE_REG_0
994  */
995 #define SPI_ENHALFRATE (1 << 5)
996 #define SPI_DIVISION_RATE(x) (((x) & 0x3) << 1)
997 
998 /*
999  * REG_EQ_CONFIG_PHY_0_1
1000  */
1001 #define SPI_EQ_CONFIG1(x) (((x) & 0xF) << 4)
1002 #define SPI_EQ_CONFIG0(x) (((x) & 0xF) << 0)
1003 
1004 /*
1005  * REG_EQ_CONFIG_PHY_2_3
1006  */
1007 #define SPI_EQ_CONFIG3(x) (((x) & 0xF) << 4)
1008 #define SPI_EQ_CONFIG2(x) (((x) & 0xF) << 0)
1009 
1010 /*
1011  * REG_EQ_CONFIG_PHY_4_5
1012  */
1013 #define SPI_EQ_CONFIG5(x) (((x) & 0xF) << 4)
1014 #define SPI_EQ_CONFIG4(x) (((x) & 0xF) << 0)
1015 
1016 /*
1017  * REG_EQ_CONFIG_PHY_6_7
1018  */
1019 #define SPI_EQ_CONFIG7(x) (((x) & 0xF) << 4)
1020 #define SPI_EQ_CONFIG6(x) (((x) & 0xF) << 0)
1021 
1022 /*
1023  * REG_EQ_BIAS_REG
1024  */
1025 #define SPI_EQ_EXTRA_SPI_LSBITS(x) (((x) & 0x3) << 6)
1026 #define SPI_EQ_BIASPTAT(x) (((x) & 0x7) << 3)
1027 #define SPI_EQ_BIASPLY(x) (((x) & 0x7) << 0)
1028 
1029 /*
1030  * REG_SYNTH_ENABLE_CNTRL
1031  */
1032 #define SPI_RECAL_SYNTH (1 << 2)
1033 #define SPI_ENABLE_SYNTH (1 << 0)
1034 
1035 /*
1036  * REG_PLL_STATUS
1037  */
1038 #define SPI_CP_CAL_VALID_RB (1 << 3)
1039 #define SPI_PLL_LOCK_RB (1 << 0)
1040 
1041 /*
1042  * REG_REF_CLK_DIVIDER_LDO
1043  */
1044 #define SPI_CDR_OVERSAMP(x) (((x) & 0x3) << 0)
1045 
1046 /*
1047  * REG_TERM_BLK1_CTRLREG0
1048  */
1049 #define SPI_I_TUNE_R_CAL_TERMBLK1 (1 << 0)
1050 
1051 /*
1052  * REG_TERM_BLK2_CTRLREG0
1053  */
1054 #define SPI_I_TUNE_R_CAL_TERMBLK2 (1 << 0)
1055 
1056 /*
1057  * REG_GENERAL_JRX_CTRL_0
1058  */
1059 #define CHECKSUM_MODE (1 << 6) /* Checksum mode */
1060 #define LINK_MODE (1 << 3) /* Link mode */
1061 #define SEL_REG_MAP_1 (1 << 2) /* Link register map selection */
1062 #define LINK_EN(x) (((x) & 0x3) << 0) /* Link enable */
1063 
1064 /*
1065  * REG_GENERAL_JRX_CTRL_1
1066  */
1067 #define SUBCLASSV_LOCAL(x) (((x) & 0x7) << 0) /* JESD204B subclass */
1068 
1069 /*
1070  * REG_DYN_LINK_LATENCY_0
1071  */
1072 #define DYN_LINK_LATENCY_0(x) (((x) & 0x1F) << 0) /* Dynamic link latency: Link 0 */
1073 
1074 /*
1075  * REG_DYN_LINK_LATENCY_1
1076  */
1077 #define DYN_LINK_LATENCY_1(x) (((x) & 0x1F) << 0) /* Dynamic link latency: Link 1 */
1078 
1079 /*
1080  * REG_LMFC_DELAY_0
1081  */
1082 #define LMFC_DELAY_0(x) (((x) & 0x1F) << 0) /* LMFC delay: Link 0 */
1083 
1084 /*
1085  * REG_LMFC_DELAY_1
1086  */
1087 #define LMFC_DELAY_1(x) (((x) & 0x1F) << 0) /* LMFC delay: Link 1 */
1088 
1089 /*
1090  * REG_LMFC_VAR_0
1091  */
1092 #define LMFC_VAR_0(x) (((x) & 0x1F) << 0) /* Location in RX LMFC where JESD words are read out from buffer */
1093 
1094 /*
1095  * REG_LMFC_VAR_1
1096  */
1097 #define LMFC_VAR_1(x) (((x) & 0x1F) << 0) /* Location in RX LMFC where JESD words are read out from buffer */
1098 
1099 /*
1100  * REG_XBAR_LN_0_1
1101  */
1102 #define SRC_LANE1(x) (((x) & 0x7) << 3) /* Logic Lane 1 source */
1103 #define SRC_LANE0(x) (((x) & 0x7) << 0) /* Logic Lane 0 source */
1104 
1105 /*
1106  * REG_XBAR_LN_2_3
1107  */
1108 #define SRC_LANE3(x) (((x) & 0x7) << 3) /* Logic Lane 3 source */
1109 #define SRC_LANE2(x) (((x) & 0x7) << 0) /* Logic Lane 2 source */
1110 
1111 /*
1112  * REG_XBAR_LN_4_5
1113  */
1114 #define SRC_LANE5(x) (((x) & 0x7) << 3) /* Logic Lane 5 source */
1115 #define SRC_LANE4(x) (((x) & 0x7) << 0) /* Logic Lane 4 source */
1116 
1117 /*
1118  * REG_XBAR_LN_6_7
1119  */
1120 #define SRC_LANE7(x) (((x) & 0x7) << 3) /* Logic Lane 7 source */
1121 #define SRC_LANE6(x) (((x) & 0x7) << 0) /* Logic Lane 6 source */
1122 
1123 /*
1124  * REG_FIFO_STATUS_REG_2
1125  */
1126 #define DRDL_FIFO_EMPTY (1 << 1) /* Deterministic latency (DRDL) FIFO is between JESD204B receiver and DAC2 and DAC3 */
1127 #define DRDL_FIFO_FULL (1 << 0) /* DRDL FIFO is between JESD204B receiver and DAC2 and DAC3 */
1128 
1129 /*
1130  * REG_SYNCB_GEN_0
1131  */
1132 #define EOMF_MASK_1 (1 << 3) /* EOMF_MASK_1 */
1133 #define EOMF_MASK_0 (1 << 2) /* EOMF_MASK_0 */
1134 #define EOF_MASK_1 (1 << 1) /* Mask EOF from QBD_1 */
1135 #define EOF_MASK_0 (1 << 0) /* Mask EOF from QBD_0 */
1136 
1137 /*
1138  * REG_SYNCB_GEN_1
1139  */
1140 #define SYNCB_ERR_DUR(x) (((x) & 0xF) << 4) /* Duration of SYNCOUT low for the purpose of error reporting */
1141 #define SYNCB_SYNCREQ_DUR(x) (((x) & 0xF) << 0) /* Duration of SYNCOUT low for purpose of synchronization request */
1142 
1143 /*
1144  * REG_PHY_PRBS_TEST_CTRL
1145  */
1146 #define PHY_TEST_START (1 << 1) /* PHY PRBS test start */
1147 #define PHY_TEST_RESET (1 << 0) /* PHY PRBS test reset */
1148 #define PHY_SRC_ERR_CNT(x) (((x) & 0x7) << 4) /* PHY error count source */
1149 #define PHY_PRBS_PAT_SEL(x) (((x) & 0x3) << 2) /* PHY PRBS pattern select */
1150 
1151 /*
1152  * REG_SHORT_TPL_TEST_0
1153  */
1154 #define SHORT_TPL_TEST_RESET (1 << 1) /* Short transport layer test reset */
1155 #define SHORT_TPL_TEST_EN (1 << 0) /* Short transport layer test enable */
1156 #define SHORT_TPL_SP_SEL(x) (((x) & 0x3) << 4) /* Short transport layer sample select */
1157 #define SHORT_TPL_M_SEL(x) (((x) & 0x3) << 2) /* Short transport layer test DAC select */
1158 
1159 /*
1160  * REG_SHORT_TPL_TEST_3
1161  */
1162 #define SHORT_TPL_FAIL (1 << 0) /* Short transport layer test fail */
1163 
1164 /*
1165  * REG_BID_REG
1166  */
1167 #define ADJCNT_RD(x) (((x) & 0xF) << 4)
1168 #define BID_RD(x) (((x) & 0xF) << 0)
1169 
1170 /*
1171  * REG_LID0_REG
1172  */
1173 #define ADJDIR_RD (1 << 6)
1174 #define PHADJ_RD (1 << 5)
1175 #define LID0_RD(x) (((x) & 0x1F) << 0)
1176 
1177 /*
1178  * REG_SCR_L_REG
1179  */
1180 #define SCR_RD (1 << 7)
1181 #define L_RD(x) (((x) & 0x1F) << 0)
1182 
1183 /*
1184  * REG_K_REG
1185  */
1186 #define K_RD(x) (((x) & 0x1F) << 0)
1187 
1188 /*
1189  * REG_CS_N_REG
1190  */
1191 #define CS_RD(x) (((x) & 0x3) << 6)
1192 #define N_RD(x) (((x) & 0x1F) << 0)
1193 
1194 /*
1195  * REG_NP_REG
1196  */
1197 #define SUBCLASSV_RD(x) (((x) & 0x7) << 5)
1198 #define NP_RD(x) (((x) & 0x1F) << 0)
1199 
1200 /*
1201  * REG_S_REG
1202  */
1203 #define JESDV_RD(x) (((x) & 0x7) << 5)
1204 #define S_RD(x) (((x) & 0x1F) << 0)
1205 
1206 /*
1207  * REG_HD_CF_REG
1208  */
1209 #define HD_RD (1 << 7)
1210 #define CF_RD(x) (((x) & 0x1F) << 0)
1211 
1212 /*
1213  * REG_LID1_REG
1214  */
1215 #define LID1_RD(x) (((x) & 0x1F) << 0)
1216 
1217 /*
1218  * REG_LID2_REG
1219  */
1220 #define LID2_RD(x) (((x) & 0x1F) << 0)
1221 
1222 /*
1223  * REG_LID3_REG
1224  */
1225 #define LID3_RD(x) (((x) & 0x1F) << 0)
1226 
1227 /*
1228  * REG_LID4_REG
1229  */
1230 #define LID4_RD(x) (((x) & 0x1F) << 0)
1231 
1232 /*
1233  * REG_LID5_REG
1234  */
1235 #define LID5_RD(x) (((x) & 0x1F) << 0)
1236 
1237 /*
1238  * REG_LID6_REG
1239  */
1240 #define LID6_RD(x) (((x) & 0x1F) << 0)
1241 
1242 /*
1243  * REG_LID7_REG
1244  */
1245 #define LID7_RD(x) (((x) & 0x1F) << 0)
1246 
1247 /*
1248  * REG_ILS_BID
1249  */
1250 #define ADJCNT(x) (((x) & 0xF) << 4)
1251 #define BID(x) (((x) & 0xF) << 0)
1252 
1253 /*
1254  * REG_ILS_LID0
1255  */
1256 #define ADJDIR (1 << 6)
1257 #define PHADJ (1 << 5)
1258 #define LID0(x) (((x) & 0x1F) << 0)
1259 
1260 /*
1261  * REG_ILS_SCR_L
1262  */
1263 #define SCR (1 << 7)
1264 #define L(x) (((x) & 0x1F) << 0)
1265 
1266 /*
1267  * REG_ILS_K
1268  */
1269 #define K(x) (((x) & 0x1F) << 0)
1270 
1271 /*
1272  * REG_ILS_CS_N
1273  */
1274 #define CS(x) (((x) & 0x3) << 6)
1275 #define N(x) (((x) & 0x1F) << 0)
1276 
1277 /*
1278  * REG_ILS_NP
1279  */
1280 #define SUBCLASSV(x) (((x) & 0x7) << 5)
1281 #define NP(x) (((x) & 0x1F) << 0)
1282 
1283 /*
1284  * REG_ILS_S
1285  */
1286 #define JESDV(x) (((x) & 0x7) << 5)
1287 #define S(x) (((x) & 0x1F) << 0)
1288 
1289 /*
1290  * REG_ILS_HD_CF
1291  */
1292 #define HD (1 << 7)
1293 #define CF(x) (((x) & 0x1F) << 0)
1294 
1295 /*
1296  * REG_ERRCNTRMON
1297  */
1298 #define LANESEL(x) (((x) & 0x7) << 4)
1299 #define CNTRSEL(x) (((x) & 0x3) << 0)
1300 
1301 /*
1302  * REG_BADDISPARITY
1303  */
1304 #define RST_IRQ_DIS (1 << 7)
1305 #define DIS_ERR_CNTR_DIS (1 << 6)
1306 #define RST_ERR_CNTR_DIS (1 << 5)
1307 #define LANE_ADDR_DIS(x) (((x) & 0x7) << 0)
1308 
1309 /*
1310  * REG_NITDISPARITY
1311  */
1312 #define RST_IRQ_NIT (1 << 7)
1313 #define DIS_ERR_CNTR_NIT (1 << 6)
1314 #define RST_ERR_CNTR_NIT (1 << 5)
1315 #define LANE_ADDR_NIT(x) (((x) & 0x7) << 0)
1316 
1317 /*
1318  * REG_UNEXPECTEDKCHAR
1319  */
1320 #define RST_IRQ_K (1 << 7)
1321 #define DIS_ERR_CNTR_K (1 << 6)
1322 #define RST_ERR_CNTR_K (1 << 5)
1323 #define LANE_ADDR_K(x) (((x) & 0x7) << 0)
1324 
1325 /*
1326  * REG_CTRLREG2
1327  */
1328 #define ILAS_MODE (1 << 7)
1329 #define REPDATATEST (1 << 5)
1330 #define QUETESTERR (1 << 4)
1331 #define AUTO_ECNTR_RST (1 << 3)
1332 
1333 /*
1334  * REG_IRQVECTOR
1335  */
1336 #define BADDIS_FLAG_OR_MASK (1 << 7)
1337 #define NITD_FLAG_OR_MASK (1 << 6)
1338 #define UEKC_FLAG_OR_MASK (1 << 5)
1339 #define INITIALLANESYNC_FLAG_OR_MASK (1 << 3)
1340 #define BADCHECKSUM_FLAG_OR_MASK (1 << 2)
1341 #define CODEGRPSYNC_FLAG_OR_MASK (1 << 0)
1342 
1343 /*
1344  * REG_SYNCASSERTIONMASK
1345  */
1346 #define BAD_DIS_S (1 << 7)
1347 #define NIT_DIS_S (1 << 6)
1348 #define UNEX_K_S (1 << 5)
1349 #define CMM_FLAG_OR_MASK (1 << 4)
1350 #define CMM_ENABLE (1 << 3)
1351 
1352 
1353 #define AD9144_MAX_DAC_RATE 2000000000UL
1354 #define AD9144_CHIP_ID 0x44
1355 #define AD9144_PRBS7 0x0
1356 #define AD9144_PRBS15 0x1
1357 
1358 /******************************************************************************/
1359 /*************************** Types Declarations *******************************/
1360 /******************************************************************************/
1361 struct ad9144_dev {
1362  /* SPI */
1364 
1365  struct jesd204_dev *jdev;
1367 
1370  uint8_t num_lanes;
1371 
1372  unsigned int interpolation;
1373  unsigned int fcenter_shift;
1374 
1375  uint8_t lane_mux[8];
1376 
1377  /* Whether to enable the internal DAC PLL (0=disable, 1=enable) */
1378  uint8_t pll_enable;
1379  /* When using the DAC PLL this specifies the external reference clock frequency in kHz. */
1381  /* When using the DAC PLL this specifies the target PLL output frequency in kHz. */
1383 };
1384 
1386  /* SPI */
1388  /* Device Settings */
1389  uint8_t spi3wire; // set device spi intereface 3/4 wires
1391  uint8_t num_lanes;
1392  uint8_t interpolation; // interpolation factor
1393  unsigned int fcenter_shift;
1394  uint32_t stpl_samples[4][4];
1395  uint32_t lane_rate_kbps;
1396  uint32_t prbs_type;
1397 
1398  uint8_t jesd204_mode;
1401  uint8_t lane_mux[8];
1402 
1403  /* Whether to enable the internal DAC PLL (0=disable, 1=enable) */
1404  uint8_t pll_enable;
1405  /* When using the DAC PLL this specifies the external reference clock frequency in kHz. */
1407  /* When using the DAC PLL this specifies the target PLL output frequency in kHz. */
1409 };
1410 
1411 /******************************************************************************/
1412 /************************ Functions Declarations ******************************/
1413 /******************************************************************************/
1414 int32_t ad9144_setup_legacy(struct ad9144_dev **device,
1415  const struct ad9144_init_param *init_param);
1416 
1417 /* Initialize ad9144_dev, JESD FSM ON*/
1418 int32_t ad9144_setup_jesd_fsm(struct ad9144_dev **device,
1419  const struct ad9144_init_param *init_param);
1420 
1421 int32_t ad9144_remove(struct ad9144_dev *dev);
1422 
1423 int32_t ad9144_spi_read(struct ad9144_dev *dev,
1424  uint16_t reg_addr,
1425  uint8_t *reg_data);
1426 
1427 int32_t ad9144_spi_write(struct ad9144_dev *dev,
1428  uint16_t reg_addr,
1429  uint8_t reg_data);
1430 
1431 int32_t ad9144_spi_check_status(struct ad9144_dev *dev,
1432  uint16_t reg_addr,
1433  uint8_t reg_mask,
1434  uint8_t exp_reg_data);
1435 
1436 int32_t ad9144_status(struct ad9144_dev *dev);
1437 
1438 int32_t ad9144_short_pattern_test(struct ad9144_dev *dev,
1439  const struct ad9144_init_param *init_param);
1440 
1441 int32_t ad9144_datapath_prbs_test(struct ad9144_dev *dev,
1442  const struct ad9144_init_param *init_param);
1443 
1444 int32_t ad9144_dac_calibrate(struct ad9144_dev *dev);
1445 
1446 int32_t ad9144_set_nco(struct ad9144_dev *dev, int32_t f_carrier_khz,
1447  int16_t phase);
1448 
1449 #endif
ad9144_init_param::pll_dac_frequency_khz
uint32_t pll_dac_frequency_khz
Definition: ad9144.h:1408
REG_CDR_RESET
#define REG_CDR_RESET
Definition: ad9144.h:205
ad9144_setup_jesd_fsm
int32_t ad9144_setup_jesd_fsm(struct ad9144_dev **device, const struct ad9144_init_param *init_param)
Definition: ad9144.c:1133
timeout
uint32_t timeout
Definition: ad413x.c:55
no_os_alloc.h
ad9144_short_pattern_test
int32_t ad9144_short_pattern_test(struct ad9144_dev *dev, const struct ad9144_init_param *init_param)
ad9144_short_pattern_test
Definition: ad9144.c:1288
FTW_UPDATE_REQ
#define FTW_UPDATE_REQ
Definition: ad9144.h:810
REG_ILS_SCR_L
#define REG_ILS_SCR_L
Definition: ad9144.h:298
SRC_LANE3
#define SRC_LANE3(x)
Definition: ad9144.h:1108
REG_SHORT_TPL_TEST_1
#define REG_SHORT_TPL_TEST_1
Definition: ad9144.h:254
REG_DACINTEGERWORD0
#define REG_DACINTEGERWORD0
Definition: ad9144.h:119
REG_CAL_CTRL
#define REG_CAL_CTRL
Definition: ad9144.h:135
ad9144_dev::interpolation
unsigned int interpolation
Definition: ad9144.h:1372
ad9144_datapath_prbs_test
int32_t ad9144_datapath_prbs_test(struct ad9144_dev *dev, const struct ad9144_init_param *init_param)
ad9144_datapath_prbs_test
Definition: ad9144.c:1326
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:86
REG_MASTER_PD
#define REG_MASTER_PD
Definition: ad9144.h:202
jesd204_dev_data::state_ops
struct jesd204_state_op state_ops[__JESD204_MAX_OPS]
Definition: jesd204.h:232
ad9144_reg_seq::reg
uint16_t reg
Definition: ad9144.c:155
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:165
JESD204_STATE_OP_REASON_INIT
@ JESD204_STATE_OP_REASON_INIT
Definition: jesd204.h:148
REG_PRBS_ERROR_I
#define REG_PRBS_ERROR_I
Definition: ad9144.h:189
REG_LMFC_VAR_0
#define REG_LMFC_VAR_0
Definition: ad9144.h:234
ad9144_dev::pll_ref_frequency_khz
uint32_t pll_ref_frequency_khz
Definition: ad9144.h:1380
ad9144_init_param::num_converters
uint8_t num_converters
Definition: ad9144.h:1390
ad9144_setup_legacy
int32_t ad9144_setup_legacy(struct ad9144_dev **device, const struct ad9144_init_param *init_param)
Definition: ad9144.c:976
REG_DACPLLSTATUS
#define REG_DACPLLSTATUS
Definition: ad9144.h:118
REG_GOODCHKSUMFLG
#define REG_GOODCHKSUMFLG
Definition: ad9144.h:316
SOFTRESET_M
#define SOFTRESET_M
Definition: ad9144.h:329
REG_LMFC_DELAY_1
#define REG_LMFC_DELAY_1
Definition: ad9144.h:233
no_os_spi.h
Header file of SPI Interface.
ad9144_dev::sample_rate_khz
uint32_t sample_rate_khz
Definition: ad9144.h:1368
ad9144_dac_calibrate
int32_t ad9144_dac_calibrate(struct ad9144_dev *dev)
Definition: ad9144.c:1197
no_os_mul_u64_u32_shr
uint64_t no_os_mul_u64_u32_shr(uint64_t a, uint32_t mul, unsigned int shift)
REG_DACLDOCNTRL1
#define REG_DACLDOCNTRL1
Definition: ad9144.h:125
REG_SYSREF_ACTRL0
#define REG_SYSREF_ACTRL0
Definition: ad9144.h:115
AD9144_MOD_TYPE_MASK
#define AD9144_MOD_TYPE_MASK
Definition: ad9144.c:82
jesd204_copy_link_params
void jesd204_copy_link_params(struct jesd204_link *dst, const struct jesd204_link *src)
SYNCARM
#define SYNCARM
Definition: ad9144.h:527
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:94
ad9144_spi_write_seq
int32_t ad9144_spi_write_seq(struct ad9144_dev *dev, const struct ad9144_reg_seq *seq, uint32_t num)
Definition: ad9144.c:159
ad9144_dev::link_config
struct jesd204_link link_config
Definition: ad9144.h:1366
REG_SHORT_TPL_TEST_2
#define REG_SHORT_TPL_TEST_2
Definition: ad9144.h:255
ad9144_status
int32_t ad9144_status(struct ad9144_dev *dev)
ad9144_status - return the status of the JESD interface
Definition: ad9144.c:1249
ad9144_init_param::lane_mux
uint8_t lane_mux[8]
Definition: ad9144.h:1401
no_os_delay.h
Header file of Delay functions.
JESD204_ENCODER_8B10B
@ JESD204_ENCODER_8B10B
Definition: jesd204.h:30
jesd204_sysref::mode
enum jesd204_sysref_mode mode
Definition: jesd204.h:61
jesd204_state_op_reason
jesd204_state_op_reason
Definition: jesd204.h:147
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:121
ad9144_init_param::prbs_type
uint32_t prbs_type
Definition: ad9144.h:1396
ad9144_set_nco
int32_t ad9144_set_nco(struct ad9144_dev *dev, int32_t f_carrier_khz, int16_t phase)
Definition: ad9144.c:381
ad9144_dev::fcenter_shift
unsigned int fcenter_shift
Definition: ad9144.h:1373
REG_ILS_BID
#define REG_ILS_BID
Definition: ad9144.h:296
REG_ILS_DID
#define REG_ILS_DID
Definition: ad9144.h:295
ad9144_datapath_prbs_test
int32_t ad9144_datapath_prbs_test(struct ad9144_dev *dev, const struct ad9144_init_param *init_param)
ad9144_datapath_prbs_test
Definition: ad9144.c:1326
ad9144_dev::pll_enable
uint8_t pll_enable
Definition: ad9144.h:1378
ad9144_init_param::jesd204_subclass
uint8_t jesd204_subclass
Definition: ad9144.h:1399
device
Definition: ad9361_util.h:75
no_os_print_log.h
Print messages helpers.
SRC_LANE0
#define SRC_LANE0(x)
Definition: ad9144.h:1103
REG_DEV_CONFIG_9
#define REG_DEV_CONFIG_9
Definition: ad9144.h:222
REG_FRAMESYNCFLG
#define REG_FRAMESYNCFLG
Definition: ad9144.h:315
ad9144_jesd204_priv
Definition: ad9144.c:74
ad9144_set_nco
int32_t ad9144_set_nco(struct ad9144_dev *dev, int32_t f_carrier_khz, int16_t phase)
Definition: ad9144.c:381
ad9144_spi_read
int32_t ad9144_spi_read(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
ad9144_spi_read
Definition: ad9144.c:87
REG_GENERAL_JRX_CTRL_1
#define REG_GENERAL_JRX_CTRL_1
Definition: ad9144.h:229
REG_ILS_CS_N
#define REG_ILS_CS_N
Definition: ad9144.h:302
REG_INTERP_MODE
#define REG_INTERP_MODE
Definition: ad9144.h:142
REG_KVAL
#define REG_KVAL
Definition: ad9144.h:320
REG_ILS_S
#define REG_ILS_S
Definition: ad9144.h:304
MODULATION_TYPE_MASK
#define MODULATION_TYPE_MASK
Definition: ad9144.h:799
REG_ILS_K
#define REG_ILS_K
Definition: ad9144.h:300
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
SRC_LANE1
#define SRC_LANE1(x)
Definition: ad9144.h:1102
ad9144_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad9144.h:1363
ad9144_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad9144.h:1387
REG_DEV_CONFIG_12
#define REG_DEV_CONFIG_12
Definition: ad9144.h:227
REG_REF_CLK_DIVIDER_LDO
#define REG_REF_CLK_DIVIDER_LDO
Definition: ad9144.h:215
jesd204_dev_priv
void * jesd204_dev_priv(struct jesd204_dev *jdev)
REG_DACPLLT5
#define REG_DACPLLT5
Definition: ad9144.h:191
ad9144_reg_seq::val
uint16_t val
Definition: ad9144.c:156
ad9144_setup_legacy
int32_t ad9144_setup_legacy(struct ad9144_dev **device, const struct ad9144_init_param *init_param)
Definition: ad9144.c:976
REG_LANEENABLE
#define REG_LANEENABLE
Definition: ad9144.h:324
AD9144_MOD_TYPE_COARSE8
#define AD9144_MOD_TYPE_COARSE8
Definition: ad9144.c:81
REG_SPI_PAGEINDX
#define REG_SPI_PAGEINDX
Definition: ad9144.h:60
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
ad9144_init_param::interpolation
uint8_t interpolation
Definition: ad9144.h:1392
no_os_error.h
Error codes definition.
NO_OS_DIV_ROUND_UP
#define NO_OS_DIV_ROUND_UP(x, y)
Definition: no_os_util.h:56
SEL_SIDEBAND
#define SEL_SIDEBAND
Definition: ad9144.h:796
pr_debug
#define pr_debug(fmt, args...)
Definition: no_os_print_log.h:135
REG_CAL_CLKDIV
#define REG_CAL_CLKDIV
Definition: ad9144.h:133
ad9144_spi_read
int32_t ad9144_spi_read(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
ad9144_spi_read
Definition: ad9144.c:87
REG_EQ_BIAS_REG
#define REG_EQ_BIAS_REG
Definition: ad9144.h:212
ad9144_init_param::jesd204_mode
uint8_t jesd204_mode
Definition: ad9144.h:1398
ad9144_status
int32_t ad9144_status(struct ad9144_dev *dev)
ad9144_status - return the status of the JESD interface
Definition: ad9144.c:1249
JESD204_OP_LINK_INIT
@ JESD204_OP_LINK_INIT
Definition: jesd204.h:198
REG_TERM_BLK2_CTRLREG0
#define REG_TERM_BLK2_CTRLREG0
Definition: ad9144.h:224
REG_NCO_PHASE_OFFSET0
#define REG_NCO_PHASE_OFFSET0
Definition: ad9144.h:150
REG_CAL_INIT
#define REG_CAL_INIT
Definition: ad9144.h:139
ad9144_init_param::num_lanes
uint8_t num_lanes
Definition: ad9144.h:1391
ad9144_dev::num_lanes
uint8_t num_lanes
Definition: ad9144.h:1370
JESD204_SYSREF_ONESHOT
@ JESD204_SYSREF_ONESHOT
Definition: jesd204.h:40
REG_INITLANESYNCFLG
#define REG_INITLANESYNCFLG
Definition: ad9144.h:317
jesd204.h
REG_SHORT_TPL_TEST_0
#define REG_SHORT_TPL_TEST_0
Definition: ad9144.h:253
MODULATION_TYPE
#define MODULATION_TYPE(x)
Definition: ad9144.h:798
SOFTRESET
#define SOFTRESET
Definition: ad9144.h:336
REG_XBAR
#define REG_XBAR(x)
Definition: ad9144.h:236
REG_SHORT_TPL_TEST_3
#define REG_SHORT_TPL_TEST_3
Definition: ad9144.h:256
JESD204_VERSION_B
@ JESD204_VERSION_B
Definition: jesd204.h:23
REG_CDR_OPERATING_MODE_REG_0
#define REG_CDR_OPERATING_MODE_REG_0
Definition: ad9144.h:206
AD9144_MOD_TYPE_NONE
#define AD9144_MOD_TYPE_NONE
Definition: ad9144.c:78
ad9144_dev
Definition: ad9144.h:1361
REG_ILS_LID0
#define REG_ILS_LID0
Definition: ad9144.h:297
REG_SPI_PRODIDL
#define REG_SPI_PRODIDL
Definition: ad9144.h:57
ad9144_init_param::pll_ref_frequency_khz
uint32_t pll_ref_frequency_khz
Definition: ad9144.h:1406
JESD204_OP_LINK_ENABLE
@ JESD204_OP_LINK_ENABLE
Definition: jesd204.h:211
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
REG_DACLOGENCNTRL
#define REG_DACLOGENCNTRL
Definition: ad9144.h:124
ad9144_remove
int32_t ad9144_remove(struct ad9144_dev *dev)
Definition: ad9144.c:1235
REG_SYNTH_ENABLE_CNTRL
#define REG_SYNTH_ENABLE_CNTRL
Definition: ad9144.h:213
AD9144_CHIP_ID
#define AD9144_CHIP_ID
Definition: ad9144.h:1354
REG_ILS_HD_CF
#define REG_ILS_HD_CF
Definition: ad9144.h:305
REG_PLL_STATUS
#define REG_PLL_STATUS
Definition: ad9144.h:214
ad9144_dev::lane_mux
uint8_t lane_mux[8]
Definition: ad9144.h:1375
REG_ILS_NP
#define REG_ILS_NP
Definition: ad9144.h:303
REG_PHY_PD
#define REG_PHY_PD
Definition: ad9144.h:203
REG_ILS_M
#define REG_ILS_M
Definition: ad9144.h:301
REG_LANEDESKEW
#define REG_LANEDESKEW
Definition: ad9144.h:310
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
REG_TERM_BLK1_CTRLREG0
#define REG_TERM_BLK1_CTRLREG0
Definition: ad9144.h:220
ad9144_setup_jesd204_link
int32_t ad9144_setup_jesd204_link(struct ad9144_dev *dev, const struct ad9144_init_param *init_param)
Definition: ad9144.c:206
jesd204_sysref::capture_falling_edge
uint8_t capture_falling_edge
Definition: jesd204.h:62
ad9144_reg_seq
Definition: ad9144.c:154
REG_DACPLLT18
#define REG_DACPLLT18
Definition: ad9144.h:195
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:75
REG_FTW0
#define REG_FTW0
Definition: ad9144.h:144
ad9144_jesd204_priv::dev
struct ad9144_dev * dev
Definition: ad9144.c:75
jesd204_dev_register
int jesd204_dev_register(struct jesd204_dev **jdev, const struct jesd204_dev_data *dev_data)
no_os_hweight8
unsigned int no_os_hweight8(uint8_t word)
ad9144_dac_calibrate
int32_t ad9144_dac_calibrate(struct ad9144_dev *dev)
Definition: ad9144.c:1197
AD9144_MOD_TYPE_COARSE4
#define AD9144_MOD_TYPE_COARSE4
Definition: ad9144.c:80
ad9144_init_param::fcenter_shift
unsigned int fcenter_shift
Definition: ad9144.h:1393
REG_LMFC_DELAY_0
#define REG_LMFC_DELAY_0
Definition: ad9144.h:232
NULL
#define NULL
Definition: wrapper.h:64
REG_CAL_INDX
#define REG_CAL_INDX
Definition: ad9144.h:134
REG_DACPLLTB
#define REG_DACPLLTB
Definition: ad9144.h:192
ad9144_dev::num_converters
uint8_t num_converters
Definition: ad9144.h:1369
REG_DEV_CONFIG_11
#define REG_DEV_CONFIG_11
Definition: ad9144.h:226
ad9144_spi_check_status
int32_t ad9144_spi_check_status(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t reg_mask, uint8_t exp_reg_data)
ad9144_spi_check_status
Definition: ad9144.c:132
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad9144_init_param::stpl_samples
uint32_t stpl_samples[4][4]
Definition: ad9144.h:1394
ad9144_init_param
Definition: ad9144.h:1385
SYNCENABLE
#define SYNCENABLE
Definition: ad9144.h:526
REG_ILS_F
#define REG_ILS_F
Definition: ad9144.h:299
JESD204_STATE_CHANGE_DONE
@ JESD204_STATE_CHANGE_DONE
Definition: jesd204.h:46
ad9144_dev::jdev
struct jesd204_dev * jdev
Definition: ad9144.h:1365
REG_SPI_SCRATCHPAD
#define REG_SPI_SCRATCHPAD
Definition: ad9144.h:62
ad9144_init_param::spi3wire
uint8_t spi3wire
Definition: ad9144.h:1389
REG_NCO_FTW_UPDATE
#define REG_NCO_FTW_UPDATE
Definition: ad9144.h:143
ad9144_spi_check_status
int32_t ad9144_spi_check_status(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t reg_mask, uint8_t exp_reg_data)
ad9144_spi_check_status
Definition: ad9144.c:132
ad9144_short_pattern_test
int32_t ad9144_short_pattern_test(struct ad9144_dev *dev, const struct ad9144_init_param *init_param)
ad9144_short_pattern_test
Definition: ad9144.c:1288
REG_SPI_INTFCONFA
#define REG_SPI_INTFCONFA
Definition: ad9144.h:54
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:122
REG_CTRLREG1
#define REG_CTRLREG1
Definition: ad9144.h:318
REG_DEV_CONFIG_10
#define REG_DEV_CONFIG_10
Definition: ad9144.h:223
SRC_LANE5
#define SRC_LANE5(x)
Definition: ad9144.h:1114
REG_CODEGRPSYNCFLG
#define REG_CODEGRPSYNCFLG
Definition: ad9144.h:314
ad9144_init_param::jesd204_scrambling
uint8_t jesd204_scrambling
Definition: ad9144.h:1400
REG_SYNCB_GEN_1
#define REG_SYNCB_GEN_1
Definition: ad9144.h:241
ad9144_init_param::pll_enable
uint8_t pll_enable
Definition: ad9144.h:1404
REG_LMFC_VAR_1
#define REG_LMFC_VAR_1
Definition: ad9144.h:235
ad9144_spi_write
int32_t ad9144_spi_write(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t reg_data)
ad9144_spi_write
Definition: ad9144.c:110
REG_SYNC_CTRL
#define REG_SYNC_CTRL
Definition: ad9144.h:85
jesd204_state_op::per_link
jesd204_link_cb per_link
Definition: jesd204.h:192
REG_PWRCNTRL0
#define REG_PWRCNTRL0
Definition: ad9144.h:64
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:58
L
#define L(x)
Definition: ad9144.h:1264
AD9144_MOD_TYPE_FINE
#define AD9144_MOD_TYPE_FINE
Definition: ad9144.c:79
ad9144_setup_jesd_fsm
int32_t ad9144_setup_jesd_fsm(struct ad9144_dev **device, const struct ad9144_init_param *init_param)
Definition: ad9144.c:1133
no_os_util.h
Header file of utility functions.
ad9144_dev::pll_dac_frequency_khz
uint32_t pll_dac_frequency_khz
Definition: ad9144.h:1382
REG_NCO_PHASE_OFFSET1
#define REG_NCO_PHASE_OFFSET1
Definition: ad9144.h:151
JESD204_OP_LINK_RUNNING
@ JESD204_OP_LINK_RUNNING
Definition: jesd204.h:212
REG_DATAPATH_CTRL
#define REG_DATAPATH_CTRL
Definition: ad9144.h:141
SRC_LANE2
#define SRC_LANE2(x)
Definition: ad9144.h:1109
SRC_LANE6
#define SRC_LANE6(x)
Definition: ad9144.h:1121
SRC_LANE7
#define SRC_LANE7(x)
Definition: ad9144.h:1120
ad9144_init_param::lane_rate_kbps
uint32_t lane_rate_kbps
Definition: ad9144.h:1395
SRC_LANE4
#define SRC_LANE4(x)
Definition: ad9144.h:1115
REG_DACPLLCNTRL
#define REG_DACPLLCNTRL
Definition: ad9144.h:117
REG_CLKCFG0
#define REG_CLKCFG0
Definition: ad9144.h:114
REG_SERDES_SPI_REG
#define REG_SERDES_SPI_REG
Definition: ad9144.h:243
ad9144.h
Header file of AD9144 Driver.
REG_PRBS_ERROR_Q
#define REG_PRBS_ERROR_Q
Definition: ad9144.h:190
jesd204_dev_data
JESD204 device initialization data.
Definition: jesd204.h:227
REG_DATA_FORMAT
#define REG_DATA_FORMAT
Definition: ad9144.h:140
ad9144_remove
int32_t ad9144_remove(struct ad9144_dev *dev)
Definition: ad9144.c:1235
REG_GENERAL_JRX_CTRL_0
#define REG_GENERAL_JRX_CTRL_0
Definition: ad9144.h:228
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:58
ad9144_spi_write
int32_t ad9144_spi_write(struct ad9144_dev *dev, uint16_t reg_addr, uint8_t reg_data)
ad9144_spi_write
Definition: ad9144.c:110
JESD204_OP_LINK_SETUP
@ JESD204_OP_LINK_SETUP
Definition: jesd204.h:204
chip_id
chip_id
Definition: ad9172.h:57
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)
REG_PRBS
#define REG_PRBS
Definition: ad9144.h:188