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)34static 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)43static 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)49static 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)57static inline bool lan969x_port_is_25g(int portno) 58 { 59 return false; 60 } 61 lan969x_port_is_rgmii(int portno)62static inline bool lan969x_port_is_rgmii(int portno) 63 { 64 return portno == 28 || portno == 29; 65 } 66 67 /* lan969x_calendar.c */ 68 int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi, 69 struct sparx5_calendar_data *data); 70 71 /* lan969x_rgmii.c */ 72 int lan969x_port_config_rgmii(struct sparx5_port *port, 73 struct sparx5_port_config *conf); 74 75 /* lan969x_fdma.c */ 76 int lan969x_fdma_init(struct sparx5 *sparx5); 77 int lan969x_fdma_deinit(struct sparx5 *sparx5); 78 int lan969x_fdma_napi_poll(struct napi_struct *napi, int weight); 79 int lan969x_fdma_xmit(struct sparx5 *sparx5, u32 *ifh, struct sk_buff *skb, 80 struct net_device *dev); 81 82 #endif 83