attach.c (418de6d955fa1da0cb4332661a31d21f57e954ab) attach.c (a180a13081708b78d42232c6d922ce3de63f12e0)
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 *

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

134 srev = ath5k_hw_reg_read(ah, AR5K_SREV);
135 if (srev < AR5K_SREV_AR5311)
136 ah->ah_version = AR5K_AR5210;
137 else if (srev < AR5K_SREV_AR5212)
138 ah->ah_version = AR5K_AR5211;
139 else
140 ah->ah_version = AR5K_AR5212;
141
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 *

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

134 srev = ath5k_hw_reg_read(ah, AR5K_SREV);
135 if (srev < AR5K_SREV_AR5311)
136 ah->ah_version = AR5K_AR5210;
137 else if (srev < AR5K_SREV_AR5212)
138 ah->ah_version = AR5K_AR5211;
139 else
140 ah->ah_version = AR5K_AR5212;
141
142 /*Fill the ath5k_hw struct with the needed functions*/
142 /* Fill the ath5k_hw struct with the needed functions */
143 ret = ath5k_hw_init_desc_functions(ah);
144 if (ret)
145 goto err_free;
146
143 ret = ath5k_hw_init_desc_functions(ah);
144 if (ret)
145 goto err_free;
146
147 /* Bring device out of sleep and reset it's units */
147 /* Bring device out of sleep and reset its units */
148 ret = ath5k_hw_nic_wakeup(ah, 0, true);
149 if (ret)
150 goto err_free;
151
152 /* Get MAC, PHY and RADIO revisions */
153 ah->ah_mac_srev = srev;
154 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
155 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
156 0xffffffff;
157 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
158 CHANNEL_5GHZ);
159 ah->ah_phy = AR5K_PHY(0);
160
148 ret = ath5k_hw_nic_wakeup(ah, 0, true);
149 if (ret)
150 goto err_free;
151
152 /* Get MAC, PHY and RADIO revisions */
153 ah->ah_mac_srev = srev;
154 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
155 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
156 0xffffffff;
157 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
158 CHANNEL_5GHZ);
159 ah->ah_phy = AR5K_PHY(0);
160
161 /* Try to identify radio chip based on it's srev */
161 /* Try to identify radio chip based on its srev */
162 switch (ah->ah_radio_5ghz_revision & 0xf0) {
163 case AR5K_SREV_RAD_5111:
164 ah->ah_radio = AR5K_RF5111;
165 ah->ah_single_chip = false;
166 ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
167 CHANNEL_2GHZ);
168 break;
169 case AR5K_SREV_RAD_5112:

--- 194 unchanged lines hidden ---
162 switch (ah->ah_radio_5ghz_revision & 0xf0) {
163 case AR5K_SREV_RAD_5111:
164 ah->ah_radio = AR5K_RF5111;
165 ah->ah_single_chip = false;
166 ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
167 CHANNEL_2GHZ);
168 break;
169 case AR5K_SREV_RAD_5112:

--- 194 unchanged lines hidden ---