Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

r8169: add support for extended chip version id and RTL9151AS

The bits in register TxConfig used for chip identification aren't
sufficient for the number of upcoming chip versions. Therefore a register
is added with extended chip version information, for compatibility
purposes it's called TX_CONFIG_V2. First chip to use the extended chip
identification is RTL9151AS.

Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
[hkallweit1@gmail.com: add support for extended XID where XID is printed]
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/a3525b74-a1aa-43f6-8413-56615f6fa795@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Javen Xu and committed by
Jakub Kicinski
5e3c5a2b bd323fab

+39 -9
+2 -1
drivers/net/ethernet/realtek/r8169.h
··· 72 72 RTL_GIGA_MAC_VER_70, 73 73 RTL_GIGA_MAC_VER_80, 74 74 RTL_GIGA_MAC_NONE, 75 - RTL_GIGA_MAC_VER_LAST = RTL_GIGA_MAC_NONE - 1 75 + RTL_GIGA_MAC_VER_LAST = RTL_GIGA_MAC_NONE - 1, 76 + RTL_GIGA_MAC_VER_EXTENDED 76 77 }; 77 78 78 79 struct rtl8169_private;
+37 -8
drivers/net/ethernet/realtek/r8169_main.c
··· 96 96 #define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN) 97 97 98 98 static const struct rtl_chip_info { 99 - u16 mask; 100 - u16 val; 99 + u32 mask; 100 + u32 val; 101 101 enum mac_version mac_version; 102 102 const char *name; 103 103 const char *fw_name; ··· 206 206 { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03, "RTL8110s" }, 207 207 { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02, "RTL8169s" }, 208 208 209 + /* extended chip version*/ 210 + { 0x7cf, 0x7c8, RTL_GIGA_MAC_VER_EXTENDED }, 211 + 209 212 /* Catch-all */ 210 213 { 0x000, 0x000, RTL_GIGA_MAC_NONE } 214 + }; 215 + 216 + static const struct rtl_chip_info rtl_chip_infos_extended[] = { 217 + { 0x7fffffff, 0x00000000, RTL_GIGA_MAC_VER_64, "RTL9151AS", 218 + FIRMWARE_9151A_1}, 219 + 220 + /* Catch-all */ 221 + { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE } 211 222 }; 212 223 213 224 static const struct pci_device_id rtl8169_pci_tbl[] = { ··· 267 256 IntrStatus = 0x3e, 268 257 269 258 TxConfig = 0x40, 259 + /* Extended chip version id */ 260 + TX_CONFIG_V2 = 0x60b0, 270 261 #define TXCFG_AUTO_FIFO (1 << 7) /* 8111e-vl */ 271 262 #define TXCFG_EMPTY (1 << 11) /* 8111e-vl */ 272 263 ··· 2440 2427 .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats, 2441 2428 }; 2442 2429 2443 - static const struct rtl_chip_info *rtl8169_get_chip_version(u16 xid, bool gmii) 2430 + static const struct rtl_chip_info *rtl8169_get_chip_version(u32 xid, bool gmii) 2444 2431 { 2445 2432 /* Chips combining a 1Gbps MAC with a 100Mbps PHY */ 2446 2433 static const struct rtl_chip_info rtl8106eus_info = { ··· 2463 2450 if (p->mac_version == RTL_GIGA_MAC_VER_46 && !gmii) 2464 2451 return &rtl8107e_info; 2465 2452 2453 + return p; 2454 + } 2455 + 2456 + static const struct rtl_chip_info *rtl8169_get_extended_chip_version(u32 xid2) 2457 + { 2458 + const struct rtl_chip_info *p = rtl_chip_infos_extended; 2459 + 2460 + while ((xid2 & p->mask) != p->val) 2461 + p++; 2466 2462 return p; 2467 2463 } 2468 2464 ··· 5596 5574 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 5597 5575 { 5598 5576 const struct rtl_chip_info *chip; 5577 + const char *ext_xid_str = ""; 5599 5578 struct rtl8169_private *tp; 5600 5579 int jumbo_max, region, rc; 5601 5580 struct net_device *dev; 5602 5581 u32 txconfig; 5603 - u16 xid; 5582 + u32 xid; 5604 5583 5605 5584 dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp)); 5606 5585 if (!dev) ··· 5649 5626 5650 5627 /* Identify chip attached to board */ 5651 5628 chip = rtl8169_get_chip_version(xid, tp->supports_gmii); 5629 + 5630 + if (chip->mac_version == RTL_GIGA_MAC_VER_EXTENDED) { 5631 + ext_xid_str = "ext"; 5632 + xid = RTL_R32(tp, TX_CONFIG_V2); 5633 + chip = rtl8169_get_extended_chip_version(xid); 5634 + } 5652 5635 if (chip->mac_version == RTL_GIGA_MAC_NONE) 5653 5636 return dev_err_probe(&pdev->dev, -ENODEV, 5654 - "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n", 5655 - xid); 5637 + "unknown chip %sXID %x, contact r8169 maintainers (see MAINTAINERS file)\n", 5638 + ext_xid_str, xid); 5656 5639 tp->mac_version = chip->mac_version; 5657 5640 tp->fw_name = chip->fw_name; 5658 5641 ··· 5797 5768 tp->leds = rtl8168_init_leds(dev); 5798 5769 } 5799 5770 5800 - netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n", 5801 - chip->name, dev->dev_addr, xid, tp->irq); 5771 + netdev_info(dev, "%s, %pM, %sXID %x, IRQ %d\n", 5772 + chip->name, dev->dev_addr, ext_xid_str, xid, tp->irq); 5802 5773 5803 5774 if (jumbo_max) 5804 5775 netdev_info(dev, "jumbo features [frames: %d bytes, tx checksumming: %s]\n",