summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h
blob: fb24fc12b613933d237deb12be9925fb31848ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2020 - 2025 Mucse Corporation. */

#ifndef _RNPGBE_MBX_FW_H
#define _RNPGBE_MBX_FW_H

#include <linux/types.h>

#include "rnpgbe.h"

#define MUCSE_MBX_REQ_HDR_LEN 24

enum MUCSE_FW_CMD {
	GET_HW_INFO     = 0x0601,
	GET_MAC_ADDRESS = 0x0602,
	RESET_HW        = 0x0603,
	POWER_UP        = 0x0803,
};

struct mucse_hw_info {
	u8 link_stat;
	u8 port_mask;
	__le32 speed;
	__le16 phy_type;
	__le16 nic_mode;
	__le16 pfnum;
	__le32 fw_version;
	__le32 axi_mhz;
	union {
		u8 port_id[4];
		__le32 port_ids;
	};
	__le32 bd_uid;
	__le32 phy_id;
	__le32 wol_status;
	__le32 ext_info;
} __packed;

struct mbx_fw_cmd_req {
	__le16 flags;
	__le16 opcode;
	__le16 datalen;
	__le16 ret_value;
	__le32 cookie_lo;
	__le32 cookie_hi;
	__le32 reply_lo;
	__le32 reply_hi;
	union {
		u8 data[32];
		struct {
			__le32 version;
			__le32 status;
		} powerup;
		struct {
			__le32 port_mask;
			__le32 pfvf_num;
		} get_mac_addr;
	};
} __packed;

struct mbx_fw_cmd_reply {
	__le16 flags;
	__le16 opcode;
	__le16 error_code;
	__le16 datalen;
	__le32 cookie_lo;
	__le32 cookie_hi;
	union {
		u8 data[40];
		struct mac_addr {
			__le32 ports;
			struct _addr {
				/* for macaddr:01:02:03:04:05:06
				 * mac-hi=0x01020304 mac-lo=0x05060000
				 */
				u8 mac[8];
			} addrs[4];
		} mac_addr;
		struct mucse_hw_info hw_info;
	};
} __packed;

int mucse_mbx_sync_fw(struct mucse_hw *hw);
int mucse_mbx_powerup(struct mucse_hw *hw, bool is_powerup);
int mucse_mbx_reset_hw(struct mucse_hw *hw);
int mucse_mbx_get_macaddr(struct mucse_hw *hw, int pfvfnum,
			  u8 *mac_addr, int port);
#endif /* _RNPGBE_MBX_FW_H */