1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
5 * Based on the r8180 driver, which is:
6 * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al.
8 * Contact Information: wlanfae <wlanfae@realtek.com>
13 static void _rtl92e_parse_pci_configuration(struct pci_dev *pdev,
14 struct net_device *dev)
16 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
21 pcie_capability_read_word(priv->pdev, PCI_EXP_LNKCTL, &link_ctrl_reg);
23 pci_read_config_byte(pdev, 0x98, &tmp);
25 pci_write_config_byte(pdev, 0x98, tmp);
28 pci_write_config_byte(pdev, 0x70f, tmp);
31 bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
33 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
38 device_id = pdev->device;
39 revision_id = pdev->revision;
40 pci_read_config_word(pdev, 0x3C, &irq_line);
42 priv->card_8192 = NIC_8192E;
44 if (device_id == 0x8192) {
45 switch (revision_id) {
46 case HAL_HW_PCI_REVISION_ID_8192PCIE:
48 "Adapter(8192 PCI-E) is found - DeviceID=%x\n",
50 priv->card_8192 = NIC_8192E;
52 case HAL_HW_PCI_REVISION_ID_8192SE:
54 "Adapter(8192SE) is found - DeviceID=%x\n",
56 priv->card_8192 = NIC_8192SE;
60 "UNKNOWN nic type(%4x:%4x)\n",
61 pdev->vendor, pdev->device);
62 priv->card_8192 = NIC_UNKNOWN;
67 if (priv->card_8192 != NIC_8192E) {
69 "Detect info(%x) and hardware info(%x) not match!\n",
70 NIC_8192E, priv->card_8192);
72 "Please select proper driver before install!!!!\n");
76 _rtl92e_parse_pci_configuration(pdev, dev);