• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 ################################################################################
4 #
5 # r8168 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
6 # controllers with PCI-Express interface.
7 #
8 # Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
9 #
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by the Free
12 # Software Foundation; either version 2 of the License, or (at your option)
13 # any later version.
14 #
15 # This program is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18 # more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # this program; if not, see <http://www.gnu.org/licenses/>.
22 #
23 # Author:
24 # Realtek NIC software team <nicfae@realtek.com>
25 # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
26 #
27 ################################################################################
28 */
29 
30 /************************************************************************************
31  *  This product is covered by one or more of the following patents:
32  *  US6,570,884, US6,115,776, and US6,327,625.
33  ***********************************************************************************/
34 
35 #ifndef _LINUX_RTL8168_FIRMWARE_H
36 #define _LINUX_RTL8168_FIRMWARE_H
37 
38 #include <linux/device.h>
39 #include <linux/firmware.h>
40 
41 struct rtl8168_private;
42 typedef void (*rtl8168_fw_write_t)(struct rtl8168_private *tp, u16 reg, u16 val);
43 typedef u32 (*rtl8168_fw_read_t)(struct rtl8168_private *tp, u16 reg);
44 
45 #define RTL8168_VER_SIZE		32
46 
47 struct rtl8168_fw {
48         rtl8168_fw_write_t phy_write;
49         rtl8168_fw_read_t phy_read;
50         rtl8168_fw_write_t mac_mcu_write;
51         rtl8168_fw_read_t mac_mcu_read;
52         const struct firmware *fw;
53         const char *fw_name;
54         struct device *dev;
55 
56         char version[RTL8168_VER_SIZE];
57 
58         struct rtl8168_fw_phy_action {
59                 __le32 *code;
60                 size_t size;
61         } phy_action;
62 };
63 
64 int rtl8168_fw_request_firmware(struct rtl8168_fw *rtl_fw);
65 void rtl8168_fw_release_firmware(struct rtl8168_fw *rtl_fw);
66 void rtl8168_fw_write_firmware(struct rtl8168_private *tp, struct rtl8168_fw *rtl_fw);
67 
68 #endif /* _LINUX_RTL8168_FIRMWARE_H */
69