mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
Complete the network device (netdev) registration flow for Mucse Gbe
Ethernet chips, including:
1. Hardware state initialization:
- Send powerup notification to firmware (via echo_fw_status)
- Sync with firmware
- Reset hardware
2. MAC address handling:
- Retrieve permanent MAC from firmware (via mucse_mbx_get_macaddr)
- Fallback to random valid MAC (eth_random_addr) if not valid mac
from Fw
Signed-off-by: Dong Yibo <dong100@mucse.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20251101013849.120565-6-dong100@mucse.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright(c) 2020 - 2025 Mucse Corporation. */
|
|
|
|
#ifndef _RNPGBE_H
|
|
#define _RNPGBE_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/mutex.h>
|
|
|
|
enum rnpgbe_boards {
|
|
board_n500,
|
|
board_n210
|
|
};
|
|
|
|
struct mucse_mbx_info {
|
|
u32 timeout_us;
|
|
u32 delay_us;
|
|
u16 fw_req;
|
|
u16 fw_ack;
|
|
/* lock for only one use mbx */
|
|
struct mutex lock;
|
|
/* fw <--> pf mbx */
|
|
u32 fwpf_shm_base;
|
|
u32 pf2fw_mbx_ctrl;
|
|
u32 fwpf_mbx_mask;
|
|
u32 fwpf_ctrl_base;
|
|
};
|
|
|
|
/* Enum for firmware notification modes,
|
|
* more modes (e.g., portup, link_report) will be added in future
|
|
**/
|
|
enum {
|
|
mucse_fw_powerup,
|
|
};
|
|
|
|
struct mucse_hw {
|
|
void __iomem *hw_addr;
|
|
struct pci_dev *pdev;
|
|
struct mucse_mbx_info mbx;
|
|
int port;
|
|
u8 pfvfnum;
|
|
};
|
|
|
|
struct mucse_stats {
|
|
u64 tx_dropped;
|
|
};
|
|
|
|
struct mucse {
|
|
struct net_device *netdev;
|
|
struct pci_dev *pdev;
|
|
struct mucse_hw hw;
|
|
struct mucse_stats stats;
|
|
};
|
|
|
|
int rnpgbe_get_permanent_mac(struct mucse_hw *hw, u8 *perm_addr);
|
|
int rnpgbe_reset_hw(struct mucse_hw *hw);
|
|
int rnpgbe_send_notify(struct mucse_hw *hw,
|
|
bool enable,
|
|
int mode);
|
|
int rnpgbe_init_hw(struct mucse_hw *hw, int board_type);
|
|
|
|
/* Device IDs */
|
|
#define PCI_VENDOR_ID_MUCSE 0x8848
|
|
#define RNPGBE_DEVICE_ID_N500_QUAD_PORT 0x8308
|
|
#define RNPGBE_DEVICE_ID_N500_DUAL_PORT 0x8318
|
|
#define RNPGBE_DEVICE_ID_N210 0x8208
|
|
#define RNPGBE_DEVICE_ID_N210L 0x820a
|
|
|
|
#define mucse_hw_wr32(hw, reg, val) \
|
|
writel((val), (hw)->hw_addr + (reg))
|
|
#endif /* _RNPGBE_H */
|