xref: /linux/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h (revision 150b567e0d572342ef08bace7ee7aff80fd75327)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Microchip lan969x Switch driver
3  *
4  * Copyright (c) 2024 Microchip Technology Inc. and its subsidiaries.
5  */
6 
7 #ifndef __LAN969X_H__
8 #define __LAN969X_H__
9 
10 #include "../sparx5/sparx5_main.h"
11 #include "../sparx5/sparx5_regs.h"
12 #include "../sparx5/sparx5_vcap_impl.h"
13 
14 /* lan969x.c */
15 extern const struct sparx5_match_data lan969x_desc;
16 
17 /* lan969x_vcap_ag_api.c */
18 extern const struct vcap_statistics lan969x_vcap_stats;
19 extern const struct vcap_info lan969x_vcaps[];
20 
21 /* lan969x_vcap_impl.c */
22 extern const struct sparx5_vcap_inst lan969x_vcap_inst_cfg[];
23 
24 /* lan969x_regs.c */
25 extern const unsigned int lan969x_tsize[TSIZE_LAST];
26 extern const unsigned int lan969x_raddr[RADDR_LAST];
27 extern const unsigned int lan969x_rcnt[RCNT_LAST];
28 extern const unsigned int lan969x_gaddr[GADDR_LAST];
29 extern const unsigned int lan969x_gcnt[GCNT_LAST];
30 extern const unsigned int lan969x_gsize[GSIZE_LAST];
31 extern const unsigned int lan969x_fpos[FPOS_LAST];
32 extern const unsigned int lan969x_fsize[FSIZE_LAST];
33 
lan969x_port_is_2g5(int portno)34 static inline bool lan969x_port_is_2g5(int portno)
35 {
36 	return portno == 1  || portno == 2  || portno == 3  ||
37 	       portno == 5  || portno == 6  || portno == 7  ||
38 	       portno == 10 || portno == 11 || portno == 14 ||
39 	       portno == 15 || portno == 18 || portno == 19 ||
40 	       portno == 22 || portno == 23;
41 }
42 
lan969x_port_is_5g(int portno)43 static inline bool lan969x_port_is_5g(int portno)
44 {
45 	return portno == 9 || portno == 13 || portno == 17 ||
46 	       portno == 21;
47 }
48 
lan969x_port_is_10g(int portno)49 static inline bool lan969x_port_is_10g(int portno)
50 {
51 	return portno == 0  || portno == 4  || portno == 8  ||
52 	       portno == 12 || portno == 16 || portno == 20 ||
53 	       portno == 24 || portno == 25 || portno == 26 ||
54 	       portno == 27;
55 }
56 
lan969x_port_is_25g(int portno)57 static inline bool lan969x_port_is_25g(int portno)
58 {
59 	return false;
60 }
61 
62 /* lan969x_calendar.c */
63 int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
64 			      struct sparx5_calendar_data *data);
65 #endif
66