attach.c (9bc4341eb79d885e5a9dda6384a60bb0f4655fe7) attach.c (2111ac0d888767999c7dd6d1309dcc1fb8012022)
1/*
2 * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *

--- 7 unchanged lines hidden (view full) ---

16 *
17 */
18
19/*************************************\
20* Attach/Detach Functions and helpers *
21\*************************************/
22
23#include <linux/pci.h>
1/*
2 * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
3 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *

--- 7 unchanged lines hidden (view full) ---

16 *
17 */
18
19/*************************************\
20* Attach/Detach Functions and helpers *
21\*************************************/
22
23#include <linux/pci.h>
24#include <linux/slab.h>
25#include "ath5k.h"
26#include "reg.h"
27#include "debug.h"
28#include "base.h"
29
30/**
31 * ath5k_hw_post - Power On Self Test helper function
32 *

--- 76 unchanged lines hidden (view full) ---

109 struct pci_dev *pdev = sc->pdev;
110 struct ath5k_eeprom_info *ee;
111 int ret;
112 u32 srev;
113
114 /*
115 * HW information
116 */
24#include "ath5k.h"
25#include "reg.h"
26#include "debug.h"
27#include "base.h"
28
29/**
30 * ath5k_hw_post - Power On Self Test helper function
31 *

--- 76 unchanged lines hidden (view full) ---

108 struct pci_dev *pdev = sc->pdev;
109 struct ath5k_eeprom_info *ee;
110 int ret;
111 u32 srev;
112
113 /*
114 * HW information
115 */
117 ah->ah_op_mode = NL80211_IFTYPE_STATION;
118 ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT;
119 ah->ah_turbo = false;
120 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
121 ah->ah_imr = 0;
122 ah->ah_atim_window = 0;
123 ah->ah_aifs = AR5K_TUNE_AIFS;
124 ah->ah_cw_min = AR5K_TUNE_CWMIN;
125 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
126 ah->ah_software_retry = false;
116 ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT;
117 ah->ah_turbo = false;
118 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
119 ah->ah_imr = 0;
120 ah->ah_atim_window = 0;
121 ah->ah_aifs = AR5K_TUNE_AIFS;
122 ah->ah_cw_min = AR5K_TUNE_CWMIN;
123 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
124 ah->ah_software_retry = false;
125 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
126 ah->ah_noise_floor = -95; /* until first NF calibration is run */
127 sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
127
128 /*
129 * Find the mac version
130 */
131 srev = ath5k_hw_reg_read(ah, AR5K_SREV);
132 if (srev < AR5K_SREV_AR5311)
133 ah->ah_version = AR5K_AR5210;
134 else if (srev < AR5K_SREV_AR5212)

--- 9 unchanged lines hidden (view full) ---

144 /* Bring device out of sleep and reset it's units */
145 ret = ath5k_hw_nic_wakeup(ah, 0, true);
146 if (ret)
147 goto err_free;
148
149 /* Get MAC, PHY and RADIO revisions */
150 ah->ah_mac_srev = srev;
151 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
128
129 /*
130 * Find the mac version
131 */
132 srev = ath5k_hw_reg_read(ah, AR5K_SREV);
133 if (srev < AR5K_SREV_AR5311)
134 ah->ah_version = AR5K_AR5210;
135 else if (srev < AR5K_SREV_AR5212)

--- 9 unchanged lines hidden (view full) ---

145 /* Bring device out of sleep and reset it's units */
146 ret = ath5k_hw_nic_wakeup(ah, 0, true);
147 if (ret)
148 goto err_free;
149
150 /* Get MAC, PHY and RADIO revisions */
151 ah->ah_mac_srev = srev;
152 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
152 ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
153 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
154 0xffffffff;
155 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
156 CHANNEL_5GHZ);
157 ah->ah_phy = AR5K_PHY(0);
158
159 /* Try to identify radio chip based on it's srev */
160 switch (ah->ah_radio_5ghz_revision & 0xf0) {

--- 162 unchanged lines hidden (view full) ---

323 }
324
325 /* MAC address is cleared until add_interface */
326 ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){});
327
328 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
329 memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
330 ath5k_hw_set_associd(ah);
153 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
154 0xffffffff;
155 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
156 CHANNEL_5GHZ);
157 ah->ah_phy = AR5K_PHY(0);
158
159 /* Try to identify radio chip based on it's srev */
160 switch (ah->ah_radio_5ghz_revision & 0xf0) {

--- 162 unchanged lines hidden (view full) ---

323 }
324
325 /* MAC address is cleared until add_interface */
326 ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){});
327
328 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
329 memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
330 ath5k_hw_set_associd(ah);
331 ath5k_hw_set_opmode(ah);
331 ath5k_hw_set_opmode(ah, sc->opmode);
332
333 ath5k_hw_rfgain_opt_init(ah);
334
335 ath5k_hw_init_nfcal_hist(ah);
336
337 /* turn on HW LEDs */
338 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT);
339

--- 24 unchanged lines hidden ---
332
333 ath5k_hw_rfgain_opt_init(ah);
334
335 ath5k_hw_init_nfcal_hist(ah);
336
337 /* turn on HW LEDs */
338 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT);
339

--- 24 unchanged lines hidden ---