aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-02-20 13:31:21 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:53 -0500
commit5f9724dd94d63e26edb02d9f6a4ce1ce35737f14 (patch)
tree1bdf6d93b958e92936581b6916cf47e29dbd9178 /drivers/net/wireless/b43
parent3718582a663e035af5d2634cd537a012e20cdb3f (diff)
b43: Convert usage of b43_radio_maskset()
This patch converts code to use the new b43_radio_maskset() API. The semantic patch that makes this change is as follows: // <smpl> @@ expression dev, addr, mask, set; @@ -b43_radio_write16(dev, addr, (b43_radio_read16(dev, addr) & mask) | set); +b43_radio_maskset(dev, addr, mask, set); // </smpl> Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/lo.c22
-rw-r--r--drivers/net/wireless/b43/phy_a.c31
-rw-r--r--drivers/net/wireless/b43/phy_g.c30
3 files changed, 25 insertions, 58 deletions
diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c
index 70c39bbbcf1f..2a4e2b02faf9 100644
--- a/drivers/net/wireless/b43/lo.c
+++ b/drivers/net/wireless/b43/lo.c
@@ -225,8 +225,7 @@ static void lo_measure_txctl_values(struct b43_wldev *dev)
225 radio_pctl_reg = tmp; 225 radio_pctl_reg = tmp;
226 } 226 }
227 } 227 }
228 b43_radio_write16(dev, 0x43, (b43_radio_read16(dev, 0x43) 228 b43_radio_maskset(dev, 0x43, 0xFFF0, radio_pctl_reg);
229 & 0xFFF0) | radio_pctl_reg);
230 b43_gphy_set_baseband_attenuation(dev, 2); 229 b43_gphy_set_baseband_attenuation(dev, 2);
231 230
232 reg = lo_txctl_register_table(dev, &mask, NULL); 231 reg = lo_txctl_register_table(dev, &mask, NULL);
@@ -241,14 +240,10 @@ static void lo_measure_txctl_values(struct b43_wldev *dev)
241 240
242 for (i = 0; i < ARRAY_SIZE(tx_magn_values); i++) { 241 for (i = 0; i < ARRAY_SIZE(tx_magn_values); i++) {
243 tx_magn = tx_magn_values[i]; 242 tx_magn = tx_magn_values[i];
244 b43_radio_write16(dev, 0x52, 243 b43_radio_maskset(dev, 0x52, 0xFF0F, tx_magn);
245 (b43_radio_read16(dev, 0x52)
246 & 0xFF0F) | tx_magn);
247 for (j = 0; j < ARRAY_SIZE(tx_bias_values); j++) { 244 for (j = 0; j < ARRAY_SIZE(tx_bias_values); j++) {
248 tx_bias = tx_bias_values[j]; 245 tx_bias = tx_bias_values[j];
249 b43_radio_write16(dev, 0x52, 246 b43_radio_maskset(dev, 0x52, 0xFFF0, tx_bias);
250 (b43_radio_read16(dev, 0x52)
251 & 0xFFF0) | tx_bias);
252 feedthrough = 247 feedthrough =
253 lo_measure_feedthrough(dev, 0, pga, 248 lo_measure_feedthrough(dev, 0, pga,
254 trsw_rx); 249 trsw_rx);
@@ -541,8 +536,7 @@ static void lo_measure_restore(struct b43_wldev *dev,
541 b43_radio_write16(dev, 0x7A, sav->radio_7A); 536 b43_radio_write16(dev, 0x7A, sav->radio_7A);
542 if (!has_tx_magnification(phy)) { 537 if (!has_tx_magnification(phy)) {
543 tmp = sav->radio_52; 538 tmp = sav->radio_52;
544 b43_radio_write16(dev, 0x52, (b43_radio_read16(dev, 0x52) 539 b43_radio_maskset(dev, 0x52, 0xFF0F, tmp);
545 & 0xFF0F) | tmp);
546 } 540 }
547 b43_write16(dev, 0x3E2, sav->reg_3E2); 541 b43_write16(dev, 0x3E2, sav->reg_3E2);
548 if (phy->type == B43_PHYTYPE_B && 542 if (phy->type == B43_PHYTYPE_B &&
@@ -761,12 +755,8 @@ struct b43_lo_calib * b43_calibrate_lo_setting(struct b43_wldev *dev,
761 755
762 txctl_reg = lo_txctl_register_table(dev, &txctl_value, &pad_mix_gain); 756 txctl_reg = lo_txctl_register_table(dev, &txctl_value, &pad_mix_gain);
763 757
764 b43_radio_write16(dev, 0x43, 758 b43_radio_maskset(dev, 0x43, 0xFFF0, rfatt->att);
765 (b43_radio_read16(dev, 0x43) & 0xFFF0) 759 b43_radio_maskset(dev, txctl_reg, ~txctl_value, (rfatt->with_padmix ? txctl_value :0));
766 | rfatt->att);
767 b43_radio_write16(dev, txctl_reg,
768 (b43_radio_read16(dev, txctl_reg) & ~txctl_value)
769 | (rfatt->with_padmix ? txctl_value : 0));
770 760
771 max_rx_gain = rfatt->att * 2; 761 max_rx_gain = rfatt->att * 2;
772 max_rx_gain += bbatt->att / 2; 762 max_rx_gain += bbatt->att / 2;
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 4f052ebf06da..c836c077d51d 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -121,25 +121,18 @@ static void aphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
121 b43_radio_write16(dev, 0x0007, (r8 << 4) | r8); 121 b43_radio_write16(dev, 0x0007, (r8 << 4) | r8);
122 b43_radio_write16(dev, 0x0020, (r8 << 4) | r8); 122 b43_radio_write16(dev, 0x0020, (r8 << 4) | r8);
123 b43_radio_write16(dev, 0x0021, (r8 << 4) | r8); 123 b43_radio_write16(dev, 0x0021, (r8 << 4) | r8);
124 b43_radio_write16(dev, 0x0022, (b43_radio_read16(dev, 0x0022) 124 b43_radio_maskset(dev, 0x0022, 0x000F, (r8 << 4));
125 & 0x000F) | (r8 << 4));
126 b43_radio_write16(dev, 0x002A, (r8 << 4)); 125 b43_radio_write16(dev, 0x002A, (r8 << 4));
127 b43_radio_write16(dev, 0x002B, (r8 << 4)); 126 b43_radio_write16(dev, 0x002B, (r8 << 4));
128 b43_radio_write16(dev, 0x0008, (b43_radio_read16(dev, 0x0008) 127 b43_radio_maskset(dev, 0x0008, 0x00F0, (r8 << 4));
129 & 0x00F0) | (r8 << 4)); 128 b43_radio_maskset(dev, 0x0029, 0xFF0F, 0x00B0);
130 b43_radio_write16(dev, 0x0029, (b43_radio_read16(dev, 0x0029)
131 & 0xFF0F) | 0x00B0);
132 b43_radio_write16(dev, 0x0035, 0x00AA); 129 b43_radio_write16(dev, 0x0035, 0x00AA);
133 b43_radio_write16(dev, 0x0036, 0x0085); 130 b43_radio_write16(dev, 0x0036, 0x0085);
134 b43_radio_write16(dev, 0x003A, (b43_radio_read16(dev, 0x003A) 131 b43_radio_maskset(dev, 0x003A, 0xFF20, freq_r3A_value(freq));
135 & 0xFF20) |
136 freq_r3A_value(freq));
137 b43_radio_mask(dev, 0x003D, 0x00FF); 132 b43_radio_mask(dev, 0x003D, 0x00FF);
138 b43_radio_write16(dev, 0x0081, (b43_radio_read16(dev, 0x0081) 133 b43_radio_maskset(dev, 0x0081, 0xFF7F, 0x0080);
139 & 0xFF7F) | 0x0080);
140 b43_radio_mask(dev, 0x0035, 0xFFEF); 134 b43_radio_mask(dev, 0x0035, 0xFFEF);
141 b43_radio_write16(dev, 0x0035, (b43_radio_read16(dev, 0x0035) 135 b43_radio_maskset(dev, 0x0035, 0xFFEF, 0x0010);
142 & 0xFFEF) | 0x0010);
143 b43_radio_set_tx_iq(dev); 136 b43_radio_set_tx_iq(dev);
144 //TODO: TSSI2dbm workaround 137 //TODO: TSSI2dbm workaround
145//FIXME b43_phy_xmitpower(dev); 138//FIXME b43_phy_xmitpower(dev);
@@ -164,17 +157,14 @@ static void b43_radio_init2060(struct b43_wldev *dev)
164 b43_radio_mask(dev, 0x0081, ~0x0020); 157 b43_radio_mask(dev, 0x0081, ~0x0020);
165 msleep(1); /* delay 400usec */ 158 msleep(1); /* delay 400usec */
166 159
167 b43_radio_write16(dev, 0x0081, 160 b43_radio_maskset(dev, 0x0081, ~0x0020, 0x0010);
168 (b43_radio_read16(dev, 0x0081) & ~0x0020) | 0x0010);
169 msleep(1); /* delay 400usec */ 161 msleep(1); /* delay 400usec */
170 162
171 b43_radio_write16(dev, 0x0005, 163 b43_radio_maskset(dev, 0x0005, ~0x0008, 0x0008);
172 (b43_radio_read16(dev, 0x0005) & ~0x0008) | 0x0008);
173 b43_radio_mask(dev, 0x0085, ~0x0010); 164 b43_radio_mask(dev, 0x0085, ~0x0010);
174 b43_radio_mask(dev, 0x0005, ~0x0008); 165 b43_radio_mask(dev, 0x0005, ~0x0008);
175 b43_radio_mask(dev, 0x0081, ~0x0040); 166 b43_radio_mask(dev, 0x0081, ~0x0040);
176 b43_radio_write16(dev, 0x0081, 167 b43_radio_maskset(dev, 0x0081, ~0x0040, 0x0040);
177 (b43_radio_read16(dev, 0x0081) & ~0x0040) | 0x0040);
178 b43_radio_write16(dev, 0x0005, 168 b43_radio_write16(dev, 0x0005,
179 (b43_radio_read16(dev, 0x0081) & ~0x0008) | 0x0008); 169 (b43_radio_read16(dev, 0x0081) & ~0x0008) | 0x0008);
180 b43_phy_write(dev, 0x0063, 0xDDC6); 170 b43_phy_write(dev, 0x0063, 0xDDC6);
@@ -226,8 +216,7 @@ static void b43_phy_ww(struct b43_wldev *dev)
226 b43_phy_set(dev, B43_PHY_OFDM(0x1B), 0x1000); 216 b43_phy_set(dev, B43_PHY_OFDM(0x1B), 0x1000);
227 b43_phy_maskset(dev, B43_PHY_OFDM(0x82), 0xF0FF, 0x0300); 217 b43_phy_maskset(dev, B43_PHY_OFDM(0x82), 0xF0FF, 0x0300);
228 b43_radio_set(dev, 0x0009, 0x0080); 218 b43_radio_set(dev, 0x0009, 0x0080);
229 b43_radio_write16(dev, 0x0012, 219 b43_radio_maskset(dev, 0x0012, 0xFFFC, 0x0002);
230 (b43_radio_read16(dev, 0x0012) & 0xFFFC) | 0x0002);
231 b43_wa_initgains(dev); 220 b43_wa_initgains(dev);
232 b43_phy_write(dev, B43_PHY_OFDM(0xBA), 0x3ED5); 221 b43_phy_write(dev, B43_PHY_OFDM(0xBA), 0x3ED5);
233 b = b43_phy_read(dev, B43_PHY_PWRDOWN); 222 b = b43_phy_read(dev, B43_PHY_PWRDOWN);
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index 8bad858c2d7a..00bb001a2689 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -248,17 +248,13 @@ static void b43_set_txpower_g(struct b43_wldev *dev,
248 b43_radio_write16(dev, 0x43, 248 b43_radio_write16(dev, 0x43,
249 (rf & 0x000F) | (tx_control & 0x0070)); 249 (rf & 0x000F) | (tx_control & 0x0070));
250 } else { 250 } else {
251 b43_radio_write16(dev, 0x43, (b43_radio_read16(dev, 0x43) 251 b43_radio_maskset(dev, 0x43, 0xFFF0, (rf & 0x000F));
252 & 0xFFF0) | (rf & 0x000F)); 252 b43_radio_maskset(dev, 0x52, ~0x0070, (tx_control & 0x0070));
253 b43_radio_write16(dev, 0x52, (b43_radio_read16(dev, 0x52)
254 & ~0x0070) | (tx_control &
255 0x0070));
256 } 253 }
257 if (has_tx_magnification(phy)) { 254 if (has_tx_magnification(phy)) {
258 b43_radio_write16(dev, 0x52, tx_magn | tx_bias); 255 b43_radio_write16(dev, 0x52, tx_magn | tx_bias);
259 } else { 256 } else {
260 b43_radio_write16(dev, 0x52, (b43_radio_read16(dev, 0x52) 257 b43_radio_maskset(dev, 0x52, 0xFFF0, (tx_bias & 0x000F));
261 & 0xFFF0) | (tx_bias & 0x000F));
262 } 258 }
263 b43_lo_g_adjust(dev); 259 b43_lo_g_adjust(dev);
264} 260}
@@ -513,8 +509,7 @@ static void b43_calc_nrssi_offset(struct b43_wldev *dev)
513 b43_phy_maskset(dev, 0x0003, 0xFF9F, 0x0040); 509 b43_phy_maskset(dev, 0x0003, 0xFF9F, 0x0040);
514 b43_radio_set(dev, 0x007A, 0x000F); 510 b43_radio_set(dev, 0x007A, 0x000F);
515 b43_set_all_gains(dev, 3, 0, 1); 511 b43_set_all_gains(dev, 3, 0, 1);
516 b43_radio_write16(dev, 0x0043, (b43_radio_read16(dev, 0x0043) 512 b43_radio_maskset(dev, 0x0043, 0x00F0, 0x000F);
517 & 0x00F0) | 0x000F);
518 udelay(30); 513 udelay(30);
519 v47F = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); 514 v47F = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F);
520 if (v47F >= 0x20) 515 if (v47F >= 0x20)
@@ -1353,8 +1348,7 @@ static u16 b43_radio_init2050(struct b43_wldev *dev)
1353 b43_radio_write16(dev, 0x43, 0x1F); 1348 b43_radio_write16(dev, 0x43, 0x1F);
1354 } else { 1349 } else {
1355 b43_radio_write16(dev, 0x52, 0); 1350 b43_radio_write16(dev, 0x52, 0);
1356 b43_radio_write16(dev, 0x43, (b43_radio_read16(dev, 0x43) 1351 b43_radio_maskset(dev, 0x43, 0xFFF0, 0x0009);
1357 & 0xFFF0) | 0x0009);
1358 } 1352 }
1359 b43_phy_write(dev, B43_PHY_CCK(0x58), 0); 1353 b43_phy_write(dev, B43_PHY_CCK(0x58), 0);
1360 1354
@@ -1681,8 +1675,7 @@ static void b43_phy_initb6(struct b43_wldev *dev)
1681 b43_radio_write16(dev, 0x5B, 0x7B); 1675 b43_radio_write16(dev, 0x5B, 0x7B);
1682 b43_radio_write16(dev, 0x5C, 0xB0); 1676 b43_radio_write16(dev, 0x5C, 0xB0);
1683 } 1677 }
1684 b43_radio_write16(dev, 0x007A, 1678 b43_radio_maskset(dev, 0x007A, 0x00F8, 0x0007);
1685 (b43_radio_read16(dev, 0x007A) & 0x00F8) | 0x0007);
1686 1679
1687 b43_gphy_channel_switch(dev, old_channel, 0); 1680 b43_gphy_channel_switch(dev, old_channel, 0);
1688 1681
@@ -1777,8 +1770,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev)
1777 b43_radio_write16(dev, 0x43, 0x000F); 1770 b43_radio_write16(dev, 0x43, 0x000F);
1778 } else { 1771 } else {
1779 b43_radio_write16(dev, 0x52, 0); 1772 b43_radio_write16(dev, 0x52, 0);
1780 b43_radio_write16(dev, 0x43, (b43_radio_read16(dev, 0x43) 1773 b43_radio_maskset(dev, 0x43, 0xFFF0, 0x9);
1781 & 0xFFF0) | 0x9);
1782 } 1774 }
1783 b43_gphy_set_baseband_attenuation(dev, 11); 1775 b43_gphy_set_baseband_attenuation(dev, 11);
1784 1776
@@ -1953,9 +1945,7 @@ static void b43_phy_init_pctl(struct b43_wldev *dev)
1953 b43_hardware_pctl_early_init(dev); 1945 b43_hardware_pctl_early_init(dev);
1954 if (gphy->cur_idle_tssi == 0) { 1946 if (gphy->cur_idle_tssi == 0) {
1955 if (phy->radio_ver == 0x2050 && phy->analog == 0) { 1947 if (phy->radio_ver == 0x2050 && phy->analog == 0) {
1956 b43_radio_write16(dev, 0x0076, 1948 b43_radio_maskset(dev, 0x0076, 0x00F7, 0x0084);
1957 (b43_radio_read16(dev, 0x0076)
1958 & 0x00F7) | 0x0084);
1959 } else { 1949 } else {
1960 struct b43_rfatt rfatt; 1950 struct b43_rfatt rfatt;
1961 struct b43_bbatt bbatt; 1951 struct b43_bbatt bbatt;
@@ -2057,9 +2047,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
2057 | gphy->lo_control->tx_bias | gphy-> 2047 | gphy->lo_control->tx_bias | gphy->
2058 lo_control->tx_magn); 2048 lo_control->tx_magn);
2059 } else { 2049 } else {
2060 b43_radio_write16(dev, 0x52, 2050 b43_radio_maskset(dev, 0x52, 0xFFF0, gphy->lo_control->tx_bias);
2061 (b43_radio_read16(dev, 0x52) & 0xFFF0)
2062 | gphy->lo_control->tx_bias);
2063 } 2051 }
2064 if (phy->rev >= 6) { 2052 if (phy->rev >= 6) {
2065 b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); 2053 b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12));