usb: gadget: m66592-udc: add pullup function
[zen-stable.git] / drivers / staging / brcm80211 / include / bcmdefs.h
blob55631f367436a4614096cc7ce4a57662a7935f2d
1 /*
2 * Copyright (c) 2010 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef _bcmdefs_h_
18 #define _bcmdefs_h_
20 #define SI_BUS 0
21 #define PCI_BUS 1
22 #define PCMCIA_BUS 2
23 #define SDIO_BUS 3
24 #define JTAG_BUS 4
25 #define USB_BUS 5
26 #define SPI_BUS 6
29 #ifndef OFF
30 #define OFF 0
31 #endif
33 #ifndef ON
34 #define ON 1 /* ON = 1 */
35 #endif
37 #define AUTO (-1) /* Auto = -1 */
39 /* Bus types */
40 #define SI_BUS 0 /* SOC Interconnect */
41 #define PCI_BUS 1 /* PCI target */
42 #define SDIO_BUS 3 /* SDIO target */
43 #define JTAG_BUS 4 /* JTAG */
44 #define USB_BUS 5 /* USB (does not support R/W REG) */
45 #define SPI_BUS 6 /* gSPI target */
46 #define RPC_BUS 7 /* RPC target */
49 /* Defines for DMA Address Width - Shared between OSL and HNDDMA */
50 #define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */
51 #define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */
52 #define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */
54 #define DMADDRWIDTH_30 30 /* 30-bit addressing capability */
55 #define DMADDRWIDTH_32 32 /* 32-bit addressing capability */
56 #define DMADDRWIDTH_63 63 /* 64-bit addressing capability */
57 #define DMADDRWIDTH_64 64 /* 64-bit addressing capability */
59 #ifdef BCMDMA64OSL
60 typedef struct {
61 u32 loaddr;
62 u32 hiaddr;
63 } dma64addr_t;
65 typedef dma64addr_t dmaaddr_t;
66 #define PHYSADDRHI(_pa) ((_pa).hiaddr)
67 #define PHYSADDRHISET(_pa, _val) \
68 do { \
69 (_pa).hiaddr = (_val); \
70 } while (0)
71 #define PHYSADDRLO(_pa) ((_pa).loaddr)
72 #define PHYSADDRLOSET(_pa, _val) \
73 do { \
74 (_pa).loaddr = (_val); \
75 } while (0)
77 #else
78 typedef unsigned long dmaaddr_t;
79 #define PHYSADDRHI(_pa) (0)
80 #define PHYSADDRHISET(_pa, _val)
81 #define PHYSADDRLO(_pa) ((_pa))
82 #define PHYSADDRLOSET(_pa, _val) \
83 do { \
84 (_pa) = (_val); \
85 } while (0)
86 #endif /* BCMDMA64OSL */
88 /* One physical DMA segment */
89 typedef struct {
90 dmaaddr_t addr;
91 u32 length;
92 } hnddma_seg_t;
94 #define MAX_DMA_SEGS 4
96 typedef struct {
97 void *oshdmah; /* Opaque handle for OSL to store its information */
98 uint origsize; /* Size of the virtual packet */
99 uint nsegs;
100 hnddma_seg_t segs[MAX_DMA_SEGS];
101 } hnddma_seg_map_t;
103 /* packet headroom necessary to accommodate the largest header in the system, (i.e TXOFF).
104 * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL.
105 * There is a compile time check in wlc.c which ensure that this value is at least as big
106 * as TXOFF. This value is used in dma_rxfill (hnddma.c).
109 #define BCMEXTRAHDROOM 172
111 /* Macros for doing definition and get/set of bitfields
112 * Usage example, e.g. a three-bit field (bits 4-6):
113 * #define <NAME>_M BITFIELD_MASK(3)
114 * #define <NAME>_S 4
115 * ...
116 * regval = R_REG(osh, &regs->regfoo);
117 * field = GFIELD(regval, <NAME>);
118 * regval = SFIELD(regval, <NAME>, 1);
119 * W_REG(osh, &regs->regfoo, regval);
121 #define BITFIELD_MASK(width) \
122 (((unsigned)1 << (width)) - 1)
123 #define GFIELD(val, field) \
124 (((val) >> field ## _S) & field ## _M)
125 #define SFIELD(val, field, bits) \
126 (((val) & (~(field ## _M << field ## _S))) | \
127 ((unsigned)(bits) << field ## _S))
130 * Priority definitions according 802.1D
132 #define PRIO_8021D_NONE 2
133 #define PRIO_8021D_BK 1
134 #define PRIO_8021D_BE 0
135 #define PRIO_8021D_EE 3
136 #define PRIO_8021D_CL 4
137 #define PRIO_8021D_VI 5
138 #define PRIO_8021D_VO 6
139 #define PRIO_8021D_NC 7
140 #define MAXPRIO 7
141 #define NUMPRIO (MAXPRIO + 1)
143 /* Max. nvram variable table size */
144 #define MAXSZ_NVRAM_VARS 4096
146 /* handle forward declaration */
147 struct wl_info;
148 struct wlc_bsscfg;
150 #endif /* _bcmdefs_h_ */