xref: /dpdk/drivers/net/ntnic/nim/i2c_nim.h (revision 27c15342a260a4a1b243cf9b0cacc9019a08a445)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright(c) 2023 Napatech A/S
4  */
5 
6 #ifndef I2C_NIM_H_
7 #define I2C_NIM_H_
8 
9 #include "ntnic_nim.h"
10 
11 typedef struct sfp_nim_state {
12 	uint8_t br;	/* bit rate, units of 100 MBits/sec */
13 } sfp_nim_state_t, *sfp_nim_state_p;
14 
15 /*
16  * Builds an nim state for the port implied by `ctx`, returns zero
17  * if successful, and non-zero otherwise. SFP and QSFP nims are supported
18  */
19 int nim_state_build(nim_i2c_ctx_t *ctx, sfp_nim_state_t *state);
20 
21 /*
22  * Returns a type name such as "SFP/SFP+" for a given NIM type identifier,
23  * or the string "ILLEGAL!".
24  */
25 const char *nim_id_to_text(uint8_t nim_id);
26 
27 int nim_qsfp_plus_nim_set_tx_laser_disable(nim_i2c_ctx_t *ctx, bool disable, int lane_idx);
28 
29 /*
30  * This function tries to classify NIM based on it's ID and some register reads
31  * and collects information into ctx structure. The @extra parameter could contain
32  * the initialization argument for specific type of NIMS.
33  */
34 int construct_and_preinit_nim(nim_i2c_ctx_p ctx, void *extra);
35 
36 #endif	/* I2C_NIM_H_ */
37