mirror of
https://github.com/proski/madwifi
synced 2024-11-25 07:49:43 +03:00
Rewrite ar_device() using HAL magic numbers
It's more reliable than a table of all device IDs. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@4014 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
parent
43de7ca42d
commit
a71559e552
@ -11557,7 +11557,7 @@ txcont_configure_radio(struct ieee80211com *ic)
|
||||
ath_set_ack_bitrate(sc, sc->sc_ackrate);
|
||||
netif_wake_queue(dev); /* restart xmit */
|
||||
|
||||
if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
|
||||
if (ar_device(sc) == 5212) {
|
||||
/* registers taken from openhal */
|
||||
#define AR5K_AR5212_TXCFG 0x0030
|
||||
#define AR5K_AR5212_TXCFG_TXCONT_ENABLE 0x00000080
|
||||
|
@ -80,56 +80,35 @@ static struct ath5k_srev_name srev_names[] = {
|
||||
{ "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
|
||||
};
|
||||
|
||||
#define AR5210_MAGIC 0x19980124
|
||||
#define AR5211_MAGIC 0x19570405
|
||||
#define AR5212_MAGIC 0x19541014
|
||||
#define AR5416_MAGIC 0x20065416
|
||||
|
||||
int
|
||||
ar_device(int devid)
|
||||
ar_device(struct ath_softc *sc)
|
||||
{
|
||||
switch (devid) {
|
||||
case AR5210_DEFAULT:
|
||||
case AR5210_PROD:
|
||||
case AR5210_AP:
|
||||
int magic = sc->sc_ah->ah_magic;
|
||||
|
||||
switch (magic) {
|
||||
case AR5210_MAGIC:
|
||||
return 5210;
|
||||
case AR5211_DEFAULT:
|
||||
case AR5311_DEVID:
|
||||
case AR5211_LEGACY:
|
||||
case AR5211_FPGA11B:
|
||||
case AR5211_MAGIC:
|
||||
return 5211;
|
||||
case AR5212_DEFAULT:
|
||||
case AR5212_DEVID:
|
||||
case AR5212_FPGA:
|
||||
case AR5212_DEVID_IBM:
|
||||
case AR5212_AR5312_REV2:
|
||||
case AR5212_AR5312_REV7:
|
||||
case AR5212_AR2313_REV8:
|
||||
case AR5212_AR2315_REV6:
|
||||
case AR5212_AR2315_REV7:
|
||||
case AR5212_AR2317_REV1:
|
||||
case AR5212_DEVID_0014:
|
||||
case AR5212_DEVID_0015:
|
||||
case AR5212_DEVID_0016:
|
||||
case AR5212_DEVID_0017:
|
||||
case AR5212_DEVID_0018:
|
||||
case AR5212_DEVID_0019:
|
||||
case AR5212_AR2413:
|
||||
case AR5212_AR5413:
|
||||
case AR5212_AR5424:
|
||||
case AR5212_DEVID_FF19:
|
||||
case AR5212_MAGIC:
|
||||
return 5212;
|
||||
case AR5213_SREV_1_0:
|
||||
case AR5213_SREV_REG:
|
||||
case AR_SUBVENDOR_ID_NOG:
|
||||
case AR_SUBVENDOR_ID_NEW_A:
|
||||
return 5213;
|
||||
case AR5416_MAGIC:
|
||||
return 5416;
|
||||
default:
|
||||
return 0; /* unknown */
|
||||
printk(KERN_WARNING "unknown HAL magic 0x%08x\n", magic);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_set_ack_bitrate(struct ath_softc *sc, int high)
|
||||
{
|
||||
if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
|
||||
if (ar_device(sc) == 5212) {
|
||||
/* set ack to be sent at low bit-rate */
|
||||
u_int32_t v = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB;
|
||||
if (high)
|
||||
|
@ -268,7 +268,7 @@ enum ath5k_dmasize {
|
||||
|
||||
|
||||
int ath_set_ack_bitrate(struct ath_softc *sc, int);
|
||||
int ar_device(int devid);
|
||||
int ar_device(struct ath_softc *sc);
|
||||
const char * ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val);
|
||||
void ath_hw_beacon_stop(struct ath_softc *sc);
|
||||
int ath_hw_check_atim(struct ath_softc *sc, int window, int intval);
|
||||
|
@ -158,7 +158,7 @@ static u_int32_t interval_to_frequency(u_int32_t pri);
|
||||
int ath_radar_is_enabled(struct ath_softc *sc)
|
||||
{
|
||||
struct ath_hal *ah = sc->sc_ah;
|
||||
if (ar_device(sc->devid) >= 5211)
|
||||
if (ar_device(sc) >= 5211)
|
||||
return ((OS_REG_READ(ah, AR5K_AR5212_PHY_ERR_FIL) &
|
||||
AR5K_AR5212_PHY_ERR_FIL_RADAR) &&
|
||||
(sc->sc_imask & HAL_INT_RXPHY) &&
|
||||
@ -243,7 +243,7 @@ int ath_radar_update(struct ath_softc *sc)
|
||||
/* configure radar pulse detector register using default values, but do
|
||||
* not toggle the enable bit. XXX: allow tweaking?? */
|
||||
ath_radar_set_params(sc, NULL);
|
||||
if (ar_device(sc->devid) >= 5211) {
|
||||
if (ar_device(sc) >= 5211) {
|
||||
HAL_INT old_ier = ath_hal_intrget(ah);
|
||||
HAL_INT new_ier = old_ier;
|
||||
unsigned int old_radar = OS_REG_READ(ah, AR5K_PHY_RADAR);
|
||||
|
Loading…
Reference in New Issue
Block a user