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.
16 #ifndef _BRCM_BOTTOM_MAC_H_
17 #define _BRCM_BOTTOM_MAC_H_
19 #include <brcmu_wifi.h>
22 /* dup state between BMAC(struct wlc_hw_info) and HIGH(struct wlc_info)
24 struct brcms_b_state {
25 u32 machwcap; /* mac hw capibility */
26 u32 preamble_ovr; /* preamble override */
31 IOV_BMAC_SBGPIOTIMERVAL,
33 IOV_BMAC_CCGPIOCTRL, /* CC GPIOCTRL REG */
34 IOV_BMAC_CCGPIOOUT, /* CC GPIOOUT REG */
35 IOV_BMAC_CCGPIOOUTEN, /* CC GPIOOUTEN REG */
36 IOV_BMAC_CCGPIOIN, /* CC GPIOIN REG */
37 IOV_BMAC_WPSGPIO, /* WPS push button GPIO pin */
40 IOV_BMAC_PCIEASPM, /* obfuscation clkreq/aspm control */
41 IOV_BMAC_PCIEADVCORRMASK, /* advanced correctable error mask */
42 IOV_BMAC_PCIECLKREQ, /* PCIE 1.1 clockreq enab support */
43 IOV_BMAC_PCIELCREG, /* PCIE LCREG */
44 IOV_BMAC_SBGPIOTIMERMASK,
45 IOV_BMAC_RFDISABLEDLY,
46 IOV_BMAC_PCIEREG, /* PCIE REG */
47 IOV_BMAC_PCICFGREG, /* PCI Config register */
48 IOV_BMAC_PCIESERDESREG, /* PCIE SERDES REG (dev, 0}offset) */
49 IOV_BMAC_PCIEGPIOOUT, /* PCIEOUT REG */
50 IOV_BMAC_PCIEGPIOOUTEN, /* PCIEOUTEN REG */
51 IOV_BMAC_PCIECLKREQENCTRL, /* clkreqenctrl REG (PCIE REV > 6.0 */
69 IOV_BMAC_NVRAM_SOURCE,
70 IOV_BMAC_OTP_RAW_READ,
74 extern int brcms_b_attach(struct wlc_info *wlc, u16 vendor, u16 device,
75 uint unit, bool piomode, void *regsva, uint bustype,
77 extern int brcms_b_detach(struct wlc_info *wlc);
78 extern void brcms_b_watchdog(void *arg);
80 /* up/down, reset, clk */
81 extern void brcms_b_copyto_objmem(struct wlc_hw_info *wlc_hw,
82 uint offset, const void *buf, int len,
84 extern void brcms_b_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset,
85 void *buf, int len, u32 sel);
86 #define brcms_b_copyfrom_shm(wlc_hw, offset, buf, len) \
87 brcms_b_copyfrom_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
88 #define brcms_b_copyto_shm(wlc_hw, offset, buf, len) \
89 brcms_b_copyto_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
91 extern void brcms_b_core_phypll_reset(struct wlc_hw_info *wlc_hw);
92 extern void brcms_b_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on);
93 extern void brcms_b_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk);
94 extern void brcms_b_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk);
95 extern void brcms_b_phy_reset(struct wlc_hw_info *wlc_hw);
96 extern void brcms_b_corereset(struct wlc_hw_info *wlc_hw, u32 flags);
97 extern void brcms_b_reset(struct wlc_hw_info *wlc_hw);
98 extern void brcms_b_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec,
100 extern int brcms_b_up_prep(struct wlc_hw_info *wlc_hw);
101 extern int brcms_b_up_finish(struct wlc_hw_info *wlc_hw);
102 extern int brcms_b_bmac_down_prep(struct wlc_hw_info *wlc_hw);
103 extern int brcms_b_down_finish(struct wlc_hw_info *wlc_hw);
104 extern void brcms_b_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode);
106 /* chanspec, ucode interface */
107 extern void brcms_b_set_chanspec(struct wlc_hw_info *wlc_hw,
109 bool mute, struct txpwr_limits *txpwr);
111 extern int brcms_b_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo,
113 extern void brcms_b_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask,
115 extern void brcms_b_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val);
116 extern u16 brcms_b_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands);
117 extern void brcms_b_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant);
118 extern u16 brcms_b_get_txant(struct wlc_hw_info *wlc_hw);
119 extern void brcms_b_antsel_type_set(struct wlc_hw_info *wlc_hw,
121 extern int brcms_b_state_get(struct wlc_hw_info *wlc_hw,
122 brcms_b_state_t *state);
123 extern void brcms_b_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v);
124 extern u16 brcms_b_read_shm(struct wlc_hw_info *wlc_hw, uint offset);
125 extern void brcms_b_write_template_ram(struct wlc_hw_info *wlc_hw, int offset,
127 extern void brcms_b_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf,
130 extern void brcms_b_hw_etheraddr(struct wlc_hw_info *wlc_hw,
133 extern bool brcms_b_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw);
134 extern void brcms_b_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot);
135 extern void brcms_b_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode);
137 extern void brcms_b_wait_for_wake(struct wlc_hw_info *wlc_hw);
139 extern void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw,
141 extern void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw,
144 extern void brcms_b_set_addrmatch(struct wlc_hw_info *wlc_hw,
145 int match_reg_offset,
147 extern void brcms_b_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw,
148 void *bcn, int len, bool both);
150 extern void brcms_b_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr,
152 extern void brcms_b_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin);
153 extern void brcms_b_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax);
155 extern void brcms_b_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL,
158 extern void brcms_b_fifoerrors(struct wlc_hw_info *wlc_hw);
161 /* API for BMAC driver (e.g. wlc_phy.c etc) */
163 extern void brcms_b_bw_set(struct wlc_hw_info *wlc_hw, u16 bw);
164 extern void brcms_b_pllreq(struct wlc_hw_info *wlc_hw, bool set,
166 extern void brcms_b_hw_up(struct wlc_hw_info *wlc_hw);
167 extern u16 brcms_b_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate);
168 extern void brcms_b_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail);
170 #endif /* _BRCM_BOTTOM_MAC_H_ */