xref: /linux/drivers/net/ethernet/realtek/r8169.h (revision 3fd6c59042dbba50391e30862beac979491145fe)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* r8169.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/netdevice.h>
12 #include <linux/types.h>
13 #include <linux/phy.h>
14 
15 enum mac_version {
16 	/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
17 	RTL_GIGA_MAC_VER_02,
18 	RTL_GIGA_MAC_VER_03,
19 	RTL_GIGA_MAC_VER_04,
20 	RTL_GIGA_MAC_VER_05,
21 	RTL_GIGA_MAC_VER_06,
22 	RTL_GIGA_MAC_VER_07,
23 	RTL_GIGA_MAC_VER_08,
24 	RTL_GIGA_MAC_VER_09,
25 	RTL_GIGA_MAC_VER_10,
26 	RTL_GIGA_MAC_VER_11,
27 	/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
28 	/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
29 	RTL_GIGA_MAC_VER_14,
30 	/* RTL_GIGA_MAC_VER_16 was merged with VER_10 */
31 	RTL_GIGA_MAC_VER_17,
32 	RTL_GIGA_MAC_VER_18,
33 	RTL_GIGA_MAC_VER_19,
34 	RTL_GIGA_MAC_VER_20,
35 	RTL_GIGA_MAC_VER_21,
36 	RTL_GIGA_MAC_VER_22,
37 	RTL_GIGA_MAC_VER_23,
38 	RTL_GIGA_MAC_VER_24,
39 	RTL_GIGA_MAC_VER_25,
40 	RTL_GIGA_MAC_VER_26,
41 	/* support for RTL_GIGA_MAC_VER_27 has been removed */
42 	RTL_GIGA_MAC_VER_28,
43 	RTL_GIGA_MAC_VER_29,
44 	RTL_GIGA_MAC_VER_30,
45 	RTL_GIGA_MAC_VER_31,
46 	RTL_GIGA_MAC_VER_32,
47 	RTL_GIGA_MAC_VER_33,
48 	RTL_GIGA_MAC_VER_34,
49 	RTL_GIGA_MAC_VER_35,
50 	RTL_GIGA_MAC_VER_36,
51 	RTL_GIGA_MAC_VER_37,
52 	RTL_GIGA_MAC_VER_38,
53 	RTL_GIGA_MAC_VER_39,
54 	RTL_GIGA_MAC_VER_40,
55 	/* support for RTL_GIGA_MAC_VER_41 has been removed */
56 	RTL_GIGA_MAC_VER_42,
57 	RTL_GIGA_MAC_VER_43,
58 	RTL_GIGA_MAC_VER_44,
59 	/* support for RTL_GIGA_MAC_VER_45 has been removed */
60 	RTL_GIGA_MAC_VER_46,
61 	/* support for RTL_GIGA_MAC_VER_47 has been removed */
62 	RTL_GIGA_MAC_VER_48,
63 	/* support for RTL_GIGA_MAC_VER_49 has been removed */
64 	/* support for RTL_GIGA_MAC_VER_50 has been removed */
65 	RTL_GIGA_MAC_VER_51,
66 	RTL_GIGA_MAC_VER_52,
67 	RTL_GIGA_MAC_VER_53,
68 	/* support for RTL_GIGA_MAC_VER_60 has been removed */
69 	RTL_GIGA_MAC_VER_61,
70 	RTL_GIGA_MAC_VER_63,
71 	RTL_GIGA_MAC_VER_64,
72 	RTL_GIGA_MAC_VER_65,
73 	RTL_GIGA_MAC_VER_66,
74 	RTL_GIGA_MAC_NONE
75 };
76 
77 struct rtl8169_private;
78 struct r8169_led_classdev;
79 
80 void r8169_apply_firmware(struct rtl8169_private *tp);
81 u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
82 u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
83 void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
84 			 enum mac_version ver);
85 
86 void r8169_get_led_name(struct rtl8169_private *tp, int idx,
87 			char *buf, int buf_len);
88 int rtl8168_get_led_mode(struct rtl8169_private *tp);
89 int rtl8168_led_mod_ctrl(struct rtl8169_private *tp, u16 mask, u16 val);
90 struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev);
91 int rtl8125_get_led_mode(struct rtl8169_private *tp, int index);
92 int rtl8125_set_led_mode(struct rtl8169_private *tp, int index, u16 mode);
93 struct r8169_led_classdev *rtl8125_init_leds(struct net_device *ndev);
94 void r8169_remove_leds(struct r8169_led_classdev *leds);
95