iPXE
Data Structures | Functions | Variables
ath5k_initvals.c File Reference
#include <unistd.h>
#include "ath5k.h"
#include "reg.h"
#include "base.h"

Go to the source code of this file.

Data Structures

struct  ath5k_ini
struct  ath5k_ini_mode

Functions

 FILE_LICENCE (MIT)
static void ath5k_hw_ini_registers (struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini *ini_regs, int change_channel)
static void ath5k_hw_ini_mode_registers (struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini_mode *ini_mode, u8 mode)
int ath5k_hw_write_initvals (struct ath5k_hw *ah, u8 mode, int change_channel)

Variables

static struct ath5k_ini ar5210_ini []
static struct ath5k_ini ar5211_ini []
static struct ath5k_ini_mode ar5211_ini_mode []
static struct ath5k_ini ar5212_ini_common_start []
static struct ath5k_ini_mode ar5212_ini_mode_start []
static struct ath5k_ini_mode rf5111_ini_mode_end []
static struct ath5k_ini rf5111_ini_common_end []
static struct ath5k_ini_mode rf5112_ini_mode_end []
static struct ath5k_ini rf5112_ini_common_end []
static struct ath5k_ini_mode rf5413_ini_mode_end []
static struct ath5k_ini rf5413_ini_common_end []
static struct ath5k_ini_mode rf2413_ini_mode_end []
static struct ath5k_ini rf2413_ini_common_end []
static struct ath5k_ini_mode rf2425_ini_mode_end []
static struct ath5k_ini rf2425_ini_common_end []
static struct ath5k_ini rf5111_ini_bbgain []
static struct ath5k_ini rf5112_ini_bbgain []

Function Documentation

FILE_LICENCE ( MIT  )
static void ath5k_hw_ini_registers ( struct ath5k_hw ah,
unsigned int  size,
const struct ath5k_ini ini_regs,
int  change_channel 
) [static]

Definition at line 1377 of file ath5k_initvals.c.

References ath5k_ini::AR5K_INI_READ, ath5k_ini::AR5K_INI_WRITE, AR5K_PCU_MAX, AR5K_PCU_MIN, AR5K_REG_WAIT, ath5k_hw_reg_read(), ath5k_hw_reg_write(), ath5k_ini::ini_mode, ath5k_ini::ini_register, ath5k_ini::ini_value, and size.

Referenced by ath5k_hw_write_initvals().

{
        unsigned int i;

        /* Write initial registers */
        for (i = 0; i < size; i++) {
                /* On channel change there is
                 * no need to mess with PCU */
                if (change_channel &&
                                ini_regs[i].ini_register >= AR5K_PCU_MIN &&
                                ini_regs[i].ini_register <= AR5K_PCU_MAX)
                        continue;

                switch (ini_regs[i].ini_mode) {
                case AR5K_INI_READ:
                        /* Cleared on read */
                        ath5k_hw_reg_read(ah, ini_regs[i].ini_register);
                        break;
                case AR5K_INI_WRITE:
                default:
                        AR5K_REG_WAIT(i);
                        ath5k_hw_reg_write(ah, ini_regs[i].ini_value,
                                        ini_regs[i].ini_register);
                }
        }
}
static void ath5k_hw_ini_mode_registers ( struct ath5k_hw ah,
unsigned int  size,
const struct ath5k_ini_mode ini_mode,
u8  mode 
) [static]

Definition at line 1405 of file ath5k_initvals.c.

References AR5K_REG_WAIT, ath5k_hw_reg_write(), and size.

Referenced by ath5k_hw_write_initvals().

{
        unsigned int i;

        for (i = 0; i < size; i++) {
                AR5K_REG_WAIT(i);
                ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode],
                        (u32)ini_mode[i].mode_register);
        }
}
int ath5k_hw_write_initvals ( struct ath5k_hw ah,
u8  mode,
int  change_channel 
)

Definition at line 1418 of file ath5k_initvals.c.

References ath5k_hw::ah_radio, ath5k_hw::ah_version, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_PHY_AGC, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, ARRAY_SIZE, ath5k_hw_ini_mode_registers(), ath5k_hw_ini_registers(), ath5k_hw_reg_write(), DBG, and EINVAL.

Referenced by ath5k_hw_reset().

