1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * Based on the r8180 driver, which is:
5 * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * The full GNU General Public License is included in this distribution in the
16 * file called LICENSE.
18 * Contact Information:
19 * wlanfae <wlanfae@realtek.com>
20 *****************************************************************************/
24 static void _rtl92e_parse_pci_configuration(struct pci_dev *pdev,
25 struct net_device *dev)
27 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
32 pcie_capability_read_word(priv->pdev, PCI_EXP_LNKCTL, &LinkCtrlReg);
34 RT_TRACE(COMP_INIT, "Link Control Register =%x\n", LinkCtrlReg);
36 pci_read_config_byte(pdev, 0x98, &tmp);
38 pci_write_config_byte(pdev, 0x98, tmp);
41 pci_write_config_byte(pdev, 0x70f, tmp);
44 bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
46 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
52 VenderID = pdev->vendor;
53 DeviceID = pdev->device;
54 RevisionID = pdev->revision;
55 pci_read_config_word(pdev, 0x3C, &IrqLine);
57 priv->card_8192 = priv->ops->nic_type;
59 if (DeviceID == 0x8192) {
61 case HAL_HW_PCI_REVISION_ID_8192PCIE:
63 "Adapter(8192 PCI-E) is found - DeviceID=%x\n",
65 priv->card_8192 = NIC_8192E;
67 case HAL_HW_PCI_REVISION_ID_8192SE:
69 "Adapter(8192SE) is found - DeviceID=%x\n",
71 priv->card_8192 = NIC_8192SE;
75 "UNKNOWN nic type(%4x:%4x)\n",
76 pdev->vendor, pdev->device);
77 priv->card_8192 = NIC_UNKNOWN;
82 if (priv->ops->nic_type != priv->card_8192) {
84 "Detect info(%x) and hardware info(%x) not match!\n",
85 priv->ops->nic_type, priv->card_8192);
87 "Please select proper driver before install!!!!\n");
91 _rtl92e_parse_pci_configuration(pdev, dev);