162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
562306a36Sopenharmony_ci * Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
662306a36Sopenharmony_ci * Copyright (c) a lot of people too. Please respect their work.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * See MAINTAINERS file for support contact information.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/device.h>
1262306a36Sopenharmony_ci#include <linux/firmware.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct rtl8169_private;
1562306a36Sopenharmony_citypedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
1662306a36Sopenharmony_citypedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define RTL_VER_SIZE		32
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cistruct rtl_fw {
2162306a36Sopenharmony_ci	rtl_fw_write_t phy_write;
2262306a36Sopenharmony_ci	rtl_fw_read_t phy_read;
2362306a36Sopenharmony_ci	rtl_fw_write_t mac_mcu_write;
2462306a36Sopenharmony_ci	rtl_fw_read_t mac_mcu_read;
2562306a36Sopenharmony_ci	const struct firmware *fw;
2662306a36Sopenharmony_ci	const char *fw_name;
2762306a36Sopenharmony_ci	struct device *dev;
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci	char version[RTL_VER_SIZE];
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	struct rtl_fw_phy_action {
3262306a36Sopenharmony_ci		__le32 *code;
3362306a36Sopenharmony_ci		size_t size;
3462306a36Sopenharmony_ci	} phy_action;
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciint rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
3862306a36Sopenharmony_civoid rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
3962306a36Sopenharmony_civoid rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);
40