Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89858
b: refs/heads/master
c: 6bb40dd
h: refs/heads/master
v: v3
  • Loading branch information
Ivo van Doorn authored and John W. Linville committed Feb 29, 2008
1 parent d146044 commit 8b0ace7
Show file tree
Hide file tree
Showing 16 changed files with 827 additions and 531 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: 9404ef34e4747228717d6e22ce3827ed366ccf41
refs/heads/master: 6bb40dd13b458beb55f5c60dba1cb28e814bd640
84 changes: 43 additions & 41 deletions trunk/drivers/net/wireless/rt2x00/rt2400pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,50 +246,50 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
/*
* Configuration handlers.
*/
static void rt2400pci_config_mac_addr(struct rt2x00_dev *rt2x00dev,
__le32 *mac)
static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev,
struct rt2x00_intf *intf,
struct rt2x00intf_conf *conf,
const unsigned int flags)
{
rt2x00pci_register_multiwrite(rt2x00dev, CSR3, mac,
(2 * sizeof(__le32)));
}
unsigned int bcn_preload;
u32 reg;

static void rt2400pci_config_bssid(struct rt2x00_dev *rt2x00dev,
__le32 *bssid)
{
rt2x00pci_register_multiwrite(rt2x00dev, CSR5, bssid,
(2 * sizeof(__le32)));
}
if (flags & CONFIG_UPDATE_TYPE) {
rt2x00pci_register_write(rt2x00dev, CSR14, 0);

static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
const int tsf_sync)
{
u32 reg;
/*
* Enable beacon config
*/
bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20);
rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload);
rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);

rt2x00pci_register_write(rt2x00dev, CSR14, 0);
/*
* Enable synchronisation.
*/
rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
rt2x00_set_field32(&reg, CSR14_TBCN,
(conf->sync == TSF_SYNC_BEACON));
rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
rt2x00_set_field32(&reg, CSR14_TSF_SYNC, conf->sync);
rt2x00pci_register_write(rt2x00dev, CSR14, reg);
}

/*
* Enable beacon config
*/
rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
rt2x00_set_field32(&reg, BCNCSR1_PRELOAD,
PREAMBLE + get_duration(IEEE80211_HEADER, 20));
rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);
if (flags & CONFIG_UPDATE_MAC)
rt2x00pci_register_multiwrite(rt2x00dev, CSR3,
conf->mac, sizeof(conf->mac));

/*
* Enable synchronisation.
*/
rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
rt2x00_set_field32(&reg, CSR14_TBCN, (tsf_sync == TSF_SYNC_BEACON));
rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
rt2x00_set_field32(&reg, CSR14_TSF_SYNC, tsf_sync);
rt2x00pci_register_write(rt2x00dev, CSR14, reg);
if (flags & CONFIG_UPDATE_BSSID)
rt2x00pci_register_multiwrite(rt2x00dev, CSR5,
conf->bssid, sizeof(conf->bssid));
}

static void rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev,
const int short_preamble,
const int ack_timeout,
const int ack_consume_time)
static int rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev,
const int short_preamble,
const int ack_timeout,
const int ack_consume_time)
{
int preamble_mask;
u32 reg;
Expand Down Expand Up @@ -327,6 +327,8 @@ static void rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84);
rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110));
rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);

return 0;
}

static void rt2400pci_config_phymode(struct rt2x00_dev *rt2x00dev,
Expand Down Expand Up @@ -481,8 +483,8 @@ static void rt2400pci_config_duration(struct rt2x00_dev *rt2x00dev,
}

static void rt2400pci_config(struct rt2x00_dev *rt2x00dev,
const unsigned int flags,
struct rt2x00lib_conf *libconf)
struct rt2x00lib_conf *libconf,
const unsigned int flags)
{
if (flags & CONFIG_UPDATE_PHYMODE)
rt2400pci_config_phymode(rt2x00dev, libconf->basic_rates);
Expand Down Expand Up @@ -1553,9 +1555,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
.write_tx_data = rt2x00pci_write_tx_data,
.kick_tx_queue = rt2400pci_kick_tx_queue,
.fill_rxdone = rt2400pci_fill_rxdone,
.config_mac_addr = rt2400pci_config_mac_addr,
.config_bssid = rt2400pci_config_bssid,
.config_type = rt2400pci_config_type,
.config_intf = rt2400pci_config_intf,
.config_preamble = rt2400pci_config_preamble,
.config = rt2400pci_config,
};
Expand Down Expand Up @@ -1590,6 +1590,8 @@ static const struct data_queue_desc rt2400pci_queue_atim = {

static const struct rt2x00_ops rt2400pci_ops = {
.name = KBUILD_MODNAME,
.max_sta_intf = 1,
.max_ap_intf = 1,
.eeprom_size = EEPROM_SIZE,
.rf_size = RF_SIZE,
.rx = &rt2400pci_queue_rx,
Expand Down
98 changes: 52 additions & 46 deletions trunk/drivers/net/wireless/rt2x00/rt2500pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,53 +246,53 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
/*
* Configuration handlers.
*/
static void rt2500pci_config_mac_addr(struct rt2x00_dev *rt2x00dev,
__le32 *mac)
{
rt2x00pci_register_multiwrite(rt2x00dev, CSR3, mac,
(2 * sizeof(__le32)));
}

static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev,
__le32 *bssid)
{
rt2x00pci_register_multiwrite(rt2x00dev, CSR5, bssid,
(2 * sizeof(__le32)));
}

static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
const int tsf_sync)
static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
struct rt2x00_intf *intf,
struct rt2x00intf_conf *conf,
const unsigned int flags)
{
struct data_queue *queue =
rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
unsigned int bcn_preload;
u32 reg;

rt2x00pci_register_write(rt2x00dev, CSR14, 0);
if (flags & CONFIG_UPDATE_TYPE) {
rt2x00pci_register_write(rt2x00dev, CSR14, 0);

/*
* Enable beacon config
*/
rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
rt2x00_set_field32(&reg, BCNCSR1_PRELOAD,
PREAMBLE + get_duration(IEEE80211_HEADER, 20));
rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min);
rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);
/*
* Enable beacon config
*/
bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20);
rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload);
rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min);
rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);

