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#include "ah.h" 22#include "ah_internal.h" 23#include "ah_devid.h" 24 25#include "ar5212/ar5212.h" 26#include "ar5212/ar5212reg.h" 27#include "ar5212/ar5212phy.h" |
28 29#define AH_5212_COMMON 30#include "ar5212/ar5212.ini" 31 32static const struct ath_hal_private ar5212hal = {{ 33 .ah_magic = AR5212_MAGIC, 34 .ah_abi = HAL_ABI_VERSION, 35 .ah_countryCode = CTRY_DEFAULT, --- 280 unchanged lines hidden (view full) --- 316 return AH_TRUE; 317 return AH_FALSE; 318#undef N 319} 320 321/* 322 * Attach for an AR5212 part. 323 */ |
324static struct ath_hal * |
325ar5212Attach(uint16_t devid, HAL_SOFTC sc, 326 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status) 327{ 328#define AH_EEPROM_PROTECT(ah) \ 329 (IS_PCIE(ah) ? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT) 330 struct ath_hal_5212 *ahp; 331 struct ath_hal *ah; |
332 struct ath_hal_rf *rf; |
333 uint32_t val; 334 uint16_t eeval; 335 HAL_STATUS ecode; |
336 337 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n", 338 __func__, sc, (void*) st, (void*) sh); 339 340 /* NB: memory is returned zero'd */ 341 ahp = ath_hal_malloc(sizeof (struct ath_hal_5212)); 342 if (ahp == AH_NULL) { 343 HALDEBUG(AH_NULL, HAL_DEBUG_ANY, --- 55 unchanged lines hidden (view full) --- 399 /* 400 * Set correct Baseband to analog shift 401 * setting to access analog chips. 402 */ 403 OS_REG_WRITE(ah, AR_PHY(0), 0x00000007); 404 405 /* Read Radio Chip Rev Extract */ 406 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah); |
407 408 rf = ath_hal_rfprobe(ah, &ecode); 409 if (rf == AH_NULL) 410 goto bad; 411 |
412 /* NB: silently accept anything in release code per Atheros */ 413 switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) { 414 case AR_RAD5111_SREV_MAJOR: 415 case AR_RAD5112_SREV_MAJOR: 416 case AR_RAD2112_SREV_MAJOR: 417 case AR_RAD2111_SREV_MAJOR: 418 case AR_RAD2413_SREV_MAJOR: 419 case AR_RAD5413_SREV_MAJOR: --- 121 unchanged lines hidden (view full) --- 541 */ 542 if (!ar5212FillCapabilityInfo(ah)) { 543 HALDEBUG(ah, HAL_DEBUG_ANY, 544 "%s: failed ar5212FillCapabilityInfo\n", __func__); 545 ecode = HAL_EEREAD; 546 goto bad; 547 } 548 |
549 if (!rf->attach(ah, &ecode)) { |
550 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: RF setup failed, status %u\n", 551 __func__, ecode); 552 goto bad; 553 } 554 /* 555 * Set noise floor adjust method; we arrange a 556 * direct call instead of thunking. 557 */ --- 278 unchanged lines hidden (view full) --- 836 837 pCap->halTstampPrecision = 15; 838 839 return AH_TRUE; 840#undef IS_COBRA 841#undef IS_GRIFFIN_LITE 842#undef AR_KEYTABLE_SIZE 843} |
844 845static const char* 846ar5212Probe(uint16_t vendorid, uint16_t devid) 847{ 848 if (vendorid == ATHEROS_VENDOR_ID || 849 vendorid == ATHEROS_3COM_VENDOR_ID || 850 vendorid == ATHEROS_3COM2_VENDOR_ID) { 851 switch (devid) { 852 case AR5212_FPGA: 853 return "Atheros 5212 (FPGA)"; 854 case AR5212_DEVID: 855 case AR5212_DEVID_IBM: 856 case AR5212_DEFAULT: 857 return "Atheros 5212"; 858 case AR5212_AR2413: 859 return "Atheros 2413"; 860 case AR5212_AR2417: 861 return "Atheros 2417"; 862 case AR5212_AR5413: 863 return "Atheros 5413"; 864 case AR5212_AR5424: 865 return "Atheros 5424/2424"; 866 } 867 } 868 return AH_NULL; 869} 870AH_CHIP(ar5212, ar5212Probe, ar5212Attach); |