xref: /dpdk/drivers/net/ntnic/include/ntnic_nim.h (revision 4783bd39273b74e4bd9f2e24099c80f7b2b5a0ea)
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 _NTNIC_NIM_H_
7eaf1ebdcSSerhii Iliushyk #define _NTNIC_NIM_H_
8eaf1ebdcSSerhii Iliushyk 
9eaf1ebdcSSerhii Iliushyk #include <stdint.h>
10eaf1ebdcSSerhii Iliushyk 
11eaf1ebdcSSerhii Iliushyk typedef enum i2c_type {
12eaf1ebdcSSerhii Iliushyk 	I2C_HWIIC,
13eaf1ebdcSSerhii Iliushyk } i2c_type_e;
14eaf1ebdcSSerhii Iliushyk 
15eaf1ebdcSSerhii Iliushyk enum nt_port_type_e {
16eaf1ebdcSSerhii Iliushyk 	NT_PORT_TYPE_NOT_AVAILABLE = 0,	/* The NIM/port type is not available (unknown) */
17eaf1ebdcSSerhii Iliushyk 	NT_PORT_TYPE_NOT_RECOGNISED,	/* The NIM/port type not recognized */
1827c15342SSerhii Iliushyk 	NT_PORT_TYPE_QSFP_PLUS_NOT_PRESENT,	/* QSFP type but slot is empty */
1927c15342SSerhii Iliushyk 	NT_PORT_TYPE_QSFP_PLUS,	/* QSFP type */
20*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_NOT_PRESENT,/* QSFP28 type but slot is empty */
21*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28,	/* QSFP28 type */
22*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_SR4,/* QSFP28-SR4 type */
23*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_LR4,/* QSFP28-LR4 type */
24*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_CR_CA_L,	/* QSFP28-CR-CA-L type */
25*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_CR_CA_S,	/* QSFP28-CR-CA-S type */
26*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_CR_CA_N,	/* QSFP28-CR-CA-N type */
27*4783bd39SSerhii Iliushyk 	/* QSFP28-FR type. Uses PAM4 modulation on one lane only */
28*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_FR,
29*4783bd39SSerhii Iliushyk 	/* QSFP28-DR type. Uses PAM4 modulation on one lane only */
30*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_DR,
31*4783bd39SSerhii Iliushyk 	/* QSFP28-LR type. Uses PAM4 modulation on one lane only */
32*4783bd39SSerhii Iliushyk 	NT_PORT_TYPE_QSFP28_LR,
33eaf1ebdcSSerhii Iliushyk };
34eaf1ebdcSSerhii Iliushyk 
35eaf1ebdcSSerhii Iliushyk typedef enum nt_port_type_e nt_port_type_t, *nt_port_type_p;
36eaf1ebdcSSerhii Iliushyk 
37eaf1ebdcSSerhii Iliushyk typedef struct nim_i2c_ctx {
38eaf1ebdcSSerhii Iliushyk 	union {
39eaf1ebdcSSerhii Iliushyk 		nthw_iic_t hwiic;	/* depends on *Fpga_t, instance number, and cycle time */
40eaf1ebdcSSerhii Iliushyk 		struct {
41eaf1ebdcSSerhii Iliushyk 			nthw_i2cm_t *p_nt_i2cm;
42eaf1ebdcSSerhii Iliushyk 			int mux_channel;
43eaf1ebdcSSerhii Iliushyk 		} hwagx;
44eaf1ebdcSSerhii Iliushyk 	};
45eaf1ebdcSSerhii Iliushyk 	i2c_type_e type;/* 0 = hwiic (xilinx) - 1 =  hwagx (agilex) */
46eaf1ebdcSSerhii Iliushyk 	uint8_t instance;
47eaf1ebdcSSerhii Iliushyk 	uint8_t devaddr;
48eaf1ebdcSSerhii Iliushyk 	uint8_t regaddr;
49eaf1ebdcSSerhii Iliushyk 	uint8_t nim_id;
50eaf1ebdcSSerhii Iliushyk 	nt_port_type_t port_type;
51eaf1ebdcSSerhii Iliushyk 
52eaf1ebdcSSerhii Iliushyk 	char vendor_name[17];
53eaf1ebdcSSerhii Iliushyk 	char prod_no[17];
54eaf1ebdcSSerhii Iliushyk 	char serial_no[17];
55eaf1ebdcSSerhii Iliushyk 	char date[9];
56eaf1ebdcSSerhii Iliushyk 	char rev[5];
57eaf1ebdcSSerhii Iliushyk 	bool avg_pwr;
58eaf1ebdcSSerhii Iliushyk 	bool content_valid;
59eaf1ebdcSSerhii Iliushyk 	uint8_t pwr_level_req;
60eaf1ebdcSSerhii Iliushyk 	uint8_t pwr_level_cur;
61eaf1ebdcSSerhii Iliushyk 	uint16_t len_info[5];
62eaf1ebdcSSerhii Iliushyk 	uint32_t speed_mask;	/* Speeds supported by the NIM */
63eaf1ebdcSSerhii Iliushyk 	int8_t lane_idx;
64eaf1ebdcSSerhii Iliushyk 	uint8_t lane_count;
65eaf1ebdcSSerhii Iliushyk 	uint32_t options;
66eaf1ebdcSSerhii Iliushyk 	bool tx_disable;
67eaf1ebdcSSerhii Iliushyk 	bool dmi_supp;
68eaf1ebdcSSerhii Iliushyk 
6927c15342SSerhii Iliushyk 	union {
7027c15342SSerhii Iliushyk 		struct {
7127c15342SSerhii Iliushyk 			bool rx_only;
72*4783bd39SSerhii Iliushyk 			bool qsfp28;
7327c15342SSerhii Iliushyk 			union {
74*4783bd39SSerhii Iliushyk 				struct {
75*4783bd39SSerhii Iliushyk 					uint8_t rev_compliance;
76*4783bd39SSerhii Iliushyk 					bool media_side_fec_ctrl;
77*4783bd39SSerhii Iliushyk 					bool host_side_fec_ctrl;
78*4783bd39SSerhii Iliushyk 					bool media_side_fec_ena;
79*4783bd39SSerhii Iliushyk 					bool host_side_fec_ena;
80*4783bd39SSerhii Iliushyk 				} qsfp28;
8127c15342SSerhii Iliushyk 			} specific_u;
8227c15342SSerhii Iliushyk 		} qsfp;
8327c15342SSerhii Iliushyk 
8427c15342SSerhii Iliushyk 	} specific_u;
85eaf1ebdcSSerhii Iliushyk } nim_i2c_ctx_t, *nim_i2c_ctx_p;
86eaf1ebdcSSerhii Iliushyk 
87eaf1ebdcSSerhii Iliushyk struct nim_sensor_group {
88eaf1ebdcSSerhii Iliushyk 	struct nim_i2c_ctx *ctx;
89eaf1ebdcSSerhii Iliushyk 	struct nim_sensor_group *next;
90eaf1ebdcSSerhii Iliushyk };
91eaf1ebdcSSerhii Iliushyk 
92eaf1ebdcSSerhii Iliushyk #endif	/* _NTNIC_NIM_H_ */
93