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