rt2x00: change REGISTER_BUSY_COUNT for USB
Because of delays on USB we do not have to iterate so many times on USB hardware when waiting for H/W register become valid. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
ad92bc9e8e
commit
7a5a73528e
|
@ -47,7 +47,7 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
|
|||
* BBP and RF register require indirect register access,
|
||||
* and use the CSR registers BBPCSR and RFCSR to achieve this.
|
||||
* These indirect registers work with busy bits,
|
||||
* and we will try maximal REGISTER_BUSY_COUNT times to access
|
||||
* and we will try maximal REGISTER_USB_BUSY_COUNT times to access
|
||||
* the register while taking a REGISTER_BUSY_DELAY us delay
|
||||
* between each attampt. When the busy bit is still set at that time,
|
||||
* the access attempt is considered to have failed,
|
||||
|
@ -122,7 +122,7 @@ static int rt2500usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
|
||||
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
|
||||
rt2500usb_register_read_lock(rt2x00dev, offset, reg);
|
||||
if (!rt2x00_get_field16(*reg, field))
|
||||
return 1;
|
||||
|
@ -904,7 +904,7 @@ static int rt2500usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
|
|||
unsigned int i;
|
||||
u8 value;
|
||||
|
||||
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
|
||||
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
|
||||
rt2500usb_bbp_read(rt2x00dev, 0, &value);
|
||||
if ((value != 0xff) && (value != 0x00))
|
||||
return 0;
|
||||
|
@ -1023,7 +1023,7 @@ static int rt2500usb_set_state(struct rt2x00_dev *rt2x00dev,
|
|||
* We must wait until the register indicates that the
|
||||
* device has entered the correct state.
|
||||
*/
|
||||
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
|
||||
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
|
||||
rt2500usb_register_read(rt2x00dev, MAC_CSR17, ®2);
|
||||
bbp_state = rt2x00_get_field16(reg2, MAC_CSR17_BBP_CURR_STATE);
|
||||
rf_state = rt2x00_get_field16(reg2, MAC_CSR17_RF_CURR_STATE);
|
||||
|
|
|
@ -1019,9 +1019,12 @@ struct rt2x00_bar_list_entry {
|
|||
* Register defines.
|
||||
* Some registers require multiple attempts before success,
|
||||
* in those cases REGISTER_BUSY_COUNT attempts should be
|
||||
* taken with a REGISTER_BUSY_DELAY interval.
|
||||
* taken with a REGISTER_BUSY_DELAY interval. Due to USB
|
||||
* bus delays, we do not have to loop so many times to wait
|
||||
* for valid register value on that bus.
|
||||
*/
|
||||
#define REGISTER_BUSY_COUNT 100
|
||||
#define REGISTER_USB_BUSY_COUNT 20
|
||||
#define REGISTER_BUSY_DELAY 100
|
||||
|
||||
/*
|
||||
|
|
|
@ -150,7 +150,7 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|||
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
|
||||
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
|
||||
rt2x00usb_register_read_lock(rt2x00dev, offset, reg);
|
||||
if (!rt2x00_get_field32(*reg, field))
|
||||
return 1;
|
||||
|
|
|
@ -1295,7 +1295,7 @@ static int rt73usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
|
|||
unsigned int i;
|
||||
u8 value;
|
||||
|
||||
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
|
||||
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
|
||||
rt73usb_bbp_read(rt2x00dev, 0, &value);
|
||||
if ((value != 0xff) && (value != 0x00))
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue