Path: blob/main/sys/dev/ath/ath_hal/ah_eeprom_v1.h
39537 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2008 Sam Leffler, Errno Consulting4* Copyright (c) 2002-2008 Atheros Communications, Inc.5*6* Permission to use, copy, modify, and/or distribute this software for any7* purpose with or without fee is hereby granted, provided that the above8* copyright notice and this permission notice appear in all copies.9*10* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES11* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF12* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR13* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES14* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN15* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF16* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.17*/18#ifndef _ATH_AH_EEPROM_V1_H_19#define _ATH_AH_EEPROM_V1_H_2021#include "ah_eeprom.h"2223/*24* EEPROM defines for Version 1 Crete EEPROM.25*26* The EEPROM is segmented into three sections:27*28* PCI/Cardbus default configuration settings29* Cardbus CIS tuples and vendor-specific data30* Atheros-specific data31*32* EEPROM entries are read 32-bits at a time through the PCI bus33* interface but are all 16-bit values.34*35* Access to the Atheros-specific data is controlled by protection36* bits and the data is checksum'd. The driver reads the Atheros37* data from the EEPROM at attach and caches it in its private state.38* This data includes the local regulatory domain, channel calibration39* settings, and phy-related configuration settings.40*/41#define AR_EEPROM_MAC(i) (0x1f-(i))/* MAC address word */42#define AR_EEPROM_MAGIC 0x3d /* magic number */43#define AR_EEPROM_PROTECT 0x3f /* Atheros segment protect register */44#define AR_EEPROM_PROTOTECT_WP_128_191 0x8045#define AR_EEPROM_REG_DOMAIN 0xbf /* Current regulatory domain register */46#define AR_EEPROM_ATHEROS_BASE 0xc0 /* Base of Atheros-specific data */47#define AR_EEPROM_ATHEROS_MAX 64 /* 64x2=128 bytes of EEPROM settings */48#define AR_EEPROM_ATHEROS(n) (AR_EEPROM_ATHEROS_BASE+(n))49#define AR_EEPROM_VERSION AR_EEPROM_ATHEROS(1)50#define AR_EEPROM_ATHEROS_TP_SETTINGS 0x09 /* Transmit power settings */51#define AR_REG_DOMAINS_MAX 4 /* # of Regulatory Domains */52#define AR_CHANNELS_MAX 5 /* # of Channel calibration groups */53#define AR_TP_SETTINGS_SIZE 11 /* # locations/Channel group */54#define AR_TP_SCALING_ENTRIES 11 /* # entries in transmit power dBm->pcdac */5556/*57* NB: we store the rfsilent select+polarity data packed58* with the encoding used in later parts so values59* returned to applications are consistent.60*/61#define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c62#define AR_EEPROM_RFSILENT_GPIO_SEL_S 263#define AR_EEPROM_RFSILENT_POLARITY 0x000264#define AR_EEPROM_RFSILENT_POLARITY_S 16566#define AR_I2DBM(x) ((uint8_t)((x * 2) + 3))6768/*69* Transmit power and channel calibration settings.70*/71struct tpcMap {72uint8_t pcdac[AR_TP_SCALING_ENTRIES];73uint8_t gainF[AR_TP_SCALING_ENTRIES];74uint8_t rate36;75uint8_t rate48;76uint8_t rate54;77uint8_t regdmn[AR_REG_DOMAINS_MAX];78};7980/*81* Information retrieved from EEPROM.82*/83typedef struct {84uint16_t ee_version; /* Version field */85uint16_t ee_protect; /* EEPROM protect field */86uint16_t ee_antenna; /* Antenna Settings */87uint16_t ee_biasCurrents; /* OB, DB */88uint8_t ee_thresh62; /* thresh62 */89uint8_t ee_xlnaOn; /* External LNA timing */90uint8_t ee_xpaOff; /* Extern output stage timing */91uint8_t ee_xpaOn; /* Extern output stage timing */92uint8_t ee_rfKill; /* Single low bit signalling if RF Kill is implemented */93uint8_t ee_devType; /* Type: PCI, miniPCI, CB */94uint8_t ee_regDomain[AR_REG_DOMAINS_MAX];95/* calibrated reg domains */96struct tpcMap ee_tpc[AR_CHANNELS_MAX];97} HAL_EEPROM_v1;98#endif /* _ATH_AH_EEPROM_V1_H_ */99100101