aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Fomichev <kernel@fomichev.me>2011-04-10 14:34:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-25 19:29:40 -0400
commitd108b7a4ddef464f239e8b655494ae3c49239230 (patch)
tree4dbd63dbae19f155293609c106000abfe9c9eaba
parent8fcf92d1cf85329d0efc029c65af3f92b2041bf2 (diff)
brcm80211: use native PCI register offsets
Signed-off-by: Stanislav Fomichev <kernel@fomichev.me> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/brcm80211/include/pcicfg.h34
-rw-r--r--drivers/staging/brcm80211/util/nicpci.c6
-rw-r--r--drivers/staging/brcm80211/util/siutils.c5
3 files changed, 8 insertions, 37 deletions
diff --git a/drivers/staging/brcm80211/include/pcicfg.h b/drivers/staging/brcm80211/include/pcicfg.h
index a3569e48ddf0..860121ffa8f5 100644
--- a/drivers/staging/brcm80211/include/pcicfg.h
+++ b/drivers/staging/brcm80211/include/pcicfg.h
@@ -17,6 +17,8 @@
17#ifndef _h_pcicfg_ 17#ifndef _h_pcicfg_
18#define _h_pcicfg_ 18#define _h_pcicfg_
19 19
20#include <linux/pci_regs.h>
21
20/* The actual config space */ 22/* The actual config space */
21 23
22#define PCI_BAR_MAX 6 24#define PCI_BAR_MAX 6
@@ -56,38 +58,6 @@ typedef struct _pci_config_regs {
56#define SZPCR (sizeof (pci_config_regs)) 58#define SZPCR (sizeof (pci_config_regs))
57#define MINSZPCR 64 /* offsetof (dev_dep[0] */ 59#define MINSZPCR 64 /* offsetof (dev_dep[0] */
58 60
59/* A structure for the config registers is nice, but in most
60 * systems the config space is not memory mapped, so we need
61 * field offsetts. :-(
62 */
63#define PCI_CFG_VID 0
64#define PCI_CFG_DID 2
65#define PCI_CFG_CMD 4
66#define PCI_CFG_STAT 6
67#define PCI_CFG_REV 8
68#define PCI_CFG_PROGIF 9
69#define PCI_CFG_SUBCL 0xa
70#define PCI_CFG_BASECL 0xb
71#define PCI_CFG_CLSZ 0xc
72#define PCI_CFG_LATTIM 0xd
73#define PCI_CFG_HDR 0xe
74#define PCI_CFG_BIST 0xf
75#define PCI_CFG_BAR0 0x10
76#define PCI_CFG_BAR1 0x14
77#define PCI_CFG_BAR2 0x18
78#define PCI_CFG_BAR3 0x1c
79#define PCI_CFG_BAR4 0x20
80#define PCI_CFG_BAR5 0x24
81#define PCI_CFG_CIS 0x28
82#define PCI_CFG_SVID 0x2c
83#define PCI_CFG_SSID 0x2e
84#define PCI_CFG_ROMBAR 0x30
85#define PCI_CFG_CAPPTR 0x34
86#define PCI_CFG_INT 0x3c
87#define PCI_CFG_PIN 0x3d
88#define PCI_CFG_MINGNT 0x3e
89#define PCI_CFG_MAXLAT 0x3f
90
91/* Classes and subclasses */ 61/* Classes and subclasses */
92 62
93/* Header types */ 63/* Header types */
diff --git a/drivers/staging/brcm80211/util/nicpci.c b/drivers/staging/brcm80211/util/nicpci.c
index a1fb2f08984d..d603452ffb5f 100644
--- a/drivers/staging/brcm80211/util/nicpci.c
+++ b/drivers/staging/brcm80211/util/nicpci.c
@@ -130,16 +130,16 @@ pcicore_find_pci_capability(void *dev, u8 req_cap_id,
130 u8 byte_val; 130 u8 byte_val;
131 131
132 /* check for Header type 0 */ 132 /* check for Header type 0 */
133 pci_read_config_byte(dev, PCI_CFG_HDR, &byte_val); 133 pci_read_config_byte(dev, PCI_HEADER_TYPE, &byte_val);
134 if ((byte_val & 0x7f) != PCI_HEADER_NORMAL) 134 if ((byte_val & 0x7f) != PCI_HEADER_NORMAL)
135 goto end; 135 goto end;
136 136
137 /* check if the capability pointer field exists */ 137 /* check if the capability pointer field exists */
138 pci_read_config_byte(dev, PCI_CFG_STAT, &byte_val); 138 pci_read_config_byte(dev, PCI_STATUS, &byte_val);
139 if (!(byte_val & PCI_CAPPTR_PRESENT)) 139 if (!(byte_val & PCI_CAPPTR_PRESENT))
140 goto end; 140 goto end;
141 141
142 pci_read_config_byte(dev, PCI_CFG_CAPPTR, &cap_ptr); 142 pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &cap_ptr);
143 /* check if the capability pointer is 0x00 */ 143 /* check if the capability pointer is 0x00 */
144 if (cap_ptr == 0x00) 144 if (cap_ptr == 0x00)
145 goto end; 145 goto end;
diff --git a/drivers/staging/brcm80211/util/siutils.c b/drivers/staging/brcm80211/util/siutils.c
index e88a7bb625f1..29b6fa70f37f 100644
--- a/drivers/staging/brcm80211/util/siutils.c
+++ b/drivers/staging/brcm80211/util/siutils.c
@@ -312,7 +312,8 @@ static __used void si_nvram_process(si_info_t *sii, char *pvars)
312 switch (sii->pub.bustype) { 312 switch (sii->pub.bustype) {
313 case PCI_BUS: 313 case PCI_BUS:
314 /* do a pci config read to get subsystem id and subvendor id */ 314 /* do a pci config read to get subsystem id and subvendor id */
315 pci_read_config_dword(sii->pbus, PCI_CFG_SVID, &w); 315 pci_read_config_dword(sii->pbus, PCI_SUBSYSTEM_VENDOR_ID,
316 &w);
316 /* Let nvram variables override subsystem Vend/ID */ 317 /* Let nvram variables override subsystem Vend/ID */
317 sii->pub.boardvendor = (u16)si_getdevpathintvar(&sii->pub, 318 sii->pub.boardvendor = (u16)si_getdevpathintvar(&sii->pub,
318 "boardvendor"); 319 "boardvendor");
@@ -1864,7 +1865,7 @@ bool si_deviceremoved(si_t *sih)
1864 switch (sih->bustype) { 1865 switch (sih->bustype) {
1865 case PCI_BUS: 1866 case PCI_BUS:
1866 ASSERT(sii->pbus != NULL); 1867 ASSERT(sii->pbus != NULL);
1867 pci_read_config_dword(sii->pbus, PCI_CFG_VID, &w); 1868 pci_read_config_dword(sii->pbus, PCI_VENDOR_ID, &w);
1868 if ((w & 0xFFFF) != PCI_VENDOR_ID_BROADCOM) 1869 if ((w & 0xFFFF) != PCI_VENDOR_ID_BROADCOM)
1869 return true; 1870 return true;
1870 break; 1871 break;