aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
diff options
context:
space:
mode:
authorMichael Buesch <mbuesch@freenet.de>2006-03-13 13:27:34 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-03-27 11:19:37 -0500
commite9357c056c5e62516f0044e60591d41f00ca7cfa (patch)
treea5dc842a43db15403207f1d763df008fb43cb8e6 /drivers/net/wireless/bcm43xx/bcm43xx_radio.c
parentaae3778176ec7a57b1c4f539b7252acfd7d99a1b (diff)
[PATCH] bcm43xx: reduce the size of bcm43xx_private by removing unneeded members.
Signed-off-by: Michael Buesch <mbuesch@freenet.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_radio.c')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_radio.c72
1 files changed, 38 insertions, 34 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
index 4d3b0e85876c..07a6169a0b34 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
@@ -114,8 +114,8 @@ void bcm43xx_radio_unlock(struct bcm43xx_private *bcm)
114 114
115u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset) 115u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset)
116{ 116{
117 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 117 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
118 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 118 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
119 119
120 switch (phy->type) { 120 switch (phy->type) {
121 case BCM43xx_PHYTYPE_A: 121 case BCM43xx_PHYTYPE_A:
@@ -151,7 +151,7 @@ void bcm43xx_radio_write16(struct bcm43xx_private *bcm, u16 offset, u16 val)
151static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm, 151static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm,
152 s16 first, s16 second, s16 third) 152 s16 first, s16 second, s16 third)
153{ 153{
154 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 154 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
155 u16 i; 155 u16 i;
156 u16 start = 0x08, end = 0x18; 156 u16 start = 0x08, end = 0x18;
157 u16 offset = 0x0400; 157 u16 offset = 0x0400;
@@ -183,7 +183,7 @@ static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm,
183 183
184static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm) 184static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm)
185{ 185{
186 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 186 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
187 u16 i, tmp; 187 u16 i, tmp;
188 u16 offset = 0x0400; 188 u16 offset = 0x0400;
189 u16 start = 0x0008, end = 0x0018; 189 u16 start = 0x0008, end = 0x0018;
@@ -217,7 +217,7 @@ static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm)
217/* Synthetic PU workaround */ 217/* Synthetic PU workaround */
218static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel) 218static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel)
219{ 219{
220 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 220 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
221 221
222 if (radio->version != 0x2050 || radio->revision >= 6) { 222 if (radio->version != 0x2050 || radio->revision >= 6) {
223 /* We do not need the workaround. */ 223 /* We do not need the workaround. */
@@ -238,7 +238,7 @@ static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel)
238 238
239u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel) 239u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel)
240{ 240{
241 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 241 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
242 u8 ret = 0; 242 u8 ret = 0;
243 u16 saved, rssi, temp; 243 u16 saved, rssi, temp;
244 int i, j = 0; 244 int i, j = 0;
@@ -269,8 +269,8 @@ u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel)
269 269
270u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm) 270u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm)
271{ 271{
272 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 272 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
273 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 273 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
274 u8 ret[13]; 274 u8 ret[13];
275 unsigned int channel = radio->channel; 275 unsigned int channel = radio->channel;
276 unsigned int i, j, start, end; 276 unsigned int i, j, start, end;
@@ -351,22 +351,23 @@ void bcm43xx_nrssi_hw_update(struct bcm43xx_private *bcm, u16 val)
351/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ 351/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */
352void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm) 352void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm)
353{ 353{
354 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
354 s16 i, delta; 355 s16 i, delta;
355 s32 tmp; 356 s32 tmp;
356 357
357 delta = 0x1F - bcm->current_core->radio->nrssi[0]; 358 delta = 0x1F - radio->nrssi[0];
358 for (i = 0; i < 64; i++) { 359 for (i = 0; i < 64; i++) {
359 tmp = (i - delta) * bcm->current_core->radio->nrssislope; 360 tmp = (i - delta) * radio->nrssislope;
360 tmp /= 0x10000; 361 tmp /= 0x10000;
361 tmp += 0x3A; 362 tmp += 0x3A;
362 tmp = limit_value(tmp, 0, 0x3F); 363 tmp = limit_value(tmp, 0, 0x3F);
363 bcm->current_core->radio->nrssi_lt[i] = tmp; 364 radio->nrssi_lt[i] = tmp;
364 } 365 }
365} 366}
366 367
367static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm) 368static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
368{ 369{
369 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 370 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
370 u16 backup[20] = { 0 }; 371 u16 backup[20] = { 0 };
371 s16 v47F; 372 s16 v47F;
372 u16 i; 373 u16 i;
@@ -531,8 +532,8 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
531 532
532void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) 533void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
533{ 534{
534 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 535 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
535 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 536 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
536 u16 backup[18] = { 0 }; 537 u16 backup[18] = { 0 };
537 u16 tmp; 538 u16 tmp;
538 s16 nrssi0, nrssi1; 539 s16 nrssi0, nrssi1;
@@ -779,8 +780,8 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
779 780
780void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm) 781void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm)
781{ 782{
782 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 783 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
783 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 784 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
784 s16 threshold; 785 s16 threshold;
785 s32 a, b; 786 s32 a, b;
786 int tmp; 787 int tmp;
@@ -804,7 +805,7 @@ void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm)
804 radiotype = 1; 805 radiotype = 1;
805 806
806 if (radiotype == 1) { 807 if (radiotype == 1) {
807 threshold = bcm->current_core->radio->nrssi[1] - 5; 808 threshold = radio->nrssi[1] - 5;
808 } else { 809 } else {
809 threshold = 40 * radio->nrssi[0]; 810 threshold = 40 * radio->nrssi[0];
810 threshold += 33 * (radio->nrssi[1] - radio->nrssi[0]); 811 threshold += 33 * (radio->nrssi[1] - radio->nrssi[0]);
@@ -901,8 +902,8 @@ static void
901bcm43xx_radio_interference_mitigation_enable(struct bcm43xx_private *bcm, 902bcm43xx_radio_interference_mitigation_enable(struct bcm43xx_private *bcm,
902 int mode) 903 int mode)
903{ 904{
904 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 905 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
905 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 906 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
906 int i = 0; 907 int i = 0;
907 u16 *stack = radio->interfstack; 908 u16 *stack = radio->interfstack;
908 u16 tmp, flipped; 909 u16 tmp, flipped;
@@ -1052,8 +1053,8 @@ static void
1052bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm, 1053bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm,
1053 int mode) 1054 int mode)
1054{ 1055{
1055 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1056 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1056 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1057 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1057 int i = 0; 1058 int i = 0;
1058 u16 *stack = radio->interfstack; 1059 u16 *stack = radio->interfstack;
1059 u16 tmp, flipped; 1060 u16 tmp, flipped;
@@ -1142,8 +1143,8 @@ bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm,
1142int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm, 1143int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm,
1143 int mode) 1144 int mode)
1144{ 1145{
1145 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1146 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1146 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1147 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1147 int currentmode; 1148 int currentmode;
1148 1149
1149 if ((phy->type != BCM43xx_PHYTYPE_G) || 1150 if ((phy->type != BCM43xx_PHYTYPE_G) ||
@@ -1199,8 +1200,8 @@ u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
1199 1200
1200u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm) 1201u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
1201{ 1202{
1202 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1203 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1203 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1204 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1204 u16 backup[19] = { 0 }; 1205 u16 backup[19] = { 0 };
1205 u16 ret; 1206 u16 ret;
1206 u16 i, j; 1207 u16 i, j;
@@ -1444,7 +1445,7 @@ int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm,
1444 u8 channel, 1445 u8 channel,
1445 int synthetic_pu_workaround) 1446 int synthetic_pu_workaround)
1446{ 1447{
1447 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1448 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1448 u16 r8, tmp; 1449 u16 r8, tmp;
1449 u16 freq; 1450 u16 freq;
1450 1451
@@ -1628,6 +1629,7 @@ static u16 bcm43xx_get_txgain_dac(u16 txpower)
1628 1629
1629void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower) 1630void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower)
1630{ 1631{
1632 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1631 u16 pamp, base, dac, ilt; 1633 u16 pamp, base, dac, ilt;
1632 1634
1633 txpower = limit_value(txpower, 0, 63); 1635 txpower = limit_value(txpower, 0, 63);
@@ -1650,7 +1652,7 @@ void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower)
1650 1652
1651 bcm43xx_ilt_write(bcm, 0x3001, dac); 1653 bcm43xx_ilt_write(bcm, 0x3001, dac);
1652 1654
1653 bcm->current_core->radio->txpower[0] = txpower; 1655 radio->txpower[0] = txpower;
1654 1656
1655 TODO(); 1657 TODO();
1656 //TODO: FuncPlaceholder (Adjust BB loft cancel) 1658 //TODO: FuncPlaceholder (Adjust BB loft cancel)
@@ -1660,8 +1662,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm,
1660 u16 baseband_attenuation, u16 radio_attenuation, 1662 u16 baseband_attenuation, u16 radio_attenuation,
1661 u16 txpower) 1663 u16 txpower)
1662{ 1664{
1663 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1665 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1664 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1666 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1665 1667
1666 if (baseband_attenuation == 0xFFFF) 1668 if (baseband_attenuation == 0xFFFF)
1667 baseband_attenuation = radio->txpower[0]; 1669 baseband_attenuation = radio->txpower[0];
@@ -1698,8 +1700,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm,
1698 1700
1699void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) 1701void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm)
1700{ 1702{
1701 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1703 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1702 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1704 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1703 int err; 1705 int err;
1704 1706
1705 if (radio->enabled) 1707 if (radio->enabled)
@@ -1730,8 +1732,8 @@ void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm)
1730 1732
1731void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm) 1733void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm)
1732{ 1734{
1733 struct bcm43xx_phyinfo *phy = bcm->current_core->phy; 1735 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1734 struct bcm43xx_radioinfo *radio = bcm->current_core->radio; 1736 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
1735 1737
1736 if (phy->type == BCM43xx_PHYTYPE_A) { 1738 if (phy->type == BCM43xx_PHYTYPE_A) {
1737 bcm43xx_radio_write16(bcm, 0x0004, 0x00FF); 1739 bcm43xx_radio_write16(bcm, 0x0004, 0x00FF);
@@ -1750,7 +1752,9 @@ void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm)
1750 1752
1751void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm) 1753void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm)
1752{ 1754{
1753 switch (bcm->current_core->phy->type) { 1755 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1756
1757 switch (phy->type) {
1754 case BCM43xx_PHYTYPE_A: 1758 case BCM43xx_PHYTYPE_A:
1755 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0068, 0x7F7F); 1759 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0068, 0x7F7F);
1756 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x006a, 0x7F7F); 1760 bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x006a, 0x7F7F);