162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2010 Broadcom Corporation
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
1162306a36Sopenharmony_ci * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
1362306a36Sopenharmony_ci * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1462306a36Sopenharmony_ci * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#ifndef _BRCM_MAIN_H_
1862306a36Sopenharmony_ci#define _BRCM_MAIN_H_
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#include <linux/etherdevice.h>
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#include <brcmu_utils.h>
2362306a36Sopenharmony_ci#include "types.h"
2462306a36Sopenharmony_ci#include "d11.h"
2562306a36Sopenharmony_ci#include "scb.h"
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define	INVCHANNEL		255	/* invalid channel */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* max # brcms_c_module_register() calls */
3062306a36Sopenharmony_ci#define BRCMS_MAXMODULES	22
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define SEQNUM_SHIFT		4
3362306a36Sopenharmony_ci#define SEQNUM_MAX		0x1000
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define NTXRATE			64	/* # tx MPDUs rate is reported for */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* Maximum wait time for a MAC suspend */
3862306a36Sopenharmony_ci/* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */
3962306a36Sopenharmony_ci#define	BRCMS_MAX_MAC_SUSPEND	83000
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* responses for probe requests older that this are tossed, zero to disable */
4262306a36Sopenharmony_ci#define BRCMS_PRB_RESP_TIMEOUT	0	/* Disable probe response timeout */
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* transmit buffer max headroom for protocol headers */
4562306a36Sopenharmony_ci#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* Macros for doing definition and get/set of bitfields
4862306a36Sopenharmony_ci * Usage example, e.g. a three-bit field (bits 4-6):
4962306a36Sopenharmony_ci *    #define <NAME>_M	BITFIELD_MASK(3)
5062306a36Sopenharmony_ci *    #define <NAME>_S	4
5162306a36Sopenharmony_ci * ...
5262306a36Sopenharmony_ci *    regval = R_REG(osh, &regs->regfoo);
5362306a36Sopenharmony_ci *    field = GFIELD(regval, <NAME>);
5462306a36Sopenharmony_ci *    regval = SFIELD(regval, <NAME>, 1);
5562306a36Sopenharmony_ci *    W_REG(osh, &regs->regfoo, regval);
5662306a36Sopenharmony_ci */
5762306a36Sopenharmony_ci#define BITFIELD_MASK(width) \
5862306a36Sopenharmony_ci		(((unsigned)1 << (width)) - 1)
5962306a36Sopenharmony_ci#define GFIELD(val, field) \
6062306a36Sopenharmony_ci		(((val) >> field ## _S) & field ## _M)
6162306a36Sopenharmony_ci#define SFIELD(val, field, bits) \
6262306a36Sopenharmony_ci		(((val) & (~(field ## _M << field ## _S))) | \
6362306a36Sopenharmony_ci		 ((unsigned)(bits) << field ## _S))
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define	SW_TIMER_MAC_STAT_UPD		30	/* periodic MAC stats update */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* max # supported core revisions (0 .. MAXCOREREV - 1) */
6862306a36Sopenharmony_ci#define	MAXCOREREV		28
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/* Double check that unsupported cores are not enabled */
7162306a36Sopenharmony_ci#if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV)
7262306a36Sopenharmony_ci#error "Configuration for D11CONF includes unsupported versions."
7362306a36Sopenharmony_ci#endif				/* Bad versions */
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/* values for shortslot_override */
7662306a36Sopenharmony_ci#define BRCMS_SHORTSLOT_AUTO	-1 /* Driver will manage Shortslot setting */
7762306a36Sopenharmony_ci#define BRCMS_SHORTSLOT_OFF	0  /* Turn off short slot */
7862306a36Sopenharmony_ci#define BRCMS_SHORTSLOT_ON	1  /* Turn on short slot */
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* value for short/long and mixmode/greenfield preamble */
8162306a36Sopenharmony_ci#define BRCMS_LONG_PREAMBLE	(0)
8262306a36Sopenharmony_ci#define BRCMS_SHORT_PREAMBLE	(1 << 0)
8362306a36Sopenharmony_ci#define BRCMS_GF_PREAMBLE		(1 << 1)
8462306a36Sopenharmony_ci#define BRCMS_MM_PREAMBLE		(1 << 2)
8562306a36Sopenharmony_ci#define BRCMS_IS_MIMO_PREAMBLE(_pre) (((_pre) == BRCMS_GF_PREAMBLE) || \
8662306a36Sopenharmony_ci				      ((_pre) == BRCMS_MM_PREAMBLE))
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci/* TxFrameID */
8962306a36Sopenharmony_ci/* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */
9062306a36Sopenharmony_ci/* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */
9162306a36Sopenharmony_ci#define TXFID_QUEUE_MASK	0x0007	/* Bits 0-2 */
9262306a36Sopenharmony_ci#define TXFID_SEQ_MASK		0x7FE0	/* Bits 5-15 */
9362306a36Sopenharmony_ci#define TXFID_SEQ_SHIFT		5	/* Number of bit shifts */
9462306a36Sopenharmony_ci#define	TXFID_RATE_PROBE_MASK	0x8000	/* Bit 15 for rate probe */
9562306a36Sopenharmony_ci#define TXFID_RATE_MASK		0x0018	/* Mask for bits 3 and 4 */
9662306a36Sopenharmony_ci#define TXFID_RATE_SHIFT	3	/* Shift 3 bits for rate mask */
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* promote boardrev */
9962306a36Sopenharmony_ci#define BOARDREV_PROMOTABLE	0xFF	/* from */
10062306a36Sopenharmony_ci#define BOARDREV_PROMOTED	1	/* to */
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci#define DATA_BLOCK_TX_SUPR	(1 << 4)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* Ucode MCTL_WAKE override bits */
10562306a36Sopenharmony_ci#define BRCMS_WAKE_OVERRIDE_CLKCTL	0x01
10662306a36Sopenharmony_ci#define BRCMS_WAKE_OVERRIDE_PHYREG	0x02
10762306a36Sopenharmony_ci#define BRCMS_WAKE_OVERRIDE_MACSUSPEND	0x04
10862306a36Sopenharmony_ci#define BRCMS_WAKE_OVERRIDE_TXFIFO	0x08
10962306a36Sopenharmony_ci#define BRCMS_WAKE_OVERRIDE_FORCEFAST	0x10
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* stuff pulled in from wlc.c */
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* Interrupt bit error summary.  Don't include I_RU: we refill DMA at other
11462306a36Sopenharmony_ci * times; and if we run out, constant I_RU interrupts may cause lockup.  We
11562306a36Sopenharmony_ci * will still get error counts from rx0ovfl.
11662306a36Sopenharmony_ci */
11762306a36Sopenharmony_ci#define	I_ERRORS	(I_PC | I_PD | I_DE | I_RO | I_XU)
11862306a36Sopenharmony_ci/* default software intmasks */
11962306a36Sopenharmony_ci#define	DEF_RXINTMASK	(I_RI)	/* enable rx int on rxfifo only */
12062306a36Sopenharmony_ci#define	DEF_MACINTMASK	(MI_TXSTOP | MI_TBTT | MI_ATIMWINEND | MI_PMQ | \
12162306a36Sopenharmony_ci			 MI_PHYTXERR | MI_DMAINT | MI_TFS | MI_BG_NOISE | \
12262306a36Sopenharmony_ci			 MI_CCA | MI_TO | MI_GP0 | MI_RFDISABLE | MI_PWRUP)
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define	MAXTXPKTS		6	/* max # pkts pending */
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* frameburst */
12762306a36Sopenharmony_ci#define	MAXTXFRAMEBURST		8 /* vanilla xpress mode: max frames/burst */
12862306a36Sopenharmony_ci#define	MAXFRAMEBURST_TXOP	10000	/* Frameburst TXOP in usec */
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define	NFIFO			6	/* # tx/rx fifopairs */
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci/* PLL requests */
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/* pll is shared on old chips */
13562306a36Sopenharmony_ci#define BRCMS_PLLREQ_SHARED	0x1
13662306a36Sopenharmony_ci/* hold pll for radio monitor register checking */
13762306a36Sopenharmony_ci#define BRCMS_PLLREQ_RADIO_MON	0x2
13862306a36Sopenharmony_ci/* hold/release pll for some short operation */
13962306a36Sopenharmony_ci#define BRCMS_PLLREQ_FLIP		0x4
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci#define	CHANNEL_BANDUNIT(wlc, ch) \
14262306a36Sopenharmony_ci	(((ch) <= CH_MAX_2G_CHANNEL) ? BAND_2G_INDEX : BAND_5G_INDEX)
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#define	OTHERBANDUNIT(wlc) \
14562306a36Sopenharmony_ci	((uint)((wlc)->band->bandunit ? BAND_2G_INDEX : BAND_5G_INDEX))
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/*
14862306a36Sopenharmony_ci * 802.11 protection information
14962306a36Sopenharmony_ci *
15062306a36Sopenharmony_ci * _g: use g spec protection, driver internal.
15162306a36Sopenharmony_ci * g_override: override for use of g spec protection.
15262306a36Sopenharmony_ci * gmode_user: user config gmode, operating band->gmode is different.
15362306a36Sopenharmony_ci * overlap: Overlap BSS/IBSS protection for both 11g and 11n.
15462306a36Sopenharmony_ci * nmode_user: user config nmode, operating pub->nmode is different.
15562306a36Sopenharmony_ci * n_cfg: use OFDM protection on MIMO frames.
15662306a36Sopenharmony_ci * n_cfg_override: override for use of N protection.
15762306a36Sopenharmony_ci * nongf: non-GF present protection.
15862306a36Sopenharmony_ci * nongf_override: override for use of GF protection.
15962306a36Sopenharmony_ci * n_pam_override: override for preamble: MM or GF.
16062306a36Sopenharmony_ci * n_obss: indicated OBSS Non-HT STA present.
16162306a36Sopenharmony_ci*/
16262306a36Sopenharmony_cistruct brcms_protection {
16362306a36Sopenharmony_ci	bool _g;
16462306a36Sopenharmony_ci	s8 g_override;
16562306a36Sopenharmony_ci	u8 gmode_user;
16662306a36Sopenharmony_ci	s8 overlap;
16762306a36Sopenharmony_ci	s8 nmode_user;
16862306a36Sopenharmony_ci	s8 n_cfg;
16962306a36Sopenharmony_ci	s8 n_cfg_override;
17062306a36Sopenharmony_ci	bool nongf;
17162306a36Sopenharmony_ci	s8 nongf_override;
17262306a36Sopenharmony_ci	s8 n_pam_override;
17362306a36Sopenharmony_ci	bool n_obss;
17462306a36Sopenharmony_ci};
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci/*
17762306a36Sopenharmony_ci * anything affecting the single/dual streams/antenna operation
17862306a36Sopenharmony_ci *
17962306a36Sopenharmony_ci * hw_txchain: HW txchain bitmap cfg.
18062306a36Sopenharmony_ci * txchain: txchain bitmap being used.
18162306a36Sopenharmony_ci * txstreams: number of txchains being used.
18262306a36Sopenharmony_ci * hw_rxchain: HW rxchain bitmap cfg.
18362306a36Sopenharmony_ci * rxchain: rxchain bitmap being used.
18462306a36Sopenharmony_ci * rxstreams: number of rxchains being used.
18562306a36Sopenharmony_ci * ant_rx_ovr: rx antenna override.
18662306a36Sopenharmony_ci * txant: userTx antenna setting.
18762306a36Sopenharmony_ci * phytxant: phyTx antenna setting in txheader.
18862306a36Sopenharmony_ci * ss_opmode: singlestream Operational mode, 0:siso; 1:cdd.
18962306a36Sopenharmony_ci * ss_algosel_auto: if true, use wlc->stf->ss_algo_channel;
19062306a36Sopenharmony_ci *			else use wlc->band->stf->ss_mode_band.
19162306a36Sopenharmony_ci * ss_algo_channel: ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC.
19262306a36Sopenharmony_ci * rxchain_restore_delay: delay time to restore default rxchain.
19362306a36Sopenharmony_ci * ldpc: AUTO/ON/OFF ldpc cap supported.
19462306a36Sopenharmony_ci * txcore[MAX_STREAMS_SUPPORTED + 1]: bitmap of selected core for each Nsts.
19562306a36Sopenharmony_ci * spatial_policy:
19662306a36Sopenharmony_ci */
19762306a36Sopenharmony_cistruct brcms_stf {
19862306a36Sopenharmony_ci	u8 hw_txchain;
19962306a36Sopenharmony_ci	u8 txchain;
20062306a36Sopenharmony_ci	u8 txstreams;
20162306a36Sopenharmony_ci	u8 hw_rxchain;
20262306a36Sopenharmony_ci	u8 rxchain;
20362306a36Sopenharmony_ci	u8 rxstreams;
20462306a36Sopenharmony_ci	u8 ant_rx_ovr;
20562306a36Sopenharmony_ci	s8 txant;
20662306a36Sopenharmony_ci	u16 phytxant;
20762306a36Sopenharmony_ci	u8 ss_opmode;
20862306a36Sopenharmony_ci	bool ss_algosel_auto;
20962306a36Sopenharmony_ci	u16 ss_algo_channel;
21062306a36Sopenharmony_ci	u8 rxchain_restore_delay;
21162306a36Sopenharmony_ci	s8 ldpc;
21262306a36Sopenharmony_ci	u8 txcore[MAX_STREAMS_SUPPORTED + 1];
21362306a36Sopenharmony_ci	s8 spatial_policy;
21462306a36Sopenharmony_ci};
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define BRCMS_STF_SS_STBC_TX(wlc, scb) \
21762306a36Sopenharmony_ci	(((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) \
21862306a36Sopenharmony_ci	 || (((scb)->flags & SCB_STBCCAP) && \
21962306a36Sopenharmony_ci	     (wlc)->band->band_stf_stbc_tx == AUTO && \
22062306a36Sopenharmony_ci	     isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC))))
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \
22362306a36Sopenharmony_ci				 NREV_GE(wlc->band->phyrev, 3))
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci#define BRCMS_SGI_CAP_PHY(wlc) ((BRCMS_ISNPHY(wlc->band) && \
22662306a36Sopenharmony_ci				 NREV_GE(wlc->band->phyrev, 3)) || \
22762306a36Sopenharmony_ci				BRCMS_ISLCNPHY(wlc->band))
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci#define BRCMS_CHAN_PHYTYPE(x)     (((x) & RXS_CHAN_PHYTYPE_MASK) \
23062306a36Sopenharmony_ci				   >> RXS_CHAN_PHYTYPE_SHIFT)
23162306a36Sopenharmony_ci#define BRCMS_CHAN_CHANNEL(x)     (((x) & RXS_CHAN_ID_MASK) \
23262306a36Sopenharmony_ci				   >> RXS_CHAN_ID_SHIFT)
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/*
23562306a36Sopenharmony_ci * core state (mac)
23662306a36Sopenharmony_ci */
23762306a36Sopenharmony_cistruct brcms_core {
23862306a36Sopenharmony_ci	uint coreidx;		/* # sb enumerated core */
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci	/* fifo */
24162306a36Sopenharmony_ci	uint *txavail[NFIFO];	/* # tx descriptors available */
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci	struct macstat *macstat_snapshot;	/* mac hw prev read values */
24462306a36Sopenharmony_ci};
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/*
24762306a36Sopenharmony_ci * band state (phy+ana+radio)
24862306a36Sopenharmony_ci */
24962306a36Sopenharmony_cistruct brcms_band {
25062306a36Sopenharmony_ci	int bandtype;		/* BRCM_BAND_2G, BRCM_BAND_5G */
25162306a36Sopenharmony_ci	uint bandunit;		/* bandstate[] index */
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	u16 phytype;		/* phytype */
25462306a36Sopenharmony_ci	u16 phyrev;
25562306a36Sopenharmony_ci	u16 radioid;
25662306a36Sopenharmony_ci	u16 radiorev;
25762306a36Sopenharmony_ci	struct brcms_phy_pub *pi; /* pointer to phy specific information */
25862306a36Sopenharmony_ci	bool abgphy_encore;
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci	u8 gmode;		/* currently active gmode */
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci	struct scb *hwrs_scb;	/* permanent scb for hw rateset */
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	/* band-specific copy of default_bss.rateset */
26562306a36Sopenharmony_ci	struct brcms_c_rateset defrateset;
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	u8 band_stf_ss_mode;	/* Configured STF type, 0:siso; 1:cdd */
26862306a36Sopenharmony_ci	s8 band_stf_stbc_tx;	/* STBC TX 0:off; 1:force on; -1:auto */
26962306a36Sopenharmony_ci	/* rates supported by chip (phy-specific) */
27062306a36Sopenharmony_ci	struct brcms_c_rateset hw_rateset;
27162306a36Sopenharmony_ci	u8 basic_rate[BRCM_MAXRATE + 1]; /* basic rates indexed by rate */
27262306a36Sopenharmony_ci	bool mimo_cap_40;	/* 40 MHz cap enabled on this band */
27362306a36Sopenharmony_ci	s8 antgain;		/* antenna gain from srom */
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci	u16 CWmin; /* minimum size of contention window, in unit of aSlotTime */
27662306a36Sopenharmony_ci	u16 CWmax; /* maximum size of contention window, in unit of aSlotTime */
27762306a36Sopenharmony_ci	struct ieee80211_supported_band band;
27862306a36Sopenharmony_ci};
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci/* module control blocks */
28162306a36Sopenharmony_cistruct modulecb {
28262306a36Sopenharmony_ci	/* module name : NULL indicates empty array member */
28362306a36Sopenharmony_ci	char name[32];
28462306a36Sopenharmony_ci	/* handle passed when handler 'doiovar' is called */
28562306a36Sopenharmony_ci	struct brcms_info *hdl;
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci	int (*down_fn)(void *handle); /* down handler. Note: the int returned
28862306a36Sopenharmony_ci				       * by the down function is a count of the
28962306a36Sopenharmony_ci				       * number of timers that could not be
29062306a36Sopenharmony_ci				       * freed.
29162306a36Sopenharmony_ci				       */
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci};
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_cistruct brcms_hw_band {
29662306a36Sopenharmony_ci	int bandtype;		/* BRCM_BAND_2G, BRCM_BAND_5G */
29762306a36Sopenharmony_ci	uint bandunit;		/* bandstate[] index */
29862306a36Sopenharmony_ci	u16 mhfs[MHFMAX];	/* MHF array shadow */
29962306a36Sopenharmony_ci	u8 bandhw_stf_ss_mode;	/* HW configured STF type, 0:siso; 1:cdd */
30062306a36Sopenharmony_ci	u16 CWmin;
30162306a36Sopenharmony_ci	u16 CWmax;
30262306a36Sopenharmony_ci	u32 core_flags;
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci	u16 phytype;		/* phytype */
30562306a36Sopenharmony_ci	u16 phyrev;
30662306a36Sopenharmony_ci	u16 radioid;
30762306a36Sopenharmony_ci	u16 radiorev;
30862306a36Sopenharmony_ci	struct brcms_phy_pub *pi; /* pointer to phy specific information */
30962306a36Sopenharmony_ci	bool abgphy_encore;
31062306a36Sopenharmony_ci};
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_cistruct brcms_hardware {
31362306a36Sopenharmony_ci	bool _piomode;		/* true if pio mode */
31462306a36Sopenharmony_ci	struct brcms_c_info *wlc;
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci	/* fifo */
31762306a36Sopenharmony_ci	struct dma_pub *di[NFIFO];	/* dma handles, per fifo */
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci	uint unit;		/* device instance number */
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci	/* version info */
32262306a36Sopenharmony_ci	u16 vendorid;	/* PCI vendor id */
32362306a36Sopenharmony_ci	u16 deviceid;	/* PCI device id */
32462306a36Sopenharmony_ci	uint corerev;		/* core revision */
32562306a36Sopenharmony_ci	u8 sromrev;		/* version # of the srom */
32662306a36Sopenharmony_ci	u16 boardrev;	/* version # of particular board */
32762306a36Sopenharmony_ci	u32 boardflags;	/* Board specific flags from srom */
32862306a36Sopenharmony_ci	u32 boardflags2;	/* More board flags if sromrev >= 4 */
32962306a36Sopenharmony_ci	u32 machwcap;	/* MAC capabilities */
33062306a36Sopenharmony_ci	u32 machwcap_backup;	/* backup of machwcap */
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci	struct si_pub *sih;	/* SI handle (cookie for siutils calls) */
33362306a36Sopenharmony_ci	struct bcma_device *d11core;	/* pointer to 802.11 core */
33462306a36Sopenharmony_ci	struct phy_shim_info *physhim; /* phy shim layer handler */
33562306a36Sopenharmony_ci	struct shared_phy *phy_sh;	/* pointer to shared phy state */
33662306a36Sopenharmony_ci	struct brcms_hw_band *band;/* pointer to active per-band state */
33762306a36Sopenharmony_ci	/* band state per phy/radio */
33862306a36Sopenharmony_ci	struct brcms_hw_band *bandstate[MAXBANDS];
33962306a36Sopenharmony_ci	u16 bmac_phytxant;	/* cache of high phytxant state */
34062306a36Sopenharmony_ci	bool shortslot;		/* currently using 11g ShortSlot timing */
34162306a36Sopenharmony_ci	u16 SRL;		/* 802.11 dot11ShortRetryLimit */
34262306a36Sopenharmony_ci	u16 LRL;		/* 802.11 dot11LongRetryLimit */
34362306a36Sopenharmony_ci	u16 SFBL;		/* Short Frame Rate Fallback Limit */
34462306a36Sopenharmony_ci	u16 LFBL;		/* Long Frame Rate Fallback Limit */
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci	bool up;		/* d11 hardware up and running */
34762306a36Sopenharmony_ci	uint now;		/* # elapsed seconds */
34862306a36Sopenharmony_ci	uint _nbands;		/* # bands supported */
34962306a36Sopenharmony_ci	u16 chanspec;	/* bmac chanspec shadow */
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci	uint *txavail[NFIFO];	/* # tx descriptors available */
35262306a36Sopenharmony_ci	const u16 *xmtfifo_sz;	/* fifo size in 256B for each xmt fifo */
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_ci	u32 pllreq;		/* pll requests to keep PLL on */
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci	u8 suspended_fifos;	/* Which TX fifo to remain awake for */
35762306a36Sopenharmony_ci	u32 maccontrol;	/* Cached value of maccontrol */
35862306a36Sopenharmony_ci	uint mac_suspend_depth;	/* current depth of mac_suspend levels */
35962306a36Sopenharmony_ci	u32 wake_override;	/* bit flags to force MAC to WAKE mode */
36062306a36Sopenharmony_ci	u32 mute_override;	/* Prevent ucode from sending beacons */
36162306a36Sopenharmony_ci	u8 etheraddr[ETH_ALEN];	/* currently configured ethernet address */
36262306a36Sopenharmony_ci	bool noreset;		/* true= do not reset hw, used by WLC_OUT */
36362306a36Sopenharmony_ci	bool forcefastclk;	/* true if h/w is forcing to use fast clk */
36462306a36Sopenharmony_ci	bool clk;		/* core is out of reset and has clock */
36562306a36Sopenharmony_ci	bool sbclk;		/* sb has clock */
36662306a36Sopenharmony_ci	bool phyclk;		/* phy is out of reset and has clock */
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci	bool ucode_loaded;	/* true after ucode downloaded */
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ci	u8 hw_stf_ss_opmode;	/* STF single stream operation mode */
37262306a36Sopenharmony_ci	u8 antsel_type;	/* Type of boardlevel mimo antenna switch-logic
37362306a36Sopenharmony_ci				 * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board
37462306a36Sopenharmony_ci				 */
37562306a36Sopenharmony_ci	u32 antsel_avail;	/*
37662306a36Sopenharmony_ci				 * put struct antsel_info here if more info is
37762306a36Sopenharmony_ci				 * needed
37862306a36Sopenharmony_ci				 */
37962306a36Sopenharmony_ci};
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/*
38262306a36Sopenharmony_ci * Principal common driver data structure.
38362306a36Sopenharmony_ci *
38462306a36Sopenharmony_ci * pub: pointer to driver public state.
38562306a36Sopenharmony_ci * wl: pointer to specific private state.
38662306a36Sopenharmony_ci * hw: HW related state.
38762306a36Sopenharmony_ci * clkreq_override: setting for clkreq for PCIE : Auto, 0, 1.
38862306a36Sopenharmony_ci * fastpwrup_dly: time in us needed to bring up d11 fast clock.
38962306a36Sopenharmony_ci * macintstatus: bit channel between isr and dpc.
39062306a36Sopenharmony_ci * macintmask: sw runtime master macintmask value.
39162306a36Sopenharmony_ci * defmacintmask: default "on" macintmask value.
39262306a36Sopenharmony_ci * clk: core is out of reset and has clock.
39362306a36Sopenharmony_ci * core: pointer to active io core.
39462306a36Sopenharmony_ci * band: pointer to active per-band state.
39562306a36Sopenharmony_ci * corestate: per-core state (one per hw core).
39662306a36Sopenharmony_ci * bandstate: per-band state (one per phy/radio).
39762306a36Sopenharmony_ci * qvalid: DirFrmQValid and BcMcFrmQValid.
39862306a36Sopenharmony_ci * ampdu: ampdu module handler.
39962306a36Sopenharmony_ci * asi: antsel module handler.
40062306a36Sopenharmony_ci * cmi: channel manager module handler.
40162306a36Sopenharmony_ci * vendorid: PCI vendor id.
40262306a36Sopenharmony_ci * deviceid: PCI device id.
40362306a36Sopenharmony_ci * ucode_rev: microcode revision.
40462306a36Sopenharmony_ci * machwcap: MAC capabilities, BMAC shadow.
40562306a36Sopenharmony_ci * perm_etheraddr: original sprom local ethernet address.
40662306a36Sopenharmony_ci * bandlocked: disable auto multi-band switching.
40762306a36Sopenharmony_ci * bandinit_pending: track band init in auto band.
40862306a36Sopenharmony_ci * radio_monitor: radio timer is running.
40962306a36Sopenharmony_ci * going_down: down path intermediate variable.
41062306a36Sopenharmony_ci * wdtimer: timer for watchdog routine.
41162306a36Sopenharmony_ci * radio_timer: timer for hw radio button monitor routine.
41262306a36Sopenharmony_ci * monitor: monitor (MPDU sniffing) mode.
41362306a36Sopenharmony_ci * bcnmisc_monitor: bcns promisc mode override for monitor.
41462306a36Sopenharmony_ci * _rifs: enable per-packet rifs.
41562306a36Sopenharmony_ci * bcn_li_bcn: beacon listen interval in # beacons.
41662306a36Sopenharmony_ci * bcn_li_dtim: beacon listen interval in # dtims.
41762306a36Sopenharmony_ci * WDarmed: watchdog timer is armed.
41862306a36Sopenharmony_ci * WDlast: last time wlc_watchdog() was called.
41962306a36Sopenharmony_ci * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac.
42062306a36Sopenharmony_ci * wme_retries: per-AC retry limits.
42162306a36Sopenharmony_ci * bsscfg: set of BSS configurations, idx 0 is default and always valid.
42262306a36Sopenharmony_ci * cfg: the primary bsscfg (can be AP or STA).
42362306a36Sopenharmony_ci * modulecb:
42462306a36Sopenharmony_ci * mimoft: SIGN or 11N.
42562306a36Sopenharmony_ci * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode.
42662306a36Sopenharmony_ci * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode.
42762306a36Sopenharmony_ci * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode.
42862306a36Sopenharmony_ci * default_bss: configured BSS parameters.
42962306a36Sopenharmony_ci * mc_fid_counter: BC/MC FIFO frame ID counter.
43062306a36Sopenharmony_ci * country_default: saved country for leaving 802.11d auto-country mode.
43162306a36Sopenharmony_ci * autocountry_default: initial country for 802.11d auto-country mode.
43262306a36Sopenharmony_ci * prb_resp_timeout: do not send prb resp if request older
43362306a36Sopenharmony_ci *		     than this, 0 = disable.
43462306a36Sopenharmony_ci * home_chanspec: shared home chanspec.
43562306a36Sopenharmony_ci * chanspec: target operational channel.
43662306a36Sopenharmony_ci * usr_fragthresh: user configured fragmentation threshold.
43762306a36Sopenharmony_ci * fragthresh[NFIFO]: per-fifo fragmentation thresholds.
43862306a36Sopenharmony_ci * RTSThresh: 802.11 dot11RTSThreshold.
43962306a36Sopenharmony_ci * SRL: 802.11 dot11ShortRetryLimit.
44062306a36Sopenharmony_ci * LRL: 802.11 dot11LongRetryLimit.
44162306a36Sopenharmony_ci * SFBL: Short Frame Rate Fallback Limit.
44262306a36Sopenharmony_ci * LFBL: Long Frame Rate Fallback Limit.
44362306a36Sopenharmony_ci * shortslot: currently using 11g ShortSlot timing.
44462306a36Sopenharmony_ci * shortslot_override: 11g ShortSlot override.
44562306a36Sopenharmony_ci * include_legacy_erp: include Legacy ERP info elt ID 47 as well as g ID 42.
44662306a36Sopenharmony_ci * PLCPHdr_override: 802.11b Preamble Type override.
44762306a36Sopenharmony_ci * stf:
44862306a36Sopenharmony_ci * bcn_rspec: save bcn ratespec purpose.
44962306a36Sopenharmony_ci * tempsense_lasttime;
45062306a36Sopenharmony_ci * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM.
45162306a36Sopenharmony_ci * tx_duty_cycle_cck: maximum allowed duty cycle for CCK.
45262306a36Sopenharmony_ci * wiphy:
45362306a36Sopenharmony_ci * pri_scb: primary Station Control Block
45462306a36Sopenharmony_ci */
45562306a36Sopenharmony_cistruct brcms_c_info {
45662306a36Sopenharmony_ci	struct brcms_pub *pub;
45762306a36Sopenharmony_ci	struct brcms_info *wl;
45862306a36Sopenharmony_ci	struct brcms_hardware *hw;
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci	/* clock */
46162306a36Sopenharmony_ci	u16 fastpwrup_dly;
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci	/* interrupt */
46462306a36Sopenharmony_ci	u32 macintstatus;
46562306a36Sopenharmony_ci	u32 macintmask;
46662306a36Sopenharmony_ci	u32 defmacintmask;
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci	bool clk;
46962306a36Sopenharmony_ci
47062306a36Sopenharmony_ci	/* multiband */
47162306a36Sopenharmony_ci	struct brcms_core *core;
47262306a36Sopenharmony_ci	struct brcms_band *band;
47362306a36Sopenharmony_ci	struct brcms_core *corestate;
47462306a36Sopenharmony_ci	struct brcms_band *bandstate[MAXBANDS];
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci	/* packet queue */
47762306a36Sopenharmony_ci	uint qvalid;
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci	struct ampdu_info *ampdu;
48062306a36Sopenharmony_ci	struct antsel_info *asi;
48162306a36Sopenharmony_ci	struct brcms_cm_info *cmi;
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci	u16 vendorid;
48462306a36Sopenharmony_ci	u16 deviceid;
48562306a36Sopenharmony_ci	uint ucode_rev;
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci	u8 perm_etheraddr[ETH_ALEN];
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci	bool bandlocked;
49062306a36Sopenharmony_ci	bool bandinit_pending;
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci	bool radio_monitor;
49362306a36Sopenharmony_ci	bool going_down;
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci	bool beacon_template_virgin;
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci	struct brcms_timer *wdtimer;
49862306a36Sopenharmony_ci	struct brcms_timer *radio_timer;
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci	/* promiscuous */
50162306a36Sopenharmony_ci	uint filter_flags;
50262306a36Sopenharmony_ci
50362306a36Sopenharmony_ci	/* driver feature */
50462306a36Sopenharmony_ci	bool _rifs;
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci	/* AP-STA synchronization, power save */
50762306a36Sopenharmony_ci	u8 bcn_li_bcn;
50862306a36Sopenharmony_ci	u8 bcn_li_dtim;
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci	bool WDarmed;
51162306a36Sopenharmony_ci	u32 WDlast;
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ci	/* WME */
51462306a36Sopenharmony_ci	u16 edcf_txop[IEEE80211_NUM_ACS];
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci	u16 wme_retries[IEEE80211_NUM_ACS];
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci	struct brcms_bss_cfg *bsscfg;
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci	struct modulecb *modulecb;
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ci	u8 mimoft;
52362306a36Sopenharmony_ci	s8 cck_40txbw;
52462306a36Sopenharmony_ci	s8 ofdm_40txbw;
52562306a36Sopenharmony_ci	s8 mimo_40txbw;
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci	struct brcms_bss_info *default_bss;
52862306a36Sopenharmony_ci
52962306a36Sopenharmony_ci	u16 mc_fid_counter;
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci	char country_default[BRCM_CNTRY_BUF_SZ];
53262306a36Sopenharmony_ci	char autocountry_default[BRCM_CNTRY_BUF_SZ];
53362306a36Sopenharmony_ci	u16 prb_resp_timeout;
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_ci	u16 home_chanspec;
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci	/* PHY parameters */
53862306a36Sopenharmony_ci	u16 chanspec;
53962306a36Sopenharmony_ci	u16 usr_fragthresh;
54062306a36Sopenharmony_ci	u16 fragthresh[NFIFO];
54162306a36Sopenharmony_ci	u16 RTSThresh;
54262306a36Sopenharmony_ci	u16 SRL;
54362306a36Sopenharmony_ci	u16 LRL;
54462306a36Sopenharmony_ci	u16 SFBL;
54562306a36Sopenharmony_ci	u16 LFBL;
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci	/* network config */
54862306a36Sopenharmony_ci	bool shortslot;
54962306a36Sopenharmony_ci	s8 shortslot_override;
55062306a36Sopenharmony_ci	bool include_legacy_erp;
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci	struct brcms_protection *protection;
55362306a36Sopenharmony_ci	s8 PLCPHdr_override;
55462306a36Sopenharmony_ci
55562306a36Sopenharmony_ci	struct brcms_stf *stf;
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ci	u32 bcn_rspec;
55862306a36Sopenharmony_ci
55962306a36Sopenharmony_ci	uint tempsense_lasttime;
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci	u16 tx_duty_cycle_ofdm;
56262306a36Sopenharmony_ci	u16 tx_duty_cycle_cck;
56362306a36Sopenharmony_ci
56462306a36Sopenharmony_ci	struct wiphy *wiphy;
56562306a36Sopenharmony_ci	struct scb pri_scb;
56662306a36Sopenharmony_ci	struct ieee80211_vif *vif;
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci	struct sk_buff *beacon;
56962306a36Sopenharmony_ci	u16 beacon_tim_offset;
57062306a36Sopenharmony_ci	u16 beacon_dtim_period;
57162306a36Sopenharmony_ci	struct sk_buff *probe_resp;
57262306a36Sopenharmony_ci};
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci/* antsel module specific state */
57562306a36Sopenharmony_cistruct antsel_info {
57662306a36Sopenharmony_ci	struct brcms_c_info *wlc;	/* pointer to main wlc structure */
57762306a36Sopenharmony_ci	struct brcms_pub *pub;		/* pointer to public fn */
57862306a36Sopenharmony_ci	u8 antsel_type;	/* Type of boardlevel mimo antenna switch-logic
57962306a36Sopenharmony_ci				 * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board
58062306a36Sopenharmony_ci				 */
58162306a36Sopenharmony_ci	u8 antsel_antswitch;	/* board level antenna switch type */
58262306a36Sopenharmony_ci	bool antsel_avail;	/* Ant selection availability (SROM based) */
58362306a36Sopenharmony_ci	struct brcms_antselcfg antcfg_11n; /* antenna configuration */
58462306a36Sopenharmony_ci	struct brcms_antselcfg antcfg_cur; /* current antenna config (auto) */
58562306a36Sopenharmony_ci};
58662306a36Sopenharmony_ci
58762306a36Sopenharmony_cienum brcms_bss_type {
58862306a36Sopenharmony_ci	BRCMS_TYPE_STATION,
58962306a36Sopenharmony_ci	BRCMS_TYPE_AP,
59062306a36Sopenharmony_ci	BRCMS_TYPE_ADHOC,
59162306a36Sopenharmony_ci};
59262306a36Sopenharmony_ci
59362306a36Sopenharmony_ci/*
59462306a36Sopenharmony_ci * BSS configuration state
59562306a36Sopenharmony_ci *
59662306a36Sopenharmony_ci * wlc: wlc to which this bsscfg belongs to.
59762306a36Sopenharmony_ci * type: interface type
59862306a36Sopenharmony_ci * SSID_len: the length of SSID
59962306a36Sopenharmony_ci * SSID: SSID string
60062306a36Sopenharmony_ci *
60162306a36Sopenharmony_ci *
60262306a36Sopenharmony_ci * BSSID: BSSID (associated)
60362306a36Sopenharmony_ci * cur_etheraddr: h/w address
60462306a36Sopenharmony_ci * flags: BSSCFG flags; see below
60562306a36Sopenharmony_ci *
60662306a36Sopenharmony_ci * current_bss: BSS parms in ASSOCIATED state
60762306a36Sopenharmony_ci *
60862306a36Sopenharmony_ci *
60962306a36Sopenharmony_ci * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation
61062306a36Sopenharmony_ci */
61162306a36Sopenharmony_cistruct brcms_bss_cfg {
61262306a36Sopenharmony_ci	struct brcms_c_info *wlc;
61362306a36Sopenharmony_ci	enum brcms_bss_type type;
61462306a36Sopenharmony_ci	u8 SSID_len;
61562306a36Sopenharmony_ci	u8 SSID[IEEE80211_MAX_SSID_LEN];
61662306a36Sopenharmony_ci	u8 BSSID[ETH_ALEN];
61762306a36Sopenharmony_ci	struct brcms_bss_info *current_bss;
61862306a36Sopenharmony_ci};
61962306a36Sopenharmony_ci
62062306a36Sopenharmony_ciint brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p);
62162306a36Sopenharmony_ciint brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
62262306a36Sopenharmony_ci			   uint *blocks);
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ciint brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config);
62562306a36Sopenharmony_civoid brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags);
62662306a36Sopenharmony_ciu16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, uint mac_len);
62762306a36Sopenharmony_ciu32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,
62862306a36Sopenharmony_ci			       bool use_rspec, u16 mimo_ctlchbw);
62962306a36Sopenharmony_ciu16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only,
63062306a36Sopenharmony_ci			       u32 rts_rate, u32 frame_rate,
63162306a36Sopenharmony_ci			       u8 rts_preamble_type, u8 frame_preamble_type,
63262306a36Sopenharmony_ci			       uint frame_len, bool ba);
63362306a36Sopenharmony_civoid brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
63462306a36Sopenharmony_ci			    struct ieee80211_sta *sta, void (*dma_callback_fn));
63562306a36Sopenharmony_civoid brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend);
63662306a36Sopenharmony_ciint brcms_c_set_nmode(struct brcms_c_info *wlc);
63762306a36Sopenharmony_civoid brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, u32 bcn_rate);
63862306a36Sopenharmony_civoid brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type);
63962306a36Sopenharmony_civoid brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,
64062306a36Sopenharmony_ci			  bool mute, struct txpwr_limits *txpwr);
64162306a36Sopenharmony_civoid brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v);
64262306a36Sopenharmony_ciu16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset);
64362306a36Sopenharmony_civoid brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val,
64462306a36Sopenharmony_ci		 int bands);
64562306a36Sopenharmony_civoid brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags);
64662306a36Sopenharmony_civoid brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val);
64762306a36Sopenharmony_civoid brcms_b_phy_reset(struct brcms_hardware *wlc_hw);
64862306a36Sopenharmony_civoid brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw);
64962306a36Sopenharmony_civoid brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw);
65062306a36Sopenharmony_civoid brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw,
65162306a36Sopenharmony_ci				     u32 override_bit);
65262306a36Sopenharmony_civoid brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
65362306a36Sopenharmony_ci				       u32 override_bit);
65462306a36Sopenharmony_civoid brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset,
65562306a36Sopenharmony_ci				int len, void *buf);
65662306a36Sopenharmony_ciu16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate);
65762306a36Sopenharmony_civoid brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset,
65862306a36Sopenharmony_ci			   const void *buf, int len, u32 sel);
65962306a36Sopenharmony_civoid brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset,
66062306a36Sopenharmony_ci			     void *buf, int len, u32 sel);
66162306a36Sopenharmony_civoid brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode);
66262306a36Sopenharmony_ciu16 brcms_b_get_txant(struct brcms_hardware *wlc_hw);
66362306a36Sopenharmony_civoid brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk);
66462306a36Sopenharmony_civoid brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk);
66562306a36Sopenharmony_civoid brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);
66662306a36Sopenharmony_civoid brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant);
66762306a36Sopenharmony_civoid brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode);
66862306a36Sopenharmony_civoid brcms_c_init_scb(struct scb *scb);
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ci#endif				/* _BRCM_MAIN_H_ */
671