Deleted Added
sdiff udiff text old ( 185380 ) new ( 185406 )
full compact
1/*
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2008 Atheros Communications, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *

--- 4 unchanged lines hidden (view full) ---

13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * $Id: ar5212_attach.c,v 1.18 2008/11/19 22:10:42 sam Exp $
18 */
19#include "opt_ah.h"
20
21#ifdef AH_SUPPORT_AR5212
22
23#if !defined(AH_SUPPORT_5112) && \
24 !defined(AH_SUPPORT_5111) && \
25 !defined(AH_SUPPORT_2413) && \
26 !defined(AH_SUPPORT_5413) && \
27 !defined(AH_SUPPORT_AR5312)
28#error "No 5212 RF support defined"
29#endif
30
31#include "ah.h"
32#include "ah_internal.h"
33#include "ah_devid.h"
34
35#include "ar5212/ar5212.h"
36#include "ar5212/ar5212reg.h"
37#include "ar5212/ar5212phy.h"
38#ifdef AH_SUPPORT_AR5311
39#include "ar5212/ar5311reg.h"
40#endif
41
42#define AH_5212_COMMON
43#include "ar5212/ar5212.ini"
44
45static const struct ath_hal_private ar5212hal = {{
46 .ah_magic = AR5212_MAGIC,
47 .ah_abi = HAL_ABI_VERSION,
48 .ah_countryCode = CTRY_DEFAULT,

--- 280 unchanged lines hidden (view full) ---

329 return AH_TRUE;
330 return AH_FALSE;
331#undef N
332}
333
334/*
335 * Attach for an AR5212 part.
336 */
337struct ath_hal *
338ar5212Attach(uint16_t devid, HAL_SOFTC sc,
339 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
340{
341#define AH_EEPROM_PROTECT(ah) \
342 (IS_PCIE(ah) ? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT)
343 struct ath_hal_5212 *ahp;
344 struct ath_hal *ah;
345 uint32_t val;
346 uint16_t eeval;
347 HAL_STATUS ecode;
348 HAL_BOOL rfStatus;
349
350 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
351 __func__, sc, (void*) st, (void*) sh);
352
353 /* NB: memory is returned zero'd */
354 ahp = ath_hal_malloc(sizeof (struct ath_hal_5212));
355 if (ahp == AH_NULL) {
356 HALDEBUG(AH_NULL, HAL_DEBUG_ANY,

--- 55 unchanged lines hidden (view full) ---

412 /*
413 * Set correct Baseband to analog shift
414 * setting to access analog chips.
415 */
416 OS_REG_WRITE(ah, AR_PHY(0), 0x00000007);
417
418 /* Read Radio Chip Rev Extract */
419 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah);
420 /* NB: silently accept anything in release code per Atheros */
421 switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) {
422 case AR_RAD5111_SREV_MAJOR:
423 case AR_RAD5112_SREV_MAJOR:
424 case AR_RAD2112_SREV_MAJOR:
425 case AR_RAD2111_SREV_MAJOR:
426 case AR_RAD2413_SREV_MAJOR:
427 case AR_RAD5413_SREV_MAJOR:

--- 121 unchanged lines hidden (view full) ---

549 */
550 if (!ar5212FillCapabilityInfo(ah)) {
551 HALDEBUG(ah, HAL_DEBUG_ANY,
552 "%s: failed ar5212FillCapabilityInfo\n", __func__);
553 ecode = HAL_EEREAD;
554 goto bad;
555 }
556
557 rfStatus = AH_FALSE;
558 if (IS_5413(ah)) {
559#ifdef AH_SUPPORT_5413
560 rfStatus = ar5413RfAttach(ah, &ecode);
561#else
562 ecode = HAL_ENOTSUPP;
563#endif
564 }
565 else if (IS_2413(ah))
566#ifdef AH_SUPPORT_2413
567 rfStatus = ar2413RfAttach(ah, &ecode);
568#else
569 ecode = HAL_ENOTSUPP;
570#endif
571 else if (IS_RAD5112(ah))
572#ifdef AH_SUPPORT_5112
573 rfStatus = ar5112RfAttach(ah, &ecode);
574#else
575 ecode = HAL_ENOTSUPP;
576#endif
577 else if (IS_2425(ah) || IS_2417(ah))
578#ifdef AH_SUPPORT_2425
579 rfStatus = ar2425RfAttach(ah, &ecode);
580#else
581 ecode = HAL_ENOTSUPP;
582#endif
583 else if (IS_RAD5111(ah))
584#ifdef AH_SUPPORT_5111
585 rfStatus = ar5111RfAttach(ah, &ecode);
586#else
587 ecode = HAL_ENOTSUPP;
588#endif
589 if (!rfStatus) {
590 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: RF setup failed, status %u\n",
591 __func__, ecode);
592 goto bad;
593 }
594 /*
595 * Set noise floor adjust method; we arrange a
596 * direct call instead of thunking.
597 */

--- 278 unchanged lines hidden (view full) ---

876
877 pCap->halTstampPrecision = 15;
878
879 return AH_TRUE;
880#undef IS_COBRA
881#undef IS_GRIFFIN_LITE
882#undef AR_KEYTABLE_SIZE
883}
884#endif /* AH_SUPPORT_AR5212 */