aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-10-06 01:50:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-06 16:30:41 -0400
commit5e7ee098ce2795e0c2628686dd97fc64bcc11594 (patch)
treee72603429a3d894521c0a37c03bac884e43fe393 /drivers/net
parentd537f5fdfcc9c57c1e3b9fb316a4bed2bf7597e7 (diff)
b43: N-PHY: simplify channel switching
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/b43/phy_n.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 5f0ce35bbe27..74c32b06efa1 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -73,7 +73,8 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
73 u16 value, u8 core, bool off); 73 u16 value, u8 core, bool off);
74static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, 74static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
75 u16 value, u8 core); 75 u16 value, u8 core);
76static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel); 76static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
77 unsigned int new_channel);
77 78
78static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec) 79static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
79{ 80{
@@ -223,7 +224,7 @@ static void b43_radio_init2055_post(struct b43_wldev *dev)
223 if (i) 224 if (i)
224 b43err(dev->wl, "radio post init timeout\n"); 225 b43err(dev->wl, "radio post init timeout\n");
225 b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F); 226 b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
226 nphy_channel_switch(dev, dev->phy.channel); 227 b43_nphy_op_switch_channel(dev, dev->phy.channel);
227 b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9); 228 b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9);
228 b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9); 229 b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9);
229 b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83); 230 b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
@@ -3438,18 +3439,6 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev,
3438 return 0; 3439 return 0;
3439} 3440}
3440 3441
3441/* Tune the hardware to a new channel */
3442static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
3443{
3444 struct b43_phy_n *nphy = dev->phy.n;
3445
3446 struct b43_chanspec chanspec;
3447 chanspec = nphy->radio_chanspec;
3448 chanspec.channel = channel;
3449
3450 return b43_nphy_set_chanspec(dev, chanspec);
3451}
3452
3453static int b43_nphy_op_allocate(struct b43_wldev *dev) 3442static int b43_nphy_op_allocate(struct b43_wldev *dev)
3454{ 3443{
3455 struct b43_phy_n *nphy; 3444 struct b43_phy_n *nphy;
@@ -3570,7 +3559,7 @@ static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
3570 } else { 3559 } else {
3571 if (dev->phy.rev >= 3) { 3560 if (dev->phy.rev >= 3) {
3572 b43_radio_init2056(dev); 3561 b43_radio_init2056(dev);
3573 b43_nphy_set_chanspec(dev, nphy->radio_chanspec); 3562 b43_nphy_op_switch_channel(dev, dev->phy.channel);
3574 } else { 3563 } else {
3575 b43_radio_init2055(dev); 3564 b43_radio_init2055(dev);
3576 } 3565 }
@@ -3586,6 +3575,9 @@ static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
3586static int b43_nphy_op_switch_channel(struct b43_wldev *dev, 3575static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
3587 unsigned int new_channel) 3576 unsigned int new_channel)
3588{ 3577{
3578 struct b43_phy_n *nphy = dev->phy.n;
3579 struct b43_chanspec chanspec;
3580
3589 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 3581 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
3590 if ((new_channel < 1) || (new_channel > 14)) 3582 if ((new_channel < 1) || (new_channel > 14))
3591 return -EINVAL; 3583 return -EINVAL;
@@ -3594,7 +3586,10 @@ static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
3594 return -EINVAL; 3586 return -EINVAL;
3595 } 3587 }
3596 3588
3597 return nphy_channel_switch(dev, new_channel); 3589 chanspec = nphy->radio_chanspec;
3590 chanspec.channel = new_channel;
3591
3592 return b43_nphy_set_chanspec(dev, chanspec);
3598} 3593}
3599 3594
3600static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev) 3595static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev)