17 #include <linux/slab.h>
25 #define ANT_SELCFG_AUTO 0x80
26 #define ANT_SELCFG_MASK 0x33
27 #define ANT_SELCFG_TX_UNICAST 0
28 #define ANT_SELCFG_RX_UNICAST 1
29 #define ANT_SELCFG_TX_DEF 2
30 #define ANT_SELCFG_RX_DEF 3
33 #define BRCMS_ANTSEL_11N_0(ant) ((((ant) & ANT_SELCFG_MASK) >> 4) & 0xf)
34 #define BRCMS_ANTSEL_11N_1(ant) (((ant) & ANT_SELCFG_MASK) & 0xf)
35 #define BRCMS_ANTIDX_11N(ant) (((BRCMS_ANTSEL_11N_0(ant)) << 2) +\
36 (BRCMS_ANTSEL_11N_1(ant)))
37 #define BRCMS_ANT_ISAUTO_11N(ant) (((ant) & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO)
38 #define BRCMS_ANTSEL_11N(ant) ((ant) & ANT_SELCFG_MASK)
42 #define ANT_SELCFG_DEF_2x2 0x01
45 #define ANT_SELCFG_NUM_2x3 3
46 #define ANT_SELCFG_DEF_2x3 0x01
49 #define ANT_SELCFG_NUM_2x4 4
50 #define ANT_SELCFG_DEF_2x4 0x02
52 static const u16 mimo_2x4_div_antselpat_tbl[] = {
59 static const u8 mimo_2x4_div_antselid_tbl[16] = {
60 0, 0, 0, 0, 0, 2, 3, 0,
61 0, 0, 1, 0, 0, 0, 0, 0
64 static const u16 mimo_2x3_div_antselpat_tbl[] = {
71 static const u8 mimo_2x3_div_antselid_tbl[16] = {
72 0, 1, 2, 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0, 0, 0, 0
111 struct ssb_sprom *sprom = &wlc->
hw->d11core->bus->sprom;
141 "board cfg invalid\n");
148 }
else if ((asi->
pub->sromrev == 4) &&
163 brcms_c_antsel_init_cfg(asi, &asi->
antcfg_11n,
true);
164 brcms_c_antsel_init_cfg(asi, &asi->
antcfg_cur,
true);
178 static u16 brcms_c_antsel_antcfg2antsel(
struct antsel_info *asi,
u8 ant_cfg)
185 mimo_antsel = (mimo_2x4_div_antselpat_tbl[
idx] & 0xf);
190 mimo_antsel = (mimo_2x3_div_antselpat_tbl[
idx] & 0xf);
198 static int brcms_c_antsel_cfgupd(
struct antsel_info *asi,
209 mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
221 mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
246 antcfg = (((
id & 0x2) << 3) | ((
id & 0x1) + 2));
251 antcfg = (((
id & 0x02) << 4) | ((
id & 0x1) + 1));
260 u8 antselid,
u8 fbantselid,
u8 *antcfg,
279 *antcfg = brcms_c_antsel_id2antcfg(asi, antselid);
280 *fbantcfg = brcms_c_antsel_id2antcfg(asi, fbantselid);
297 antselid = mimo_2x4_div_antselid_tbl[(antsel & 0xf)];
302 antselid = mimo_2x3_div_antselid_tbl[(antsel & 0xf)];