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, &LinkCtrlReg);
23 RT_TRACE(COMP_INIT, "Link Control Register =%x\n", LinkCtrlReg);
25 pci_read_config_byte(pdev, 0x98, &tmp);
27 pci_write_config_byte(pdev, 0x98, tmp);
30 pci_write_config_byte(pdev, 0x70f, tmp);
33 bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
35 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
40 DeviceID = pdev->device;
41 RevisionID = pdev->revision;
42 pci_read_config_word(pdev, 0x3C, &IrqLine);
44 priv->card_8192 = priv->ops->nic_type;
46 if (DeviceID == 0x8192) {
48 case HAL_HW_PCI_REVISION_ID_8192PCIE:
50 "Adapter(8192 PCI-E) is found - DeviceID=%x\n",
52 priv->card_8192 = NIC_8192E;
54 case HAL_HW_PCI_REVISION_ID_8192SE:
56 "Adapter(8192SE) is found - DeviceID=%x\n",
58 priv->card_8192 = NIC_8192SE;
62 "UNKNOWN nic type(%4x:%4x)\n",
63 pdev->vendor, pdev->device);
64 priv->card_8192 = NIC_UNKNOWN;
69 if (priv->ops->nic_type != priv->card_8192) {
71 "Detect info(%x) and hardware info(%x) not match!\n",
72 priv->ops->nic_type, priv->card_8192);
74 "Please select proper driver before install!!!!\n");
78 _rtl92e_parse_pci_configuration(pdev, dev);