1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
3  *
4  * Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
5  * Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
6  * Copyright (c) a lot of people too. Please respect their work.
7  *
8  * See MAINTAINERS file for support contact information.
9  */
10 
11 #include <linux/device.h>
12 #include <linux/firmware.h>
13 
14 struct rtl8169_private;
15 typedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
16 typedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
17 
18 #define RTL_VER_SIZE		32
19 
20 struct rtl_fw {
21 	rtl_fw_write_t phy_write;
22 	rtl_fw_read_t phy_read;
23 	rtl_fw_write_t mac_mcu_write;
24 	rtl_fw_read_t mac_mcu_read;
25 	const struct firmware *fw;
26 	const char *fw_name;
27 	struct device *dev;
28 
29 	char version[RTL_VER_SIZE];
30 
31 	struct rtl_fw_phy_action {
32 		__le32 *code;
33 		size_t size;
34 	} phy_action;
35 };
36 
37 int rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
38 void rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
39 void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);
40