diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-01-14 00:05:57 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:09:53 -0800 |
commit | d15913140645d9c23e8b0a9a0bb307ca889688d3 (patch) | |
tree | 7bd05a3d5f082d4dc7adcb82d066cb56e35eb847 /drivers/net/wireless/b43/phy.c | |
parent | 53a6e2342d73d509318836e320f70cd286acd69c (diff) |
b43: Add NPHY channel switch code
This adds code and table data for channel switching on NPHYs.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy.c')
-rw-r--r-- | drivers/net/wireless/b43/phy.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 03cca61fdf84..71507b260b6d 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c @@ -3883,7 +3883,8 @@ int b43_radio_selectchannel(struct b43_wldev *dev, struct b43_phy *phy = &dev->phy; u16 r8, tmp; u16 freq; - u16 channelcookie; + u16 channelcookie, savedcookie; + int err = 0; if (channel == 0xFF) { switch (phy->type) { @@ -3910,12 +3911,15 @@ int b43_radio_selectchannel(struct b43_wldev *dev, if (0 /*FIXME on 5Ghz */) channelcookie |= 0x100; //FIXME set 40Mhz flag if required + savedcookie = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN); b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, channelcookie); switch (phy->type) { case B43_PHYTYPE_A: - if (channel > 200) - return -EINVAL; + if (channel > 200) { + err = -EINVAL; + goto out; + } freq = channel2freq_a(channel); r8 = b43_radio_read16(dev, 0x0008); @@ -3964,8 +3968,10 @@ int b43_radio_selectchannel(struct b43_wldev *dev, b43_phy_xmitpower(dev); //FIXME correct? break; case B43_PHYTYPE_G: - if ((channel < 1) || (channel > 14)) - return -EINVAL; + if ((channel < 1) || (channel > 14)) { + err = -EINVAL; + goto out; + } if (synthetic_pu_workaround) b43_synth_pu_workaround(dev, channel); @@ -3990,7 +3996,9 @@ int b43_radio_selectchannel(struct b43_wldev *dev, } break; case B43_PHYTYPE_N: - b43_nphy_selectchannel(dev, channel); + err = b43_nphy_selectchannel(dev, channel); + if (err) + goto out; break; default: B43_WARN_ON(1); @@ -3999,8 +4007,12 @@ int b43_radio_selectchannel(struct b43_wldev *dev, phy->channel = channel; /* Wait for the radio to tune to the channel and stabilize. */ msleep(8); - - return 0; +out: + if (err) { + b43_shm_write16(dev, B43_SHM_SHARED, + B43_SHM_SH_CHAN, savedcookie); + } + return err; } void b43_radio_turn_on(struct b43_wldev *dev) |