Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79393
b: refs/heads/master
c: f31800d
h: refs/heads/master
i:
  79391: 81dde38
v: v3
  • Loading branch information
Michael Buesch authored and David S. Miller committed Jan 28, 2008
1 parent b5f56ee commit b280a35
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5250703e3144e50fbeceb4d1fc01ea2fd159fd4a
refs/heads/master: f31800d8b79bc42e495070aa6e6425841b7bdcbf
17 changes: 8 additions & 9 deletions trunk/drivers/net/wireless/b43/b43.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ struct b43_phy {
u16 radio_ver; /* Radio version */
u8 radio_rev; /* Radio revision */

bool locked; /* Only used in b43_phy_{un}lock() */
bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */

/* ACI (adjacent channel interference) flags. */
Expand Down Expand Up @@ -513,11 +512,6 @@ struct b43_phy {
s16 lna_gain; /* LNA */
s16 pga_gain; /* PGA */

/* PHY lock for core.rev < 3
* This lock is only used by b43_phy_{un}lock()
*/
spinlock_t lock;

/* Desired TX power level (in dBm).
* This is set by the user and adjusted in b43_phy_xmitpower(). */
u8 power_level;
Expand All @@ -528,9 +522,7 @@ struct b43_phy {
struct b43_bbatt bbatt;
struct b43_rfatt rfatt;
u8 tx_control; /* B43_TXCTL_XXX */
#ifdef CONFIG_B43_DEBUG
bool manual_txpower_control; /* Manual TX-power control enabled? */
#endif

/* Hardware Power Control enabled? */
bool hardware_power_control;

Expand Down Expand Up @@ -571,6 +563,13 @@ struct b43_phy {
B43_OFDMTAB_DIRECTION_READ,
B43_OFDMTAB_DIRECTION_WRITE,
} ofdmtab_addr_direction;

#if B43_DEBUG
/* Manual TX-power control enabled? */
bool manual_txpower_control;
/* PHY registers locked by b43_phy_lock()? */
bool phy_locked;
#endif /* B43_DEBUG */
};

/* Data structures for DMA transmission, per 80211 core. */
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/net/wireless/b43/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ static ssize_t txpower_g_read_file(struct b43_wldev *dev,
static int txpower_g_write_file(struct b43_wldev *dev,
const char *buf, size_t count)
{
unsigned long phy_flags;

if (dev->phy.type != B43_PHYTYPE_G)
return -ENODEV;
if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) {
Expand All @@ -247,12 +245,12 @@ static int txpower_g_write_file(struct b43_wldev *dev,
dev->phy.tx_control |= B43_TXCTL_PA2DB;
if (pa3db)
dev->phy.tx_control |= B43_TXCTL_PA3DB;
b43_phy_lock(dev, phy_flags);
b43_phy_lock(dev);
b43_radio_lock(dev);
b43_set_txpower_g(dev, &dev->phy.bbatt,
&dev->phy.rfatt, dev->phy.tx_control);
b43_radio_unlock(dev);
b43_phy_unlock(dev, phy_flags);
b43_phy_unlock(dev);
}

return 0;
Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3146,9 +3146,6 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig));
memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos));

/* Flags */
phy->locked = 0;

phy->aci_enable = 0;
phy->aci_wlan_automatic = 0;
phy->aci_hw_rssi = 0;
Expand All @@ -3175,7 +3172,6 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
phy->lofcal = 0xFFFF;
phy->initval = 0xFFFF;

spin_lock_init(&phy->lock);
phy->interfmode = B43_INTERFMODE_NONE;
phy->channel = 0xFF;

Expand Down
60 changes: 24 additions & 36 deletions trunk/drivers/net/wireless/b43/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,42 +228,30 @@ static void b43_shm_clear_tssi(struct b43_wldev *dev)
}
}

void b43_raw_phy_lock(struct b43_wldev *dev)
/* Lock the PHY registers against concurrent access from the microcode.
* This lock is nonrecursive. */
void b43_phy_lock(struct b43_wldev *dev)
{
struct b43_phy *phy = &dev->phy;

B43_WARN_ON(!irqs_disabled());

/* We had a check for MACCTL==0 here, but I think that doesn't
* make sense, as MACCTL is never 0 when this is called.
* --mb */
B43_WARN_ON(b43_read32(dev, B43_MMIO_MACCTL) == 0);
#if B43_DEBUG
B43_WARN_ON(dev->phy.phy_locked);
dev->phy.phy_locked = 1;
#endif
B43_WARN_ON(dev->dev->id.revision < 3);

if (dev->dev->id.revision < 3) {
b43_mac_suspend(dev);
spin_lock(&phy->lock);
} else {
if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP))
b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
}
phy->locked = 1;
if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP))
b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
}

