aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Fomichev <kernel@fomichev.me>2011-04-10 14:34:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-25 19:29:42 -0400
commit6b80b24789a6f81db1a774b6693cee1e5741f0eb (patch)
tree73b9bcb65982240f65b14bd23e222ede66717bd4
parentb68692e795dc0e4f52139c2840a3c2f88a8d2e7f (diff)
brcm80211: update PCI config space define
- replaced sizeof(struct pci_config_regs) with exact size; removed struct - cleaned up the rest of broadcom PCI specific defines 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.h67
-rw-r--r--drivers/staging/brcm80211/util/nicpci.c4
2 files changed, 19 insertions, 52 deletions
diff --git a/drivers/staging/brcm80211/include/pcicfg.h b/drivers/staging/brcm80211/include/pcicfg.h
index eefcc04c34f6..d0c617a63c4f 100644
--- a/drivers/staging/brcm80211/include/pcicfg.h
+++ b/drivers/staging/brcm80211/include/pcicfg.h
@@ -19,65 +19,32 @@
19 19
20#include <linux/pci_regs.h> 20#include <linux/pci_regs.h>
21 21
22/* The actual config space */ 22/* PCI configuration address space size */
23 23#define PCI_SZPCR 256
24#define PCI_BAR_MAX 6
25
26#define PCR_RSVDA_MAX 2
27
28typedef struct _pci_config_regs {
29 u16 vendor;
30 u16 device;
31 u16 command;
32 u16 status;
33 u8 rev_id;
34 u8 prog_if;
35 u8 sub_class;
36 u8 base_class;
37 u8 cache_line_size;
38 u8 latency_timer;
39 u8 header_type;
40 u8 bist;
41 u32 base[PCI_BAR_MAX];
42 u32 cardbus_cis;
43 u16 subsys_vendor;
44 u16 subsys_id;
45 u32 baserom;
46 u32 rsvd_a[PCR_RSVDA_MAX];
47 u8 int_line;
48 u8 int_pin;
49 u8 min_gnt;
50 u8 max_lat;
51 u8 dev_dep[192];
52} pci_config_regs;
53
54#define SZPCR (sizeof (pci_config_regs))
55 24
56/* Everything below is BRCM HND proprietary */ 25/* Everything below is BRCM HND proprietary */
57 26
58/* Brcm PCI configuration registers */ 27/* Brcm PCI configuration registers */
59#define PCI_BAR0_WIN 0x80 /* backplane address space accessed by BAR0 */ 28#define PCI_BAR0_WIN 0x80 /* backplane address space accessed by BAR0 */
60#define PCI_SPROM_CONTROL 0x88 /* sprom property control */ 29#define PCI_SPROM_CONTROL 0x88 /* sprom property control */
61#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */ 30#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */
62#define PCI_BAR0_WIN2 0xac /* backplane address space accessed by second 4KB of BAR0 */ 31#define PCI_SBIM_SHIFT 8 /* backplane core interrupt mask bits offset */
63#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */ 32#define PCI_BAR0_WIN2 0xac /* backplane address space accessed by second 4KB of BAR0 */
64#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */ 33#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */
65#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */ 34#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */
66 35#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */
67#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */ 36
68#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */ 37#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */
69#define PCI_BAR0_PCISBR_OFFSET (4 * 1024) /* pci core SB registers are at the end of the 38#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */
39#define PCI_BAR0_PCISBR_OFFSET (4 * 1024) /* pci core SB registers are at the end of the
70 * 8KB window, so their address is the "regular" 40 * 8KB window, so their address is the "regular"
71 * address plus 4K 41 * address plus 4K
72 */ 42 */
73#define PCI_BAR0_WINSZ (16 * 1024) /* bar0 window size Match with corerev 13 */ 43#define PCI_BAR0_WINSZ (16 * 1024) /* bar0 window size Match with corerev 13 */
74/* On pci corerev >= 13 and all pcie, the bar0 is now 16KB and it maps: */ 44/* On pci corerev >= 13 and all pcie, the bar0 is now 16KB and it maps: */
75#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024) /* bar0 + 8K accesses pci/pcie core registers */ 45#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024) /* bar0 + 8K accesses pci/pcie core registers */
76#define PCI_16KB0_CCREGS_OFFSET (12 * 1024) /* bar0 + 12K accesses chipc core registers */ 46#define PCI_16KB0_CCREGS_OFFSET (12 * 1024) /* bar0 + 12K accesses chipc core registers */
77
78#define PCI_SBIM_STATUS_SERR 0x4 /* backplane SBErr interrupt status */
79 47
80/* PCI_INT_MASK */ 48#define PCI_SBIM_STATUS_SERR 0x4 /* backplane SBErr interrupt status */
81#define PCI_SBIM_SHIFT 8 /* backplane core interrupt mask bits offset */
82 49
83#endif /* _h_pcicfg_ */ 50#endif /* _h_pcicfg_ */
diff --git a/drivers/staging/brcm80211/util/nicpci.c b/drivers/staging/brcm80211/util/nicpci.c
index 9be55ea96b12..6eabbed5cd27 100644
--- a/drivers/staging/brcm80211/util/nicpci.c
+++ b/drivers/staging/brcm80211/util/nicpci.c
@@ -166,8 +166,8 @@ pcicore_find_pci_capability(void *dev, u8 req_cap_id,
166 *buflen = 0; 166 *buflen = 0;
167 /* copy the cpability data excluding cap ID and next ptr */ 167 /* copy the cpability data excluding cap ID and next ptr */
168 cap_data = cap_ptr + 2; 168 cap_data = cap_ptr + 2;
169 if ((bufsize + cap_data) > SZPCR) 169 if ((bufsize + cap_data) > PCI_SZPCR)
170 bufsize = SZPCR - cap_data; 170 bufsize = PCI_SZPCR - cap_data;
171 *buflen = bufsize; 171 *buflen = bufsize;
172 while (bufsize--) { 172 while (bufsize--) {
173 pci_read_config_byte(dev, cap_data, buf); 173 pci_read_config_byte(dev, cap_data, buf);