Skip to content

Commit cdafdc2

Browse files
hkallweitdavem330
authored andcommitted
r8169: sync support for RTL8401 with vendor driver
So far RTL8401 was treated like a RTL8101e, means we relied on the BIOS to configure MAC and PHY properly. Make RTL8401 a separate chip version and copy MAC / PHY config from r8101 vendor driver. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 93c09ca commit cdafdc2

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

drivers/net/ethernet/realtek/r8169.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum mac_version {
2525
RTL_GIGA_MAC_VER_11,
2626
RTL_GIGA_MAC_VER_12,
2727
RTL_GIGA_MAC_VER_13,
28+
RTL_GIGA_MAC_VER_14,
2829
RTL_GIGA_MAC_VER_16,
2930
RTL_GIGA_MAC_VER_17,
3031
RTL_GIGA_MAC_VER_18,

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static const struct {
106106
[RTL_GIGA_MAC_VER_11] = {"RTL8168b/8111b" },
107107
[RTL_GIGA_MAC_VER_12] = {"RTL8168b/8111b" },
108108
[RTL_GIGA_MAC_VER_13] = {"RTL8101e/RTL8100e" },
109+
[RTL_GIGA_MAC_VER_14] = {"RTL8401" },
109110
[RTL_GIGA_MAC_VER_16] = {"RTL8101e" },
110111
[RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b" },
111112
[RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp" },
@@ -1999,8 +2000,7 @@ static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii)
19992000
{ 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 },
20002001
{ 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 },
20012002
{ 0x7cf, 0x340, RTL_GIGA_MAC_VER_13 },
2002-
/* RTL8401, reportedly works if treated as RTL8101e */
2003-
{ 0x7cf, 0x240, RTL_GIGA_MAC_VER_13 },
2003+
{ 0x7cf, 0x240, RTL_GIGA_MAC_VER_14 },
20042004
{ 0x7cf, 0x343, RTL_GIGA_MAC_VER_10 },
20052005
{ 0x7cf, 0x342, RTL_GIGA_MAC_VER_16 },
20062006
{ 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 },
@@ -3401,6 +3401,19 @@ static void rtl_hw_start_8102e_3(struct rtl8169_private *tp)
34013401
rtl_ephy_write(tp, 0x03, 0xc2f9);
34023402
}
34033403

3404+
static void rtl_hw_start_8401(struct rtl8169_private *tp)
3405+
{
3406+
static const struct ephy_info e_info_8401[] = {
3407+
{ 0x01, 0xffff, 0x6fe5 },
3408+
{ 0x03, 0xffff, 0x0599 },
3409+
{ 0x06, 0xffff, 0xaf25 },
3410+
{ 0x07, 0xffff, 0x8e68 },
3411+
};
3412+
3413+
rtl_ephy_init(tp, e_info_8401);
3414+
RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
3415+
}
3416+
34043417
static void rtl_hw_start_8105e_1(struct rtl8169_private *tp)
34053418
{
34063419
static const struct ephy_info e_info_8105e_1[] = {
@@ -3614,6 +3627,7 @@ static void rtl_hw_config(struct rtl8169_private *tp)
36143627
[RTL_GIGA_MAC_VER_11] = rtl_hw_start_8168b,
36153628
[RTL_GIGA_MAC_VER_12] = rtl_hw_start_8168b,
36163629
[RTL_GIGA_MAC_VER_13] = NULL,
3630+
[RTL_GIGA_MAC_VER_14] = rtl_hw_start_8401,
36173631
[RTL_GIGA_MAC_VER_16] = NULL,
36183632
[RTL_GIGA_MAC_VER_17] = rtl_hw_start_8168b,
36193633
[RTL_GIGA_MAC_VER_18] = rtl_hw_start_8168cp_1,

drivers/net/ethernet/realtek/r8169_phy_config.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,13 @@ static void rtl8102e_hw_phy_config(struct rtl8169_private *tp,
10911091
rtl_writephy_batch(phydev, phy_reg_init);
10921092
}
10931093

1094+
static void rtl8401_hw_phy_config(struct rtl8169_private *tp,
1095+
struct phy_device *phydev)
1096+
{
1097+
phy_set_bits(phydev, 0x11, BIT(12));
1098+
phy_modify_paged(phydev, 0x0002, 0x0f, 0x0000, 0x0003);
1099+
}
1100+
10941101
static void rtl8105e_hw_phy_config(struct rtl8169_private *tp,
10951102
struct phy_device *phydev)
10961103
{
@@ -1261,6 +1268,7 @@ void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
12611268
[RTL_GIGA_MAC_VER_11] = rtl8168bb_hw_phy_config,
12621269
[RTL_GIGA_MAC_VER_12] = rtl8168bef_hw_phy_config,
12631270
[RTL_GIGA_MAC_VER_13] = NULL,
1271+
[RTL_GIGA_MAC_VER_14] = rtl8401_hw_phy_config,
12641272
[RTL_GIGA_MAC_VER_16] = NULL,
12651273
[RTL_GIGA_MAC_VER_17] = rtl8168bef_hw_phy_config,
12661274
[RTL_GIGA_MAC_VER_18] = rtl8168cp_1_hw_phy_config,

0 commit comments

Comments
 (0)