void b43_raw_phy_unlock(struct b43_wldev *dev)
void b43_phy_unlock(struct b43_wldev *dev)
{
struct b43_phy *phy = &dev->phy;
#if B43_DEBUG
B43_WARN_ON(!dev->phy.phy_locked);
dev->phy.phy_locked = 0;
#endif
B43_WARN_ON(dev->dev->id.revision < 3);

B43_WARN_ON(!irqs_disabled());
if (dev->dev->id.revision < 3) {
if (phy->locked) {
spin_unlock(&phy->lock);
b43_mac_enable(dev);
}
} else {
if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP))
b43_power_saving_ctl_bits(dev, 0);
}
phy->locked = 0;
if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP))
b43_power_saving_ctl_bits(dev, 0);
}

/* Different PHYs require different register routing flags.
Expand Down Expand Up @@ -1730,7 +1718,6 @@ void b43_phy_xmitpower(struct b43_wldev *dev)
int rfatt_delta, bbatt_delta;
int rfatt, bbatt;
u8 tx_control;
unsigned long phylock_flags;

tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x0058);
v0 = (s8) (tmp & 0x00FF);
Expand Down Expand Up @@ -1861,13 +1848,13 @@ void b43_phy_xmitpower(struct b43_wldev *dev)
phy->bbatt.att = bbatt;

/* Adjust the hardware */
b43_phy_lock(dev, phylock_flags);
b43_phy_lock(dev);
b43_radio_lock(dev);
b43_set_txpower_g(dev, &phy->bbatt, &phy->rfatt,
phy->tx_control);
b43_lo_g_ctl_mark_cur_used(dev);
b43_radio_unlock(dev);
b43_phy_unlock(dev, phylock_flags);
b43_phy_unlock(dev);
break;
}
default:
Expand Down Expand Up @@ -2158,6 +2145,7 @@ void b43_radio_lock(struct b43_wldev *dev)
u32 macctl;

macctl = b43_read32(dev, B43_MMIO_MACCTL);
B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK);
macctl |= B43_MACCTL_RADIOLOCK;
b43_write32(dev, B43_MMIO_MACCTL, macctl);
/* Commit the write and wait for the device
Expand All @@ -2174,6 +2162,7 @@ void b43_radio_unlock(struct b43_wldev *dev)
b43_read16(dev, B43_MMIO_PHY_VER);
/* unlock */
macctl = b43_read32(dev, B43_MMIO_MACCTL);
B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK));
macctl &= ~B43_MACCTL_RADIOLOCK;
b43_write32(dev, B43_MMIO_MACCTL, macctl);
}
Expand Down Expand Up @@ -2355,12 +2344,11 @@ u8 b43_radio_aci_scan(struct b43_wldev * dev)
u8 ret[13];
unsigned int channel = phy->channel;
unsigned int i, j, start, end;
unsigned long phylock_flags;

if (!((phy->type == B43_PHYTYPE_G) && (phy->rev > 0)))
return 0;

b43_phy_lock(dev, phylock_flags);
b43_phy_lock(dev);
b43_radio_lock(dev);
b43_phy_write(dev, 0x0802, b43_phy_read(dev, 0x0802) & 0xFFFC);
b43_phy_write(dev, B43_PHY_G_CRS,
Expand Down Expand Up @@ -2389,7 +2377,7 @@ u8 b43_radio_aci_scan(struct b43_wldev * dev)
ret[j] = 1;
}
b43_radio_unlock(dev);
b43_phy_unlock(dev, phylock_flags);
b43_phy_unlock(dev);

return ret[channel - 1];
}
Expand Down
14 changes: 2 additions & 12 deletions trunk/drivers/net/wireless/b43/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,8 @@ enum {
#define B43_PHYVER_TYPE_SHIFT 8
#define B43_PHYVER_VERSION 0x00FF

void b43_raw_phy_lock(struct b43_wldev *dev);
#define b43_phy_lock(dev, flags) \
do { \
local_irq_save(flags); \
b43_raw_phy_lock(dev); \
} while (0)
void b43_raw_phy_unlock(struct b43_wldev *dev);
#define b43_phy_unlock(dev, flags) \
do { \
b43_raw_phy_unlock(dev); \
local_irq_restore(flags); \
} while (0)
void b43_phy_lock(struct b43_wldev *dev);
void b43_phy_unlock(struct b43_wldev *dev);

u16 b43_phy_read(struct b43_wldev *dev, u16 offset);
void b43_phy_write(struct b43_wldev *dev, u16 offset, u16 val);
Expand Down

0 comments on commit b280a35

Please sign in to comment.