]>
Commit | Line | Data |
---|---|---|
a9533e7e HP |
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 | */ | |
62b54dca AS |
16 | #ifndef _wlc_bmac_h_ |
17 | #define _wlc_bmac_h_ | |
a9533e7e HP |
18 | |
19 | /* XXXXX this interface is under wlc.c by design | |
20 | * http://hwnbu-twiki.broadcom.com/bin/view/Mwgroup/WlBmacDesign | |
21 | * | |
22 | * high driver files(e.g. wlc_ampdu.c etc) | |
23 | * wlc.h/wlc.c | |
24 | * wlc_bmac.h/wlc_bmac.c | |
25 | * | |
26 | * So don't include this in files other than wlc.c, wlc_bmac* wl_rte.c(dongle port) and wl_phy.c | |
27 | * create wrappers in wlc.c if needed | |
28 | */ | |
29 | ||
e304151f RV |
30 | /* dup state between BMAC(struct wlc_hw_info) and HIGH(struct wlc_info) |
31 | driver */ | |
a9533e7e | 32 | typedef struct wlc_bmac_state { |
66cbd3ab GKH |
33 | u32 machwcap; /* mac hw capibility */ |
34 | u32 preamble_ovr; /* preamble override */ | |
a9533e7e HP |
35 | } wlc_bmac_state_t; |
36 | ||
37 | enum { | |
38 | IOV_BMAC_DIAG, | |
39 | IOV_BMAC_SBGPIOTIMERVAL, | |
40 | IOV_BMAC_SBGPIOOUT, | |
41 | IOV_BMAC_CCGPIOCTRL, /* CC GPIOCTRL REG */ | |
42 | IOV_BMAC_CCGPIOOUT, /* CC GPIOOUT REG */ | |
43 | IOV_BMAC_CCGPIOOUTEN, /* CC GPIOOUTEN REG */ | |
44 | IOV_BMAC_CCGPIOIN, /* CC GPIOIN REG */ | |
45 | IOV_BMAC_WPSGPIO, /* WPS push button GPIO pin */ | |
46 | IOV_BMAC_OTPDUMP, | |
47 | IOV_BMAC_OTPSTAT, | |
48 | IOV_BMAC_PCIEASPM, /* obfuscation clkreq/aspm control */ | |
49 | IOV_BMAC_PCIEADVCORRMASK, /* advanced correctable error mask */ | |
50 | IOV_BMAC_PCIECLKREQ, /* PCIE 1.1 clockreq enab support */ | |
51 | IOV_BMAC_PCIELCREG, /* PCIE LCREG */ | |
52 | IOV_BMAC_SBGPIOTIMERMASK, | |
53 | IOV_BMAC_RFDISABLEDLY, | |
54 | IOV_BMAC_PCIEREG, /* PCIE REG */ | |
55 | IOV_BMAC_PCICFGREG, /* PCI Config register */ | |
56 | IOV_BMAC_PCIESERDESREG, /* PCIE SERDES REG (dev, 0}offset) */ | |
57 | IOV_BMAC_PCIEGPIOOUT, /* PCIEOUT REG */ | |
58 | IOV_BMAC_PCIEGPIOOUTEN, /* PCIEOUTEN REG */ | |
59 | IOV_BMAC_PCIECLKREQENCTRL, /* clkreqenctrl REG (PCIE REV > 6.0 */ | |
60 | IOV_BMAC_DMALPBK, | |
61 | IOV_BMAC_CCREG, | |
62 | IOV_BMAC_COREREG, | |
63 | IOV_BMAC_SDCIS, | |
64 | IOV_BMAC_SDIO_DRIVE, | |
65 | IOV_BMAC_OTPW, | |
66 | IOV_BMAC_NVOTPW, | |
67 | IOV_BMAC_SROM, | |
68 | IOV_BMAC_SRCRC, | |
69 | IOV_BMAC_CIS_SOURCE, | |
70 | IOV_BMAC_CISVAR, | |
71 | IOV_BMAC_OTPLOCK, | |
72 | IOV_BMAC_OTP_CHIPID, | |
73 | IOV_BMAC_CUSTOMVAR1, | |
74 | IOV_BMAC_BOARDFLAGS, | |
75 | IOV_BMAC_BOARDFLAGS2, | |
76 | IOV_BMAC_WPSLED, | |
77 | IOV_BMAC_NVRAM_SOURCE, | |
78 | IOV_BMAC_OTP_RAW_READ, | |
79 | IOV_BMAC_LAST | |
80 | }; | |
81 | ||
c6a9e1fc | 82 | extern int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device, |
e69284f2 BR |
83 | uint unit, bool piomode, struct osl_info *osh, |
84 | void *regsva, uint bustype, void *btparam); | |
c6a9e1fc | 85 | extern int wlc_bmac_detach(struct wlc_info *wlc); |
a9533e7e | 86 | extern void wlc_bmac_watchdog(void *arg); |
a9533e7e HP |
87 | |
88 | /* up/down, reset, clk */ | |
e304151f | 89 | extern void wlc_bmac_copyto_objmem(struct wlc_hw_info *wlc_hw, |
a9533e7e | 90 | uint offset, const void *buf, int len, |
66cbd3ab | 91 | u32 sel); |
e304151f | 92 | extern void wlc_bmac_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset, |
66cbd3ab | 93 | void *buf, int len, u32 sel); |
a9533e7e HP |
94 | #define wlc_bmac_copyfrom_shm(wlc_hw, offset, buf, len) \ |
95 | wlc_bmac_copyfrom_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL) | |
96 | #define wlc_bmac_copyto_shm(wlc_hw, offset, buf, len) \ | |
97 | wlc_bmac_copyto_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL) | |
98 | ||
e304151f RV |
99 | extern void wlc_bmac_core_phypll_reset(struct wlc_hw_info *wlc_hw); |
100 | extern void wlc_bmac_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on); | |
101 | extern void wlc_bmac_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk); | |
102 | extern void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk); | |
103 | extern void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw); | |
104 | extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags); | |
105 | extern void wlc_bmac_reset(struct wlc_hw_info *wlc_hw); | |
106 | extern void wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec, | |
a9533e7e | 107 | bool mute); |
e304151f RV |
108 | extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw); |
109 | extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw); | |
110 | extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw); | |
111 | extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw); | |
e304151f | 112 | extern void wlc_bmac_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode); |
a9533e7e HP |
113 | |
114 | /* chanspec, ucode interface */ | |
e304151f RV |
115 | extern void wlc_bmac_set_chanspec(struct wlc_hw_info *wlc_hw, |
116 | chanspec_t chanspec, | |
a9533e7e HP |
117 | bool mute, struct txpwr_limits *txpwr); |
118 | ||
e304151f | 119 | extern int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo, |
7cc4a4c0 | 120 | uint *blocks); |
e304151f | 121 | extern void wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask, |
7d4df48e | 122 | u16 val, int bands); |
e304151f RV |
123 | extern void wlc_bmac_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val); |
124 | extern u16 wlc_bmac_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands); | |
e304151f RV |
125 | extern void wlc_bmac_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant); |
126 | extern u16 wlc_bmac_get_txant(struct wlc_hw_info *wlc_hw); | |
127 | extern void wlc_bmac_antsel_type_set(struct wlc_hw_info *wlc_hw, | |
128 | u8 antsel_type); | |
e304151f RV |
129 | extern int wlc_bmac_state_get(struct wlc_hw_info *wlc_hw, |
130 | wlc_bmac_state_t *state); | |
131 | extern void wlc_bmac_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v); | |
132 | extern u16 wlc_bmac_read_shm(struct wlc_hw_info *wlc_hw, uint offset); | |
133 | extern void wlc_bmac_set_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v, | |
a9533e7e | 134 | int len); |
e304151f | 135 | extern void wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset, |
a9533e7e | 136 | int len, void *buf); |
e304151f | 137 | extern void wlc_bmac_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf, |
7cc4a4c0 | 138 | uint *len); |
a9533e7e | 139 | |
e304151f | 140 | extern void wlc_bmac_hw_etheraddr(struct wlc_hw_info *wlc_hw, |
a44d4236 | 141 | u8 *ea); |
a9533e7e | 142 | |
e304151f RV |
143 | extern bool wlc_bmac_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw); |
144 | extern void wlc_bmac_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot); | |
e304151f | 145 | extern void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode); |
a9533e7e | 146 | |
e304151f | 147 | extern void wlc_bmac_wait_for_wake(struct wlc_hw_info *wlc_hw); |
a9533e7e | 148 | |
e304151f | 149 | extern void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw, |
66cbd3ab | 150 | u32 override_bit); |
e304151f | 151 | extern void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw, |
66cbd3ab | 152 | u32 override_bit); |
a9533e7e | 153 | |
e304151f | 154 | extern void wlc_bmac_set_rcmta(struct wlc_hw_info *wlc_hw, int idx, |
a44d4236 | 155 | const u8 *addr); |
e304151f RV |
156 | extern void wlc_bmac_set_addrmatch(struct wlc_hw_info *wlc_hw, |
157 | int match_reg_offset, | |
a44d4236 | 158 | const u8 *addr); |
e304151f RV |
159 | extern void wlc_bmac_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw, |
160 | void *bcn, int len, bool both); | |
a9533e7e | 161 | |
e304151f | 162 | extern void wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr, |
66cbd3ab | 163 | u32 *tsf_h_ptr); |
e304151f RV |
164 | extern void wlc_bmac_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin); |
165 | extern void wlc_bmac_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax); | |
166 | extern void wlc_bmac_set_noreset(struct wlc_hw_info *wlc, bool noreset_flag); | |
a9533e7e | 167 | |
e304151f | 168 | extern void wlc_bmac_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL, |
7d4df48e | 169 | u16 LRL); |
a9533e7e | 170 | |
e304151f | 171 | extern void wlc_bmac_fifoerrors(struct wlc_hw_info *wlc_hw); |
a9533e7e | 172 | |
a9533e7e HP |
173 | |
174 | /* API for BMAC driver (e.g. wlc_phy.c etc) */ | |
175 | ||
e304151f RV |
176 | extern void wlc_bmac_bw_set(struct wlc_hw_info *wlc_hw, u16 bw); |
177 | extern void wlc_bmac_pllreq(struct wlc_hw_info *wlc_hw, bool set, | |
178 | mbool req_bit); | |
e304151f | 179 | extern bool wlc_bmac_taclear(struct wlc_hw_info *wlc_hw, bool ta_ok); |
a9533e7e | 180 | extern void wlc_bmac_hw_up(struct wlc_hw_info *wlc_hw); |
e304151f | 181 | extern u16 wlc_bmac_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate); |
e304151f | 182 | extern void wlc_bmac_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail); |
62b54dca AS |
183 | |
184 | #endif /* _wlc_bmac_h_ */ |