Deleted Added
full compact
ar9280.c (240449) ar9280.c (241195)
1/*
2 * Copyright (c) 2008-2009 Sam Leffler, Errno Consulting
3 * Copyright (c) 2008 Atheros Communications, Inc.
4 *
5 * Permission to use, copy, modify, and/or 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 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
1/*
2 * Copyright (c) 2008-2009 Sam Leffler, Errno Consulting
3 * Copyright (c) 2008 Atheros Communications, Inc.
4 *
5 * Permission to use, copy, modify, and/or 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 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9280.c 240449 2012-09-13 07:25:41Z adrian $
17 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9280.c 241195 2012-10-04 15:42:45Z adrian $
18 */
19#include "opt_ah.h"
20
21/*
22 * NB: Merlin and later have a simpler RF backend.
23 */
24#include "ah.h"
25#include "ah_internal.h"

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

127 } else if ((freq % 10) == 0) {
128 aModeRefSel = 2;
129 }
130 if (aModeRefSel) break;
131 case 1:
132 default:
133 aModeRefSel = 0;
134 /* Enable 2G (fractional) mode for channels which are 5MHz spaced */
18 */
19#include "opt_ah.h"
20
21/*
22 * NB: Merlin and later have a simpler RF backend.
23 */
24#include "ah.h"
25#include "ah_internal.h"

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

127 } else if ((freq % 10) == 0) {
128 aModeRefSel = 2;
129 }
130 if (aModeRefSel) break;
131 case 1:
132 default:
133 aModeRefSel = 0;
134 /* Enable 2G (fractional) mode for channels which are 5MHz spaced */
135 fracMode = 1;
136 refDivA = 1;
137 channelSel = (freq * 0x8000)/15;
138
135
136 /*
137 * Workaround for talking on PSB non-5MHz channels;
138 * the pre-Merlin chips only had a 2.5MHz channel
139 * spacing so some channels aren't reachable.
140
141 *
142 * This interoperates on the quarter rate channels
143 * with the AR5112 and later RF synths. Please note
144 * that the synthesiser isn't able to completely
145 * accurately represent these frequencies (as the
146 * resolution in this reference is 2.5MHz) and thus
147 * it will be slightly "off centre." This matches
148 * the same slightly incorrect centre frequency
149 * behaviour that the AR5112 and later channel
150 * selection code has.
151 *
152 * This also interoperates with the AR5416
153 * synthesiser modification for programming
154 * fractional frequencies in 5GHz mode. However
155 * that modification is also disabled by default.
156 *
157 * This is disabled because it hasn't been tested for
158 * regulatory compliance and neither have the NICs
159 * which would use it. So if you enable this code,
160 * you must first ensure that you've re-certified the
161 * NICs in question beforehand or you will be
162 * violating your local regulatory rules and breaking
163 * the law.
164 */
165#if 0
166 if (freq % 5 == 0) {
167#endif
168 /* Normal */
169 fracMode = 1;
170 refDivA = 1;
171 channelSel = (freq * 0x8000)/15;
172#if 0
173 } else {
174 /* Offset by 500KHz */
175 uint32_t f, ch, ch2;
176
177 fracMode = 1;
178 refDivA = 1;
179
180 /* Calculate the "adjusted" frequency */
181 f = freq - 2;
182 ch = (((f - 4800) * 10) / 25) + 1;
183
184 ch2 = ((ch * 25) / 5) + 9600;
185 channelSel = (ch2 * 0x4000) / 15;
186 //ath_hal_printf(ah,
187 // "%s: freq=%d, ch=%d, ch2=%d, "
188 // "channelSel=%d\n",
189 // __func__, freq, ch, ch2, channelSel);
190 }
191#endif
192
139 /* RefDivA setting */
140 OS_A_REG_RMW_FIELD(ah, AR_AN_SYNTH9,
141 AR_AN_SYNTH9_REFDIVA, refDivA);
142 }
143
144 if (!fracMode) {
145 ndiv = (freq * (refDivA >> aModeRefSel))/60;
146 channelSel = ndiv & 0x1ff;

--- 258 unchanged lines hidden ---
193 /* RefDivA setting */
194 OS_A_REG_RMW_FIELD(ah, AR_AN_SYNTH9,
195 AR_AN_SYNTH9_REFDIVA, refDivA);
196 }
197
198 if (!fracMode) {
199 ndiv = (freq * (refDivA >> aModeRefSel))/60;
200 channelSel = ndiv & 0x1ff;

--- 258 unchanged lines hidden ---