~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to drivers/staging/brcm80211/brcmsmac/wlc_stf.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <bcmdefs.h>
23
23
#include <bcmutils.h>
24
 
#include <siutils.h>
 
24
#include <aiutils.h>
25
25
#include <wlioctl.h>
26
26
#include <bcmwifi.h>
 
27
#include <bcmnvram.h>
27
28
#include <sbhnddma.h>
28
29
 
29
30
#include "wlc_types.h"
69
70
 
70
71
static void wlc_stf_stbc_rx_ht_update(struct wlc_info *wlc, int val)
71
72
{
72
 
        ASSERT((val == HT_CAP_RX_STBC_NO)
73
 
               || (val == HT_CAP_RX_STBC_ONE_STREAM));
74
 
 
75
73
        /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */
76
74
        if (WLC_STF_SS_STBC_RX(wlc)) {
77
75
                if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO))
193
191
 
194
192
static int wlc_stf_txcore_set(struct wlc_info *wlc, u8 Nsts, u8 core_mask)
195
193
{
196
 
        WL_TRACE("wl%d: %s: Nsts %d core_mask %x\n",
197
 
                 wlc->pub->unit, __func__, Nsts, core_mask);
198
 
 
199
 
        ASSERT((Nsts > 0) && (Nsts <= MAX_STREAMS_SUPPORTED));
 
194
        BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
 
195
                 wlc->pub->unit, Nsts, core_mask);
200
196
 
201
197
        if (WLC_BITSCNT(core_mask) > wlc->stf->txstreams) {
202
198
                core_mask = 0;
208
204
                core_mask = wlc->stf->txchain;
209
205
        }
210
206
 
211
 
        ASSERT(!core_mask || Nsts <= WLC_BITSCNT(core_mask));
212
 
 
213
207
        wlc->stf->txcore[Nsts] = core_mask;
214
208
        /* Nsts = 1..4, txcore index = 1..4 */
215
209
        if (Nsts == 1) {
225
219
                }
226
220
        }
227
221
 
228
 
        return BCME_OK;
 
222
        return 0;
229
223
}
230
224
 
231
225
static int wlc_stf_spatial_policy_set(struct wlc_info *wlc, int val)
233
227
        int i;
234
228
        u8 core_mask = 0;
235
229
 
236
 
        WL_TRACE("wl%d: %s: val %x\n", wlc->pub->unit, __func__, val);
 
230
        BCMMSG(wlc->wiphy, "wl%d: val %x\n", wlc->pub->unit, val);
237
231
 
238
232
        wlc->stf->spatial_policy = (s8) val;
239
233
        for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) {
241
235
                    wlc->stf->txchain : txcore_default[i];
242
236
                wlc_stf_txcore_set(wlc, (u8) i, core_mask);
243
237
        }
244
 
        return BCME_OK;
 
238
        return 0;
245
239
}
246
240
 
247
241
int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force)
251
245
        uint i;
252
246
 
253
247
        if (wlc->stf->txchain == txchain)
254
 
                return BCME_OK;
 
248
                return 0;
255
249
 
256
250
        if ((txchain & ~wlc->stf->hw_txchain)
257
251
            || !(txchain & wlc->stf->hw_txchain))
258
 
                return BCME_RANGE;
 
252
                return -EINVAL;
259
253
 
260
254
        /* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */
261
255
        txstreams = (u8) WLC_BITSCNT(txchain);
262
256
        if (txstreams > MAX_STREAMS_SUPPORTED)
263
 
                return BCME_RANGE;
 
257
                return -EINVAL;
264
258
 
265
259
        if (txstreams == 1) {
266
260
                for (i = 0; i < NBANDS(wlc); i++)
269
263
                            || (RSPEC_STF(wlc->bandstate[i]->mrspec_override) !=
270
264
                                PHY_TXC1_MODE_SISO)) {
271
265
                                if (!force)
272
 
                                        return BCME_ERROR;
 
266
                                        return -EBADE;
273
267
 
274
268
                                /* over-write the override rspec */
275
269
                                if (RSPEC_STF(wlc->bandstate[i]->rspec_override)
276
270
                                    != PHY_TXC1_MODE_SISO) {
277
271
                                        wlc->bandstate[i]->rspec_override = 0;
278
 
                                        WL_ERROR("%s(): temp sense override non-SISO rspec_override\n",
279
 
                                                 __func__);
 
272
                                        wiphy_err(wlc->wiphy, "%s(): temp "
 
273
                                                  "sense override non-SISO "
 
274
                                                  "rspec_override\n",
 
275
                                                  __func__);
280
276
                                }
281
277
                                if (RSPEC_STF
282
278
                                    (wlc->bandstate[i]->mrspec_override) !=
283
279
                                    PHY_TXC1_MODE_SISO) {
284
280
                                        wlc->bandstate[i]->mrspec_override = 0;
285
 
                                        WL_ERROR("%s(): temp sense override non-SISO mrspec_override\n",
286
 
                                                 __func__);
 
281
                                        wiphy_err(wlc->wiphy, "%s(): temp "
 
282
                                                  "sense override non-SISO "
 
283
                                                  "mrspec_override\n",
 
284
                                                  __func__);
287
285
                                }
288
286
                        }
