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 const struct ath5k_ini ar5210_ini []
 
static const struct ath5k_ini ar5211_ini []
 
static const struct ath5k_ini_mode ar5211_ini_mode []
 
static const struct ath5k_ini ar5212_ini_common_start []
 
static const struct ath5k_ini_mode ar5212_ini_mode_start []
 
static const struct ath5k_ini_mode rf5111_ini_mode_end []
 
static const struct ath5k_ini rf5111_ini_common_end []
 
static const struct ath5k_ini_mode rf5112_ini_mode_end []
 
static const struct ath5k_ini rf5112_ini_common_end []
 
static const struct ath5k_ini_mode rf5413_ini_mode_end []
 
static const struct ath5k_ini rf5413_ini_common_end []
 
static const struct ath5k_ini_mode rf2413_ini_mode_end []
 
static const struct ath5k_ini rf2413_ini_common_end []
 
static const struct ath5k_ini_mode rf2425_ini_mode_end []
 
static const struct ath5k_ini rf2425_ini_common_end []
 
static const struct ath5k_ini rf5111_ini_bbgain []
 
static const struct ath5k_ini rf5112_ini_bbgain []
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( MIT  )

◆ ath5k_hw_ini_registers()

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.

1379 {
1380  unsigned int i;
1381 
1382  /* Write initial registers */
1383  for (i = 0; i < size; i++) {
1384  /* On channel change there is
1385  * no need to mess with PCU */
1386  if (change_channel &&
1387  ini_regs[i].ini_register >= AR5K_PCU_MIN &&
1388  ini_regs[i].ini_register <= AR5K_PCU_MAX)
1389  continue;
1390 
1391  switch (ini_regs[i].ini_mode) {
1392  case AR5K_INI_READ:
1393  /* Cleared on read */
1394  ath5k_hw_reg_read(ah, ini_regs[i].ini_register);
1395  break;
1396  case AR5K_INI_WRITE:
1397  default:
1398  AR5K_REG_WAIT(i);
1399  ath5k_hw_reg_write(ah, ini_regs[i].ini_value,
1400  ini_regs[i].ini_register);
1401  }
1402  }
1403 }
#define AR5K_REG_WAIT(_i)
Definition: ath5k.h:133
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1222
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1214
#define AR5K_PCU_MIN
Definition: reg.h:1116
#define AR5K_PCU_MAX
Definition: reg.h:1117

References ah, 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().

◆ ath5k_hw_ini_mode_registers()

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.

1408 {
1409  unsigned int i;
1410 
1411  for (i = 0; i < size; i++) {
1412  AR5K_REG_WAIT(i);
1413  ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode],
1414  (u32)ini_mode[i].mode_register);
1415  }
1416 }
#define AR5K_REG_WAIT(_i)
Definition: ath5k.h:133
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1222
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:23

References ah, AR5K_REG_WAIT, ath5k_hw_reg_write(), ath5k_ini::ini_mode, and size.

Referenced by ath5k_hw_write_initvals().

◆ ath5k_hw_write_initvals()

int ath5k_hw_write_initvals ( struct ath5k_hw ah,
u8  mode,
int  change_channel 
)

Definition at line 1418 of file ath5k_initvals.c.

1419 {
1420  /*
1421  * Write initial register settings
1422  */
1423 
1424  /* For AR5212 and combatible */
1425  if (ah->ah_version == AR5K_AR5212) {
1426 
1427  /* First set of mode-specific settings */
1430  ar5212_ini_mode_start, mode);
1431 
1432  /*
1433  * Write initial settings common for all modes
1434  */
1436  ar5212_ini_common_start, change_channel);
1437 
1438  /* Second set of mode-specific settings */
1439  switch (ah->ah_radio) {
1440  case AR5K_RF5111:
1441 
1444  rf5111_ini_mode_end, mode);
1445 
1448  rf5111_ini_common_end, change_channel);
1449 
1450  /* Baseband gain table */
1453  rf5111_ini_bbgain, change_channel);
1454 
1455  break;
1456  case AR5K_RF5112:
1457 
1460  rf5112_ini_mode_end, mode);
1461 
1464  rf5112_ini_common_end, change_channel);
1465 
1468  rf5112_ini_bbgain, change_channel);
1469 
1470  break;
1471  case AR5K_RF5413:
1472 
1475  rf5413_ini_mode_end, mode);
1476 
1479  rf5413_ini_common_end, change_channel);
1480 
1483  rf5112_ini_bbgain, change_channel);
1484 
1485  break;
1486  case AR5K_RF2316:
1487  case AR5K_RF2413:
1488 
1491  rf2413_ini_mode_end, mode);
1492 
1495  rf2413_ini_common_end, change_channel);
1496 
1497  /* Override settings from rf2413_ini_common_end */
1498  if (ah->ah_radio == AR5K_RF2316) {
1499  ath5k_hw_reg_write(ah, 0x00004000,
1500  AR5K_PHY_AGC);
1501  ath5k_hw_reg_write(ah, 0x081b7caa,
1502  0xa274);
1503  }
1504 
1507  rf5112_ini_bbgain, change_channel);
1508  break;
1509  case AR5K_RF2317:
1510  case AR5K_RF2425:
1511 
1514  rf2425_ini_mode_end, mode);
1515 
1518  rf2425_ini_common_end, change_channel);
1519 
1522  rf5112_ini_bbgain, change_channel);
1523  break;
1524  default:
1525  return -EINVAL;
1526 
1527  }
1528 
1529  /* For AR5211 */
1530  } else if (ah->ah_version == AR5K_AR5211) {
1531 
1532  /* AR5K_MODE_11B */
1533  if (mode > 2) {
1534  DBG("ath5k: unsupported channel mode %d\n", mode);
1535  return -EINVAL;
1536  }
1537 
1538  /* Mode-specific settings */
1540  ar5211_ini_mode, mode);
1541 
1542  /*
1543  * Write initial settings common for all modes
1544  */
1546  ar5211_ini, change_channel);
1547 
1548  /* AR5211 only comes with 5111 */
1549 
1550  /* Baseband gain table */
1552  rf5111_ini_bbgain, change_channel);
1553  /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
1554  } else if (ah->ah_version == AR5K_AR5210) {
1556  ar5210_ini, change_channel);
1557  }
1558 
1559  return 0;
1560 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
static const struct ath5k_ini rf2413_ini_common_end[]
static const struct ath5k_ini_mode rf5111_ini_mode_end[]
static const struct ath5k_ini rf5112_ini_common_end[]
static const struct ath5k_ini_mode rf2425_ini_mode_end[]
static const struct ath5k_ini rf5111_ini_bbgain[]
#define AR5K_PHY_AGC
Definition: reg.h:1905
static const struct ath5k_ini_mode ar5212_ini_mode_start[]
static const struct ath5k_ini_mode rf2413_ini_mode_end[]
static const struct ath5k_ini ar5211_ini[]
static const struct ath5k_ini rf5112_ini_bbgain[]
static const struct ath5k_ini ar5210_ini[]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static const struct ath5k_ini rf5111_ini_common_end[]
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1222
static const struct ath5k_ini ar5212_ini_common_start[]
static const struct ath5k_ini_mode rf5413_ini_mode_end[]
static const struct ath5k_ini_mode rf5112_ini_mode_end[]
uint8_t ah
Definition: registers.h:85
static const struct ath5k_ini rf5413_ini_common_end[]
static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini *ini_regs, int change_channel)
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static const struct ath5k_ini_mode ar5211_ini_mode[]
static const struct ath5k_ini rf2425_ini_common_end[]
static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini_mode *ini_mode, u8 mode)

