1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2020 - 2025 Mucse Corporation. */ 3 4 #ifndef _RNPGBE_H 5 #define _RNPGBE_H 6 7 #include <linux/types.h> 8 #include <linux/mutex.h> 9 10 enum rnpgbe_boards { 11 board_n500, 12 board_n210 13 }; 14 15 struct mucse_mbx_info { 16 u32 timeout_us; 17 u32 delay_us; 18 u16 fw_req; 19 u16 fw_ack; 20 /* lock for only one use mbx */ 21 struct mutex lock; 22 /* fw <--> pf mbx */ 23 u32 fwpf_shm_base; 24 u32 pf2fw_mbx_ctrl; 25 u32 fwpf_mbx_mask; 26 u32 fwpf_ctrl_base; 27 }; 28 29 /* Enum for firmware notification modes, 30 * more modes (e.g., portup, link_report) will be added in future 31 **/ 32 enum { 33 mucse_fw_powerup, 34 }; 35 36 struct mucse_hw { 37 void __iomem *hw_addr; 38 struct pci_dev *pdev; 39 struct mucse_mbx_info mbx; 40 int port; 41 u8 pfvfnum; 42 }; 43 44 struct mucse_stats { 45 u64 tx_dropped; 46 }; 47 48 struct mucse { 49 struct net_device *netdev; 50 struct pci_dev *pdev; 51 struct mucse_hw hw; 52 struct mucse_stats stats; 53 }; 54 55 int rnpgbe_get_permanent_mac(struct mucse_hw *hw, u8 *perm_addr); 56 int rnpgbe_reset_hw(struct mucse_hw *hw); 57 int rnpgbe_send_notify(struct mucse_hw *hw, 58 bool enable, 59 int mode); 60 int rnpgbe_init_hw(struct mucse_hw *hw, int board_type); 61 62 /* Device IDs */ 63 #define PCI_VENDOR_ID_MUCSE 0x8848 64 #define RNPGBE_DEVICE_ID_N500_QUAD_PORT 0x8308 65 #define RNPGBE_DEVICE_ID_N500_DUAL_PORT 0x8318 66 #define RNPGBE_DEVICE_ID_N210 0x8208 67 #define RNPGBE_DEVICE_ID_N210L 0x820a 68 69 #define mucse_hw_wr32(hw, reg, val) \ 70 writel((val), (hw)->hw_addr + (reg)) 71 #endif /* _RNPGBE_H */ 72