289
287
        }
303
301
        for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++)
304
302
                wlc_stf_txcore_set(wlc, (u8) i, txcore_default[i]);
305
303
 
306
 
        return BCME_OK;
 
304
        return 0;
307
305
}
308
306
 
309
307
/* update wlc->stf->ss_opmode which represents the operational stf_ss mode we're using */
319
317
        if (WLC_STBC_CAP_PHY(wlc) &&
320
318
            wlc->stf->ss_algosel_auto
321
319
            && (wlc->stf->ss_algo_channel != (u16) -1)) {
322
 
                ASSERT(isset(&wlc->stf->ss_algo_channel, PHY_TXC1_MODE_CDD)
323
 
                       || isset(&wlc->stf->ss_algo_channel,
324
 
                                PHY_TXC1_MODE_SISO));
325
320
                upd_stf_ss = (wlc->stf->no_cddstbc || (wlc->stf->txstreams == 1)
326
321
                              || isset(&wlc->stf->ss_algo_channel,
327
322
                                       PHY_TXC1_MODE_SISO)) ? PHY_TXC1_MODE_SISO
371
366
 
372
367
int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val)
373
368
{
374
 
        int bcmerror = BCME_OK;
 
369
        int bcmerror = 0;
375
370
 
376
371
        /* when there is only 1 tx_streams, don't allow to change the txant */
377
372
        if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1))
378
 
                return ((val == wlc->stf->txant) ? bcmerror : BCME_RANGE);
 
373
                return ((val == wlc->stf->txant) ? bcmerror : -EINVAL);
379
374
 
380
375
        switch (val) {
381
376
        case -1:
391
386
                val = ANT_TX_LAST_RX;
392
387
                break;
393
388
        default:
394
 
                bcmerror = BCME_RANGE;
 
389
                bcmerror = -EINVAL;
395
390
                break;
396
391
        }
397
392
 
398
 
        if (bcmerror == BCME_OK)
 
393
        if (bcmerror == 0)
399
394
                wlc->stf->txant = (s8) val;
400
395
 
401
396
        return bcmerror;
421
416
        s8 txant;
422
417
 
423
418
        txant = (s8) wlc->stf->txant;
424
 
        ASSERT(txant == ANT_TX_FORCE_0 || txant == ANT_TX_FORCE_1
425
 
               || txant == ANT_TX_LAST_RX);
426
 
 
427
419
        if (WLC_PHY_11N_CAP(wlc->band)) {
428
420
                if (txant == ANT_TX_FORCE_0) {
429
421
                        wlc->stf->phytxant = PHY_TXC_ANT_0;
439
431
                        if (WLCISLCNPHY(wlc->band) || WLCISSSLPNPHY(wlc->band))
440
432
                                wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST;
441
433
                        else {
442
 
                                /* keep this assert to catch out of sync wlc->stf->txcore */
443
 
                                ASSERT(wlc->stf->txchain > 0);
 
434
                                /* catch out of sync wlc->stf->txcore */
 
435
                                WARN_ON(wlc->stf->txchain <= 0);
444
436
                                wlc->stf->phytxant =
445
437
                                    wlc->stf->txchain << PHY_TXC_ANT_SHIFT;
446
438
                        }
504
496
        u16 phytxant = wlc->stf->phytxant;
505
497
 
506
498
        if (RSPEC_STF(rspec) != PHY_TXC1_MODE_SISO) {
507
 
                ASSERT(wlc->stf->txstreams > 1);
508
499
                phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT;
509
500
        } else if (wlc->stf->txant == ANT_TX_DEF)
510
501
                phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT;
524
515
 
525
516
        /* for non-siso rates or default setting, use the available chains */
526
517
        if (WLCISNPHY(wlc->band)) {
527
 
                ASSERT(wlc->stf->txchain != 0);
528
518
                phytxant = _wlc_stf_phytxchain_sel(wlc, rspec);
529
519
                mask = PHY_TXC_HTANT_MASK;
530
520
        }