5eabb8e0860e89cb6407061c7d4434621babdd85
[deliverable/linux.git] / drivers / staging / brcm80211 / brcmsmac / wlc_bmac.h
1 /*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
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.
7 *
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.
15 */
16
17 /* XXXXX this interface is under wlc.c by design
18 * http://hwnbu-twiki.broadcom.com/bin/view/Mwgroup/WlBmacDesign
19 *
20 * high driver files(e.g. wlc_ampdu.c etc)
21 * wlc.h/wlc.c
22 * wlc_bmac.h/wlc_bmac.c
23 *
24 * So don't include this in files other than wlc.c, wlc_bmac* wl_rte.c(dongle port) and wl_phy.c
25 * create wrappers in wlc.c if needed
26 */
27
28 /* dup state between BMAC(struct wlc_hw_info) and HIGH(struct wlc_info)
29 driver */
30 typedef struct wlc_bmac_state {
31 u32 machwcap; /* mac hw capibility */
32 u32 preamble_ovr; /* preamble override */
33 } wlc_bmac_state_t;
34
35 enum {
36 IOV_BMAC_DIAG,
37 IOV_BMAC_SBGPIOTIMERVAL,
38 IOV_BMAC_SBGPIOOUT,
39 IOV_BMAC_CCGPIOCTRL, /* CC GPIOCTRL REG */
40 IOV_BMAC_CCGPIOOUT, /* CC GPIOOUT REG */
41 IOV_BMAC_CCGPIOOUTEN, /* CC GPIOOUTEN REG */
42 IOV_BMAC_CCGPIOIN, /* CC GPIOIN REG */
43 IOV_BMAC_WPSGPIO, /* WPS push button GPIO pin */
44 IOV_BMAC_OTPDUMP,
45 IOV_BMAC_OTPSTAT,
46 IOV_BMAC_PCIEASPM, /* obfuscation clkreq/aspm control */
47 IOV_BMAC_PCIEADVCORRMASK, /* advanced correctable error mask */
48 IOV_BMAC_PCIECLKREQ, /* PCIE 1.1 clockreq enab support */
49 IOV_BMAC_PCIELCREG, /* PCIE LCREG */
50 IOV_BMAC_SBGPIOTIMERMASK,
51 IOV_BMAC_RFDISABLEDLY,
52 IOV_BMAC_PCIEREG, /* PCIE REG */
53 IOV_BMAC_PCICFGREG, /* PCI Config register */
54 IOV_BMAC_PCIESERDESREG, /* PCIE SERDES REG (dev, 0}offset) */
55 IOV_BMAC_PCIEGPIOOUT, /* PCIEOUT REG */
56 IOV_BMAC_PCIEGPIOOUTEN, /* PCIEOUTEN REG */
57 IOV_BMAC_PCIECLKREQENCTRL, /* clkreqenctrl REG (PCIE REV > 6.0 */
58 IOV_BMAC_DMALPBK,
59 IOV_BMAC_CCREG,
60 IOV_BMAC_COREREG,
61 IOV_BMAC_SDCIS,
62 IOV_BMAC_SDIO_DRIVE,
63 IOV_BMAC_OTPW,
64 IOV_BMAC_NVOTPW,
65 IOV_BMAC_SROM,
66 IOV_BMAC_SRCRC,
67 IOV_BMAC_CIS_SOURCE,
68 IOV_BMAC_CISVAR,
69 IOV_BMAC_OTPLOCK,
70 IOV_BMAC_OTP_CHIPID,
71 IOV_BMAC_CUSTOMVAR1,
72 IOV_BMAC_BOARDFLAGS,
73 IOV_BMAC_BOARDFLAGS2,
74 IOV_BMAC_WPSLED,
75 IOV_BMAC_NVRAM_SOURCE,
76 IOV_BMAC_OTP_RAW_READ,
77 IOV_BMAC_LAST
78 };
79
80 typedef enum {
81 BMAC_DUMP_GPIO_ID,
82 BMAC_DUMP_SI_ID,
83 BMAC_DUMP_SIREG_ID,
84 BMAC_DUMP_SICLK_ID,
85 BMAC_DUMP_CCREG_ID,
86 BMAC_DUMP_PCIEREG_ID,
87 BMAC_DUMP_PHYREG_ID,
88 BMAC_DUMP_PHYTBL_ID,
89 BMAC_DUMP_PHYTBL2_ID,
90 BMAC_DUMP_PHY_RADIOREG_ID,
91 BMAC_DUMP_LAST
92 } wlc_bmac_dump_id_t;
93
94 extern int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device,
95 uint unit, bool piomode, struct osl_info *osh,
96 void *regsva, uint bustype, void *btparam);
97 extern int wlc_bmac_detach(struct wlc_info *wlc);
98 extern void wlc_bmac_watchdog(void *arg);
99 extern void wlc_bmac_info_init(struct wlc_hw_info *wlc_hw);
100
101 /* up/down, reset, clk */
102 extern void wlc_bmac_xtal(struct wlc_hw_info *wlc_hw, bool want);
103
104 extern void wlc_bmac_copyto_objmem(struct wlc_hw_info *wlc_hw,
105 uint offset, const void *buf, int len,
106 u32 sel);
107 extern void wlc_bmac_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset,
108 void *buf, int len, u32 sel);
109 #define wlc_bmac_copyfrom_shm(wlc_hw, offset, buf, len) \
110 wlc_bmac_copyfrom_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
111 #define wlc_bmac_copyto_shm(wlc_hw, offset, buf, len) \
112 wlc_bmac_copyto_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
113
114 extern void wlc_bmac_core_phy_clk(struct wlc_hw_info *wlc_hw, bool clk);
115 extern void wlc_bmac_core_phypll_reset(struct wlc_hw_info *wlc_hw);
116 extern void wlc_bmac_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on);
117 extern void wlc_bmac_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk);
118 extern void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk);
119 extern void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw);
120 extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags);
121 extern void wlc_bmac_reset(struct wlc_hw_info *wlc_hw);
122 extern void wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec,
123 bool mute);
124 extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw);
125 extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw);
126 extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw);
127 extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw);
128 extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags);
129 extern void wlc_bmac_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode);
130
131 /* chanspec, ucode interface */
132 extern int wlc_bmac_bandtype(struct wlc_hw_info *wlc_hw);
133 extern void wlc_bmac_set_chanspec(struct wlc_hw_info *wlc_hw,
134 chanspec_t chanspec,
135 bool mute, struct txpwr_limits *txpwr);
136
137 extern void wlc_bmac_txfifo(struct wlc_hw_info *wlc_hw, uint fifo, void *p,
138 bool commit, u16 frameid, u8 txpktpend);
139 extern int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo,
140 uint *blocks);
141 extern void wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask,
142 u16 val, int bands);
143 extern void wlc_bmac_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val);
144 extern u16 wlc_bmac_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands);
145 extern void wlc_bmac_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant);
146 extern u16 wlc_bmac_get_txant(struct wlc_hw_info *wlc_hw);
147 extern void wlc_bmac_antsel_type_set(struct wlc_hw_info *wlc_hw,
148 u8 antsel_type);
149 extern int wlc_bmac_state_get(struct wlc_hw_info *wlc_hw,
150 wlc_bmac_state_t *state);
151 extern void wlc_bmac_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v);
152 extern u16 wlc_bmac_read_shm(struct wlc_hw_info *wlc_hw, uint offset);
153 extern void wlc_bmac_set_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v,
154 int len);
155 extern void wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset,
156 int len, void *buf);
157 extern void wlc_bmac_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf,
158 uint *len);
159
160 extern void wlc_bmac_process_ps_switch(struct wlc_hw_info *wlc,
161 struct ether_addr *ea, s8 ps_on);
162 extern void wlc_bmac_hw_etheraddr(struct wlc_hw_info *wlc_hw,
163 u8 *ea);
164 extern bool wlc_bmac_validate_chip_access(struct wlc_hw_info *wlc_hw);
165
166 extern bool wlc_bmac_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw);
167 extern void wlc_bmac_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot);
168 extern void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool want, mbool flags);
169 extern void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode);
170
171 extern void wlc_bmac_wait_for_wake(struct wlc_hw_info *wlc_hw);
172 extern bool wlc_bmac_tx_fifo_suspended(struct wlc_hw_info *wlc_hw,
173 uint tx_fifo);
174 extern void wlc_bmac_tx_fifo_suspend(struct wlc_hw_info *wlc_hw, uint tx_fifo);
175 extern void wlc_bmac_tx_fifo_resume(struct wlc_hw_info *wlc_hw, uint tx_fifo);
176
177 extern void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw,
178 u32 override_bit);
179 extern void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw,
180 u32 override_bit);
181
182 extern void wlc_bmac_set_rcmta(struct wlc_hw_info *wlc_hw, int idx,
183 const u8 *addr);
184 extern void wlc_bmac_set_addrmatch(struct wlc_hw_info *wlc_hw,
185 int match_reg_offset,
186 const u8 *addr);
187 extern void wlc_bmac_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw,
188 void *bcn, int len, bool both);
189
190 extern void wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr,
191 u32 *tsf_h_ptr);
192 extern void wlc_bmac_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin);
193 extern void wlc_bmac_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax);
194 extern void wlc_bmac_set_noreset(struct wlc_hw_info *wlc, bool noreset_flag);
195
196 extern void wlc_bmac_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL,
197 u16 LRL);
198
199 extern void wlc_bmac_fifoerrors(struct wlc_hw_info *wlc_hw);
200
201
202 /* API for BMAC driver (e.g. wlc_phy.c etc) */
203
204 extern void wlc_bmac_bw_set(struct wlc_hw_info *wlc_hw, u16 bw);
205 extern void wlc_bmac_pllreq(struct wlc_hw_info *wlc_hw, bool set,
206 mbool req_bit);
207 extern bool wlc_bmac_taclear(struct wlc_hw_info *wlc_hw, bool ta_ok);
208 extern void wlc_bmac_hw_up(struct wlc_hw_info *wlc_hw);
209
210 extern void wlc_bmac_dump(struct wlc_hw_info *wlc_hw, struct bcmstrbuf *b,
211 wlc_bmac_dump_id_t dump_id);
212
213 extern u16 wlc_bmac_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate);
214
215 extern void wlc_bmac_assert_type_set(struct wlc_hw_info *wlc_hw, u32 type);
216 extern void wlc_bmac_blink_sync(struct wlc_hw_info *wlc_hw, u32 led_pins);
217
218 extern void wlc_bmac_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail);
This page took 0.049331 seconds and 4 git commands to generate.