| 1 | /***************************************************************************//** |
| 2 | * @file AD9250.h |
| 3 | * @brief Header file of AD9250 Driver. |
| 4 | * @author DNechita ([email protected]) |
| 5 | ******************************************************************************** |
| 6 | * Copyright 2013(c) Analog Devices, Inc. |
| 7 | * |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions are met: |
| 12 | * - Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * - Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in |
| 16 | * the documentation and/or other materials provided with the |
| 17 | * distribution. |
| 18 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 19 | * contributors may be used to endorse or promote products derived |
| 20 | * from this software without specific prior written permission. |
| 21 | * - The use of this software may or may not infringe the patent rights |
| 22 | * of one or more patent holders. This license does not release you |
| 23 | * from the requirement that you obtain separate licenses from these |
| 24 | * patent holders to use this software. |
| 25 | * - Use of the software either in source or binary form, must be run |
| 26 | * on or directly connected to an Analog Devices Inc. component. |
| 27 | * |
| 28 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
| 29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 31 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | * |
| 39 | ******************************************************************************** |
| 40 | * SVN Revision: $WCREV$ |
| 41 | *******************************************************************************/ |
| 42 | #ifndef __AD9250_H__ |
| 43 | #define __AD9250_H__ |
| 44 | |
| 45 | /******************************************************************************/ |
| 46 | /***************************** Include Files **********************************/ |
| 47 | /******************************************************************************/ |
| 48 | #include <stdint.h> |
| 49 | |
| 50 | /******************************************************************************/ |
| 51 | /*********************************** AD9250 ***********************************/ |
| 52 | /******************************************************************************/ |
| 53 | |
| 54 | /* Registers */ |
| 55 | |
| 56 | #define AD9250_READ (1 << 15) |
| 57 | #define AD9250_WRITE (0 << 15) |
| 58 | #define AD9250_CNT(x) ((((x) & 0x3) - 1) << 13) |
| 59 | #define AD9250_ADDR(x) ((x) & 0xFF) |
| 60 | |
| 61 | #define AD9250_R1B (1 << 8) |
| 62 | #define AD9250_R2B (2 << 8) |
| 63 | #define AD9250_R3B (3 << 8) |
| 64 | #define AD9250_TRANSF_LEN(x) (((x) >> 8) & 0xFF) |
| 65 | #define SHADOW(x) ((x) << 16) |
| 66 | |
| 67 | /* Chip configuration registers */ |
| 68 | #define AD9250_REG_SPI_CFG (AD9250_R1B | 0x00) |
| 69 | #define AD9250_REG_CHIP_ID (AD9250_R1B | 0x01) |
| 70 | #define AD9250_REG_CHIP_INFO (AD9250_R1B | 0x02) |
| 71 | |
| 72 | /* Channel index and transfer registers */ |
| 73 | #define AD9250_REG_CH_INDEX (AD9250_R1B | 0x05) |
| 74 | #define AD9250_REG_DEVICE_UPDATE (AD9250_R1B | 0xFF) |
| 75 | |
| 76 | /* Program register map */ |
| 77 | #define AD9250_REG_PDWN (AD9250_R1B | 0x08) |
| 78 | #define AD9250_REG_CLOCK (AD9250_R1B | 0x09 | SHADOW(1)) |
| 79 | #define AD9250_REG_PLL_STAT (AD9250_R1B | 0x0A) |
| 80 | #define AD9250_REG_CLOCK_DIV (AD9250_R1B | 0x0B | SHADOW(2)) |
| 81 | #define AD9250_REG_TEST (AD9250_R1B | 0x0D | SHADOW(3)) |
| 82 | #define AD9250_REG_BIST (AD9250_R1B | 0x0E | SHADOW(4)) |
| 83 | #define AD9250_REG_OFFSET (AD9250_R1B | 0x10 | SHADOW(5)) |
| 84 | #define AD9250_REG_OUT_MODE (AD9250_R1B | 0x14 | SHADOW(6)) |
| 85 | #define AD9250_REG_CML (AD9250_R1B | 0x15) |
| 86 | #define AD9250_REG_VREF (AD9250_R1B | 0x18 | SHADOW(7)) |
| 87 | #define AD9250_REG_USER_TEST1 (AD9250_R2B | 0x1A) |
| 88 | #define AD9250_REG_USER_TEST2 (AD9250_R2B | 0x1C) |
| 89 | #define AD9250_REG_USER_TEST3 (AD9250_R2B | 0x1E) |
| 90 | #define AD9250_REG_USER_TEST4 (AD9250_R2B | 0x20) |
| 91 | #define AD9250_REG_PLL_ENCODE (AD9250_R1B | 0x21) |
| 92 | #define AD9250_REG_BIST_MISR (AD9250_R2B | 0x25) |
| 93 | #define AD9250_REG_SYS_CTRL (AD9250_R1B | 0x3A | SHADOW(8)) |
| 94 | #define AD9250_REG_DCC_CTRL (AD9250_R1B | 0x40 | SHADOW(9)) |
| 95 | #define AD9250_REG_DCC_VAL (AD9250_R2B | 0x42 | SHADOW(10)) |
| 96 | #define AD9250_REG_FAST_DETECT (AD9250_R1B | 0x45 | SHADOW(11)) |
| 97 | #define AD9250_REG_FD_UPPER_THD (AD9250_R2B | 0x48 | SHADOW(12)) |
| 98 | #define AD9250_REG_FD_LOWER_THD (AD9250_R2B | 0x4A | SHADOW(13)) |
| 99 | #define AD9250_REG_FD_DWELL_TIME (AD9250_R2B | 0x4C | SHADOW(14)) |
| 100 | #define AD9250_REG_204B_QUICK_CFG (AD9250_R1B | 0x5E) |
| 101 | #define AD9250_REG_204B_CTRL1 (AD9250_R1B | 0x5F) |
| 102 | #define AD9250_REG_204B_CTRL2 (AD9250_R1B | 0x60) |
| 103 | #define AD9250_REG_204B_CTRL3 (AD9250_R1B | 0x61) |
| 104 | #define AD9250_REG_204B_DID_CFG (AD9250_R1B | 0x64) |
| 105 | #define AD9250_REG_204B_BID_CFG (AD9250_R1B | 0x65) |
| 106 | #define AD9250_REG_204B_LID_CFG1 (AD9250_R1B | 0x67) |
| 107 | #define AD9250_REG_204B_LID_CFG2 (AD9250_R1B | 0x68) |
| 108 | #define AD9250_REG_204B_PARAM_SCR_L (AD9250_R1B | 0x6E) |
| 109 | #define AD9250_REG_204B_PARAM_F (AD9250_R1B | 0x6F) |
| 110 | #define AD9250_REG_204B_PARAM_K (AD9250_R1B | 0x70) |
| 111 | #define AD9250_REG_204B_PARAM_M (AD9250_R1B | 0x71) |
| 112 | #define AD9250_REG_204B_PARAM_CS_N (AD9250_R1B | 0x72) |
| 113 | #define AD9250_REG_204B_PARAM_NP (AD9250_R1B | 0x73) |
| 114 | #define AD9250_REG_204B_PARAM_S (AD9250_R1B | 0x74) |
| 115 | #define AD9250_REG_204B_PARAM_HD_CF (AD9250_R1B | 0x75) |
| 116 | #define AD9250_REG_204B_RESV1 (AD9250_R1B | 0x76) |
| 117 | #define AD9250_REG_204B_RESV2 (AD9250_R1B | 0x77) |
| 118 | #define AD9250_REG_204B_CHKSUM0 (AD9250_R1B | 0x79) |
| 119 | #define AD9250_REG_204B_CHKSUM1 (AD9250_R1B | 0x7A) |
| 120 | #define AD9250_REG_204B_LANE_ASSGN1 (AD9250_R1B | 0x82) |
| 121 | #define AD9250_REG_204B_LANE_ASSGN2 (AD9250_R1B | 0x83) |
| 122 | #define AD9250_REG_204B_LMFC_OFFSET (AD9250_R1B | 0x8B) |
| 123 | #define AD9250_REG_204B_PRE_EMPHASIS (AD9250_R1B | 0xA8) |
| 124 | |
| 125 | /* AD9250_REG_SPI_CFG */ |
| 126 | #define AD9250_SPI_CFG_LSB_FIRST ((1 << 6) | (1 << 1)) |
| 127 | #define AD9250_SPI_CFG_SOFT_RST ((1 << 5) | (1 << 2)) |
| 128 | |
| 129 | /* AD9250_REG_CH_INDEX */ |
| 130 | #define AD9250_CH_INDEX_ADC_A (1 << 0) |
| 131 | #define AD9250_CH_INDEX_ADC_B (1 << 1) |
| 132 | |
| 133 | /* AD9250_REG_DEVICE_UPDATE */ |
| 134 | #define AD9250_DEVICE_UPDATE_SW (1 << 0) |
| 135 | |
| 136 | /* AD9250_REG_PDWN */ |
| 137 | #define AD9250_PDWN_EXTERN (1 << 5) |
| 138 | #define AD9250_PDWN_JTX (1 << 4) |
| 139 | #define AD9250_PDWN_JESD204B(x) (((x) & 0x3) << 2) |
| 140 | #define AD9250_PDWN_CHIP(x) (((x) & 0x3) << 0) |
| 141 | |
| 142 | /* AD9250_REG_CLOCK */ |
| 143 | #define AD9250_CLOCK_SELECTION(x) (((x) & 0x3) << 4) |
| 144 | #define AD9250_CLOCK_DUTY_CYCLE (1 << 0) |
| 145 | |
| 146 | /* AD9250_REG_PLL_STAT */ |
| 147 | #define AD9250_PLL_STAT_LOCKED (1 << 7) |
| 148 | #define AD9250_PLL_STAT_204B_LINK_RDY (1 << 0) |
| 149 | |
| 150 | /* AD9250_REG_CLOCK_DIV */ |
| 151 | #define AD9250_CLOCK_DIV_PHASE(x) (((x) & 0x7) << 3) |
| 152 | #define AD9250_CLOCK_DIV_RATIO(x) (((x) & 0x7) << 0) |
| 153 | |
| 154 | /* AD9250_REG_TEST */ |
| 155 | #define AD9250_TEST_USER_TEST_MODE(x) (((x) & 0x3) << 6) |
| 156 | #define AD9250_TEST_RST_PN_LONG (1 << 5) |
| 157 | #define AD9250_TEST_RST_PN_SHOR (1 << 4) |
| 158 | #define AD9250_TEST_OUTPUT_TEST(x) (((x) & 0xF) << 0) |
| 159 | |
| 160 | /* AD9250_REG_BIST */ |
| 161 | #define AD9250_BIST_RESET (1 << 2) |
| 162 | #define AD9250_BIST_ENABLE (1 << 0) |
| 163 | |
| 164 | /* AD9250_REG_OFFSET */ |
| 165 | #define AD9250_REG_OFFSET_ADJUST(x) (((x) & 0x3F) << 0) |
| 166 | |
| 167 | /* AD9250_REG_OUT_MODE */ |
| 168 | #define AD9250_OUT_MODE_JTX_BIT_ASSIGN(x) (((x) & 0x7) << 5) |
| 169 | #define AD9250_OUT_MODE_DISABLE (1 << 4) |
| 170 | #define AD9250_OUT_MODE_INVERT_DATA (1 << 3) |
| 171 | #define AD9250_OUT_MODE_DATA_FORMAT(x) (((x) & 0x1) << 0) |
| 172 | |
| 173 | /* AD9250_REG_CML */ |
| 174 | #define AD9250_CML_DIFF_OUT_LEVEL(x) (((x) & 0x7) << 0) |
| 175 | |
| 176 | /* AD9250_REG_VREF */ |
| 177 | #define AD9250_VREF_FS_ADJUST(x) (((x) & 0x1F) << 0) |
| 178 | |
| 179 | /* AD9250_REG_PLL_ENCODE */ |
| 180 | #define AD9250_PLL_ENCODE(x) (((x) & 0x3) << 3) |
| 181 | |
| 182 | /* AD9250_REG_SYS_CTRL */ |
| 183 | #define AD9250_SYS_CTRL_REALIGN_ON_SYNCINB (1 << 4) |
| 184 | #define AD9250_SYS_CTRL_REALIGN_ON_SYSREF (1 << 3) |
| 185 | #define AD9250_SYS_CTRL_SYSREF_MODE (1 << 2) |
| 186 | #define AD9250_SYS_CTRL_SYSREF_EN (1 << 1) |
| 187 | #define AD9250_SYS_CTRL_SYNCINB_EN (1 << 0) |
| 188 | |
| 189 | /* AD9250_REG_DCC_CTRL */ |
| 190 | #define AD9250_DCC_CTRL_FREEZE_DCC (1 << 6) |
| 191 | #define AD9250_DCC_CTRL_DCC_BW(x) (((x) & 0xF) << 2) |
| 192 | #define AD9250_DCC_CTRL_DCC_EN (1 << 1) |
| 193 | |
| 194 | /* AD9250_REG_FAST_DETECT */ |
| 195 | #define AD9250_FAST_DETECT_PIN_FCT (1 << 4) |
| 196 | #define AD9250_FAST_DETECT_FORCE_FDA_FDB_PIN (1 << 3) |
| 197 | #define AD9250_FAST_DETECT_FORCE_FDA_FDB_VAL (1 << 2) |
| 198 | #define AD9250_FAST_DETECT_OUTPUT_ENABLE (1 << 0) |
| 199 | |
| 200 | /* AD9250_REG_204B_QUICK_CFG */ |
| 201 | #define AD9250_204B_QUICK_CFG(x) (((x) & 0xFF) << 0) |
| 202 | |
| 203 | /* AD9250_REG_204B_CTRL1 */ |
| 204 | #define AD9250_204B_CTRL1_TAIL_BITS (1 << 6) |
| 205 | #define AD9250_204B_CTRL1_TEST_SAMPLE_EN (1 << 5) |
| 206 | #define AD9250_204B_CTRL1_ILAS_MODE(x) (((x) & 0x3) << 2) |
| 207 | #define AD9250_204B_CTRL1_POWER_DOWN (1 << 0) |
| 208 | |
| 209 | /* AD9250_REG_204B_CTRL2 */ |
| 210 | #define AD9250_204B_CTRL2_INVERT_JESD_BITS (1 << 1) |
| 211 | |
| 212 | /* AD9250_REG_204B_CTRL3 */ |
| 213 | #define AD9250_204B_CTRL3_TEST_DATA_INJ_PT(x) (((x) & 0x3) << 4) |
| 214 | #define AD9250_204B_CTRL3_JESD_TEST_MODE(x) (((x) & 0xF) << 0) |
| 215 | |
| 216 | /* AD9250_REG_204B_PARAM_SCR_L */ |
| 217 | #define AD9250_204B_PARAM_SCR_L_SCRAMBLING (1 << 7) |
| 218 | #define AD9250_204B_PARAM_SCR_L_LANES (1 << 0) |
| 219 | |
| 220 | /* AD9250_REG_204B_PARAM_CS_N */ |
| 221 | #define AD9250_204B_PARAM_CS_N_NR_CTRL_BITS(x) (((x) & 0x3) << 6) |
| 222 | #define AD9250_204B_PARAM_CS_N_ADC_RESOLUTION(x) (((x) & 0xF) << 0) |
| 223 | |
| 224 | /* AD9250_REG_204B_PARAM_NP */ |
| 225 | #define AD9250_204B_PARAM_NP_JESD_SUBCLASS(x) (((x) & 0x3) << 5) |
| 226 | #define AD9250_204B_PARAM_NP_JESD_N_VAL(x) (((x) & 0xF) << 0) |
| 227 | |
| 228 | /* AD9250_REG_204B_PARAM_S */ |
| 229 | #define AD9250_204B_PARAM_S(x) (((x) << 0x1F) << 0) |
| 230 | |
| 231 | /* AD9250_REG_204B_PARAM_HD_CF */ |
| 232 | #define AD9250_204B_PARAM_HD_CF_HD_VAL (1 << 7) |
| 233 | #define AD9250_204B_PARAM_HD_CF_CF_VAL(x) (((x) & 0x1F) << 0) |
| 234 | |
| 235 | /* AD9250_REG_204B_LANE_ASSGN1 */ |
| 236 | #define AD9250_204B_LANE_ASSGN1(x) (((x) & 0x3) << 4) |
| 237 | |
| 238 | /* AD9250_REG_204B_LANE_ASSGN2 */ |
| 239 | #define AD9250_204B_LANE_ASSGN2(x) (((x) &0x3) << 0) |
| 240 | |
| 241 | /* AD9250_REG_204B_LMFC_OFFSET */ |
| 242 | #define AD9250_204B_LMFC_OFFSET(x) (((x) & 0x1F) << 0) |
| 243 | |
| 244 | /*****************************************************************************/ |
| 245 | /************************** Types Declarations *******************************/ |
| 246 | /*****************************************************************************/ |
| 247 | |
| 248 | /** |
| 249 | * struct ad9250_platform_data - Platform specific information. |
| 250 | * |
| 251 | * @extrnPDWNmode: External PDWN mode. |
| 252 | * 0 = PDWN is full power down |
| 253 | * 1 = PDWN puts device in standby |
| 254 | * @enClkDCS: Clock duty cycle stabilizer enable. |
| 255 | * 0 = disable |
| 256 | * 1 = enable |
| 257 | * @clkSelection: Clock selection. |
| 258 | * 0 = Nyquist clock |
| 259 | * 2 = RF clock divide by 4 |
| 260 | * 3 = clock off |
| 261 | * @clkDivRatio: Clock divider ratio relative to the encode clock. |
| 262 | * 0x00 = divide by 1 |
| 263 | * 0x01 = divide by 2 |
| 264 | * ... |
| 265 | * 0x07 = divide by 8 |
| 266 | * @clkDivPhase: Clock divide phase relative to the encode clock. |
| 267 | * 0x0 = 0 input clock cycles delayed |
| 268 | * 0x1 = 1 input clock cycles delayed |
| 269 | * ... |
| 270 | * 0x7 = 7 input clock cycles delayed |
| 271 | * @adcVref: Main reference full-scale VREF adjustment. |
| 272 | * 0x0f = internal 2.087 V p-p |
| 273 | * ... |
| 274 | * 0x01 = internal 1.772 V p-p |
| 275 | * 0x00 = internal 1.75 V p-p [default] |
| 276 | * 0x1F = internal 1.727 V p-p |
| 277 | * ... |
| 278 | * 0x10 = internal 1.383 V p-p |
| 279 | * @pllLowEncode: PLL low encode. |
| 280 | * 0 = for lane speeds > 2 Gbps |
| 281 | * 1 = for lane speeds < 2 Gbps |
| 282 | * @name: Device name. |
| 283 | */ |
| 284 | struct ad9250_platform_data |
| 285 | { |
| 286 | /* Power configuration */ |
| 287 | int8_t extrnPDWNmode; |
| 288 | /* Global clock */ |
| 289 | int8_t enClkDCS; |
| 290 | int8_t clkSelection; |
| 291 | int8_t clkDivRatio; |
| 292 | int8_t clkDivPhase; |
| 293 | /* ADC Vref */ |
| 294 | int8_t adcVref; |
| 295 | /* PLL */ |
| 296 | int8_t pllLowEncode; |
| 297 | /* Device name */ |
| 298 | int8_t name[16]; |
| 299 | }; |
| 300 | |
| 301 | /** |
| 302 | * struct ad9250_jesd204b_cfg - JESD204B interface configuration. |
| 303 | * |
| 304 | * @jtxInStandBy: JTX in standby. |
| 305 | * 0 = 204B core is unaffected in standby |
| 306 | * 1 = 204B core is powered down except for PLL during standby |
| 307 | * @cmlLevel: JESD204B CML differential output drive level adjustment. |
| 308 | * 0 = 81% of nominal (that is, 238 mV) |
| 309 | * 1 = 89% of nominal (that is, 262 mV) |
| 310 | * 2 = 98% of nominal (that is, 286 mV) |
| 311 | * 3 = nominal [default] (that is, 293 mV) |
| 312 | * 6 = 126% of nominal (that is, 368 mV) |
| 313 | * @quickCfgOption: Quick configuration register. |
| 314 | * 0x11 = M = 1, L = 1; one converter, one lane |
| 315 | * 0x12 = M = 1, L = 2; one converter, two lanes |
| 316 | * 0x21 = M = 2, L = 1; two converters, one lane |
| 317 | * 0x22 = M = 2, L = 2; two converters, two lanes |
| 318 | * @subclass: JESD204B subclass. |
| 319 | * 0 = Subclass 0 |
| 320 | * 1 = Subclass 1 |
| 321 | * @ctrlBitsNo: Number of control bits (CS). |
| 322 | * 0 = no control bits(CS = 0) |
| 323 | * 1 = 1 control bit (CS = 1) |
| 324 | * 2 = 2 control bits (CS = 2) |
| 325 | * @ctrlBitsAssign: JTX CS bits assignment. |
| 326 | * 0 = {overrange||underrange, valid} |
| 327 | * 1 = {overrange||underrange} |
| 328 | * 2 = {overrange||underrange, blank} |
| 329 | * 3 = {blank, valid} |
| 330 | * 4 = {blank, blank} |
| 331 | * All others = {overrange||underrange, valid} |
| 332 | * @tailBitsMode: Tail bits: If CS bits are not enabled. |
| 333 | * 0 = extra bits are 0 |
| 334 | * 1 = extra bits are 9-bit PN |
| 335 | * @did: JESD204B device identification value: DID[7:0] |
| 336 | * @bid: JESD204B bank identification value : BID[3:0] |
| 337 | * @lid0: JESD204B lane0 identification value: LID[4:0] |
| 338 | * @lid1: JESD204B lane1 identification value: LID[4:0] |
| 339 | * @k: JESD204B number of frames per multiframe (K); set value of K per JESD204B |
| 340 | * specifications, but also must be a multiple of 4 octets. |
| 341 | * @scrambling: JESD204B scrambling (SCR). |
| 342 | * 0 = disabled |
| 343 | * 1 = enabled |
| 344 | * @ilasMode: Initial lane alignment sequence (ILAS) mode. |
| 345 | * 1 = ILAS normal mode enabled |
| 346 | * 3 = ILAS always on, test mode |
| 347 | * @enIlasTest: JESD204B test sample. |
| 348 | * 0 = disabled |
| 349 | * 1 = enabled |
| 350 | * @invertLogicBits: Invert logic of JESD204B bits. |
| 351 | * 0 = non-invert |
| 352 | * 1 = invert |
| 353 | * @enSysRef: SYSREF+- enable. |
| 354 | * 0 = disabled |
| 355 | * 1 = enabled |
| 356 | * @enSyncInB: Enable SYNCINB+- buffer. |
| 357 | * 0 = buffer disabled |
| 358 | * 1 = buffer enabled |
| 359 | * @sysRefMode: SYSREF+- mode. |
| 360 | * 0 = continuous reset clock dividers |
| 361 | * 1 = sync on next SYSREF+- rising edge only |
| 362 | * @alignSyncInB: Options for interpreting single on SYNCINB+-. |
| 363 | * 0 = normal mode |
| 364 | * 1 = realign lanes on every active SYNCINB+- |
| 365 | * @alignSysRef: Options for interpreting single on SYSREF+-. |
| 366 | * 0 = normal mode; |
| 367 | * 1 = realign lanes on every active SYSREF+- |
| 368 | * @lane0Assign: Option to remap converter and lane assignments. |
| 369 | * 0 = assign Logical Lane 0 to Physical Lane A [default] |
| 370 | * 1 = assign Logical Lane 0 to Physical Lane B |
| 371 | * @lane1Assign: Option to remap converter and lane assignments. |
| 372 | * 0 = assign Logical Lane 1 to Physical Lane A |
| 373 | * 1 = assign Logical Lane 1 to Physical Lane B [default] |
| 374 | */ |
| 375 | struct ad9250_jesd204b_cfg |
| 376 | { |
| 377 | /* Power configuration */ |
| 378 | int8_t jtxInStandBy; |
| 379 | /* Output drive adjustment */ |
| 380 | int8_t cmlLevel; |
| 381 | /* Quick configuration */ |
| 382 | int8_t quickCfgOption; |
| 383 | /* Detailed Options */ |
| 384 | int8_t subclass; |
| 385 | int8_t ctrlBitsNo; |
| 386 | int8_t ctrlBitsAssign; |
| 387 | int8_t tailBitsMode; |
| 388 | int8_t did; |
| 389 | int8_t bid; |
| 390 | int8_t lid0; |
| 391 | int8_t lid1; |
| 392 | int8_t k; |
| 393 | int8_t scrambling; |
| 394 | int8_t ilasMode; |
| 395 | int8_t enIlasTest; |
| 396 | int8_t invertLogicBits; |
| 397 | int8_t enSysRef; |
| 398 | int8_t enSyncInB; |
| 399 | int8_t sysRefMode; |
| 400 | int8_t alignSyncInB; |
| 401 | int8_t alignSysRef; |
| 402 | int8_t lane0Assign; |
| 403 | int8_t lane1Assign; |
| 404 | }; |
| 405 | |
| 406 | /** |
| 407 | * struct ad9250_fast_detect_cfg - Fast Detect module configuration. |
| 408 | * |
| 409 | * @enFd: Enable fast detect output. |
| 410 | * 0 = disable |
| 411 | * 1 = enable |
| 412 | * @pinFunction: Pin function. |
| 413 | * 0 = fast detect |
| 414 | * 1 = overrange |
| 415 | * @forcePins: Force FDA/FDB pins |
| 416 | * 0 = normal function |
| 417 | * 1 = force to value |
| 418 | * @pinForceValue: Force value of FDA/FDB pins. |
| 419 | * 0 = output on FD pins will be 0 |
| 420 | * 1 = output on FD pins will be 1 |
| 421 | * @fdUpperTresh: Fast Detect Upper Threshold[14:0]. |
| 422 | * @fdLowerTresh: Fast Detect Lower Threshold[14:0]. |
| 423 | * @dfDwellTime: Fast Detect Dwell Time[15:0]. |
| 424 | */ |
| 425 | struct ad9250_fast_detect_cfg |
| 426 | { |
| 427 | int8_t enFd; |
| 428 | int8_t pinFunction; |
| 429 | int8_t forcePins; |
| 430 | int8_t pinForceValue; |
| 431 | int16_t fdUpperTresh; |
| 432 | int16_t fdLowerTresh; |
| 433 | int16_t dfDwellTime; |
| 434 | }; |
| 435 | |
| 436 | /******************************************************************************/ |
| 437 | /************************ Functions Declarations ******************************/ |
| 438 | /******************************************************************************/ |
| 439 | |
| 440 | /*! Configures the device. */ |
| 441 | int32_t ad9250_setup(int32_t spiBaseAddr, int32_t ssNo); |
| 442 | /*! Reads the value of the selected register. */ |
| 443 | int32_t ad9250_read(int32_t registerAddress); |
| 444 | /*! Writes a value to the selected register. */ |
| 445 | int32_t ad9250_write(int32_t registerAddress, int32_t registerValue); |
| 446 | /*! Initiates a transfer and waits for the operation to end. */ |
| 447 | int32_t ad9250_transfer(void); |
| 448 | /*! Resets all registers to their default values. */ |
| 449 | int32_t ad9250_soft_reset(void); |
| 450 | /*! Configures the power mode of the chip. */ |
| 451 | int32_t ad9250_chip_pwr_mode(int32_t mode); |
| 452 | /*! Selects a channel as the current channel for further configurations. */ |
| 453 | int32_t ad9250_select_channel_for_config(int32_t channel); |
| 454 | /*! Sets the ADC's test mode. */ |
| 455 | int32_t ad9250_test_mode(int32_t mode); |
| 456 | /*! Sets the offset adjustment. */ |
| 457 | int32_t ad9250_offset_adj(int32_t adj); |
| 458 | /*! Disables (1) or enables (0) the data output. */ |
| 459 | int32_t ad9250_output_disable(int32_t en); |
| 460 | /*! Activates the inverted (1) or normal (0) output mode. */ |
| 461 | int32_t ad9250_output_invert(int32_t invert); |
| 462 | /*! Specifies the output format. */ |
| 463 | int32_t ad9250_output_format(int32_t format); |
| 464 | /*! Sets (1) or clears (0) the reset short PN sequence bit(PN9). */ |
| 465 | int32_t ad9250_reset_PN29(int32_t rst); |
| 466 | /*! Sets (1) or clears (0) the reset long PN sequence bit(PN23). */ |
| 467 | int32_t ad9250_reset_PN23(int32_t rst); |
| 468 | /*! Configures a User Test Pattern. */ |
| 469 | int32_t ad9250_set_user_pattern(int32_t patternNo, int32_t user_pattern); |
| 470 | /*! Enables the Build-In-Self-Test. */ |
| 471 | int32_t ad9250_bist_enable(int32_t enable); |
| 472 | /*! Resets the Build-In-Self-Test. */ |
| 473 | int32_t ad9250_bist_reset(int32_t reset); |
| 474 | /*! Configures the JESD204B interface. */ |
| 475 | int32_t ad9250_jesd204b_setup(void); |
| 476 | /*! Configures the power mode of the JESD204B data transmit block. */ |
| 477 | int32_t ad9250_jesd204b_pwr_mode(int32_t mode); |
| 478 | /*! Selects the point in the processing path of a lane, where the test data will |
| 479 | be inserted. */ |
| 480 | int32_t ad9250_jesd204b_select_test_injection_point(int32_t injPoint); |
| 481 | /*! Selects a JESD204B test mode. */ |
| 482 | int32_t ad9250_jesd204b_test_mode(int32_t testMode); |
| 483 | /*! Inverts the logic of JESD204B bits. */ |
| 484 | int32_t ad9250_jesd204b_invert_logic(int32_t invert); |
| 485 | /*! Configures the Fast-Detect module. */ |
| 486 | int32_t ad9250_fast_detect_setup(void); |
| 487 | /*! Enables DC correction for use in the output data signal path. */ |
| 488 | int32_t ad9250_dcc_enable(int32_t enable); |
| 489 | /*! Selects the bandwidth value for the DC correction circuit. */ |
| 490 | int32_t ad9250_dcc_bandwidth(int32_t bw); |
| 491 | /*! Freezes DC correction value. */ |
| 492 | int32_t ad9250_dcc_freeze(int32_t freeze); |
| 493 | |
| 494 | #endif /* __AD9250_H__ */ |