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 <andreamrl@tiscali.it>, 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 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
22 * Contact Information:
23 * wlanfae <wlanfae@realtek.com>
24 *****************************************************************************/
28 static void rtl8192_parse_pci_configuration(struct pci_dev
*pdev
,
29 struct net_device
*dev
)
31 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
37 pos
= pci_find_capability(priv
->pdev
, PCI_CAP_ID_EXP
);
38 pci_read_config_byte(priv
->pdev
, pos
+ PCI_EXP_LNKCTL
, &LinkCtrlReg
);
39 priv
->NdisAdapter
.LinkCtrlReg
= LinkCtrlReg
;
41 RT_TRACE(COMP_INIT
, "Link Control Register =%x\n",
42 priv
->NdisAdapter
.LinkCtrlReg
);
44 pci_read_config_byte(pdev
, 0x98, &tmp
);
46 pci_write_config_byte(pdev
, 0x98, tmp
);
49 pci_write_config_byte(pdev
, 0x70f, tmp
);
52 bool rtl8192_pci_findadapter(struct pci_dev
*pdev
, struct net_device
*dev
)
54 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
60 VenderID
= pdev
->vendor
;
61 DeviceID
= pdev
->device
;
62 RevisionID
= pdev
->revision
;
63 pci_read_config_word(pdev
, 0x3C, &IrqLine
);
65 priv
->card_8192
= priv
->ops
->nic_type
;
67 if (DeviceID
== 0x8172) {
69 case HAL_HW_PCI_REVISION_ID_8192PCIE
:
70 printk(KERN_INFO
"Adapter(8192 PCI-E) is found - "
71 "DeviceID=%x\n", DeviceID
);
72 priv
->card_8192
= NIC_8192E
;
74 case HAL_HW_PCI_REVISION_ID_8192SE
:
75 printk(KERN_INFO
"Adapter(8192SE) is found - "
76 "DeviceID=%x\n", DeviceID
);
77 priv
->card_8192
= NIC_8192SE
;
80 printk(KERN_INFO
"UNKNOWN nic type(%4x:%4x)\n",
81 pdev
->vendor
, pdev
->device
);
82 priv
->card_8192
= NIC_UNKNOWN
;
87 if (priv
->ops
->nic_type
!= priv
->card_8192
) {
88 printk(KERN_INFO
"Detect info(%x) and hardware info(%x) not match!\n",
89 priv
->ops
->nic_type
, priv
->card_8192
);
90 printk(KERN_INFO
"Please select proper driver before install!!!!\n");
94 rtl8192_parse_pci_configuration(pdev
, dev
);