{
        /*
         * Write initial register settings
         */

        /* For AR5212 and combatible */
        if (ah->ah_version == AR5K_AR5212) {

                /* First set of mode-specific settings */
                ath5k_hw_ini_mode_registers(ah,
                        ARRAY_SIZE(ar5212_ini_mode_start),
                        ar5212_ini_mode_start, mode);

                /*
                 * Write initial settings common for all modes
                 */
                ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start),
                                ar5212_ini_common_start, change_channel);

                /* Second set of mode-specific settings */
                switch (ah->ah_radio) {
                case AR5K_RF5111:

                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf5111_ini_mode_end),
                                        rf5111_ini_mode_end, mode);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5111_ini_common_end),
                                        rf5111_ini_common_end, change_channel);

                        /* Baseband gain table */
                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5111_ini_bbgain),
                                        rf5111_ini_bbgain, change_channel);

                        break;
                case AR5K_RF5112:

                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_mode_end),
                                        rf5112_ini_mode_end, mode);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_common_end),
                                        rf5112_ini_common_end, change_channel);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);

                        break;
                case AR5K_RF5413:

                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf5413_ini_mode_end),
                                        rf5413_ini_mode_end, mode);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5413_ini_common_end),
                                        rf5413_ini_common_end, change_channel);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);

                        break;
                case AR5K_RF2316:
                case AR5K_RF2413:

                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf2413_ini_mode_end),
                                        rf2413_ini_mode_end, mode);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf2413_ini_common_end),
                                        rf2413_ini_common_end, change_channel);

                        /* Override settings from rf2413_ini_common_end */
                        if (ah->ah_radio == AR5K_RF2316) {
                                ath5k_hw_reg_write(ah, 0x00004000,
                                                        AR5K_PHY_AGC);
                                ath5k_hw_reg_write(ah, 0x081b7caa,
                                                        0xa274);
                        }

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);
                        break;
                case AR5K_RF2317:
                case AR5K_RF2425:

                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf2425_ini_mode_end),
                                        rf2425_ini_mode_end, mode);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf2425_ini_common_end),
                                        rf2425_ini_common_end, change_channel);

                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);
                        break;
                default:
                        return -EINVAL;

                }

        /* For AR5211 */
        } else if (ah->ah_version == AR5K_AR5211) {

                /* AR5K_MODE_11B */
                if (mode > 2) {
                        DBG("ath5k: unsupported channel mode %d\n", mode);
                        return -EINVAL;
                }

                /* Mode-specific settings */
                ath5k_hw_ini_mode_registers(ah, ARRAY_SIZE(ar5211_ini_mode),
                                ar5211_ini_mode, mode);

                /*
                 * Write initial settings common for all modes
                 */
                ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini),
                                ar5211_ini, change_channel);

                /* AR5211 only comes with 5111 */

                /* Baseband gain table */
                ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain),
                                rf5111_ini_bbgain, change_channel);
        /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
        } else if (ah->ah_version == AR5K_AR5210) {
                ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini),
                                ar5210_ini, change_channel);
        }

        return 0;
}

Variable Documentation

struct ath5k_ini ar5210_ini[] [static]

Definition at line 56 of file ath5k_initvals.c.

struct ath5k_ini ar5211_ini[] [static]

Definition at line 268 of file ath5k_initvals.c.

struct ath5k_ini_mode ar5211_ini_mode[] [static]

Definition at line 397 of file ath5k_initvals.c.

Definition at line 472 of file ath5k_initvals.c.

Definition at line 685 of file ath5k_initvals.c.

Definition at line 740 of file ath5k_initvals.c.

struct ath5k_ini rf5111_ini_common_end[] [static]
Initial value:
 {
        { AR5K_DCU_FP,          0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_AGC,         0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_ADC_CTL,     0x00022ffe, AR5K_INI_WRITE },
        { 0x983c,               0x00020100, AR5K_INI_WRITE },
        { AR5K_PHY_GAIN_OFFSET, 0x1284613c, AR5K_INI_WRITE },
        { AR5K_PHY_PAPD_PROBE,  0x00004883, AR5K_INI_WRITE },
        { 0x9940,               0x00000004, AR5K_INI_WRITE },
        { 0x9958,               0x000000ff, AR5K_INI_WRITE },
        { 0x9974,               0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_SPENDING,    0x00000018, AR5K_INI_WRITE },
        { AR5K_PHY_CCKTXCTL,    0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_CCK_CROSSCORR, 0xd03e6788, AR5K_INI_WRITE },
        { AR5K_PHY_DAG_CCK_CTL, 0x000001b5, AR5K_INI_WRITE },
        { 0xa23c,               0x13c889af, AR5K_INI_WRITE },
}

Definition at line 772 of file ath5k_initvals.c.

Definition at line 790 of file ath5k_initvals.c.

struct ath5k_ini rf5112_ini_common_end[] [static]
Initial value:
 {
        { AR5K_DCU_FP,          0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_AGC,         0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_ADC_CTL,     0x00022ffe, AR5K_INI_WRITE },
        { 0x983c,               0x00020100, AR5K_INI_WRITE },
        { AR5K_PHY_GAIN_OFFSET, 0x1284613c, AR5K_INI_WRITE },
        { AR5K_PHY_PAPD_PROBE,  0x00004882, AR5K_INI_WRITE },
        { 0x9940,               0x00000004, AR5K_INI_WRITE },
        { 0x9958,               0x000000ff, AR5K_INI_WRITE },
        { 0x9974,               0x00000000, AR5K_INI_WRITE },
        { AR5K_PHY_DAG_CCK_CTL, 0x000001b5, AR5K_INI_WRITE },
        { 0xa23c,               0x13c889af, AR5K_INI_WRITE },
}

Definition at line 826 of file ath5k_initvals.c.

Definition at line 841 of file ath5k_initvals.c.

struct ath5k_ini rf5413_ini_common_end[] [static]

Definition at line 905 of file ath5k_initvals.c.

Definition at line 980 of file ath5k_initvals.c.

struct ath5k_ini rf2413_ini_common_end[] [static]

Definition at line 1016 of file ath5k_initvals.c.

Definition at line 1102 of file ath5k_initvals.c.

struct ath5k_ini rf2425_ini_common_end[] [static]

Definition at line 1152 of file ath5k_initvals.c.

struct ath5k_ini rf5111_ini_bbgain[] [static]

Definition at line 1238 of file ath5k_initvals.c.

struct ath5k_ini rf5112_ini_bbgain[] [static]

Definition at line 1306 of file ath5k_initvals.c.