18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
58c2ecf20Sopenharmony_ci * Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
68c2ecf20Sopenharmony_ci * Copyright (c) a lot of people too. Please respect their work.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * See MAINTAINERS file for support contact information.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/device.h>
128c2ecf20Sopenharmony_ci#include <linux/firmware.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct rtl8169_private;
158c2ecf20Sopenharmony_citypedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
168c2ecf20Sopenharmony_citypedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define RTL_VER_SIZE		32
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct rtl_fw {
218c2ecf20Sopenharmony_ci	rtl_fw_write_t phy_write;
228c2ecf20Sopenharmony_ci	rtl_fw_read_t phy_read;
238c2ecf20Sopenharmony_ci	rtl_fw_write_t mac_mcu_write;
248c2ecf20Sopenharmony_ci	rtl_fw_read_t mac_mcu_read;
258c2ecf20Sopenharmony_ci	const struct firmware *fw;
268c2ecf20Sopenharmony_ci	const char *fw_name;
278c2ecf20Sopenharmony_ci	struct device *dev;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	char version[RTL_VER_SIZE];
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	struct rtl_fw_phy_action {
328c2ecf20Sopenharmony_ci		__le32 *code;
338c2ecf20Sopenharmony_ci		size_t size;
348c2ecf20Sopenharmony_ci	} phy_action;
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciint rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
388c2ecf20Sopenharmony_civoid rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
398c2ecf20Sopenharmony_civoid rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);
40