003 File Manager
Current Path:
/usr/src/sys/contrib/dev/ath/ath_hal/ar9300
usr
/
src
/
sys
/
contrib
/
dev
/
ath
/
ath_hal
/
ar9300
/
📁
..
📄
ar9300.h
(73.54 KB)
📄
ar9300_aic.c
(25.58 KB)
📄
ar9300_ani.c
(49.8 KB)
📄
ar9300_aphrodite10.ini
(59.29 KB)
📄
ar9300_attach.c
(174.66 KB)
📄
ar9300_beacon.c
(7.28 KB)
📄
ar9300_devid.h
(3.01 KB)
📄
ar9300_eeprom.c
(163.03 KB)
📄
ar9300_freebsd.c
(28.11 KB)
📄
ar9300_freebsd.h
(4 KB)
📄
ar9300_freebsd_inc.h
(11.58 KB)
📄
ar9300_gpio.c
(20.62 KB)
📄
ar9300_interrupts.c
(26.58 KB)
📄
ar9300_jupiter10.ini
(71.26 KB)
📄
ar9300_jupiter20.ini
(77.96 KB)
📄
ar9300_keycache.c
(21.45 KB)
📄
ar9300_mci.c
(72.45 KB)
📄
ar9300_misc.c
(137.4 KB)
📄
ar9300_osprey22.ini
(103.16 KB)
📄
ar9300_osprey22_scoemu.ini
(98.42 KB)
📄
ar9300_paprd.c
(95.21 KB)
📄
ar9300_phy.c
(46.46 KB)
📄
ar9300_power.c
(52.81 KB)
📄
ar9300_radar.c
(19.78 KB)
📄
ar9300_radio.c
(9.69 KB)
📄
ar9300_raw_adc_capture.c
(1.36 KB)
📄
ar9300_recv.c
(9.57 KB)
📄
ar9300_recv_ds.c
(7.81 KB)
📄
ar9300_reset.c
(225.67 KB)
📄
ar9300_rtt.c
(1020 B)
📄
ar9300_sim.c
(804 B)
📄
ar9300_sim.h
(871 B)
📄
ar9300_spectral.c
(19.97 KB)
📄
ar9300_stub.c
(7.26 KB)
📄
ar9300_stub.h
(145 B)
📄
ar9300_stub_funcs.c
(22.62 KB)
📄
ar9300_stub_funcs.h
(12.75 KB)
📄
ar9300_timer.c
(5.59 KB)
📄
ar9300_tx99_tgt.c
(31.81 KB)
📄
ar9300_txbf.c
(1017 B)
📄
ar9300_txbf.h
(856 B)
📄
ar9300_txbf_cal.c
(937 B)
📄
ar9300_xmit.c
(32.01 KB)
📄
ar9300_xmit_ds.c
(28.62 KB)
📄
ar9300desc.h
(21.6 KB)
📄
ar9300eep.h
(28.6 KB)
📄
ar9300paprd.h
(1.72 KB)
📄
ar9300phy.h
(94.99 KB)
📄
ar9300radar.h
(1.83 KB)
📄
ar9300reg.h
(153.77 KB)
📄
ar9300template_ap121.h
(22.42 KB)
📄
ar9300template_aphrodite.h
(22.17 KB)
📄
ar9300template_cus157.h
(21.77 KB)
📄
ar9300template_generic.h
(22.15 KB)
📄
ar9300template_hb112.h
(22.49 KB)
📄
ar9300template_hb116.h
(22.45 KB)
📄
ar9300template_osprey_k31.h
(22.51 KB)
📄
ar9300template_wasp_2.h
(21.97 KB)
📄
ar9300template_wasp_k31.h
(21.93 KB)
📄
ar9300template_xb112.h
(22.58 KB)
📄
ar9300template_xb113.h
(22.4 KB)
📄
ar9330_11.ini
(62.51 KB)
📄
ar9330_12.ini
(58.84 KB)
📄
ar9340.ini
(117.7 KB)
📄
ar9462_2p0_initvals.h
(42.75 KB)
📄
ar9462_2p1_initvals.h
(10.28 KB)
📄
ar9485.ini
(63.9 KB)
📄
ar9485_1_1.ini
(62.75 KB)
📄
ar953x.ini
(46.38 KB)
📄
ar955x.ini
(75.5 KB)
📄
ar9580.ini
(109.06 KB)
📄
eeprom.diff
(10.13 KB)
📄
osprey_reg_map.h
(227.66 KB)
📄
osprey_reg_map_macro.h
(3.91 MB)
📄
poseidon_reg_map_macro.h
(213.28 KB)
📄
scorpion_reg_map.h
(98.86 KB)
📄
scorpion_reg_map_macro.h
(3.11 MB)
📄
sources
(1.73 KB)
📄
wasp_reg_map.h
(4.55 KB)
Editing: eeprom.diff
/* * Copyright (c) 2013 Qualcomm Atheros, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ diff --git a/hal/ar9300/ar9300_eeprom.c b/hal/ar9300/ar9300_eeprom.c index 2fe5506..628026f 100644 --- a/hal/ar9300/ar9300_eeprom.c +++ b/hal/ar9300/ar9300_eeprom.c @@ -342,6 +342,8 @@ ar9300_otp_read(struct ath_hal *ah, u_int off, u_int32_t *data, HAL_BOOL is_wifi int status = 0; u_int32_t addr; + //ath_hal_printf(ah, "%s: reading offset 0x%x\n", __func__, off); + addr = (AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah))? OTP_MEM_START_ADDRESS_WASP : OTP_MEM_START_ADDRESS; if (!is_wifi) { @@ -372,6 +374,7 @@ ar9300_otp_read(struct ath_hal *ah, u_int off, u_int32_t *data, HAL_BOOL is_wifi addr = BTOTP_STATUS1_EFUSE_READ_DATA; } *data = OS_REG_READ(ah, addr); + //ath_hal_printf(ah, "%s: data=0x%x\n", __func__, *data); return AH_TRUE; } @@ -603,6 +606,8 @@ ar9300_eeprom_attach(struct ath_hal *ah) systime_t current_system_time = OS_GET_TIMESTAMP(); #endif #endif + + ath_hal_printf(ah, "%s: starting\n", __func__); ahp->try_dram = 1; ahp->try_eeprom = 1; ahp->try_otp = 1; @@ -679,10 +684,14 @@ ar9300_eeprom_attach(struct ath_hal *ah) #endif #endif + ath_hal_printf(ah, "%s: calling ar9300_fill_eeprom\n", __func__); if (!ar9300_fill_eeprom(ah)) { return HAL_EIO; } + ath_hal_printf(ah, "%s: calibration data type = %d\n", __func__, + AH9300(ah)->calibration_data_source); + return HAL_OK; /* return ar9300_check_eeprom(ah); */ #endif @@ -704,6 +713,7 @@ ar9300_eeprom_attach(struct ath_hal *ah) ahp->ah_eeprom.mac_addr[4] = 0xD0; ahp->ah_eeprom.mac_addr[5] = 0x00; #endif + ath_hal_printf(ah, "%s: %s:%d\n", __func__, __FILE__, __LINE__); return HAL_OK; #else #if ATH_DRIVER_SIM @@ -764,13 +774,17 @@ ar9300_eeprom_attach(struct ath_hal *ah) return HAL_OK; } #endif + ath_hal_printf(ah, "%s: %s:%d\n", __func__, __FILE__, __LINE__); if (AR_SREV_HORNET(ah) || AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) { ahp->try_eeprom = 0; } + ath_hal_printf(ah, "%s: %s:%d\n", __func__, __FILE__, __LINE__); if (!ar9300_eeprom_restore(ah)) { + ath_hal_printf(ah, "%s: %s:%d\n", __func__, __FILE__, __LINE__); return HAL_EIO; } + ath_hal_printf(ah, "%s: %s:%d\n", __func__, __FILE__, __LINE__); return HAL_OK; #endif #endif @@ -3743,6 +3757,12 @@ ar9300_calibration_data_read_otp(struct ath_hal *ah, long address, unsigned long byte_addr; u_int32_t svalue; + ath_hal_printf(ah, "%s: called: address=%d, many=%d, is_wifi=%d\n", + __func__, + (int) address, + many, + is_wifi); + if (((address) < 0) || ((address + many) > 0x400)) { return AH_FALSE; } @@ -3802,6 +3822,8 @@ ar9300_calibration_data_read_array(struct ath_hal *ah, int address, { int it; + ath_hal_printf(ah, "%s: address=%d, many=%d\n", __func__, address, many); + for (it = 0; it < many; it++) { (void)ar9300_calibration_data_read(ah, address - it, buffer + it, 1); } @@ -4001,13 +4023,24 @@ ar9300_eeprom_restore_internal_address(struct ath_hal *ah, int restored; u_int16_t checksum, mchecksum; + ath_hal_printf(ah, "%s: called, cptr=0x%x, mdata_size=%d, blank=%d\n", + __func__, cptr, mdata_size, blank); + restored = 0; for (it = 0; it < MSTATE; it++) { (void) ar9300_calibration_data_read_array( ah, cptr, word, compression_header_length); + ath_hal_printf(ah, "%s: word = 0x%x, 0x%x, 0x%x, 0x%x\n", + __func__, + word[0], + word[1], + word[2], + word[3]); if (word[0] == blank && word[1] == blank && word[2] == blank && word[3] == blank) { - break; + ath_hal_printf(ah, "%s: word=blank, skipping\n", __func__); + cptr -= compression_header_length; + continue; } ar9300_compression_header_unpack( word, &code, &reference, &length, &major, &minor); @@ -4143,19 +4176,18 @@ static int ar9300_eeprom_restore_from_dram(struct ath_hal *ah, ar9300_eeprom_t *mptr, int mdata_size) { -#if 0 struct ath_hal_9300 *ahp = AH9300(ah); char *cal_ptr; -#endif +#if 0 /* cal data in flash / DRAM isn't currently supported */ ath_hal_printf(ah, "%s: Cal data from DRAM isn't supported\n", __func__); return -1; +#endif #ifndef WIN32 -#if 0 HALASSERT(mdata_size > 0); /* if cal_in_flash is true, the address sent by LMAC to HAL @@ -4164,14 +4196,17 @@ ar9300_eeprom_restore_from_dram(struct ath_hal *ah, ar9300_eeprom_t *mptr, if(ar9300_eep_data_in_flash(ah)) return -1; +#if 0 /* check if LMAC sent DRAM address is valid */ if (!(uintptr_t)(AH_PRIVATE(ah)->ah_st)) { return -1; } +#endif /* When calibration data is from host, Host will copy the compressed data to the predefined DRAM location saved at ah->ah_st */ ath_hal_printf(ah, "Restoring Cal data from DRAM\n"); +#if 0 #ifdef __NetBSD__ ahp->ah_cal_mem = OS_REMAP(ah, (uintptr_t)(AH_PRIVATE(ah)->ah_st), HOST_CALDATA_SIZE); @@ -4184,6 +4219,20 @@ ar9300_eeprom_restore_from_dram(struct ath_hal *ah, ar9300_eeprom_t *mptr, HALDEBUG(ah, HAL_DEBUG_EEPROM,"%s: can't remap dram region\n", __func__); return -1; } +#endif + + /* + * The atheros HAL passes in this buffer anyway, and we copy things + * into it. However, the FreeBSD driver doesn't supply this + * particular memory. So, let's just assume attach/detach will + * provide us with a 16 kilobyte buffer for now, and hope the whole + * OTP path works. + */ + if (! ahp->ah_cal_mem) { + ath_hal_printf(ah, "%s: FreeBSD: ah_cal_mem isn't set\n", __func__); + return -1; + } + cal_ptr = &((char *)(ahp->ah_cal_mem))[AR9300_FLASH_CAL_START_OFFSET]; OS_MEMCPY(mptr, cal_ptr, mdata_size); @@ -4201,7 +4250,6 @@ ar9300_eeprom_restore_from_dram(struct ath_hal *ah, ar9300_eeprom_t *mptr, } return mdata_size; -#endif #else return -1; #endif @@ -4290,6 +4338,11 @@ ar9300_eeprom_restore_from_flash(struct ath_hal *ah, ar9300_eeprom_t *mptr, } #endif + ath_hal_printf(ah, "%s: eeprom version=%d, template version=%d\n", + __func__, + (int) mptr->eeprom_version, + (int) mptr->template_version); + if (mptr->eeprom_version == 0xff || mptr->template_version == 0xff || mptr->eeprom_version == 0 || @@ -4321,10 +4374,11 @@ ar9300_eeprom_restore_internal(struct ath_hal *ah, ar9300_eeprom_t *mptr, nptr = -1; - if ((AH9300(ah)->calibration_data_try == calibration_data_none || + if (0 && (AH9300(ah)->calibration_data_try == calibration_data_none || AH9300(ah)->calibration_data_try == calibration_data_dram) && AH9300(ah)->try_dram && nptr < 0) { + ath_hal_printf(ah, "%s: trying dram\n", __func__); AH9300(ah)->calibration_data_source = calibration_data_dram; AH9300(ah)->calibration_data_source_address = 0; nptr = ar9300_eeprom_restore_from_dram(ah, mptr, mdata_size); @@ -4334,7 +4388,7 @@ ar9300_eeprom_restore_internal(struct ath_hal *ah, ar9300_eeprom_t *mptr, } } - if ((AH9300(ah)->calibration_data_try == calibration_data_none || + if (0 && (AH9300(ah)->calibration_data_try == calibration_data_none || AH9300(ah)->calibration_data_try == calibration_data_eeprom) && AH9300(ah)->try_eeprom && nptr < 0) { @@ -4343,6 +4397,7 @@ ar9300_eeprom_restore_internal(struct ath_hal *ah, ar9300_eeprom_t *mptr, * base_address=0x3ff where we used to write the data */ AH9300(ah)->calibration_data_source = calibration_data_eeprom; + ath_hal_printf(ah, "%s: trying eeprom\n", __func__); if (AH9300(ah)->calibration_data_try_address != 0) { AH9300(ah)->calibration_data_source_address = AH9300(ah)->calibration_data_try_address; @@ -4374,7 +4429,7 @@ ar9300_eeprom_restore_internal(struct ath_hal *ah, ar9300_eeprom_t *mptr, * ##### should be an ifdef test for any AP usage, * either in driver or in nart */ - if ((AH9300(ah)->calibration_data_try == calibration_data_none || + if (0 && (AH9300(ah)->calibration_data_try == calibration_data_none || AH9300(ah)->calibration_data_try == calibration_data_flash) && AH9300(ah)->try_flash && nptr < 0) { @@ -4388,10 +4443,17 @@ ar9300_eeprom_restore_internal(struct ath_hal *ah, ar9300_eeprom_t *mptr, } } + /* XXX FreeBSD? */ + AH9300(ah)->calibration_data_try = calibration_data_otp; + AH9300(ah)->calibration_data_try_address = 0x2ff; + if ((AH9300(ah)->calibration_data_try == calibration_data_none || AH9300(ah)->calibration_data_try == calibration_data_otp) && AH9300(ah)->try_otp && nptr < 0) { + ath_hal_printf(ah, "%s: trying OTP, try_address=0x%x\n", + __func__, + AH9300(ah)->calibration_data_try_address); AH9300(ah)->calibration_data_source = calibration_data_otp; if (AH9300(ah)->calibration_data_try_address != 0) { AH9300(ah)->calibration_data_source_address = @@ -4526,6 +4588,8 @@ ar9300_eeprom_restore(struct ath_hal *ah) int mdata_size; HAL_BOOL status = AH_FALSE; + ath_hal_printf(ah, "%s: called\n", __func__); + mptr = &ahp->ah_eeprom; mdata_size = ar9300_eeprom_struct_size();
Upload File
Create Folder