/*
* Enable synchronisation.
*/
rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
rt2x00_set_field32(&reg, CSR14_TBCN, (tsf_sync == TSF_SYNC_BEACON));
rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
rt2x00_set_field32(&reg, CSR14_TSF_SYNC, tsf_sync);
rt2x00pci_register_write(rt2x00dev, CSR14, reg);
/*
* Enable synchronisation.
*/
rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
rt2x00_set_field32(&reg, CSR14_TBCN,
(conf->sync == TSF_SYNC_BEACON));
rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
rt2x00_set_field32(&reg, CSR14_TSF_SYNC, conf->sync);
rt2x00pci_register_write(rt2x00dev, CSR14, reg);
}

if (flags & CONFIG_UPDATE_MAC)
rt2x00pci_register_multiwrite(rt2x00dev, CSR3,
conf->mac, sizeof(conf->mac));

if (flags & CONFIG_UPDATE_BSSID)
rt2x00pci_register_multiwrite(rt2x00dev, CSR5,
conf->bssid, sizeof(conf->bssid));
}

static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev,
const int short_preamble,
const int ack_timeout,
const int ack_consume_time)
static int rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev,
const int short_preamble,
const int ack_timeout,
const int ack_consume_time)
{
int preamble_mask;
u32 reg;
Expand Down Expand Up @@ -330,6 +330,8 @@ static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84);
rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110));
rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);

return 0;
}

static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev,
Expand Down Expand Up @@ -529,8 +531,8 @@ static void rt2500pci_config_duration(struct rt2x00_dev *rt2x00dev,
}

static void rt2500pci_config(struct rt2x00_dev *rt2x00dev,
const unsigned int flags,
struct rt2x00lib_conf *libconf)
struct rt2x00lib_conf *libconf,
const unsigned int flags)
{
if (flags & CONFIG_UPDATE_PHYMODE)
rt2500pci_config_phymode(rt2x00dev, libconf->basic_rates);
Expand Down Expand Up @@ -609,19 +611,23 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
/*
* To prevent collisions with MAC ASIC on chipsets
* up to version C the link tuning should halt after 20
* seconds.
* seconds while being associated.
*/
if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D &&
rt2x00dev->intf_associated &&
rt2x00dev->link.count > 20)
return;

rt2500pci_bbp_read(rt2x00dev, 17, &r17);

/*
* Chipset versions C and lower should directly continue
* to the dynamic CCA tuning.
* to the dynamic CCA tuning. Chipset version D and higher
* should go straight to dynamic CCA tuning when they
* are not associated.
*/
if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D)
if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D ||
!rt2x00dev->intf_associated)
goto dynamic_cca_tune;

/*
Expand Down Expand Up @@ -1861,9 +1867,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
.write_tx_data = rt2x00pci_write_tx_data,
.kick_tx_queue = rt2500pci_kick_tx_queue,
.fill_rxdone = rt2500pci_fill_rxdone,
.config_mac_addr = rt2500pci_config_mac_addr,
.config_bssid = rt2500pci_config_bssid,
.config_type = rt2500pci_config_type,
.config_intf = rt2500pci_config_intf,
.config_preamble = rt2500pci_config_preamble,
.config = rt2500pci_config,
};
Expand Down Expand Up @@ -1898,6 +1902,8 @@ static const struct data_queue_desc rt2500pci_queue_atim = {

static const struct rt2x00_ops rt2500pci_ops = {
.name = KBUILD_MODNAME,
.max_sta_intf = 1,
.max_ap_intf = 1,
.eeprom_size = EEPROM_SIZE,
.rf_size = RF_SIZE,
.rx = &rt2500pci_queue_rx,
Expand Down
Loading

0 comments on commit 8b0ace7

Please sign in to comment.