Giga Lite is a Realtek proprietary mode which runs at 500 Mbps over two pairs. Set RTL_PHY_F_GIGA_LITE and MAC_500FD on RTL8168H, RTL8168EP and RTL8168FP, so that the PHY driver exposes it as 500baseT2/Full. The vendor driver enables Giga Lite on RTL8168H and RTL8168FP, but not on RTL8168M, which shares its chip version with RTL8168H in r8169. So exclude RTL8168M by its XID. RTL8168EP is not handled by the vendor driver, but Giga Lite was tested to work on it. Signed-off-by: Hee-Suk Kim <hsk…@dilluti0n.com> --- drivers/net/ethernet/realtek/r8169_main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 1da64c6e39e2..59a6c3a5a645 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -28,6 +28,7 @@ #include <linux/bitfield.h> #include <linux/phylink.h> #include <linux/prefetch.h> +#include <linux/realtek_phy.h> #include <linux/ipv6.h> #include <linux/unaligned.h> #include <linux/u64_stats_sync.h> @@ -884,6 +885,7 @@ struct rtl8169_private { struct mutex led_lock; /* serialize LED ctrl RMW access */ unsigned supports_gmii:1; + unsigned supports_giga_lite:1; unsigned aspm_manageable:1; unsigned dash_enabled:1; dma_addr_t counters_phys_addr; @@ -2290,6 +2292,7 @@ static const struct rtl_coalesce_info rtl_coalesce_info_8169[] = { static const struct rtl_coalesce_info rtl_coalesce_info_8168_8136[] = { { SPEED_1000, COALESCE_DELAY(5000) }, + { SPEED_500, COALESCE_DELAY(5000) }, { SPEED_100, COALESCE_DELAY(2560) }, { SPEED_10, COALESCE_DELAY(40960) }, { 0 }, @@ -2662,6 +2665,20 @@ static const struct rtl_chip_info *rtl8169_get_chip_version(u32 xid, bool gmii) return p; } +static bool rtl_supports_giga_lite(struct rtl8169_private *tp, u32 xid) +{ + switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_46: + /* RTL8168M */ + return (xid & 0x7cf) != 0x6c0; + case RTL_GIGA_MAC_VER_51: + case RTL_GIGA_MAC_VER_52: + return true; + default: + return false; + } +} + static const struct rtl_chip_info *rtl8169_get_extended_chip_version(u32 xid2) { const struct rtl_chip_info *p = rtl_chip_infos_extended; @@ -6291,6 +6308,9 @@ static int r8169_mdio_register(struct rtl8169_private *tp) return -EUNATCH; } + if (tp->supports_giga_lite) + tp->phydev->dev_flags |= RTL_PHY_F_GIGA_LITE; + /* Keep EEE off but the version stays EEE-capable so that link-up * still clears the MAC TX-LPI bits. */ @@ -6664,6 +6684,9 @@ static int rtl_init_phylink(struct rtl8169_private *tp) if (tp->supports_gmii) tp->phylink_config.mac_capabilities |= MAC_1000FD; + if (tp->supports_giga_lite) + tp->phylink_config.mac_capabilities |= MAC_500FD; + if (tp->mac_version < RTL_GIGA_MAC_VER_61) phy_mode = tp->supports_gmii ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII; @@ -6869,6 +6892,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) "unknown chip %sXID %x, contact r8169 maintainers (see MAINTAINERS file)\n", ext_xid_str, xid); tp->mac_version = chip->mac_version; + tp->supports_giga_lite = rtl_supports_giga_lite(tp, xid); tp->fw_name = chip->fw_name; tp->speed = SPEED_UNKNOWN;
-- 2.56.1