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 /* dup state between BMAC(struct wlc_hw_info) and HIGH(struct wlc_info)
21 struct wlc_bmac_state {
22 u32 machwcap; /* mac hw capibility */
23 u32 preamble_ovr; /* preamble override */
28 IOV_BMAC_SBGPIOTIMERVAL,
30 IOV_BMAC_CCGPIOCTRL, /* CC GPIOCTRL REG */
31 IOV_BMAC_CCGPIOOUT, /* CC GPIOOUT REG */
32 IOV_BMAC_CCGPIOOUTEN, /* CC GPIOOUTEN REG */
33 IOV_BMAC_CCGPIOIN, /* CC GPIOIN REG */
34 IOV_BMAC_WPSGPIO, /* WPS push button GPIO pin */
37 IOV_BMAC_PCIEASPM, /* obfuscation clkreq/aspm control */
38 IOV_BMAC_PCIEADVCORRMASK, /* advanced correctable error mask */
39 IOV_BMAC_PCIECLKREQ, /* PCIE 1.1 clockreq enab support */
40 IOV_BMAC_PCIELCREG, /* PCIE LCREG */
41 IOV_BMAC_SBGPIOTIMERMASK,
42 IOV_BMAC_RFDISABLEDLY,
43 IOV_BMAC_PCIEREG, /* PCIE REG */
44 IOV_BMAC_PCICFGREG, /* PCI Config register */
45 IOV_BMAC_PCIESERDESREG, /* PCIE SERDES REG (dev, 0}offset) */
46 IOV_BMAC_PCIEGPIOOUT, /* PCIEOUT REG */
47 IOV_BMAC_PCIEGPIOOUTEN, /* PCIEOUTEN REG */
48 IOV_BMAC_PCIECLKREQENCTRL, /* clkreqenctrl REG (PCIE REV > 6.0 */
66 IOV_BMAC_NVRAM_SOURCE,
67 IOV_BMAC_OTP_RAW_READ,
71 extern int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device,
72 uint unit, bool piomode, void *regsva, uint bustype,
74 extern int wlc_bmac_detach(struct wlc_info *wlc);
75 extern void wlc_bmac_watchdog(void *arg);
77 /* up/down, reset, clk */
78 extern void wlc_bmac_copyto_objmem(struct wlc_hw_info *wlc_hw,
79 uint offset, const void *buf, int len,
81 extern void wlc_bmac_copyfrom_objmem(struct wlc_hw_info *wlc_hw, uint offset,
82 void *buf, int len, u32 sel);
83 #define wlc_bmac_copyfrom_shm(wlc_hw, offset, buf, len) \
84 wlc_bmac_copyfrom_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
85 #define wlc_bmac_copyto_shm(wlc_hw, offset, buf, len) \
86 wlc_bmac_copyto_objmem(wlc_hw, offset, buf, len, OBJADDR_SHM_SEL)
88 extern void wlc_bmac_core_phypll_reset(struct wlc_hw_info *wlc_hw);
89 extern void wlc_bmac_core_phypll_ctl(struct wlc_hw_info *wlc_hw, bool on);
90 extern void wlc_bmac_phyclk_fgc(struct wlc_hw_info *wlc_hw, bool clk);
91 extern void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk);
92 extern void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw);
93 extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags);
94 extern void wlc_bmac_reset(struct wlc_hw_info *wlc_hw);
95 extern void wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec,
97 extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw);
98 extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw);
99 extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw);
100 extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw);
101 extern void wlc_bmac_switch_macfreq(struct wlc_hw_info *wlc_hw, u8 spurmode);
103 /* chanspec, ucode interface */
104 extern void wlc_bmac_set_chanspec(struct wlc_hw_info *wlc_hw,
106 bool mute, struct txpwr_limits *txpwr);
108 extern int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo,
110 extern void wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask,
112 extern void wlc_bmac_mctrl(struct wlc_hw_info *wlc_hw, u32 mask, u32 val);
113 extern u16 wlc_bmac_mhf_get(struct wlc_hw_info *wlc_hw, u8 idx, int bands);
114 extern void wlc_bmac_txant_set(struct wlc_hw_info *wlc_hw, u16 phytxant);
115 extern u16 wlc_bmac_get_txant(struct wlc_hw_info *wlc_hw);
116 extern void wlc_bmac_antsel_type_set(struct wlc_hw_info *wlc_hw,
118 extern int wlc_bmac_state_get(struct wlc_hw_info *wlc_hw,
119 wlc_bmac_state_t *state);
120 extern void wlc_bmac_write_shm(struct wlc_hw_info *wlc_hw, uint offset, u16 v);
121 extern u16 wlc_bmac_read_shm(struct wlc_hw_info *wlc_hw, uint offset);
122 extern void wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset,
124 extern void wlc_bmac_copyfrom_vars(struct wlc_hw_info *wlc_hw, char **buf,
127 extern void wlc_bmac_hw_etheraddr(struct wlc_hw_info *wlc_hw,
130 extern bool wlc_bmac_radio_read_hwdisabled(struct wlc_hw_info *wlc_hw);
131 extern void wlc_bmac_set_shortslot(struct wlc_hw_info *wlc_hw, bool shortslot);
132 extern void wlc_bmac_band_stf_ss_set(struct wlc_hw_info *wlc_hw, u8 stf_mode);
134 extern void wlc_bmac_wait_for_wake(struct wlc_hw_info *wlc_hw);
136 extern void wlc_ucode_wake_override_set(struct wlc_hw_info *wlc_hw,
138 extern void wlc_ucode_wake_override_clear(struct wlc_hw_info *wlc_hw,
141 extern void wlc_bmac_set_addrmatch(struct wlc_hw_info *wlc_hw,
142 int match_reg_offset,
144 extern void wlc_bmac_write_hw_bcntemplates(struct wlc_hw_info *wlc_hw,
145 void *bcn, int len, bool both);
147 extern void wlc_bmac_read_tsf(struct wlc_hw_info *wlc_hw, u32 *tsf_l_ptr,
149 extern void wlc_bmac_set_cwmin(struct wlc_hw_info *wlc_hw, u16 newmin);
150 extern void wlc_bmac_set_cwmax(struct wlc_hw_info *wlc_hw, u16 newmax);
152 extern void wlc_bmac_retrylimit_upd(struct wlc_hw_info *wlc_hw, u16 SRL,
155 extern void wlc_bmac_fifoerrors(struct wlc_hw_info *wlc_hw);
158 /* API for BMAC driver (e.g. wlc_phy.c etc) */
160 extern void wlc_bmac_bw_set(struct wlc_hw_info *wlc_hw, u16 bw);
161 extern void wlc_bmac_pllreq(struct wlc_hw_info *wlc_hw, bool set,
163 extern void wlc_bmac_hw_up(struct wlc_hw_info *wlc_hw);
164 extern u16 wlc_bmac_rate_shm_offset(struct wlc_hw_info *wlc_hw, u8 rate);
165 extern void wlc_bmac_antsel_set(struct wlc_hw_info *wlc_hw, u32 antsel_avail);
167 #endif /* _BRCM_BOTTOM_MAC_H_ */