Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/drivers/ad9523/ad9523.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file AD9523.h
3 * @brief Header file of AD9523 Driver.
4 * @author DBogdan ([email protected])
5 ********************************************************************************
6 * Copyright 2012-2016(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 #ifndef _AD9523_H_
41 #define _AD9523_H_
42
43 /*****************************************************************************/
44 /***************************** Include Files *********************************/
45 /*****************************************************************************/
46 #include "platform_drivers.h"
47
48 /******************************************************************************/
49 /****************************** AD9523 ****************************************/
50 /******************************************************************************/
51 /* Registers */
52
53 #define AD9523_READ (1 << 15)
54 #define AD9523_WRITE (0 << 15)
55 #define AD9523_CNT(x) (((x) - 1) << 13)
56 #define AD9523_ADDR(x) ((x) & 0xFFF)
57
58 #define AD9523_R1B (1 << 16)
59 #define AD9523_R2B (2 << 16)
60 #define AD9523_R3B (3 << 16)
61 #define AD9523_TRANSF_LEN(x) ((x) >> 16)
62
63 #define AD9523_SERIAL_PORT_CONFIG (AD9523_R1B | 0x0)
64 #define AD9523_VERSION_REGISTER (AD9523_R1B | 0x2)
65 #define AD9523_PART_REGISTER (AD9523_R1B | 0x3)
66 #define AD9523_READBACK_CTRL (AD9523_R1B | 0x4)
67
68 #define AD9523_EEPROM_CUSTOMER_VERSION_ID (AD9523_R2B | 0x6)
69
70 #define AD9523_PLL1_REF_A_DIVIDER (AD9523_R2B | 0x11)
71 #define AD9523_PLL1_REF_B_DIVIDER (AD9523_R2B | 0x13)
72 #define AD9523_PLL1_REF_TEST_DIVIDER (AD9523_R1B | 0x14)
73 #define AD9523_PLL1_FEEDBACK_DIVIDER (AD9523_R2B | 0x17)
74 #define AD9523_PLL1_CHARGE_PUMP_CTRL (AD9523_R2B | 0x19)
75 #define AD9523_PLL1_INPUT_RECEIVERS_CTRL (AD9523_R1B | 0x1A)
76 #define AD9523_PLL1_REF_CTRL (AD9523_R1B | 0x1B)
77 #define AD9523_PLL1_MISC_CTRL (AD9523_R1B | 0x1C)
78 #define AD9523_PLL1_LOOP_FILTER_CTRL (AD9523_R1B | 0x1D)
79
80 #define AD9523_PLL2_CHARGE_PUMP (AD9523_R1B | 0xF0)
81 #define AD9523_PLL2_FEEDBACK_DIVIDER_AB (AD9523_R1B | 0xF1)
82 #define AD9523_PLL2_CTRL (AD9523_R1B | 0xF2)
83 #define AD9523_PLL2_VCO_CTRL (AD9523_R1B | 0xF3)
84 #define AD9523_PLL2_VCO_DIVIDER (AD9523_R1B | 0xF4)
85 #define AD9523_PLL2_LOOP_FILTER_CTRL (AD9523_R2B | 0xF6)
86 #define AD9523_PLL2_R2_DIVIDER (AD9523_R1B | 0xF7)
87
88 #define AD9523_CHANNEL_CLOCK_DIST(ch) (AD9523_R3B | (0x192 + 3 * ch))
89
90 #define AD9523_PLL1_OUTPUT_CTRL (AD9523_R1B | 0x1BA)
91 #define AD9523_PLL1_OUTPUT_CHANNEL_CTRL (AD9523_R1B | 0x1BB)
92
93 #define AD9523_READBACK_0 (AD9523_R1B | 0x22C)
94 #define AD9523_READBACK_1 (AD9523_R1B | 0x22D)
95
96 #define AD9523_STATUS_SIGNALS (AD9523_R3B | 0x232)
97 #define AD9523_POWER_DOWN_CTRL (AD9523_R1B | 0x233)
98 #define AD9523_IO_UPDATE (AD9523_R1B | 0x234)
99
100 #define AD9523_EEPROM_DATA_XFER_STATUS (AD9523_R1B | 0xB00)
101 #define AD9523_EEPROM_ERROR_READBACK (AD9523_R1B | 0xB01)
102 #define AD9523_EEPROM_CTRL1 (AD9523_R1B | 0xB02)
103 #define AD9523_EEPROM_CTRL2 (AD9523_R1B | 0xB03)
104
105 /* AD9523_SERIAL_PORT_CONFIG */
106
107 #define AD9523_SER_CONF_SDO_ACTIVE ((1 << 7) | (1 << 0))
108 #define AD9523_SER_CONF_SOFT_RESET ((1 << 5) | (1 << 2))
109
110 /* AD9523_READBACK_CTRL */
111 #define AD9523_READBACK_CTRL_READ_BUFFERED (1 << 0)
112
113 /* AD9523_PLL1_CHARGE_PUMP_CTRL */
114 #define AD9523_PLL1_CHARGE_PUMP_CURRENT_nA(x) (((x) / 500) & 0x7F)
115 #define AD9523_PLL1_CHARGE_PUMP_TRISTATE (1 << 7)
116 #define AD9523_PLL1_CHARGE_PUMP_MODE_NORMAL (3 << 8)
117 #define AD9523_PLL1_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 8)
118 #define AD9523_PLL1_CHARGE_PUMP_MODE_PUMP_UP (1 << 8)
119 #define AD9523_PLL1_CHARGE_PUMP_MODE_TRISTATE (0 << 8)
120 #define AD9523_PLL1_BACKLASH_PW_MIN (0 << 10)
121 #define AD9523_PLL1_BACKLASH_PW_LOW (1 << 10)
122 #define AD9523_PLL1_BACKLASH_PW_HIGH (2 << 10)
123 #define AD9523_PLL1_BACKLASH_PW_MAX (3 << 10)
124
125 /* AD9523_PLL1_INPUT_RECEIVERS_CTRL */
126 #define AD9523_PLL1_REF_TEST_RCV_EN (1 << 7)
127 #define AD9523_PLL1_REFB_DIFF_RCV_EN (1 << 6)
128 #define AD9523_PLL1_REFA_DIFF_RCV_EN (1 << 5)
129 #define AD9523_PLL1_REFB_RCV_EN (1 << 4)
130 #define AD9523_PLL1_REFA_RCV_EN (1 << 3)
131 #define AD9523_PLL1_REFA_REFB_PWR_CTRL_EN (1 << 2)
132 #define AD9523_PLL1_OSC_IN_CMOS_NEG_INP_EN (1 << 1)
133 #define AD9523_PLL1_OSC_IN_DIFF_EN (1 << 0)
134
135 /* AD9523_PLL1_REF_CTRL */
136 #define AD9523_PLL1_BYPASS_REF_TEST_DIV_EN (1 << 7)
137 #define AD9523_PLL1_BYPASS_FEEDBACK_DIV_EN (1 << 6)
138 #define AD9523_PLL1_ZERO_DELAY_MODE_INT (1 << 5)
139 #define AD9523_PLL1_ZERO_DELAY_MODE_EXT (0 << 5)
140 #define AD9523_PLL1_OSC_IN_PLL_FEEDBACK_EN (1 << 4)
141 #define AD9523_PLL1_ZD_IN_CMOS_NEG_INP_EN (1 << 3)
142 #define AD9523_PLL1_ZD_IN_DIFF_EN (1 << 2)
143 #define AD9523_PLL1_REFB_CMOS_NEG_INP_EN (1 << 1)
144 #define AD9523_PLL1_REFA_CMOS_NEG_INP_EN (1 << 0)
145
146 /* AD9523_PLL1_MISC_CTRL */
147 #define AD9523_PLL1_REFB_INDEP_DIV_CTRL_EN (1 << 7)
148 #define AD9523_PLL1_OSC_CTRL_FAIL_VCC_BY2_EN (1 << 6)
149 #define AD9523_PLL1_REF_MODE(x) ((x) << 2)
150 #define AD9523_PLL1_BYPASS_REFB_DIV (1 << 1)
151 #define AD9523_PLL1_BYPASS_REFA_DIV (1 << 0)
152
153 /* AD9523_PLL1_LOOP_FILTER_CTRL */
154 #define AD9523_PLL1_LOOP_FILTER_RZERO(x) ((x) & 0xF)
155
156 /* AD9523_PLL2_CHARGE_PUMP */
157 #define AD9523_PLL2_CHARGE_PUMP_CURRENT_nA(x) ((x) / 3500)
158
159 /* AD9523_PLL2_FEEDBACK_DIVIDER_AB */
160 #define AD9523_PLL2_FB_NDIV_A_CNT(x) (((x) & 0x3) << 6)
161 #define AD9523_PLL2_FB_NDIV_B_CNT(x) (((x) & 0x3F) << 0)
162 #define AD9523_PLL2_FB_NDIV(a, b) (4 * (b) + (a))
163
164 /* AD9523_PLL2_CTRL */
165 #define AD9523_PLL2_CHARGE_PUMP_MODE_NORMAL (3 << 0)
166 #define AD9523_PLL2_CHARGE_PUMP_MODE_PUMP_DOWN (2 << 0)
167 #define AD9523_PLL2_CHARGE_PUMP_MODE_PUMP_UP (1 << 0)
168 #define AD9523_PLL2_CHARGE_PUMP_MODE_TRISTATE (0 << 0)
169 #define AD9523_PLL2_BACKLASH_PW_MIN (0 << 2)
170 #define AD9523_PLL2_BACKLASH_PW_LOW (1 << 2)
171 #define AD9523_PLL2_BACKLASH_PW_HIGH (2 << 2)
172 #define AD9523_PLL2_BACKLASH_PW_MAX (3 << 1)
173 #define AD9523_PLL2_BACKLASH_CTRL_EN (1 << 4)
174 #define AD9523_PLL2_FREQ_DOUBLER_EN (1 << 5)
175 #define AD9523_PLL2_LOCK_DETECT_PWR_DOWN_EN (1 << 7)
176
177 /* AD9523_PLL2_VCO_CTRL */
178 #define AD9523_PLL2_VCO_CALIBRATE (1 << 1)
179 #define AD9523_PLL2_FORCE_VCO_MIDSCALE (1 << 2)
180 #define AD9523_PLL2_FORCE_REFERENCE_VALID (1 << 3)
181 #define AD9523_PLL2_FORCE_RELEASE_SYNC (1 << 4)
182
183 /* AD9523_PLL2_VCO_DIVIDER */
184 #define AD9523_PLL2_VCO_DIV_M1(x) ((((x) - 3) & 0x3) << 0)
185 #define AD9523_PLL2_VCO_DIV_M2(x) ((((x) - 3) & 0x3) << 4)
186 #define AD9523_PLL2_VCO_DIV_M1_PWR_DOWN_EN (1 << 2)
187 #define AD9523_PLL2_VCO_DIV_M2_PWR_DOWN_EN (1 << 6)
188
189 /* AD9523_PLL2_LOOP_FILTER_CTRL */
190 #define AD9523_PLL2_LOOP_FILTER_CPOLE1(x) (((x) & 0x7) << 0)
191 #define AD9523_PLL2_LOOP_FILTER_RZERO(x) (((x) & 0x7) << 3)
192 #define AD9523_PLL2_LOOP_FILTER_RPOLE2(x) (((x) & 0x7) << 6)
193 #define AD9523_PLL2_LOOP_FILTER_RZERO_BYPASS_EN (1 << 8)
194
195 /* AD9523_PLL2_R2_DIVIDER */
196 #define AD9523_PLL2_R2_DIVIDER_VAL(x) (((x) & 0x1F) << 0)
197
198 /* AD9523_CHANNEL_CLOCK_DIST */
199 #define AD9523_CLK_DIST_DIV_PHASE(x) (((x) & 0x3F) << 18)
200 #define AD9523_CLK_DIST_DIV_PHASE_REV(x) ((ret >> 18) & 0x3F)
201 #define AD9523_CLK_DIST_DIV(x) ((((x) - 1) & 0x3FF) << 8)
202 #define AD9523_CLK_DIST_DIV_REV(x) (((ret >> 8) & 0x3FF) + 1)
203 #define AD9523_CLK_DIST_INV_DIV_OUTPUT_EN (1 << 7)
204 #define AD9523_CLK_DIST_IGNORE_SYNC_EN (1 << 6)
205 #define AD9523_CLK_DIST_PWR_DOWN_EN (1 << 5)
206 #define AD9523_CLK_DIST_LOW_PWR_MODE_EN (1 << 4)
207 #define AD9523_CLK_DIST_DRIVER_MODE(x) (((x) & 0xF) << 0)
208
209 /* AD9523_PLL1_OUTPUT_CTRL */
210 #define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH6_M2 (1 << 7)
211 #define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH5_M2 (1 << 6)
212 #define AD9523_PLL1_OUTP_CTRL_VCO_DIV_SEL_CH4_M2 (1 << 5)
213 #define AD9523_PLL1_OUTP_CTRL_CMOS_DRV_WEAK (1 << 4)
214 #define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_1 (0 << 0)
215 #define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_2 (1 << 0)
216 #define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_4 (2 << 0)
217 #define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_8 (4 << 0)
218 #define AD9523_PLL1_OUTP_CTRL_OUTPUT_DIV_16 (8 << 0)
219
220 /* AD9523_PLL1_OUTPUT_CHANNEL_CTRL */
221 #define AD9523_PLL1_OUTP_CH_CTRL_OUTPUT_PWR_DOWN_EN (1 << 7)
222 #define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH9_M2 (1 << 6)
223 #define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH8_M2 (1 << 5)
224 #define AD9523_PLL1_OUTP_CH_CTRL_VCO_DIV_SEL_CH7_M2 (1 << 4)
225 #define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH3 (1 << 3)
226 #define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH2 (1 << 2)
227 #define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH1 (1 << 1)
228 #define AD9523_PLL1_OUTP_CH_CTRL_VCXO_SRC_SEL_CH0 (1 << 0)
229
230 /* AD9523_READBACK_0 */
231 #define AD9523_READBACK_0_STAT_PLL2_REF_CLK (1 << 7)
232 #define AD9523_READBACK_0_STAT_PLL2_FB_CLK (1 << 6)
233 #define AD9523_READBACK_0_STAT_VCXO (1 << 5)
234 #define AD9523_READBACK_0_STAT_REF_TEST (1 << 4)
235 #define AD9523_READBACK_0_STAT_REFB (1 << 3)
236 #define AD9523_READBACK_0_STAT_REFA (1 << 2)
237 #define AD9523_READBACK_0_STAT_PLL2_LD (1 << 1)
238 #define AD9523_READBACK_0_STAT_PLL1_LD (1 << 0)
239
240 /* AD9523_READBACK_1 */
241 #define AD9523_READBACK_1_HOLDOVER_ACTIVE (1 << 3)
242 #define AD9523_READBACK_1_AUTOMODE_SEL_REFB (1 << 2)
243 #define AD9523_READBACK_1_VCO_CALIB_IN_PROGRESS (1 << 0)
244
245 /* AD9523_STATUS_SIGNALS */
246 #define AD9523_STATUS_SIGNALS_SYNC_MAN_CTRL (1 << 16)
247 #define AD9523_STATUS_MONITOR_01_PLL12_LOCKED (0x302)
248 /* AD9523_POWER_DOWN_CTRL */
249 #define AD9523_POWER_DOWN_CTRL_PLL1_PWR_DOWN (1 << 2)
250 #define AD9523_POWER_DOWN_CTRL_PLL2_PWR_DOWN (1 << 1)
251 #define AD9523_POWER_DOWN_CTRL_DIST_PWR_DOWN (1 << 0)
252
253 /* AD9523_IO_UPDATE */
254 #define AD9523_IO_UPDATE_EN (1 << 0)
255
256 /* AD9523_EEPROM_DATA_XFER_STATUS */
257 #define AD9523_EEPROM_DATA_XFER_IN_PROGRESS (1 << 0)
258
259 /* AD9523_EEPROM_ERROR_READBACK */
260 #define AD9523_EEPROM_ERROR_READBACK_FAIL (1 << 0)
261
262 /* AD9523_EEPROM_CTRL1 */
263 #define AD9523_EEPROM_CTRL1_SOFT_EEPROM (1 << 1)
264 #define AD9523_EEPROM_CTRL1_EEPROM_WRITE_PROT_DIS (1 << 0)
265
266 /* AD9523_EEPROM_CTRL2 */
267 #define AD9523_EEPROM_CTRL2_REG2EEPROM (1 << 0)
268
269 #define AD9523_NUM_CHAN 14
270 #define AD9523_NUM_CHAN_ALT_CLK_SRC 10
271
272 #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
273
274 /******************************************************************************/
275 /************************ Types Definitions ***********************************/
276 /******************************************************************************/
277 enum outp_drv_mode
278 {
279 TRISTATE,
280 LVPECL_8mA,
281 LVDS_4mA,
282 LVDS_7mA,
283 HSTL0_16mA,
284 HSTL1_8mA,
285 CMOS_CONF1,
286 CMOS_CONF2,
287 CMOS_CONF3,
288 CMOS_CONF4,
289 CMOS_CONF5,
290 CMOS_CONF6,
291 CMOS_CONF7,
292 CMOS_CONF8,
293 CMOS_CONF9
294 };
295
296 enum ref_sel_mode
297 {
298 NONEREVERTIVE_STAY_ON_REFB,
299 REVERT_TO_REFA,
300 SELECT_REFA,
301 SELECT_REFB,
302 EXT_REF_SEL
303 };
304
305 /**
306 * struct ad9523_channel_spec - Output channel configuration
307 *
308 * @channel_num: Output channel number.
309 * @divider_output_invert_en: Invert the polarity of the output clock.
310 * @sync_ignore_en: Ignore chip-level SYNC signal.
311 * @low_power_mode_en: Reduce power used in the differential output modes.
312 * @use_alt_clock_src: Channel divider uses alternative clk source.
313 * @output_dis: Disables, powers down the entire channel.
314 * @driver_mode: Output driver mode (logic level family).
315 * @divider_phase: Divider initial phase after a SYNC. Range 0..63
316 LSB = 1/2 of a period of the divider input clock.
317 * @channel_divider: 10-bit channel divider.
318 * @extended_name: Optional descriptive channel name.
319 */
320
321 typedef struct
322 {
323 unsigned channel_num;
324 unsigned char divider_output_invert_en;
325 unsigned char sync_ignore_en;
326 unsigned char low_power_mode_en;
327 unsigned char use_alt_clock_src; /* CH0..CH3 VCXO, CH4..CH9 VCO2 */
328 unsigned char output_dis;
329 unsigned char driver_mode;
330 unsigned char divider_phase;
331 unsigned short channel_divider;
332 char extended_name[16];
333 } ad9523_channel_spec;
334
335 enum pll1_rzero_resistor {
336 RZERO_883_OHM,
337 RZERO_677_OHM,
338 RZERO_341_OHM,
339 RZERO_135_OHM,
340 RZERO_10_OHM,
341 RZERO_USE_EXT_RES = 8,
342 };
343
344 enum rpole2_resistor {
345 RPOLE2_900_OHM,
346 RPOLE2_450_OHM,
347 RPOLE2_300_OHM,
348 RPOLE2_225_OHM,
349 };
350
351 enum rzero_resistor {
352 RZERO_3250_OHM,
353 RZERO_2750_OHM,
354 RZERO_2250_OHM,
355 RZERO_2100_OHM,
356 RZERO_3000_OHM,
357 RZERO_2500_OHM,
358 RZERO_2000_OHM,
359 RZERO_1850_OHM,
360 };
361
362 enum cpole1_capacitor {
363 CPOLE1_0_PF,
364 CPOLE1_8_PF,
365 CPOLE1_16_PF,
366 CPOLE1_24_PF,
367 _CPOLE1_24_PF, /* place holder */
368 CPOLE1_32_PF,
369 CPOLE1_40_PF,
370 CPOLE1_48_PF,
371 };
372
373 /**
374 * struct ad9523_platform_data - platform specific information
375 *
376 * @vcxo_freq: External VCXO frequency in Hz
377 * @refa_diff_rcv_en: REFA differential/single-ended input selection.
378 * @refb_diff_rcv_en: REFB differential/single-ended input selection.
379 * @zd_in_diff_en: Zero Delay differential/single-ended input selection.
380 * @osc_in_diff_en: OSC differential/ single-ended input selection.
381 * @refa_cmos_neg_inp_en: REFA single-ended neg./pos. input enable.
382 * @refb_cmos_neg_inp_en: REFB single-ended neg./pos. input enable.
383 * @zd_in_cmos_neg_inp_en: Zero Delay single-ended neg./pos. input enable.
384 * @osc_in_cmos_neg_inp_en: OSC single-ended neg./pos. input enable.
385 * @refa_r_div: PLL1 10-bit REFA R divider.
386 * @refb_r_div: PLL1 10-bit REFB R divider.
387 * @pll1_feedback_div: PLL1 10-bit Feedback N divider.
388 * @pll1_charge_pump_current_nA: Magnitude of PLL1 charge pump current (nA).
389 * @zero_delay_mode_internal_en: Internal, external Zero Delay mode selection.
390 * @osc_in_feedback_en: PLL1 feedback path, local feedback from
391 * the OSC_IN receiver or zero delay mode
392 * @pll1_loop_filter_rzero: PLL1 Loop Filter Zero Resistor selection.
393 * @ref_mode: Reference selection mode.
394 * @pll2_charge_pump_current_nA: Magnitude of PLL2 charge pump current (nA).
395 * @pll2_ndiv_a_cnt: PLL2 Feedback N-divider, A Counter, range 0..4.
396 * @pll2_ndiv_b_cnt: PLL2 Feedback N-divider, B Counter, range 0..63.
397 * @pll2_freq_doubler_en: PLL2 frequency doubler enable.
398 * @pll2_r2_div: PLL2 R2 divider, range 0..31.
399 * @pll2_vco_diff_m1: VCO1 divider, range 3..5.
400 * @pll2_vco_diff_m2: VCO2 divider, range 3..5.
401 * @rpole2: PLL2 loop filter Rpole resistor value.
402 * @rzero: PLL2 loop filter Rzero resistor value.
403 * @cpole1: PLL2 loop filter Cpole capacitor value.
404 * @rzero_bypass_en: PLL2 loop filter Rzero bypass enable.
405 * @num_channels: Array size of struct ad9523_channel_spec.
406 * @channels: Pointer to channel array.
407 * @name: Optional alternative iio device name.
408 */
409
410 typedef struct
411 {
412 unsigned long vcxo_freq;
413 unsigned char spi3wire;
414
415 /* Differential/ Single-Ended Input Configuration */
416 unsigned char refa_diff_rcv_en;
417 unsigned char refb_diff_rcv_en;
418 unsigned char zd_in_diff_en;
419 unsigned char osc_in_diff_en;
420
421 /*
422 * Valid if differential input disabled
423 * if not true defaults to pos input
424 */
425 unsigned char refa_cmos_neg_inp_en;
426 unsigned char refb_cmos_neg_inp_en;
427 unsigned char zd_in_cmos_neg_inp_en;
428 unsigned char osc_in_cmos_neg_inp_en;
429
430 /* PLL1 Setting */
431 unsigned short refa_r_div;
432 unsigned short refb_r_div;
433 unsigned short pll1_feedback_div;
434 unsigned short pll1_charge_pump_current_nA;
435 unsigned char zero_delay_mode_internal_en;
436 unsigned char osc_in_feedback_en;
437 unsigned char pll1_bypass_en;
438 unsigned char pll1_loop_filter_rzero;
439
440 /* Reference */
441 unsigned char ref_mode;
442
443 /* PLL2 Setting */
444 unsigned int pll2_charge_pump_current_nA;
445 unsigned char pll2_ndiv_a_cnt;
446 unsigned char pll2_ndiv_b_cnt;
447 unsigned char pll2_freq_doubler_en;
448 unsigned char pll2_r2_div;
449 unsigned char pll2_vco_diff_m1; /* 3..5 */
450 unsigned char pll2_vco_diff_m2; /* 3..5 */
451
452 /* Loop Filter PLL2 */
453 unsigned char rpole2;
454 unsigned char rzero;
455 unsigned char cpole1;
456 unsigned char rzero_bypass_en;
457
458 /* Output Channel Configuration */
459 int num_channels;
460 ad9523_channel_spec *channels;
461
462 char name[16];
463 } ad9523_platform_data;
464
465 /******************************************************************************/
466 /************************ Functions Declarations ******************************/
467 /******************************************************************************/
468 /* Reads the value of the selected register. */
469 int32_t ad9523_spi_read(spi_device *dev,
470 uint32_t reg_addr,
471 uint32_t *reg_data);
472 /* Writes a value to the selected register. */
473 int32_t ad9523_spi_write(spi_device *dev,
474 uint32_t reg_addr,
475 uint32_t reg_data);
476 /* Updates the AD9523 configuration */
477 int32_t ad9523_io_update(spi_device *dev);
478 /* Sets the clock provider for selected channel. */
479 int32_t ad9523_vco_out_map(spi_device *dev,
480 uint32_t ch,
481 uint32_t out);
482 /* Updates the AD9523 configuration. */
483 int32_t ad9523_sync(spi_device *dev);
484 /* Initialize the AD9523 data structure*/
485 int32_t ad9523_init(ad9523_platform_data *pdata);
486 /* Configure the AD9523. */
487 int32_t ad9523_setup(spi_device *dev,
488 ad9523_platform_data *pdata);
489 #endif // __AD9523_H__