References ah, ar5210_ini, ar5211_ini, ar5211_ini_mode, ar5212_ini_common_start, ar5212_ini_mode_start, 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, EINVAL, rf2413_ini_common_end, rf2413_ini_mode_end, rf2425_ini_common_end, rf2425_ini_mode_end, rf5111_ini_bbgain, rf5111_ini_common_end, rf5111_ini_mode_end, rf5112_ini_bbgain, rf5112_ini_common_end, rf5112_ini_mode_end, rf5413_ini_common_end, and rf5413_ini_mode_end.

Referenced by ath5k_hw_reset().

Variable Documentation

◆ ar5210_ini

const struct ath5k_ini ar5210_ini[]
static

Definition at line 56 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ ar5211_ini

const struct ath5k_ini ar5211_ini[]
static

Definition at line 268 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ ar5211_ini_mode

const struct ath5k_ini_mode ar5211_ini_mode[]
static

Definition at line 397 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ ar5212_ini_common_start

const struct ath5k_ini ar5212_ini_common_start[]
static

Definition at line 472 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ ar5212_ini_mode_start

const struct ath5k_ini_mode ar5212_ini_mode_start[]
static

Definition at line 685 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5111_ini_mode_end

const struct ath5k_ini_mode rf5111_ini_mode_end[]
static

Definition at line 740 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5111_ini_common_end

const 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 },
}
#define AR5K_PHY_SPENDING
Definition: reg.h:2484
#define AR5K_PHY_PAPD_PROBE
Definition: reg.h:2240
#define AR5K_PHY_AGC
Definition: reg.h:1905
#define AR5K_PHY_ADC_CTL
Definition: reg.h:1947
#define AR5K_DCU_FP
Definition: reg.h:801
#define AR5K_PHY_CCK_CROSSCORR
Definition: reg.h:2530
#define AR5K_PHY_DAG_CCK_CTL
Definition: reg.h:2550
#define AR5K_PHY_CCKTXCTL
Definition: reg.h:2521
#define AR5K_PHY_GAIN_OFFSET
Definition: reg.h:1990

Definition at line 772 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5112_ini_mode_end

const struct ath5k_ini_mode rf5112_ini_mode_end[]
static

Definition at line 790 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5112_ini_common_end

const 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 },
}
#define AR5K_PHY_PAPD_PROBE
Definition: reg.h:2240
#define AR5K_PHY_AGC
Definition: reg.h:1905
#define AR5K_PHY_ADC_CTL
Definition: reg.h:1947
#define AR5K_DCU_FP
Definition: reg.h:801
#define AR5K_PHY_DAG_CCK_CTL
Definition: reg.h:2550
#define AR5K_PHY_GAIN_OFFSET
Definition: reg.h:1990

Definition at line 826 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5413_ini_mode_end

const struct ath5k_ini_mode rf5413_ini_mode_end[]
static

Definition at line 841 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5413_ini_common_end

const struct ath5k_ini rf5413_ini_common_end[]
static

Definition at line 905 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf2413_ini_mode_end

const struct ath5k_ini_mode rf2413_ini_mode_end[]
static

Definition at line 980 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf2413_ini_common_end

const struct ath5k_ini rf2413_ini_common_end[]
static

Definition at line 1016 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf2425_ini_mode_end

const struct ath5k_ini_mode rf2425_ini_mode_end[]
static

Definition at line 1102 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf2425_ini_common_end

const struct ath5k_ini rf2425_ini_common_end[]
static

Definition at line 1152 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5111_ini_bbgain

const struct ath5k_ini rf5111_ini_bbgain[]
static

Definition at line 1238 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().

◆ rf5112_ini_bbgain

const struct ath5k_ini rf5112_ini_bbgain[]
static

Definition at line 1306 of file ath5k_initvals.c.

Referenced by ath5k_hw_write_initvals().