diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00')
24 files changed, 2463 insertions, 1334 deletions
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 76cd47eb901..9b915d3a44b 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig @@ -173,6 +173,13 @@ config RT2800USB_RT53XX           rt2800usb driver.           Supported chips: RT5370 +config RT2800USB_RT55XX +       bool "rt2800usb - Include support for rt55xx devices (EXPERIMENTAL)" +       ---help--- +         This adds support for rt55xx wireless chipset family to the +         rt2800usb driver. +         Supported chips: RT5572 +  config RT2800USB_UNKNOWN  	bool "rt2800usb - Include support for unknown (USB) devices"  	default n diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index dcfb54e0c51..f7143733d7e 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c @@ -41,7 +41,7 @@  /*   * Register access.   * All access to the CSR registers will go through the methods - * rt2x00pci_register_read and rt2x00pci_register_write. + * rt2x00mmio_register_read and rt2x00mmio_register_write.   * 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, @@ -52,9 +52,9 @@   * and we will print an error.   */  #define WAIT_FOR_BBP(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg))  #define WAIT_FOR_RF(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg))  static void rt2400pci_bbp_write(struct rt2x00_dev *rt2x00dev,  				const unsigned int word, const u8 value) @@ -74,7 +74,7 @@ static void rt2400pci_bbp_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, BBPCSR_BUSY, 1);  		rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 1); -		rt2x00pci_register_write(rt2x00dev, BBPCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg);  	}  	mutex_unlock(&rt2x00dev->csr_mutex); @@ -101,7 +101,7 @@ static void rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, BBPCSR_BUSY, 1);  		rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 0); -		rt2x00pci_register_write(rt2x00dev, BBPCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg);  		WAIT_FOR_BBP(rt2x00dev, ®);  	} @@ -129,7 +129,7 @@ static void rt2400pci_rf_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, RFCSR_IF_SELECT, 0);  		rt2x00_set_field32(®, RFCSR_BUSY, 1); -		rt2x00pci_register_write(rt2x00dev, RFCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, RFCSR, reg);  		rt2x00_rf_write(rt2x00dev, word, value);  	} @@ -141,7 +141,7 @@ static void rt2400pci_eepromregister_read(struct eeprom_93cx6 *eeprom)  	struct rt2x00_dev *rt2x00dev = eeprom->data;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR21, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR21, ®);  	eeprom->reg_data_in = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_IN);  	eeprom->reg_data_out = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_OUT); @@ -163,15 +163,15 @@ static void rt2400pci_eepromregister_write(struct eeprom_93cx6 *eeprom)  	rt2x00_set_field32(®, CSR21_EEPROM_CHIP_SELECT,  			   !!eeprom->reg_chip_select); -	rt2x00pci_register_write(rt2x00dev, CSR21, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR21, reg);  }  #ifdef CONFIG_RT2X00_LIB_DEBUGFS  static const struct rt2x00debug rt2400pci_rt2x00debug = {  	.owner	= THIS_MODULE,  	.csr	= { -		.read		= rt2x00pci_register_read, -		.write		= rt2x00pci_register_write, +		.read		= rt2x00mmio_register_read, +		.write		= rt2x00mmio_register_write,  		.flags		= RT2X00DEBUGFS_OFFSET,  		.word_base	= CSR_REG_BASE,  		.word_size	= sizeof(u32), @@ -205,7 +205,7 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®);  	return rt2x00_get_field32(reg, GPIOCSR_VAL0);  } @@ -218,14 +218,14 @@ static void rt2400pci_brightness_set(struct led_classdev *led_cdev,  	unsigned int enabled = brightness != LED_OFF;  	u32 reg; -	rt2x00pci_register_read(led->rt2x00dev, LEDCSR, ®); +	rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®);  	if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC)  		rt2x00_set_field32(®, LEDCSR_LINK, enabled);  	else if (led->type == LED_TYPE_ACTIVITY)  		rt2x00_set_field32(®, LEDCSR_ACTIVITY, enabled); -	rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); +	rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg);  }  static int rt2400pci_blink_set(struct led_classdev *led_cdev, @@ -236,10 +236,10 @@ static int rt2400pci_blink_set(struct led_classdev *led_cdev,  	    container_of(led_cdev, struct rt2x00_led, led_dev);  	u32 reg; -	rt2x00pci_register_read(led->rt2x00dev, LEDCSR, ®); +	rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®);  	rt2x00_set_field32(®, LEDCSR_ON_PERIOD, *delay_on);  	rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, *delay_off); -	rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); +	rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg);  	return 0;  } @@ -269,7 +269,7 @@ static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev,  	 * Note that the version error will always be dropped  	 * since there is no filter for it at this time.  	 */ -	rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  	rt2x00_set_field32(®, RXCSR0_DROP_CRC,  			   !(filter_flags & FIF_FCSFAIL));  	rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL, @@ -282,7 +282,7 @@ static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev,  			   !(filter_flags & FIF_PROMISC_IN_BSS) &&  			   !rt2x00dev->intf_ap_count);  	rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1); -	rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  }  static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev, @@ -298,25 +298,26 @@ static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev,  		 * Enable beacon config  		 */  		bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20); -		rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); +		rt2x00mmio_register_read(rt2x00dev, BCNCSR1, ®);  		rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload); -		rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, BCNCSR1, reg);  		/*  		 * Enable synchronisation.  		 */ -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  	}  	if (flags & CONFIG_UPDATE_MAC) -		rt2x00pci_register_multiwrite(rt2x00dev, CSR3, -					      conf->mac, sizeof(conf->mac)); +		rt2x00mmio_register_multiwrite(rt2x00dev, CSR3, +					       conf->mac, sizeof(conf->mac));  	if (flags & CONFIG_UPDATE_BSSID) -		rt2x00pci_register_multiwrite(rt2x00dev, CSR5, -					      conf->bssid, sizeof(conf->bssid)); +		rt2x00mmio_register_multiwrite(rt2x00dev, CSR5, +					       conf->bssid, +					       sizeof(conf->bssid));  }  static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev, @@ -332,68 +333,68 @@ static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,  	if (changed & BSS_CHANGED_ERP_PREAMBLE) {  		preamble_mask = erp->short_preamble << 3; -		rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR1, ®);  		rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x1ff);  		rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0x13a);  		rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER);  		rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR1, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR2, ®);  		rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00);  		rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 10)); -		rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR2, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR3, ®);  		rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask);  		rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 20)); -		rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR3, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR4, ®);  		rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask);  		rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 55)); -		rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR4, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR5, ®);  		rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask);  		rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 110)); -		rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR5, reg);  	}  	if (changed & BSS_CHANGED_BASIC_RATES) -		rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); +		rt2x00mmio_register_write(rt2x00dev, ARCSR1, erp->basic_rates);  	if (changed & BSS_CHANGED_ERP_SLOT) { -		rt2x00pci_register_read(rt2x00dev, CSR11, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  		rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); -		rt2x00pci_register_write(rt2x00dev, CSR11, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -		rt2x00pci_register_read(rt2x00dev, CSR18, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR18, ®);  		rt2x00_set_field32(®, CSR18_SIFS, erp->sifs);  		rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); -		rt2x00pci_register_write(rt2x00dev, CSR18, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR18, reg); -		rt2x00pci_register_read(rt2x00dev, CSR19, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR19, ®);  		rt2x00_set_field32(®, CSR19_DIFS, erp->difs);  		rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); -		rt2x00pci_register_write(rt2x00dev, CSR19, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR19, reg);  	}  	if (changed & BSS_CHANGED_BEACON_INT) { -		rt2x00pci_register_read(rt2x00dev, CSR12, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR12, ®);  		rt2x00_set_field32(®, CSR12_BEACON_INTERVAL,  				   erp->beacon_int * 16);  		rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION,  				   erp->beacon_int * 16); -		rt2x00pci_register_write(rt2x00dev, CSR12, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR12, reg);  	}  } @@ -497,7 +498,7 @@ static void rt2400pci_config_channel(struct rt2x00_dev *rt2x00dev,  	/*  	 * Clear false CRC during channel switch.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, &rf->rf1); +	rt2x00mmio_register_read(rt2x00dev, CNT0, &rf->rf1);  }  static void rt2400pci_config_txpower(struct rt2x00_dev *rt2x00dev, int txpower) @@ -510,12 +511,12 @@ static void rt2400pci_config_retry_limit(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR11, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  	rt2x00_set_field32(®, CSR11_LONG_RETRY,  			   libconf->conf->long_frame_max_tx_count);  	rt2x00_set_field32(®, CSR11_SHORT_RETRY,  			   libconf->conf->short_frame_max_tx_count); -	rt2x00pci_register_write(rt2x00dev, CSR11, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR11, reg);  }  static void rt2400pci_config_ps(struct rt2x00_dev *rt2x00dev, @@ -527,7 +528,7 @@ static void rt2400pci_config_ps(struct rt2x00_dev *rt2x00dev,  	u32 reg;  	if (state == STATE_SLEEP) { -		rt2x00pci_register_read(rt2x00dev, CSR20, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR20, ®);  		rt2x00_set_field32(®, CSR20_DELAY_AFTER_TBCN,  				   (rt2x00dev->beacon_int - 20) * 16);  		rt2x00_set_field32(®, CSR20_TBCN_BEFORE_WAKEUP, @@ -535,14 +536,14 @@ static void rt2400pci_config_ps(struct rt2x00_dev *rt2x00dev,  		/* We must first disable autowake before it can be enabled */  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 1); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  	} else { -		rt2x00pci_register_read(rt2x00dev, CSR20, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR20, ®);  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  	}  	rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); @@ -568,10 +569,10 @@ static void rt2400pci_config_cw(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR11, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  	rt2x00_set_field32(®, CSR11_CWMIN, cw_min);  	rt2x00_set_field32(®, CSR11_CWMAX, cw_max); -	rt2x00pci_register_write(rt2x00dev, CSR11, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR11, reg);  }  /* @@ -586,7 +587,7 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev,  	/*  	 * Update FCS error count from register.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT0, ®);  	qual->rx_failed = rt2x00_get_field32(reg, CNT0_FCS_ERROR);  	/* @@ -641,16 +642,16 @@ static void rt2400pci_start_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  		rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); -		rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_COUNT, 1);  		rt2x00_set_field32(®, CSR14_TBCN, 1);  		rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  		break;  	default:  		break; @@ -664,19 +665,19 @@ static void rt2400pci_kick_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_AC_VO: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_AC_VI: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_ATIM: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	default:  		break; @@ -692,21 +693,21 @@ static void rt2400pci_stop_queue(struct data_queue *queue)  	case QID_AC_VO:  	case QID_AC_VI:  	case QID_ATIM: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_ABORT, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  		rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); -		rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_COUNT, 0);  		rt2x00_set_field32(®, CSR14_TBCN, 0);  		rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  		/*  		 * Wait for possibly running tbtt tasklets. @@ -723,7 +724,7 @@ static void rt2400pci_stop_queue(struct data_queue *queue)   */  static bool rt2400pci_get_entry_state(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word;  	if (entry->queue->qid == QID_RX) { @@ -740,7 +741,7 @@ static bool rt2400pci_get_entry_state(struct queue_entry *entry)  static void rt2400pci_clear_entry(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);  	u32 word; @@ -766,53 +767,53 @@ static void rt2400pci_clear_entry(struct queue_entry *entry)  static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)  { -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	u32 reg;  	/*  	 * Initialize registers.  	 */ -	rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR2, ®);  	rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size);  	rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit);  	rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit);  	rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); -	rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR2, reg);  	entry_priv = rt2x00dev->tx[1].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR3, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR3, ®);  	rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR3, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR3, reg);  	entry_priv = rt2x00dev->tx[0].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR5, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR5, ®);  	rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR5, reg);  	entry_priv = rt2x00dev->atim->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR4, ®);  	rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR4, reg);  	entry_priv = rt2x00dev->bcn->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR6, ®);  	rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR6, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR6, reg); -	rt2x00pci_register_read(rt2x00dev, RXCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR1, ®);  	rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size);  	rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); -	rt2x00pci_register_write(rt2x00dev, RXCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR1, reg);  	entry_priv = rt2x00dev->rx->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, RXCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR2, ®);  	rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, RXCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR2, reg);  	return 0;  } @@ -821,23 +822,23 @@ static int rt2400pci_init_registers(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_write(rt2x00dev, PSCSR0, 0x00020002); -	rt2x00pci_register_write(rt2x00dev, PSCSR1, 0x00000002); -	rt2x00pci_register_write(rt2x00dev, PSCSR2, 0x00023f20); -	rt2x00pci_register_write(rt2x00dev, PSCSR3, 0x00000002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR0, 0x00020002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR1, 0x00000002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR2, 0x00023f20); +	rt2x00mmio_register_write(rt2x00dev, PSCSR3, 0x00000002); -	rt2x00pci_register_read(rt2x00dev, TIMECSR, ®); +	rt2x00mmio_register_read(rt2x00dev, TIMECSR, ®);  	rt2x00_set_field32(®, TIMECSR_US_COUNT, 33);  	rt2x00_set_field32(®, TIMECSR_US_64_COUNT, 63);  	rt2x00_set_field32(®, TIMECSR_BEACON_EXPECT, 0); -	rt2x00pci_register_write(rt2x00dev, TIMECSR, reg); +	rt2x00mmio_register_write(rt2x00dev, TIMECSR, reg); -	rt2x00pci_register_read(rt2x00dev, CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR9, ®);  	rt2x00_set_field32(®, CSR9_MAX_FRAME_UNIT,  			   (rt2x00dev->rx->data_size / 128)); -	rt2x00pci_register_write(rt2x00dev, CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR9, reg); -	rt2x00pci_register_read(rt2x00dev, CSR14, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  	rt2x00_set_field32(®, CSR14_TSF_COUNT, 0);  	rt2x00_set_field32(®, CSR14_TSF_SYNC, 0);  	rt2x00_set_field32(®, CSR14_TBCN, 0); @@ -846,63 +847,63 @@ static int rt2400pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 0);  	rt2x00_set_field32(®, CSR14_CFP_COUNT_PRELOAD, 0);  	rt2x00_set_field32(®, CSR14_TBCM_PRELOAD, 0); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg); -	rt2x00pci_register_write(rt2x00dev, CNT3, 0x3f080000); +	rt2x00mmio_register_write(rt2x00dev, CNT3, 0x3f080000); -	rt2x00pci_register_read(rt2x00dev, ARCSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, ARCSR0, ®);  	rt2x00_set_field32(®, ARCSR0_AR_BBP_DATA0, 133);  	rt2x00_set_field32(®, ARCSR0_AR_BBP_ID0, 134);  	rt2x00_set_field32(®, ARCSR0_AR_BBP_DATA1, 136);  	rt2x00_set_field32(®, ARCSR0_AR_BBP_ID1, 135); -	rt2x00pci_register_write(rt2x00dev, ARCSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, ARCSR0, reg); -	rt2x00pci_register_read(rt2x00dev, RXCSR3, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR3, ®);  	rt2x00_set_field32(®, RXCSR3_BBP_ID0, 3); /* Tx power.*/  	rt2x00_set_field32(®, RXCSR3_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, RXCSR3_BBP_ID1, 32); /* Signal */  	rt2x00_set_field32(®, RXCSR3_BBP_ID1_VALID, 1);  	rt2x00_set_field32(®, RXCSR3_BBP_ID2, 36); /* Rssi */  	rt2x00_set_field32(®, RXCSR3_BBP_ID2_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, RXCSR3, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR3, reg); -	rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100);  	if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE))  		return -EBUSY; -	rt2x00pci_register_write(rt2x00dev, MACCSR0, 0x00217223); -	rt2x00pci_register_write(rt2x00dev, MACCSR1, 0x00235518); +	rt2x00mmio_register_write(rt2x00dev, MACCSR0, 0x00217223); +	rt2x00mmio_register_write(rt2x00dev, MACCSR1, 0x00235518); -	rt2x00pci_register_read(rt2x00dev, MACCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, MACCSR2, ®);  	rt2x00_set_field32(®, MACCSR2_DELAY, 64); -	rt2x00pci_register_write(rt2x00dev, MACCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, MACCSR2, reg); -	rt2x00pci_register_read(rt2x00dev, RALINKCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RALINKCSR, ®);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA0, 17);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID0, 154);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA1, 0);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID1, 154); -	rt2x00pci_register_write(rt2x00dev, RALINKCSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RALINKCSR, reg); -	rt2x00pci_register_read(rt2x00dev, CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR1, ®);  	rt2x00_set_field32(®, CSR1_SOFT_RESET, 1);  	rt2x00_set_field32(®, CSR1_BBP_RESET, 0);  	rt2x00_set_field32(®, CSR1_HOST_READY, 0); -	rt2x00pci_register_write(rt2x00dev, CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR1, ®);  	rt2x00_set_field32(®, CSR1_SOFT_RESET, 0);  	rt2x00_set_field32(®, CSR1_HOST_READY, 1); -	rt2x00pci_register_write(rt2x00dev, CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR1, reg);  	/*  	 * We must clear the FCS and FIFO error count.  	 * These registers are cleared on read,  	 * so we may pass a useless variable to store the value.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, ®); -	rt2x00pci_register_read(rt2x00dev, CNT4, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT0, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT4, ®);  	return 0;  } @@ -919,7 +920,7 @@ static int rt2400pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } @@ -976,8 +977,8 @@ static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 * should clear the register to assure a clean state.  	 */  	if (state == STATE_RADIO_IRQ_ON) { -		rt2x00pci_register_read(rt2x00dev, CSR7, ®); -		rt2x00pci_register_write(rt2x00dev, CSR7, reg); +		rt2x00mmio_register_read(rt2x00dev, CSR7, ®); +		rt2x00mmio_register_write(rt2x00dev, CSR7, reg);  	}  	/* @@ -986,13 +987,13 @@ static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask);  	rt2x00_set_field32(®, CSR8_RXDONE, mask); -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); @@ -1025,7 +1026,7 @@ static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev)  	/*  	 * Disable power  	 */ -	rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0);  }  static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev, @@ -1039,12 +1040,12 @@ static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev,  	put_to_sleep = (state != STATE_AWAKE); -	rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®);  	rt2x00_set_field32(®, PWRCSR1_SET_STATE, 1);  	rt2x00_set_field32(®, PWRCSR1_BBP_DESIRE_STATE, state);  	rt2x00_set_field32(®, PWRCSR1_RF_DESIRE_STATE, state);  	rt2x00_set_field32(®, PWRCSR1_PUT_TO_SLEEP, put_to_sleep); -	rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg);  	/*  	 * Device is not guaranteed to be in the requested state yet. @@ -1052,12 +1053,12 @@ static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev,  	 * device has entered the correct state.  	 */  	for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -		rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®2); +		rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®2);  		bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE);  		rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE);  		if (bbp_state == state && rf_state == state)  			return 0; -		rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg);  		msleep(10);  	} @@ -1092,8 +1093,8 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -1105,7 +1106,7 @@ static void rt2400pci_write_tx_desc(struct queue_entry *entry,  				    struct txentry_desc *txdesc)  {  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	__le32 *txd = entry_priv->desc;  	u32 word; @@ -1182,12 +1183,12 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,  	 * Disable beaconing while we are reloading the beacon data,  	 * otherwise we might be sending out invalid data.  	 */ -	rt2x00pci_register_read(rt2x00dev, CSR14, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  	if (rt2x00queue_map_txskb(entry)) { -		ERROR(rt2x00dev, "Fail to map beacon, aborting\n"); +		rt2x00_err(rt2x00dev, "Fail to map beacon, aborting\n");  		goto out;  	}  	/* @@ -1208,7 +1209,7 @@ out:  	 * Enable beaconing again.  	 */  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  }  /* @@ -1218,7 +1219,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,  				  struct rxdone_entry_desc *rxdesc)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word0;  	u32 word2;  	u32 word3; @@ -1276,7 +1277,7 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev,  			     const enum data_queue_qid queue_idx)  {  	struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	struct queue_entry *entry;  	struct txdone_entry_desc txdesc;  	u32 word; @@ -1322,9 +1323,9 @@ static inline void rt2400pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irq(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	rt2x00_set_field32(®, irq_field, 0); -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock_irq(&rt2x00dev->irqmask_lock);  } @@ -1347,11 +1348,11 @@ static void rt2400pci_txstatus_tasklet(unsigned long data)  	if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) {  		spin_lock_irq(&rt2x00dev->irqmask_lock); -		rt2x00pci_register_read(rt2x00dev, CSR8, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  		rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0);  		rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, 0);  		rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); -		rt2x00pci_register_write(rt2x00dev, CSR8, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  		spin_unlock_irq(&rt2x00dev->irqmask_lock);  	} @@ -1368,7 +1369,7 @@ static void rt2400pci_tbtt_tasklet(unsigned long data)  static void rt2400pci_rxdone_tasklet(unsigned long data)  {  	struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -	if (rt2x00pci_rxdone(rt2x00dev)) +	if (rt2x00mmio_rxdone(rt2x00dev))  		tasklet_schedule(&rt2x00dev->rxdone_tasklet);  	else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))  		rt2400pci_enable_interrupt(rt2x00dev, CSR8_RXDONE); @@ -1383,8 +1384,8 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)  	 * Get the interrupt sources & saved to local variable.  	 * Write register value back to clear pending interrupts.  	 */ -	rt2x00pci_register_read(rt2x00dev, CSR7, ®); -	rt2x00pci_register_write(rt2x00dev, CSR7, reg); +	rt2x00mmio_register_read(rt2x00dev, CSR7, ®); +	rt2x00mmio_register_write(rt2x00dev, CSR7, reg);  	if (!reg)  		return IRQ_NONE; @@ -1421,9 +1422,9 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)  	 */  	spin_lock(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	reg |= mask; -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock(&rt2x00dev->irqmask_lock); @@ -1442,7 +1443,7 @@ static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	u16 word;  	u8 *mac; -	rt2x00pci_register_read(rt2x00dev, CSR21, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR21, ®);  	eeprom.data = rt2x00dev;  	eeprom.register_read = rt2400pci_eepromregister_read; @@ -1463,12 +1464,12 @@ static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word);  	if (word == 0xffff) { -		ERROR(rt2x00dev, "Invalid EEPROM data detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid EEPROM data detected\n");  		return -EINVAL;  	} @@ -1490,12 +1491,12 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)  	 * Identify RF chipset.  	 */  	value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); -	rt2x00pci_register_read(rt2x00dev, CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR0, ®);  	rt2x00_set_chip(rt2x00dev, RT2460, value,  			rt2x00_get_field32(reg, CSR0_REVISION));  	if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { -		ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n");  		return -ENODEV;  	} @@ -1635,9 +1636,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)  	 * Enable rfkill polling by setting GPIO direction of the  	 * rfkill switch GPIO pin correctly.  	 */ -	rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®);  	rt2x00_set_field32(®, GPIOCSR_DIR0, 1); -	rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg); +	rt2x00mmio_register_write(rt2x00dev, GPIOCSR, reg);  	/*  	 * Initialize hw specifications. @@ -1697,9 +1698,9 @@ static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw,  	u64 tsf;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR17, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR17, ®);  	tsf = (u64) rt2x00_get_field32(reg, CSR17_HIGH_TSFTIMER) << 32; -	rt2x00pci_register_read(rt2x00dev, CSR16, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR16, ®);  	tsf |= rt2x00_get_field32(reg, CSR16_LOW_TSFTIMER);  	return tsf; @@ -1710,7 +1711,7 @@ static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw)  	struct rt2x00_dev *rt2x00dev = hw->priv;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR15, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR15, ®);  	return rt2x00_get_field32(reg, CSR15_BEACON_SENT);  } @@ -1743,8 +1744,8 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {  	.tbtt_tasklet		= rt2400pci_tbtt_tasklet,  	.rxdone_tasklet		= rt2400pci_rxdone_tasklet,  	.probe_hw		= rt2400pci_probe_hw, -	.initialize		= rt2x00pci_initialize, -	.uninitialize		= rt2x00pci_uninitialize, +	.initialize		= rt2x00mmio_initialize, +	.uninitialize		= rt2x00mmio_uninitialize,  	.get_entry_state	= rt2400pci_get_entry_state,  	.clear_entry		= rt2400pci_clear_entry,  	.set_device_state	= rt2400pci_set_device_state, @@ -1755,7 +1756,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {  	.start_queue		= rt2400pci_start_queue,  	.kick_queue		= rt2400pci_kick_queue,  	.stop_queue		= rt2400pci_stop_queue, -	.flush_queue		= rt2x00pci_flush_queue, +	.flush_queue		= rt2x00mmio_flush_queue,  	.write_tx_desc		= rt2400pci_write_tx_desc,  	.write_beacon		= rt2400pci_write_beacon,  	.fill_rxdone		= rt2400pci_fill_rxdone, @@ -1770,28 +1771,28 @@ static const struct data_queue_desc rt2400pci_queue_rx = {  	.entry_num		= 24,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= RXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2400pci_queue_tx = {  	.entry_num		= 24,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2400pci_queue_bcn = {  	.entry_num		= 1,  	.data_size		= MGMT_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2400pci_queue_atim = {  	.entry_num		= 8,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct rt2x00_ops rt2400pci_ops = { diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index e1d2dc9ed28..77e45b223d1 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c @@ -41,7 +41,7 @@  /*   * Register access.   * All access to the CSR registers will go through the methods - * rt2x00pci_register_read and rt2x00pci_register_write. + * rt2x00mmio_register_read and rt2x00mmio_register_write.   * 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, @@ -52,9 +52,9 @@   * and we will print an error.   */  #define WAIT_FOR_BBP(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg))  #define WAIT_FOR_RF(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg))  static void rt2500pci_bbp_write(struct rt2x00_dev *rt2x00dev,  				const unsigned int word, const u8 value) @@ -74,7 +74,7 @@ static void rt2500pci_bbp_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, BBPCSR_BUSY, 1);  		rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 1); -		rt2x00pci_register_write(rt2x00dev, BBPCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg);  	}  	mutex_unlock(&rt2x00dev->csr_mutex); @@ -101,7 +101,7 @@ static void rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, BBPCSR_BUSY, 1);  		rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 0); -		rt2x00pci_register_write(rt2x00dev, BBPCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg);  		WAIT_FOR_BBP(rt2x00dev, ®);  	} @@ -129,7 +129,7 @@ static void rt2500pci_rf_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, RFCSR_IF_SELECT, 0);  		rt2x00_set_field32(®, RFCSR_BUSY, 1); -		rt2x00pci_register_write(rt2x00dev, RFCSR, reg); +		rt2x00mmio_register_write(rt2x00dev, RFCSR, reg);  		rt2x00_rf_write(rt2x00dev, word, value);  	} @@ -141,7 +141,7 @@ static void rt2500pci_eepromregister_read(struct eeprom_93cx6 *eeprom)  	struct rt2x00_dev *rt2x00dev = eeprom->data;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR21, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR21, ®);  	eeprom->reg_data_in = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_IN);  	eeprom->reg_data_out = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_OUT); @@ -163,15 +163,15 @@ static void rt2500pci_eepromregister_write(struct eeprom_93cx6 *eeprom)  	rt2x00_set_field32(®, CSR21_EEPROM_CHIP_SELECT,  			   !!eeprom->reg_chip_select); -	rt2x00pci_register_write(rt2x00dev, CSR21, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR21, reg);  }  #ifdef CONFIG_RT2X00_LIB_DEBUGFS  static const struct rt2x00debug rt2500pci_rt2x00debug = {  	.owner	= THIS_MODULE,  	.csr	= { -		.read		= rt2x00pci_register_read, -		.write		= rt2x00pci_register_write, +		.read		= rt2x00mmio_register_read, +		.write		= rt2x00mmio_register_write,  		.flags		= RT2X00DEBUGFS_OFFSET,  		.word_base	= CSR_REG_BASE,  		.word_size	= sizeof(u32), @@ -205,7 +205,7 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®);  	return rt2x00_get_field32(reg, GPIOCSR_VAL0);  } @@ -218,14 +218,14 @@ static void rt2500pci_brightness_set(struct led_classdev *led_cdev,  	unsigned int enabled = brightness != LED_OFF;  	u32 reg; -	rt2x00pci_register_read(led->rt2x00dev, LEDCSR, ®); +	rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®);  	if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC)  		rt2x00_set_field32(®, LEDCSR_LINK, enabled);  	else if (led->type == LED_TYPE_ACTIVITY)  		rt2x00_set_field32(®, LEDCSR_ACTIVITY, enabled); -	rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); +	rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg);  }  static int rt2500pci_blink_set(struct led_classdev *led_cdev, @@ -236,10 +236,10 @@ static int rt2500pci_blink_set(struct led_classdev *led_cdev,  	    container_of(led_cdev, struct rt2x00_led, led_dev);  	u32 reg; -	rt2x00pci_register_read(led->rt2x00dev, LEDCSR, ®); +	rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®);  	rt2x00_set_field32(®, LEDCSR_ON_PERIOD, *delay_on);  	rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, *delay_off); -	rt2x00pci_register_write(led->rt2x00dev, LEDCSR, reg); +	rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg);  	return 0;  } @@ -270,7 +270,7 @@ static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev,  	 * and broadcast frames will always be accepted since  	 * there is no filter for it at this time.  	 */ -	rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  	rt2x00_set_field32(®, RXCSR0_DROP_CRC,  			   !(filter_flags & FIF_FCSFAIL));  	rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL, @@ -286,7 +286,7 @@ static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev,  	rt2x00_set_field32(®, RXCSR0_DROP_MCAST,  			   !(filter_flags & FIF_ALLMULTI));  	rt2x00_set_field32(®, RXCSR0_DROP_BCAST, 0); -	rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  }  static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev, @@ -303,25 +303,25 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,  		 * Enable beacon config  		 */  		bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20); -		rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); +		rt2x00mmio_register_read(rt2x00dev, BCNCSR1, ®);  		rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload);  		rt2x00_set_field32(®, BCNCSR1_BEACON_CWMIN, queue->cw_min); -		rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, BCNCSR1, reg);  		/*  		 * Enable synchronisation.  		 */ -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  	}  	if (flags & CONFIG_UPDATE_MAC) -		rt2x00pci_register_multiwrite(rt2x00dev, CSR3, +		rt2x00mmio_register_multiwrite(rt2x00dev, CSR3,  					      conf->mac, sizeof(conf->mac));  	if (flags & CONFIG_UPDATE_BSSID) -		rt2x00pci_register_multiwrite(rt2x00dev, CSR5, +		rt2x00mmio_register_multiwrite(rt2x00dev, CSR5,  					      conf->bssid, sizeof(conf->bssid));  } @@ -338,68 +338,68 @@ static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,  	if (changed & BSS_CHANGED_ERP_PREAMBLE) {  		preamble_mask = erp->short_preamble << 3; -		rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR1, ®);  		rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x162);  		rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0xa2);  		rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER);  		rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR1, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR2, ®);  		rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00);  		rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 10)); -		rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR2, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR3, ®);  		rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask);  		rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 20)); -		rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR3, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR4, ®);  		rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask);  		rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 55)); -		rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR4, reg); -		rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); +		rt2x00mmio_register_read(rt2x00dev, ARCSR5, ®);  		rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask);  		rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84);  		rt2x00_set_field32(®, ARCSR2_LENGTH,  				   GET_DURATION(ACK_SIZE, 110)); -		rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); +		rt2x00mmio_register_write(rt2x00dev, ARCSR5, reg);  	}  	if (changed & BSS_CHANGED_BASIC_RATES) -		rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); +		rt2x00mmio_register_write(rt2x00dev, ARCSR1, erp->basic_rates);  	if (changed & BSS_CHANGED_ERP_SLOT) { -		rt2x00pci_register_read(rt2x00dev, CSR11, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  		rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); -		rt2x00pci_register_write(rt2x00dev, CSR11, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -		rt2x00pci_register_read(rt2x00dev, CSR18, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR18, ®);  		rt2x00_set_field32(®, CSR18_SIFS, erp->sifs);  		rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); -		rt2x00pci_register_write(rt2x00dev, CSR18, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR18, reg); -		rt2x00pci_register_read(rt2x00dev, CSR19, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR19, ®);  		rt2x00_set_field32(®, CSR19_DIFS, erp->difs);  		rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); -		rt2x00pci_register_write(rt2x00dev, CSR19, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR19, reg);  	}  	if (changed & BSS_CHANGED_BEACON_INT) { -		rt2x00pci_register_read(rt2x00dev, CSR12, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR12, ®);  		rt2x00_set_field32(®, CSR12_BEACON_INTERVAL,  				   erp->beacon_int * 16);  		rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION,  				   erp->beacon_int * 16); -		rt2x00pci_register_write(rt2x00dev, CSR12, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR12, reg);  	}  } @@ -418,7 +418,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,  	BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||  	       ant->tx == ANTENNA_SW_DIVERSITY); -	rt2x00pci_register_read(rt2x00dev, BBPCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, BBPCSR1, ®);  	rt2500pci_bbp_read(rt2x00dev, 14, &r14);  	rt2500pci_bbp_read(rt2x00dev, 2, &r2); @@ -470,7 +470,7 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, BBPCSR1_OFDM_FLIP, 0);  	} -	rt2x00pci_register_write(rt2x00dev, BBPCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, BBPCSR1, reg);  	rt2500pci_bbp_write(rt2x00dev, 14, r14);  	rt2500pci_bbp_write(rt2x00dev, 2, r2);  } @@ -541,7 +541,7 @@ static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev,  	/*  	 * Clear false CRC during channel switch.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, &rf->rf1); +	rt2x00mmio_register_read(rt2x00dev, CNT0, &rf->rf1);  }  static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev, @@ -559,12 +559,12 @@ static void rt2500pci_config_retry_limit(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR11, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  	rt2x00_set_field32(®, CSR11_LONG_RETRY,  			   libconf->conf->long_frame_max_tx_count);  	rt2x00_set_field32(®, CSR11_SHORT_RETRY,  			   libconf->conf->short_frame_max_tx_count); -	rt2x00pci_register_write(rt2x00dev, CSR11, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR11, reg);  }  static void rt2500pci_config_ps(struct rt2x00_dev *rt2x00dev, @@ -576,7 +576,7 @@ static void rt2500pci_config_ps(struct rt2x00_dev *rt2x00dev,  	u32 reg;  	if (state == STATE_SLEEP) { -		rt2x00pci_register_read(rt2x00dev, CSR20, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR20, ®);  		rt2x00_set_field32(®, CSR20_DELAY_AFTER_TBCN,  				   (rt2x00dev->beacon_int - 20) * 16);  		rt2x00_set_field32(®, CSR20_TBCN_BEFORE_WAKEUP, @@ -584,14 +584,14 @@ static void rt2500pci_config_ps(struct rt2x00_dev *rt2x00dev,  		/* We must first disable autowake before it can be enabled */  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 1); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  	} else { -		rt2x00pci_register_read(rt2x00dev, CSR20, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR20, ®);  		rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); -		rt2x00pci_register_write(rt2x00dev, CSR20, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR20, reg);  	}  	rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); @@ -625,13 +625,13 @@ static void rt2500pci_link_stats(struct rt2x00_dev *rt2x00dev,  	/*  	 * Update FCS error count from register.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT0, ®);  	qual->rx_failed = rt2x00_get_field32(reg, CNT0_FCS_ERROR);  	/*  	 * Update False CCA count from register.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT3, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT3, ®);  	qual->false_cca = rt2x00_get_field32(reg, CNT3_FALSE_CCA);  } @@ -731,16 +731,16 @@ static void rt2500pci_start_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  		rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); -		rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_COUNT, 1);  		rt2x00_set_field32(®, CSR14_TBCN, 1);  		rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  		break;  	default:  		break; @@ -754,19 +754,19 @@ static void rt2500pci_kick_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_AC_VO: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_AC_VI: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_ATIM: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	default:  		break; @@ -782,21 +782,21 @@ static void rt2500pci_stop_queue(struct data_queue *queue)  	case QID_AC_VO:  	case QID_AC_VI:  	case QID_ATIM: -		rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®);  		rt2x00_set_field32(®, TXCSR0_ABORT, 1); -		rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg);  		break;  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, RXCSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®);  		rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); -		rt2x00pci_register_write(rt2x00dev, RXCSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, CSR14, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  		rt2x00_set_field32(®, CSR14_TSF_COUNT, 0);  		rt2x00_set_field32(®, CSR14_TBCN, 0);  		rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); -		rt2x00pci_register_write(rt2x00dev, CSR14, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  		/*  		 * Wait for possibly running tbtt tasklets. @@ -813,7 +813,7 @@ static void rt2500pci_stop_queue(struct data_queue *queue)   */  static bool rt2500pci_get_entry_state(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word;  	if (entry->queue->qid == QID_RX) { @@ -830,7 +830,7 @@ static bool rt2500pci_get_entry_state(struct queue_entry *entry)  static void rt2500pci_clear_entry(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);  	u32 word; @@ -852,53 +852,53 @@ static void rt2500pci_clear_entry(struct queue_entry *entry)  static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev)  { -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	u32 reg;  	/*  	 * Initialize registers.  	 */ -	rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR2, ®);  	rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size);  	rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit);  	rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit);  	rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); -	rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR2, reg);  	entry_priv = rt2x00dev->tx[1].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR3, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR3, ®);  	rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR3, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR3, reg);  	entry_priv = rt2x00dev->tx[0].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR5, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR5, ®);  	rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR5, reg);  	entry_priv = rt2x00dev->atim->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR4, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR4, ®);  	rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR4, reg);  	entry_priv = rt2x00dev->bcn->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, TXCSR6, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR6, ®);  	rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TXCSR6, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR6, reg); -	rt2x00pci_register_read(rt2x00dev, RXCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR1, ®);  	rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size);  	rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); -	rt2x00pci_register_write(rt2x00dev, RXCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR1, reg);  	entry_priv = rt2x00dev->rx->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, RXCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR2, ®);  	rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, RXCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR2, reg);  	return 0;  } @@ -907,30 +907,30 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_write(rt2x00dev, PSCSR0, 0x00020002); -	rt2x00pci_register_write(rt2x00dev, PSCSR1, 0x00000002); -	rt2x00pci_register_write(rt2x00dev, PSCSR2, 0x00020002); -	rt2x00pci_register_write(rt2x00dev, PSCSR3, 0x00000002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR0, 0x00020002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR1, 0x00000002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR2, 0x00020002); +	rt2x00mmio_register_write(rt2x00dev, PSCSR3, 0x00000002); -	rt2x00pci_register_read(rt2x00dev, TIMECSR, ®); +	rt2x00mmio_register_read(rt2x00dev, TIMECSR, ®);  	rt2x00_set_field32(®, TIMECSR_US_COUNT, 33);  	rt2x00_set_field32(®, TIMECSR_US_64_COUNT, 63);  	rt2x00_set_field32(®, TIMECSR_BEACON_EXPECT, 0); -	rt2x00pci_register_write(rt2x00dev, TIMECSR, reg); +	rt2x00mmio_register_write(rt2x00dev, TIMECSR, reg); -	rt2x00pci_register_read(rt2x00dev, CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR9, ®);  	rt2x00_set_field32(®, CSR9_MAX_FRAME_UNIT,  			   rt2x00dev->rx->data_size / 128); -	rt2x00pci_register_write(rt2x00dev, CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR9, reg);  	/*  	 * Always use CWmin and CWmax set in descriptor.  	 */ -	rt2x00pci_register_read(rt2x00dev, CSR11, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR11, ®);  	rt2x00_set_field32(®, CSR11_CW_SELECT, 0); -	rt2x00pci_register_write(rt2x00dev, CSR11, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -	rt2x00pci_register_read(rt2x00dev, CSR14, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  	rt2x00_set_field32(®, CSR14_TSF_COUNT, 0);  	rt2x00_set_field32(®, CSR14_TSF_SYNC, 0);  	rt2x00_set_field32(®, CSR14_TBCN, 0); @@ -939,11 +939,11 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 0);  	rt2x00_set_field32(®, CSR14_CFP_COUNT_PRELOAD, 0);  	rt2x00_set_field32(®, CSR14_TBCM_PRELOAD, 0); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg); -	rt2x00pci_register_write(rt2x00dev, CNT3, 0); +	rt2x00mmio_register_write(rt2x00dev, CNT3, 0); -	rt2x00pci_register_read(rt2x00dev, TXCSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, TXCSR8, ®);  	rt2x00_set_field32(®, TXCSR8_BBP_ID0, 10);  	rt2x00_set_field32(®, TXCSR8_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, TXCSR8_BBP_ID1, 11); @@ -952,30 +952,30 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, TXCSR8_BBP_ID2_VALID, 1);  	rt2x00_set_field32(®, TXCSR8_BBP_ID3, 12);  	rt2x00_set_field32(®, TXCSR8_BBP_ID3_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, TXCSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, TXCSR8, reg); -	rt2x00pci_register_read(rt2x00dev, ARTCSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, ARTCSR0, ®);  	rt2x00_set_field32(®, ARTCSR0_ACK_CTS_1MBS, 112);  	rt2x00_set_field32(®, ARTCSR0_ACK_CTS_2MBS, 56);  	rt2x00_set_field32(®, ARTCSR0_ACK_CTS_5_5MBS, 20);  	rt2x00_set_field32(®, ARTCSR0_ACK_CTS_11MBS, 10); -	rt2x00pci_register_write(rt2x00dev, ARTCSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, ARTCSR0, reg); -	rt2x00pci_register_read(rt2x00dev, ARTCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, ARTCSR1, ®);  	rt2x00_set_field32(®, ARTCSR1_ACK_CTS_6MBS, 45);  	rt2x00_set_field32(®, ARTCSR1_ACK_CTS_9MBS, 37);  	rt2x00_set_field32(®, ARTCSR1_ACK_CTS_12MBS, 33);  	rt2x00_set_field32(®, ARTCSR1_ACK_CTS_18MBS, 29); -	rt2x00pci_register_write(rt2x00dev, ARTCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, ARTCSR1, reg); -	rt2x00pci_register_read(rt2x00dev, ARTCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, ARTCSR2, ®);  	rt2x00_set_field32(®, ARTCSR2_ACK_CTS_24MBS, 29);  	rt2x00_set_field32(®, ARTCSR2_ACK_CTS_36MBS, 25);  	rt2x00_set_field32(®, ARTCSR2_ACK_CTS_48MBS, 25);  	rt2x00_set_field32(®, ARTCSR2_ACK_CTS_54MBS, 25); -	rt2x00pci_register_write(rt2x00dev, ARTCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, ARTCSR2, reg); -	rt2x00pci_register_read(rt2x00dev, RXCSR3, ®); +	rt2x00mmio_register_read(rt2x00dev, RXCSR3, ®);  	rt2x00_set_field32(®, RXCSR3_BBP_ID0, 47); /* CCK Signal */  	rt2x00_set_field32(®, RXCSR3_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, RXCSR3_BBP_ID1, 51); /* Rssi */ @@ -984,9 +984,9 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, RXCSR3_BBP_ID2_VALID, 1);  	rt2x00_set_field32(®, RXCSR3_BBP_ID3, 51); /* RSSI */  	rt2x00_set_field32(®, RXCSR3_BBP_ID3_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, RXCSR3, reg); +	rt2x00mmio_register_write(rt2x00dev, RXCSR3, reg); -	rt2x00pci_register_read(rt2x00dev, PCICSR, ®); +	rt2x00mmio_register_read(rt2x00dev, PCICSR, ®);  	rt2x00_set_field32(®, PCICSR_BIG_ENDIAN, 0);  	rt2x00_set_field32(®, PCICSR_RX_TRESHOLD, 0);  	rt2x00_set_field32(®, PCICSR_TX_TRESHOLD, 3); @@ -994,54 +994,54 @@ static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, PCICSR_ENABLE_CLK, 1);  	rt2x00_set_field32(®, PCICSR_READ_MULTIPLE, 1);  	rt2x00_set_field32(®, PCICSR_WRITE_INVALID, 1); -	rt2x00pci_register_write(rt2x00dev, PCICSR, reg); +	rt2x00mmio_register_write(rt2x00dev, PCICSR, reg); -	rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100); -	rt2x00pci_register_write(rt2x00dev, GPIOCSR, 0x0000ff00); -	rt2x00pci_register_write(rt2x00dev, TESTCSR, 0x000000f0); +	rt2x00mmio_register_write(rt2x00dev, GPIOCSR, 0x0000ff00); +	rt2x00mmio_register_write(rt2x00dev, TESTCSR, 0x000000f0);  	if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE))  		return -EBUSY; -	rt2x00pci_register_write(rt2x00dev, MACCSR0, 0x00213223); -	rt2x00pci_register_write(rt2x00dev, MACCSR1, 0x00235518); +	rt2x00mmio_register_write(rt2x00dev, MACCSR0, 0x00213223); +	rt2x00mmio_register_write(rt2x00dev, MACCSR1, 0x00235518); -	rt2x00pci_register_read(rt2x00dev, MACCSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, MACCSR2, ®);  	rt2x00_set_field32(®, MACCSR2_DELAY, 64); -	rt2x00pci_register_write(rt2x00dev, MACCSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, MACCSR2, reg); -	rt2x00pci_register_read(rt2x00dev, RALINKCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RALINKCSR, ®);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA0, 17);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID0, 26);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_VALID0, 1);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA1, 0);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID1, 26);  	rt2x00_set_field32(®, RALINKCSR_AR_BBP_VALID1, 1); -	rt2x00pci_register_write(rt2x00dev, RALINKCSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RALINKCSR, reg); -	rt2x00pci_register_write(rt2x00dev, BBPCSR1, 0x82188200); +	rt2x00mmio_register_write(rt2x00dev, BBPCSR1, 0x82188200); -	rt2x00pci_register_write(rt2x00dev, TXACKCSR0, 0x00000020); +	rt2x00mmio_register_write(rt2x00dev, TXACKCSR0, 0x00000020); -	rt2x00pci_register_read(rt2x00dev, CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR1, ®);  	rt2x00_set_field32(®, CSR1_SOFT_RESET, 1);  	rt2x00_set_field32(®, CSR1_BBP_RESET, 0);  	rt2x00_set_field32(®, CSR1_HOST_READY, 0); -	rt2x00pci_register_write(rt2x00dev, CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR1, ®);  	rt2x00_set_field32(®, CSR1_SOFT_RESET, 0);  	rt2x00_set_field32(®, CSR1_HOST_READY, 1); -	rt2x00pci_register_write(rt2x00dev, CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR1, reg);  	/*  	 * We must clear the FCS and FIFO error count.  	 * These registers are cleared on read,  	 * so we may pass a useless variable to store the value.  	 */ -	rt2x00pci_register_read(rt2x00dev, CNT0, ®); -	rt2x00pci_register_read(rt2x00dev, CNT4, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT0, ®); +	rt2x00mmio_register_read(rt2x00dev, CNT4, ®);  	return 0;  } @@ -1058,7 +1058,7 @@ static int rt2500pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } @@ -1131,8 +1131,8 @@ static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 * should clear the register to assure a clean state.  	 */  	if (state == STATE_RADIO_IRQ_ON) { -		rt2x00pci_register_read(rt2x00dev, CSR7, ®); -		rt2x00pci_register_write(rt2x00dev, CSR7, reg); +		rt2x00mmio_register_read(rt2x00dev, CSR7, ®); +		rt2x00mmio_register_write(rt2x00dev, CSR7, reg);  	}  	/* @@ -1141,13 +1141,13 @@ static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, mask);  	rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask);  	rt2x00_set_field32(®, CSR8_RXDONE, mask); -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); @@ -1179,7 +1179,7 @@ static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev)  	/*  	 * Disable power  	 */ -	rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0);  }  static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, @@ -1193,12 +1193,12 @@ static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev,  	put_to_sleep = (state != STATE_AWAKE); -	rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®);  	rt2x00_set_field32(®, PWRCSR1_SET_STATE, 1);  	rt2x00_set_field32(®, PWRCSR1_BBP_DESIRE_STATE, state);  	rt2x00_set_field32(®, PWRCSR1_RF_DESIRE_STATE, state);  	rt2x00_set_field32(®, PWRCSR1_PUT_TO_SLEEP, put_to_sleep); -	rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg);  	/*  	 * Device is not guaranteed to be in the requested state yet. @@ -1206,12 +1206,12 @@ static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev,  	 * device has entered the correct state.  	 */  	for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -		rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®2); +		rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®2);  		bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE);  		rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE);  		if (bbp_state == state && rf_state == state)  			return 0; -		rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); +		rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg);  		msleep(10);  	} @@ -1246,8 +1246,8 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -1259,7 +1259,7 @@ static void rt2500pci_write_tx_desc(struct queue_entry *entry,  				    struct txentry_desc *txdesc)  {  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	__le32 *txd = entry_priv->desc;  	u32 word; @@ -1335,12 +1335,12 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,  	 * Disable beaconing while we are reloading the beacon data,  	 * otherwise we might be sending out invalid data.  	 */ -	rt2x00pci_register_read(rt2x00dev, CSR14, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR14, ®);  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  	if (rt2x00queue_map_txskb(entry)) { -		ERROR(rt2x00dev, "Fail to map beacon, aborting\n"); +		rt2x00_err(rt2x00dev, "Fail to map beacon, aborting\n");  		goto out;  	} @@ -1358,7 +1358,7 @@ out:  	 * Enable beaconing again.  	 */  	rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); -	rt2x00pci_register_write(rt2x00dev, CSR14, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR14, reg);  }  /* @@ -1367,7 +1367,7 @@ out:  static void rt2500pci_fill_rxdone(struct queue_entry *entry,  				  struct rxdone_entry_desc *rxdesc)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word0;  	u32 word2; @@ -1405,7 +1405,7 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev,  			     const enum data_queue_qid queue_idx)  {  	struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	struct queue_entry *entry;  	struct txdone_entry_desc txdesc;  	u32 word; @@ -1451,9 +1451,9 @@ static inline void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irq(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	rt2x00_set_field32(®, irq_field, 0); -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock_irq(&rt2x00dev->irqmask_lock);  } @@ -1476,11 +1476,11 @@ static void rt2500pci_txstatus_tasklet(unsigned long data)  	if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) {  		spin_lock_irq(&rt2x00dev->irqmask_lock); -		rt2x00pci_register_read(rt2x00dev, CSR8, ®); +		rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  		rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0);  		rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, 0);  		rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); -		rt2x00pci_register_write(rt2x00dev, CSR8, reg); +		rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  		spin_unlock_irq(&rt2x00dev->irqmask_lock);  	} @@ -1497,7 +1497,7 @@ static void rt2500pci_tbtt_tasklet(unsigned long data)  static void rt2500pci_rxdone_tasklet(unsigned long data)  {  	struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -	if (rt2x00pci_rxdone(rt2x00dev)) +	if (rt2x00mmio_rxdone(rt2x00dev))  		tasklet_schedule(&rt2x00dev->rxdone_tasklet);  	else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))  		rt2500pci_enable_interrupt(rt2x00dev, CSR8_RXDONE); @@ -1512,8 +1512,8 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)  	 * Get the interrupt sources & saved to local variable.  	 * Write register value back to clear pending interrupts.  	 */ -	rt2x00pci_register_read(rt2x00dev, CSR7, ®); -	rt2x00pci_register_write(rt2x00dev, CSR7, reg); +	rt2x00mmio_register_read(rt2x00dev, CSR7, ®); +	rt2x00mmio_register_write(rt2x00dev, CSR7, reg);  	if (!reg)  		return IRQ_NONE; @@ -1550,9 +1550,9 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)  	 */  	spin_lock(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR8, ®);  	reg |= mask; -	rt2x00pci_register_write(rt2x00dev, CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, CSR8, reg);  	spin_unlock(&rt2x00dev->irqmask_lock); @@ -1569,7 +1569,7 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	u16 word;  	u8 *mac; -	rt2x00pci_register_read(rt2x00dev, CSR21, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR21, ®);  	eeprom.data = rt2x00dev;  	eeprom.register_read = rt2500pci_eepromregister_read; @@ -1590,7 +1590,7 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); @@ -1606,7 +1606,7 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0);  		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2522);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); @@ -1615,7 +1615,7 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_NIC_DYN_BBP_TUNE, 0);  		rt2x00_set_field16(&word, EEPROM_NIC_CCK_TX_POWER, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); -		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &word); @@ -1623,7 +1623,8 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_CALIBRATE_OFFSET_RSSI,  				   DEFAULT_RSSI_OFFSET);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_CALIBRATE_OFFSET, word); -		EEPROM(rt2x00dev, "Calibrate offset: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Calibrate offset: 0x%04x\n", +				  word);  	}  	return 0; @@ -1644,7 +1645,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)  	 * Identify RF chipset.  	 */  	value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); -	rt2x00pci_register_read(rt2x00dev, CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR0, ®);  	rt2x00_set_chip(rt2x00dev, RT2560, value,  			rt2x00_get_field32(reg, CSR0_REVISION)); @@ -1654,7 +1655,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)  	    !rt2x00_rf(rt2x00dev, RF2525) &&  	    !rt2x00_rf(rt2x00dev, RF2525E) &&  	    !rt2x00_rf(rt2x00dev, RF5222)) { -		ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n");  		return -ENODEV;  	} @@ -1950,9 +1951,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)  	 * Enable rfkill polling by setting GPIO direction of the  	 * rfkill switch GPIO pin correctly.  	 */ -	rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); +	rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®);  	rt2x00_set_field32(®, GPIOCSR_DIR0, 1); -	rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg); +	rt2x00mmio_register_write(rt2x00dev, GPIOCSR, reg);  	/*  	 * Initialize hw specifications. @@ -1986,9 +1987,9 @@ static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw,  	u64 tsf;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR17, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR17, ®);  	tsf = (u64) rt2x00_get_field32(reg, CSR17_HIGH_TSFTIMER) << 32; -	rt2x00pci_register_read(rt2x00dev, CSR16, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR16, ®);  	tsf |= rt2x00_get_field32(reg, CSR16_LOW_TSFTIMER);  	return tsf; @@ -1999,7 +2000,7 @@ static int rt2500pci_tx_last_beacon(struct ieee80211_hw *hw)  	struct rt2x00_dev *rt2x00dev = hw->priv;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, CSR15, ®); +	rt2x00mmio_register_read(rt2x00dev, CSR15, ®);  	return rt2x00_get_field32(reg, CSR15_BEACON_SENT);  } @@ -2032,8 +2033,8 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {  	.tbtt_tasklet		= rt2500pci_tbtt_tasklet,  	.rxdone_tasklet		= rt2500pci_rxdone_tasklet,  	.probe_hw		= rt2500pci_probe_hw, -	.initialize		= rt2x00pci_initialize, -	.uninitialize		= rt2x00pci_uninitialize, +	.initialize		= rt2x00mmio_initialize, +	.uninitialize		= rt2x00mmio_uninitialize,  	.get_entry_state	= rt2500pci_get_entry_state,  	.clear_entry		= rt2500pci_clear_entry,  	.set_device_state	= rt2500pci_set_device_state, @@ -2044,7 +2045,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {  	.start_queue		= rt2500pci_start_queue,  	.kick_queue		= rt2500pci_kick_queue,  	.stop_queue		= rt2500pci_stop_queue, -	.flush_queue		= rt2x00pci_flush_queue, +	.flush_queue		= rt2x00mmio_flush_queue,  	.write_tx_desc		= rt2500pci_write_tx_desc,  	.write_beacon		= rt2500pci_write_beacon,  	.fill_rxdone		= rt2500pci_fill_rxdone, @@ -2059,28 +2060,28 @@ static const struct data_queue_desc rt2500pci_queue_rx = {  	.entry_num		= 32,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= RXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2500pci_queue_tx = {  	.entry_num		= 32,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2500pci_queue_bcn = {  	.entry_num		= 1,  	.data_size		= MGMT_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2500pci_queue_atim = {  	.entry_num		= 8,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct rt2x00_ops rt2500pci_ops = { diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 6b2e1e431dd..a7f7b365eff 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c @@ -134,8 +134,8 @@ static int rt2500usb_regbusy_read(struct rt2x00_dev *rt2x00dev,  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "Indirect register access failed: " -	      "offset=0x%.08x, value=0x%.08x\n", offset, *reg); +	rt2x00_err(rt2x00dev, "Indirect register access failed: offset=0x%.08x, value=0x%.08x\n", +		   offset, *reg);  	*reg = ~0;  	return 0; @@ -916,7 +916,7 @@ static int rt2500usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } @@ -1069,8 +1069,8 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -1353,7 +1353,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); @@ -1369,7 +1369,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0);  		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2522);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); @@ -1378,7 +1378,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_NIC_DYN_BBP_TUNE, 0);  		rt2x00_set_field16(&word, EEPROM_NIC_CCK_TX_POWER, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); -		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &word); @@ -1386,14 +1386,15 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_CALIBRATE_OFFSET_RSSI,  				   DEFAULT_RSSI_OFFSET);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_CALIBRATE_OFFSET, word); -		EEPROM(rt2x00dev, "Calibrate offset: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Calibrate offset: 0x%04x\n", +				  word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE, &word);  	if (word == 0xffff) {  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_THRESHOLD, 45);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE, word); -		EEPROM(rt2x00dev, "BBPtune: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune: 0x%04x\n", word);  	}  	/* @@ -1408,7 +1409,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCUPPER, 0x40);  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); -		EEPROM(rt2x00dev, "BBPtune vgc: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune vgc: 0x%04x\n", word);  	} else {  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); @@ -1419,7 +1420,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_LOW, 0x48);  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word); -		EEPROM(rt2x00dev, "BBPtune r17: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r17: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word); @@ -1427,7 +1428,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R24_LOW, 0x40);  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R24_HIGH, 0x80);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R24, word); -		EEPROM(rt2x00dev, "BBPtune r24: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r24: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R25, &word); @@ -1435,7 +1436,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R25_LOW, 0x40);  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R25_HIGH, 0x50);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R25, word); -		EEPROM(rt2x00dev, "BBPtune r25: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r25: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R61, &word); @@ -1443,7 +1444,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R61_LOW, 0x60);  		rt2x00_set_field16(&word, EEPROM_BBPTUNE_R61_HIGH, 0x6d);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R61, word); -		EEPROM(rt2x00dev, "BBPtune r61: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r61: 0x%04x\n", word);  	}  	return 0; @@ -1468,7 +1469,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_chip(rt2x00dev, RT2570, value, reg);  	if (((reg & 0xfff0) != 0) || ((reg & 0x0000000f) == 0)) { -		ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RT chipset detected\n");  		return -ENODEV;  	} @@ -1478,7 +1479,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)  	    !rt2x00_rf(rt2x00dev, RF2525) &&  	    !rt2x00_rf(rt2x00dev, RF2525E) &&  	    !rt2x00_rf(rt2x00dev, RF5222)) { -		ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n");  		return -ENODEV;  	} diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 4db1088a847..a7630d5ec89 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h @@ -51,6 +51,7 @@   * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)   * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392)   * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) + * RF5592 2.4G/5G 2T2R   * RF5360 2.4G 1T1R   * RF5370 2.4G 1T1R   * RF5390 2.4G 1T1R @@ -68,6 +69,7 @@  #define RF3320				0x000b  #define RF3322				0x000c  #define RF3053				0x000d +#define RF5592				0x000f  #define RF3290				0x3290  #define RF5360				0x5360  #define RF5370				0x5370 @@ -88,11 +90,8 @@  #define REV_RT3390E			0x0211  #define REV_RT5390F			0x0502  #define REV_RT5390R			0x1502 +#define REV_RT5592C			0x0221 -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */  #define DEFAULT_RSSI_OFFSET		120  /* @@ -690,6 +689,12 @@  #define GPIO_SWITCH_7			FIELD32(0x00000080)  /* + * FIXME: where the DEBUG_INDEX name come from? + */ +#define MAC_DEBUG_INDEX			0x05e8 +#define MAC_DEBUG_INDEX_XTAL		FIELD32(0x80000000) + +/*   * MAC Control/Status Registers(CSR).   * Some values are set in TU, whereas 1 TU == 1024 us.   */ @@ -1934,6 +1939,9 @@ struct mac_iveiv_entry {  #define BBP4_BANDWIDTH			FIELD8(0x18)  #define BBP4_MAC_IF_CTRL		FIELD8(0x40) +/* BBP27 */ +#define BBP27_RX_CHAIN_SEL		FIELD8(0x60) +  /*   * BBP 47: Bandwidth   */ @@ -1948,6 +1956,20 @@ struct mac_iveiv_entry {  #define BBP49_UPDATE_FLAG		FIELD8(0x01)  /* + * BBP 105: + * - bit0: detect SIG on primary channel only (on 40MHz bandwidth) + * - bit1: FEQ (Feed Forward Compensation) for independend streams + * - bit2: MLD (Maximum Likehood Detection) for 2 streams (reserved on single + *	   stream) + * - bit4: channel estimation updates based on remodulation of + *	   L-SIG and HT-SIG symbols + */ +#define BBP105_DETECT_SIG_ON_PRIMARY	FIELD8(0x01) +#define BBP105_FEQ			FIELD8(0x02) +#define BBP105_MLD			FIELD8(0x04) +#define BBP105_SIG_REMODULATION		FIELD8(0x08) + +/*   * BBP 109   */  #define BBP109_TX0_POWER		FIELD8(0x0f) @@ -1967,6 +1989,11 @@ struct mac_iveiv_entry {  #define BBP152_RX_DEFAULT_ANT		FIELD8(0x80)  /* + * BBP 254: unknown + */ +#define BBP254_BIT7			FIELD8(0x80) + +/*   * RFCSR registers   * The wordsize of the RFCSR is 8 bits.   */ @@ -2022,9 +2049,18 @@ struct mac_iveiv_entry {  #define RFCSR7_BITS67			FIELD8(0xc0)  /* + * RFCSR 9: + */ +#define RFCSR9_K			FIELD8(0x0f) +#define RFCSR9_N			FIELD8(0x10) +#define RFCSR9_UNKNOWN			FIELD8(0x60) +#define RFCSR9_MOD			FIELD8(0x80) + +/*   * RFCSR 11:   */  #define RFCSR11_R			FIELD8(0x03) +#define RFCSR11_MOD			FIELD8(0xc0)  /*   * RFCSR 12: @@ -2130,11 +2166,13 @@ struct mac_iveiv_entry {   * RFCSR 49:   */  #define RFCSR49_TX			FIELD8(0x3f) +#define RFCSR49_EP			FIELD8(0xc0)  /*   * RFCSR 50:   */  #define RFCSR50_TX			FIELD8(0x3f) +#define RFCSR50_EP			FIELD8(0xc0)  /*   * RF registers @@ -2497,6 +2535,61 @@ struct mac_iveiv_entry {  #define EEPROM_BBP_REG_ID		FIELD16(0xff00)  /* + * EEPROM IQ Calibration, unlike other entries those are byte addresses. + */ + +#define EEPROM_IQ_GAIN_CAL_TX0_2G			0x130 +#define EEPROM_IQ_PHASE_CAL_TX0_2G			0x131 +#define EEPROM_IQ_GROUPDELAY_CAL_TX0_2G			0x132 +#define EEPROM_IQ_GAIN_CAL_TX1_2G			0x133 +#define EEPROM_IQ_PHASE_CAL_TX1_2G			0x134 +#define EEPROM_IQ_GROUPDELAY_CAL_TX1_2G			0x135 +#define EEPROM_IQ_GAIN_CAL_RX0_2G			0x136 +#define EEPROM_IQ_PHASE_CAL_RX0_2G			0x137 +#define EEPROM_IQ_GROUPDELAY_CAL_RX0_2G			0x138 +#define EEPROM_IQ_GAIN_CAL_RX1_2G			0x139 +#define EEPROM_IQ_PHASE_CAL_RX1_2G			0x13A +#define EEPROM_IQ_GROUPDELAY_CAL_RX1_2G			0x13B +#define EEPROM_RF_IQ_COMPENSATION_CONTROL		0x13C +#define EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL	0x13D +#define EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5G		0x144 +#define EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5G		0x145 +#define EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5G	0X146 +#define EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5G	0x147 +#define EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5G	0x148 +#define EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5G	0x149 +#define EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5G		0x14A +#define EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5G		0x14B +#define EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5G	0X14C +#define EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5G	0x14D +#define EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5G	0x14E +#define EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5G	0x14F +#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH36_TO_CH64_5G	0x150 +#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH36_TO_CH64_5G	0x151 +#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH100_TO_CH138_5G	0x152 +#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH100_TO_CH138_5G	0x153 +#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH140_TO_CH165_5G	0x154 +#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH140_TO_CH165_5G	0x155 +#define EEPROM_IQ_GAIN_CAL_RX0_CH36_TO_CH64_5G		0x156 +#define EEPROM_IQ_PHASE_CAL_RX0_CH36_TO_CH64_5G		0x157 +#define EEPROM_IQ_GAIN_CAL_RX0_CH100_TO_CH138_5G	0X158 +#define EEPROM_IQ_PHASE_CAL_RX0_CH100_TO_CH138_5G	0x159 +#define EEPROM_IQ_GAIN_CAL_RX0_CH140_TO_CH165_5G	0x15A +#define EEPROM_IQ_PHASE_CAL_RX0_CH140_TO_CH165_5G	0x15B +#define EEPROM_IQ_GAIN_CAL_RX1_CH36_TO_CH64_5G		0x15C +#define EEPROM_IQ_PHASE_CAL_RX1_CH36_TO_CH64_5G		0x15D +#define EEPROM_IQ_GAIN_CAL_RX1_CH100_TO_CH138_5G	0X15E +#define EEPROM_IQ_PHASE_CAL_RX1_CH100_TO_CH138_5G	0x15F +#define EEPROM_IQ_GAIN_CAL_RX1_CH140_TO_CH165_5G	0x160 +#define EEPROM_IQ_PHASE_CAL_RX1_CH140_TO_CH165_5G	0x161 +#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH36_TO_CH64_5G	0x162 +#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH36_TO_CH64_5G	0x163 +#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH100_TO_CH138_5G	0x164 +#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH100_TO_CH138_5G	0x165 +#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH140_TO_CH165_5G	0x166 +#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH140_TO_CH165_5G	0x167 + +/*   * MCU mailbox commands.   * MCU_SLEEP - go to power-save mode.   *             arg1: 1: save as much power as possible, 0: save less power. @@ -2535,6 +2628,8 @@ struct mac_iveiv_entry {  #define TXWI_DESC_SIZE			(4 * sizeof(__le32))  #define RXWI_DESC_SIZE			(4 * sizeof(__le32)) +#define TXWI_DESC_SIZE_5592		(5 * sizeof(__le32)) +#define RXWI_DESC_SIZE_5592		(6 * sizeof(__le32))  /*   * TX WI structure   */ diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index a658b4bc7da..b52d70c75e1 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -80,7 +80,7 @@ static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev)  	    rt2x00_rf(rt2x00dev, RF3022))  		return true; -	WARNING(rt2x00dev, "Unknown RF chipset on rt305x\n"); +	rt2x00_warn(rt2x00dev, "Unknown RF chipset on rt305x\n");  	return false;  } @@ -328,7 +328,7 @@ int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev)  		msleep(1);  	} -	ERROR(rt2x00dev, "Unstable hardware.\n"); +	rt2x00_err(rt2x00dev, "Unstable hardware\n");  	return -EBUSY;  }  EXPORT_SYMBOL_GPL(rt2800_wait_csr_ready); @@ -351,7 +351,7 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)  		msleep(10);  	} -	ERROR(rt2x00dev, "WPDMA TX/RX busy [0x%08x].\n", reg); +	rt2x00_err(rt2x00dev, "WPDMA TX/RX busy [0x%08x]\n", reg);  	return -EACCES;  }  EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); @@ -512,7 +512,7 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,  	}  	if (i == REGISTER_BUSY_COUNT) { -		ERROR(rt2x00dev, "PBF system register not ready.\n"); +		rt2x00_err(rt2x00dev, "PBF system register not ready\n");  		return -EBUSY;  	} @@ -527,8 +527,10 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,  	 */  	rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);  	rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -	if (rt2x00_is_usb(rt2x00dev)) +	if (rt2x00_is_usb(rt2x00dev)) {  		rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); +		rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); +	}  	msleep(1);  	return 0; @@ -540,6 +542,7 @@ void rt2800_write_tx_data(struct queue_entry *entry,  {  	__le32 *txwi = rt2800_drv_get_txwi(entry);  	u32 word; +	int i;  	/*  	 * Initialize TX Info descriptor @@ -582,14 +585,16 @@ void rt2800_write_tx_data(struct queue_entry *entry,  	rt2x00_desc_write(txwi, 1, word);  	/* -	 * Always write 0 to IV/EIV fields, hardware will insert the IV -	 * from the IVEIV register when TXD_W3_WIV is set to 0. +	 * Always write 0 to IV/EIV fields (word 2 and 3), hardware will insert +	 * the IV from the IVEIV register when TXD_W3_WIV is set to 0.  	 * When TXD_W3_WIV is set to 1 it will use the IV data  	 * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which  	 * crypto entry in the registers should be used to encrypt the frame. +	 * +	 * Nulify all remaining words as well, we don't know how to program them.  	 */ -	_rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); -	_rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); +	for (i = 2; i < entry->queue->winfo_size / sizeof(__le32); i++) +		_rt2x00_desc_write(txwi, i, 0);  }  EXPORT_SYMBOL_GPL(rt2800_write_tx_data); @@ -674,11 +679,10 @@ void rt2800_process_rxwi(struct queue_entry *entry,  	 * Convert descriptor AGC value to RSSI value.  	 */  	rxdesc->rssi = rt2800_agc_to_rssi(entry->queue->rt2x00dev, word); -  	/* -	 * Remove RXWI descriptor from start of buffer. +	 * Remove RXWI descriptor from start of the buffer.  	 */ -	skb_pull(entry->skb, RXWI_DESC_SIZE); +	skb_pull(entry->skb, entry->queue->winfo_size);  }  EXPORT_SYMBOL_GPL(rt2800_process_rxwi); @@ -769,6 +773,7 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)  	unsigned int beacon_base;  	unsigned int padding_len;  	u32 orig_reg, reg; +	const int txwi_desc_size = entry->queue->winfo_size;  	/*  	 * Disable beaconing while we are reloading the beacon data, @@ -782,14 +787,14 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)  	/*  	 * Add space for the TXWI in front of the skb.  	 */ -	memset(skb_push(entry->skb, TXWI_DESC_SIZE), 0, TXWI_DESC_SIZE); +	memset(skb_push(entry->skb, txwi_desc_size), 0, txwi_desc_size);  	/*  	 * Register descriptor details in skb frame descriptor.  	 */  	skbdesc->flags |= SKBDESC_DESC_IN_SKB;  	skbdesc->desc = entry->skb->data; -	skbdesc->desc_len = TXWI_DESC_SIZE; +	skbdesc->desc_len = txwi_desc_size;  	/*  	 * Add the TXWI for the beacon to the skb. @@ -806,7 +811,7 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)  	 */  	padding_len = roundup(entry->skb->len, 4) - entry->skb->len;  	if (padding_len && skb_pad(entry->skb, padding_len)) { -		ERROR(rt2x00dev, "Failure padding beacon, aborting\n"); +		rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n");  		/* skb freed by skb_pad() on failure */  		entry->skb = NULL;  		rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); @@ -835,13 +840,14 @@ static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev,  						unsigned int beacon_base)  {  	int i; +	const int txwi_desc_size = rt2x00dev->ops->bcn->winfo_size;  	/*  	 * For the Beacon base registers we only need to clear  	 * the whole TXWI which (when set to 0) will invalidate  	 * the entire beacon.  	 */ -	for (i = 0; i < TXWI_DESC_SIZE; i += sizeof(__le32)) +	for (i = 0; i < txwi_desc_size; i += sizeof(__le32))  		rt2800_register_write(rt2x00dev, beacon_base + i, 0);  } @@ -1988,8 +1994,21 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,  }  #define POWER_BOUND		0x27 +#define POWER_BOUND_5G		0x2b  #define FREQ_OFFSET_BOUND	0x5f +static void rt2800_adjust_freq_offset(struct rt2x00_dev *rt2x00dev) +{ +	u8 rfcsr; + +	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); +	if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) +		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); +	else +		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); +	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); +} +  static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,  					 struct ieee80211_conf *conf,  					 struct rf_channel *rf, @@ -2010,12 +2029,7 @@ static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);  	rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); -	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); -	if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); -	else -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); -	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); +	rt2800_adjust_freq_offset(rt2x00dev);  	if (rf->channel <= 14) {  		if (rf->channel == 6) @@ -2056,13 +2070,7 @@ static void rt2800_config_channel_rf3322(struct rt2x00_dev *rt2x00dev,  	else  		rt2800_rfcsr_write(rt2x00dev, 48, info->default_power2); -	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); -	if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); -	else -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); - -	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); +	rt2800_adjust_freq_offset(rt2x00dev);  	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);  	rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); @@ -2127,12 +2135,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,  	rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1);  	rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); -	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); -	if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); -	else -		rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); -	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); +	rt2800_adjust_freq_offset(rt2x00dev);  	if (rf->channel <= 14) {  		int idx = rf->channel-1; @@ -2184,6 +2187,382 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,  	}  } +static void rt2800_config_channel_rf55xx(struct rt2x00_dev *rt2x00dev, +					 struct ieee80211_conf *conf, +					 struct rf_channel *rf, +					 struct channel_info *info) +{ +	u8 rfcsr, ep_reg; +	u32 reg; +	int power_bound; + +	/* TODO */ +	const bool is_11b = false; +	const bool is_type_ep = false; + +	rt2800_register_read(rt2x00dev, LDO_CFG0, ®); +	rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, +			   (rf->channel > 14 || conf_is_ht40(conf)) ? 5 : 0); +	rt2800_register_write(rt2x00dev, LDO_CFG0, reg); + +	/* Order of values on rf_channel entry: N, K, mod, R */ +	rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1 & 0xff); + +	rt2800_rfcsr_read(rt2x00dev,  9, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR9_K, rf->rf2 & 0xf); +	rt2x00_set_field8(&rfcsr, RFCSR9_N, (rf->rf1 & 0x100) >> 8); +	rt2x00_set_field8(&rfcsr, RFCSR9_MOD, ((rf->rf3 - 8) & 0x4) >> 2); +	rt2800_rfcsr_write(rt2x00dev, 9, rfcsr); + +	rt2800_rfcsr_read(rt2x00dev, 11, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf4 - 1); +	rt2x00_set_field8(&rfcsr, RFCSR11_MOD, (rf->rf3 - 8) & 0x3); +	rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); + +	if (rf->channel <= 14) { +		rt2800_rfcsr_write(rt2x00dev, 10, 0x90); +		/* FIXME: RF11 owerwrite ? */ +		rt2800_rfcsr_write(rt2x00dev, 11, 0x4A); +		rt2800_rfcsr_write(rt2x00dev, 12, 0x52); +		rt2800_rfcsr_write(rt2x00dev, 13, 0x42); +		rt2800_rfcsr_write(rt2x00dev, 22, 0x40); +		rt2800_rfcsr_write(rt2x00dev, 24, 0x4A); +		rt2800_rfcsr_write(rt2x00dev, 25, 0x80); +		rt2800_rfcsr_write(rt2x00dev, 27, 0x42); +		rt2800_rfcsr_write(rt2x00dev, 36, 0x80); +		rt2800_rfcsr_write(rt2x00dev, 37, 0x08); +		rt2800_rfcsr_write(rt2x00dev, 38, 0x89); +		rt2800_rfcsr_write(rt2x00dev, 39, 0x1B); +		rt2800_rfcsr_write(rt2x00dev, 40, 0x0D); +		rt2800_rfcsr_write(rt2x00dev, 41, 0x9B); +		rt2800_rfcsr_write(rt2x00dev, 42, 0xD5); +		rt2800_rfcsr_write(rt2x00dev, 43, 0x72); +		rt2800_rfcsr_write(rt2x00dev, 44, 0x0E); +		rt2800_rfcsr_write(rt2x00dev, 45, 0xA2); +		rt2800_rfcsr_write(rt2x00dev, 46, 0x6B); +		rt2800_rfcsr_write(rt2x00dev, 48, 0x10); +		rt2800_rfcsr_write(rt2x00dev, 51, 0x3E); +		rt2800_rfcsr_write(rt2x00dev, 52, 0x48); +		rt2800_rfcsr_write(rt2x00dev, 54, 0x38); +		rt2800_rfcsr_write(rt2x00dev, 56, 0xA1); +		rt2800_rfcsr_write(rt2x00dev, 57, 0x00); +		rt2800_rfcsr_write(rt2x00dev, 58, 0x39); +		rt2800_rfcsr_write(rt2x00dev, 60, 0x45); +		rt2800_rfcsr_write(rt2x00dev, 61, 0x91); +		rt2800_rfcsr_write(rt2x00dev, 62, 0x39); + +		/* TODO RF27 <- tssi */ + +		rfcsr = rf->channel <= 10 ? 0x07 : 0x06; +		rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); +		rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); + +		if (is_11b) { +			/* CCK */ +			rt2800_rfcsr_write(rt2x00dev, 31, 0xF8); +			rt2800_rfcsr_write(rt2x00dev, 32, 0xC0); +			if (is_type_ep) +				rt2800_rfcsr_write(rt2x00dev, 55, 0x06); +			else +				rt2800_rfcsr_write(rt2x00dev, 55, 0x47); +		} else { +			/* OFDM */ +			if (is_type_ep) +				rt2800_rfcsr_write(rt2x00dev, 55, 0x03); +			else +				rt2800_rfcsr_write(rt2x00dev, 55, 0x43); +		} + +		power_bound = POWER_BOUND; +		ep_reg = 0x2; +	} else { +		rt2800_rfcsr_write(rt2x00dev, 10, 0x97); +		/* FIMXE: RF11 overwrite */ +		rt2800_rfcsr_write(rt2x00dev, 11, 0x40); +		rt2800_rfcsr_write(rt2x00dev, 25, 0xBF); +		rt2800_rfcsr_write(rt2x00dev, 27, 0x42); +		rt2800_rfcsr_write(rt2x00dev, 36, 0x00); +		rt2800_rfcsr_write(rt2x00dev, 37, 0x04); +		rt2800_rfcsr_write(rt2x00dev, 38, 0x85); +		rt2800_rfcsr_write(rt2x00dev, 40, 0x42); +		rt2800_rfcsr_write(rt2x00dev, 41, 0xBB); +		rt2800_rfcsr_write(rt2x00dev, 42, 0xD7); +		rt2800_rfcsr_write(rt2x00dev, 45, 0x41); +		rt2800_rfcsr_write(rt2x00dev, 48, 0x00); +		rt2800_rfcsr_write(rt2x00dev, 57, 0x77); +		rt2800_rfcsr_write(rt2x00dev, 60, 0x05); +		rt2800_rfcsr_write(rt2x00dev, 61, 0x01); + +		/* TODO RF27 <- tssi */ + +		if (rf->channel >= 36 && rf->channel <= 64) { + +			rt2800_rfcsr_write(rt2x00dev, 12, 0x2E); +			rt2800_rfcsr_write(rt2x00dev, 13, 0x22); +			rt2800_rfcsr_write(rt2x00dev, 22, 0x60); +			rt2800_rfcsr_write(rt2x00dev, 23, 0x7F); +			if (rf->channel <= 50) +				rt2800_rfcsr_write(rt2x00dev, 24, 0x09); +			else if (rf->channel >= 52) +				rt2800_rfcsr_write(rt2x00dev, 24, 0x07); +			rt2800_rfcsr_write(rt2x00dev, 39, 0x1C); +			rt2800_rfcsr_write(rt2x00dev, 43, 0x5B); +			rt2800_rfcsr_write(rt2x00dev, 44, 0X40); +			rt2800_rfcsr_write(rt2x00dev, 46, 0X00); +			rt2800_rfcsr_write(rt2x00dev, 51, 0xFE); +			rt2800_rfcsr_write(rt2x00dev, 52, 0x0C); +			rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); +			if (rf->channel <= 50) { +				rt2800_rfcsr_write(rt2x00dev, 55, 0x06), +				rt2800_rfcsr_write(rt2x00dev, 56, 0xD3); +			} else if (rf->channel >= 52) { +				rt2800_rfcsr_write(rt2x00dev, 55, 0x04); +				rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); +			} + +			rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +			rt2800_rfcsr_write(rt2x00dev, 59, 0x7F); +			rt2800_rfcsr_write(rt2x00dev, 62, 0x15); + +		} else if (rf->channel >= 100 && rf->channel <= 165) { + +			rt2800_rfcsr_write(rt2x00dev, 12, 0x0E); +			rt2800_rfcsr_write(rt2x00dev, 13, 0x42); +			rt2800_rfcsr_write(rt2x00dev, 22, 0x40); +			if (rf->channel <= 153) { +				rt2800_rfcsr_write(rt2x00dev, 23, 0x3C); +				rt2800_rfcsr_write(rt2x00dev, 24, 0x06); +			} else if (rf->channel >= 155) { +				rt2800_rfcsr_write(rt2x00dev, 23, 0x38); +				rt2800_rfcsr_write(rt2x00dev, 24, 0x05); +			} +			if (rf->channel <= 138) { +				rt2800_rfcsr_write(rt2x00dev, 39, 0x1A); +				rt2800_rfcsr_write(rt2x00dev, 43, 0x3B); +				rt2800_rfcsr_write(rt2x00dev, 44, 0x20); +				rt2800_rfcsr_write(rt2x00dev, 46, 0x18); +			} else if (rf->channel >= 140) { +				rt2800_rfcsr_write(rt2x00dev, 39, 0x18); +				rt2800_rfcsr_write(rt2x00dev, 43, 0x1B); +				rt2800_rfcsr_write(rt2x00dev, 44, 0x10); +				rt2800_rfcsr_write(rt2x00dev, 46, 0X08); +			} +			if (rf->channel <= 124) +				rt2800_rfcsr_write(rt2x00dev, 51, 0xFC); +			else if (rf->channel >= 126) +				rt2800_rfcsr_write(rt2x00dev, 51, 0xEC); +			if (rf->channel <= 138) +				rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +			else if (rf->channel >= 140) +				rt2800_rfcsr_write(rt2x00dev, 52, 0x06); +			rt2800_rfcsr_write(rt2x00dev, 54, 0xEB); +			if (rf->channel <= 138) +				rt2800_rfcsr_write(rt2x00dev, 55, 0x01); +			else if (rf->channel >= 140) +				rt2800_rfcsr_write(rt2x00dev, 55, 0x00); +			if (rf->channel <= 128) +				rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); +			else if (rf->channel >= 130) +				rt2800_rfcsr_write(rt2x00dev, 56, 0xAB); +			if (rf->channel <= 116) +				rt2800_rfcsr_write(rt2x00dev, 58, 0x1D); +			else if (rf->channel >= 118) +				rt2800_rfcsr_write(rt2x00dev, 58, 0x15); +			if (rf->channel <= 138) +				rt2800_rfcsr_write(rt2x00dev, 59, 0x3F); +			else if (rf->channel >= 140) +				rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); +			if (rf->channel <= 116) +				rt2800_rfcsr_write(rt2x00dev, 62, 0x1D); +			else if (rf->channel >= 118) +				rt2800_rfcsr_write(rt2x00dev, 62, 0x15); +		} + +		power_bound = POWER_BOUND_5G; +		ep_reg = 0x3; +	} + +	rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr); +	if (info->default_power1 > power_bound) +		rt2x00_set_field8(&rfcsr, RFCSR49_TX, power_bound); +	else +		rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); +	if (is_type_ep) +		rt2x00_set_field8(&rfcsr, RFCSR49_EP, ep_reg); +	rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); + +	rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr); +	if (info->default_power1 > power_bound) +		rt2x00_set_field8(&rfcsr, RFCSR50_TX, power_bound); +	else +		rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2); +	if (is_type_ep) +		rt2x00_set_field8(&rfcsr, RFCSR50_EP, ep_reg); +	rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); + +	rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); +	rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); + +	rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, +			  rt2x00dev->default_ant.tx_chain_num >= 1); +	rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, +			  rt2x00dev->default_ant.tx_chain_num == 2); +	rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); + +	rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, +			  rt2x00dev->default_ant.rx_chain_num >= 1); +	rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, +			  rt2x00dev->default_ant.rx_chain_num == 2); +	rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); + +	rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); +	rt2800_rfcsr_write(rt2x00dev, 6, 0xe4); + +	if (conf_is_ht40(conf)) +		rt2800_rfcsr_write(rt2x00dev, 30, 0x16); +	else +		rt2800_rfcsr_write(rt2x00dev, 30, 0x10); + +	if (!is_11b) { +		rt2800_rfcsr_write(rt2x00dev, 31, 0x80); +		rt2800_rfcsr_write(rt2x00dev, 32, 0x80); +	} + +	/* TODO proper frequency adjustment */ +	rt2800_adjust_freq_offset(rt2x00dev); + +	/* TODO merge with others */ +	rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); +	rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); + +	/* BBP settings */ +	rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); +	rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); +	rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); + +	rt2800_bbp_write(rt2x00dev, 79, (rf->channel <= 14) ? 0x1C : 0x18); +	rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08); +	rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38); +	rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92); + +	/* GLRT band configuration */ +	rt2800_bbp_write(rt2x00dev, 195, 128); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0xE0 : 0xF0); +	rt2800_bbp_write(rt2x00dev, 195, 129); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x1F : 0x1E); +	rt2800_bbp_write(rt2x00dev, 195, 130); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x38 : 0x28); +	rt2800_bbp_write(rt2x00dev, 195, 131); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); +	rt2800_bbp_write(rt2x00dev, 195, 133); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); +	rt2800_bbp_write(rt2x00dev, 195, 124); +	rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); +} + +static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev, +					   const unsigned int word, +					   const u8 value) +{ +	u8 chain, reg; + +	for (chain = 0; chain < rt2x00dev->default_ant.rx_chain_num; chain++) { +		rt2800_bbp_read(rt2x00dev, 27, ®); +		rt2x00_set_field8(®,  BBP27_RX_CHAIN_SEL, chain); +		rt2800_bbp_write(rt2x00dev, 27, reg); + +		rt2800_bbp_write(rt2x00dev, word, value); +	} +} + +static void rt2800_iq_calibrate(struct rt2x00_dev *rt2x00dev, int channel) +{ +	u8 cal; + +	/* TX0 IQ Gain */ +	rt2800_bbp_write(rt2x00dev, 158, 0x2c); +	if (channel <= 14) +		cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX0_2G); +	else if (channel >= 36 && channel <= 64) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5G); +	else if (channel >= 100 && channel <= 138) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5G); +	else if (channel >= 140 && channel <= 165) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5G); +	else +		cal = 0; +	rt2800_bbp_write(rt2x00dev, 159, cal); + +	/* TX0 IQ Phase */ +	rt2800_bbp_write(rt2x00dev, 158, 0x2d); +	if (channel <= 14) +		cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX0_2G); +	else if (channel >= 36 && channel <= 64) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5G); +	else if (channel >= 100 && channel <= 138) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5G); +	else if (channel >= 140 && channel <= 165) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5G); +	else +		cal = 0; +	rt2800_bbp_write(rt2x00dev, 159, cal); + +	/* TX1 IQ Gain */ +	rt2800_bbp_write(rt2x00dev, 158, 0x4a); +	if (channel <= 14) +		cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX1_2G); +	else if (channel >= 36 && channel <= 64) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5G); +	else if (channel >= 100 && channel <= 138) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5G); +	else if (channel >= 140 && channel <= 165) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5G); +	else +		cal = 0; +	rt2800_bbp_write(rt2x00dev, 159, cal); + +	/* TX1 IQ Phase */ +	rt2800_bbp_write(rt2x00dev, 158, 0x4b); +	if (channel <= 14) +		cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX1_2G); +	else if (channel >= 36 && channel <= 64) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5G); +	else if (channel >= 100 && channel <= 138) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5G); +	else if (channel >= 140 && channel <= 165) +		cal = rt2x00_eeprom_byte(rt2x00dev, +					 EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5G); +	else +		cal = 0; +	rt2800_bbp_write(rt2x00dev, 159, cal); + +	/* FIXME: possible RX0, RX1 callibration ? */ + +	/* RF IQ compensation control */ +	rt2800_bbp_write(rt2x00dev, 158, 0x04); +	cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_RF_IQ_COMPENSATION_CONTROL); +	rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); + +	/* RF IQ imbalance compensation control */ +	rt2800_bbp_write(rt2x00dev, 158, 0x03); +	cal = rt2x00_eeprom_byte(rt2x00dev, +				 EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL); +	rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); +} +  static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,  				  struct ieee80211_conf *conf,  				  struct rf_channel *rf, @@ -2225,6 +2604,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,  	case RF5392:  		rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info);  		break; +	case RF5592: +		rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info); +		break;  	default:  		rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);  	} @@ -2326,6 +2708,17 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,  	if (rt2x00_rt(rt2x00dev, RT3572))  		rt2800_rfcsr_write(rt2x00dev, 8, 0x80); +	if (rt2x00_rt(rt2x00dev, RT5592)) { +		rt2800_bbp_write(rt2x00dev, 195, 141); +		rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a); + +		/* AGC init */ +		reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; +		rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); + +		rt2800_iq_calibrate(rt2x00dev, rf->channel); +	} +  	rt2800_bbp_read(rt2x00dev, 4, &bbp);  	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf));  	rt2800_bbp_write(rt2x00dev, 4, bbp); @@ -2763,7 +3156,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,  void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev)  { -	rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.channel, +	rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan,  			      rt2x00dev->tx_power);  }  EXPORT_SYMBOL_GPL(rt2800_gain_calibration); @@ -2898,11 +3291,11 @@ void rt2800_config(struct rt2x00_dev *rt2x00dev,  	if (flags & IEEE80211_CONF_CHANGE_CHANNEL) {  		rt2800_config_channel(rt2x00dev, libconf->conf,  				      &libconf->rf, &libconf->channel); -		rt2800_config_txpower(rt2x00dev, libconf->conf->channel, +		rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan,  				      libconf->conf->power_level);  	}  	if (flags & IEEE80211_CONF_CHANGE_POWER) -		rt2800_config_txpower(rt2x00dev, libconf->conf->channel, +		rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan,  				      libconf->conf->power_level);  	if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)  		rt2800_config_retry_limit(rt2x00dev, libconf); @@ -2938,13 +3331,16 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev)  		    rt2x00_rt(rt2x00dev, RT3390) ||  		    rt2x00_rt(rt2x00dev, RT3572) ||  		    rt2x00_rt(rt2x00dev, RT5390) || -		    rt2x00_rt(rt2x00dev, RT5392)) +		    rt2x00_rt(rt2x00dev, RT5392) || +		    rt2x00_rt(rt2x00dev, RT5592))  			vgc = 0x1c + (2 * rt2x00dev->lna_gain);  		else  			vgc = 0x2e + rt2x00dev->lna_gain;  	} else { /* 5GHZ band */  		if (rt2x00_rt(rt2x00dev, RT3572))  			vgc = 0x22 + (rt2x00dev->lna_gain * 5) / 3; +		else if (rt2x00_rt(rt2x00dev, RT5592)) +			vgc = 0x24 + (2 * rt2x00dev->lna_gain);  		else {  			if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags))  				vgc = 0x32 + (rt2x00dev->lna_gain * 5) / 3; @@ -2960,7 +3356,11 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev,  				  struct link_qual *qual, u8 vgc_level)  {  	if (qual->vgc_level != vgc_level) { -		rt2800_bbp_write(rt2x00dev, 66, vgc_level); +		if (rt2x00_rt(rt2x00dev, RT5592)) { +			rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); +			rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); +		} else +			rt2800_bbp_write(rt2x00dev, 66, vgc_level);  		qual->vgc_level = vgc_level;  		qual->vgc_level_reg = vgc_level;  	} @@ -2975,15 +3375,23 @@ EXPORT_SYMBOL_GPL(rt2800_reset_tuner);  void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,  		       const u32 count)  { +	u8 vgc; +  	if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C))  		return; -  	/* -	 * When RSSI is better then -80 increase VGC level with 0x10 +	 * When RSSI is better then -80 increase VGC level with 0x10, except +	 * for rt5592 chip.  	 */ -	rt2800_set_vgc(rt2x00dev, qual, -		       rt2800_get_default_vgc(rt2x00dev) + -		       ((qual->rssi > -80) * 0x10)); + +	vgc = rt2800_get_default_vgc(rt2x00dev); + +	if (rt2x00_rt(rt2x00dev, RT5592) && qual->rssi > -65) +		vgc += 0x20; +	else if (qual->rssi > -80) +		vgc += 0x10; + +	rt2800_set_vgc(rt2x00dev, qual, vgc);  }  EXPORT_SYMBOL_GPL(rt2800_link_tuner); @@ -3122,7 +3530,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)  		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);  		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);  	} else if (rt2x00_rt(rt2x00dev, RT5390) || -		   rt2x00_rt(rt2x00dev, RT5392)) { +		   rt2x00_rt(rt2x00dev, RT5392) || +		   rt2x00_rt(rt2x00dev, RT5592)) {  		rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);  		rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);  		rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); @@ -3302,7 +3711,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, TXOP_CTRL_CFG_EXT_CWMIN, 0);  	rt2800_register_write(rt2x00dev, TXOP_CTRL_CFG, reg); -	rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, 0x00000002); +	reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; +	rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);  	rt2800_register_read(rt2x00dev, TX_RTS_CFG, ®);  	rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32); @@ -3459,7 +3869,7 @@ static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP/RF register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP/RF register access failed, aborting\n");  	return -EACCES;  } @@ -3483,10 +3893,140 @@ static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } +static void rt2800_bbp4_mac_if_ctrl(struct rt2x00_dev *rt2x00dev) +{ +	u8 value; + +	rt2800_bbp_read(rt2x00dev, 4, &value); +	rt2x00_set_field8(&value, BBP4_MAC_IF_CTRL, 1); +	rt2800_bbp_write(rt2x00dev, 4, value); +} + +static void rt2800_init_freq_calibration(struct rt2x00_dev *rt2x00dev) +{ +	rt2800_bbp_write(rt2x00dev, 142, 1); +	rt2800_bbp_write(rt2x00dev, 143, 57); +} + +static void rt2800_init_bbp_5592_glrt(struct rt2x00_dev *rt2x00dev) +{ +	const u8 glrt_table[] = { +		0xE0, 0x1F, 0X38, 0x32, 0x08, 0x28, 0x19, 0x0A, 0xFF, 0x00, /* 128 ~ 137 */ +		0x16, 0x10, 0x10, 0x0B, 0x36, 0x2C, 0x26, 0x24, 0x42, 0x36, /* 138 ~ 147 */ +		0x30, 0x2D, 0x4C, 0x46, 0x3D, 0x40, 0x3E, 0x42, 0x3D, 0x40, /* 148 ~ 157 */ +		0X3C, 0x34, 0x2C, 0x2F, 0x3C, 0x35, 0x2E, 0x2A, 0x49, 0x41, /* 158 ~ 167 */ +		0x36, 0x31, 0x30, 0x30, 0x0E, 0x0D, 0x28, 0x21, 0x1C, 0x16, /* 168 ~ 177 */ +		0x50, 0x4A, 0x43, 0x40, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, /* 178 ~ 187 */ +		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 188 ~ 197 */ +		0x00, 0x00, 0x7D, 0x14, 0x32, 0x2C, 0x36, 0x4C, 0x43, 0x2C, /* 198 ~ 207 */ +		0x2E, 0x36, 0x30, 0x6E,					    /* 208 ~ 211 */ +	}; +	int i; + +	for (i = 0; i < ARRAY_SIZE(glrt_table); i++) { +		rt2800_bbp_write(rt2x00dev, 195, 128 + i); +		rt2800_bbp_write(rt2x00dev, 196, glrt_table[i]); +	} +}; + +static void rt2800_init_bbp_early(struct rt2x00_dev *rt2x00dev) +{ +	rt2800_bbp_write(rt2x00dev, 65, 0x2C); +	rt2800_bbp_write(rt2x00dev, 66, 0x38); +	rt2800_bbp_write(rt2x00dev, 68, 0x0B); +	rt2800_bbp_write(rt2x00dev, 69, 0x12); +	rt2800_bbp_write(rt2x00dev, 70, 0x0a); +	rt2800_bbp_write(rt2x00dev, 73, 0x10); +	rt2800_bbp_write(rt2x00dev, 81, 0x37); +	rt2800_bbp_write(rt2x00dev, 82, 0x62); +	rt2800_bbp_write(rt2x00dev, 83, 0x6A); +	rt2800_bbp_write(rt2x00dev, 84, 0x99); +	rt2800_bbp_write(rt2x00dev, 86, 0x00); +	rt2800_bbp_write(rt2x00dev, 91, 0x04); +	rt2800_bbp_write(rt2x00dev, 92, 0x00); +	rt2800_bbp_write(rt2x00dev, 103, 0x00); +	rt2800_bbp_write(rt2x00dev, 105, 0x05); +	rt2800_bbp_write(rt2x00dev, 106, 0x35); +} + +static void rt2800_init_bbp_5592(struct rt2x00_dev *rt2x00dev) +{ +	int ant, div_mode; +	u16 eeprom; +	u8 value; + +	rt2800_init_bbp_early(rt2x00dev); + +	rt2800_bbp_read(rt2x00dev, 105, &value); +	rt2x00_set_field8(&value, BBP105_MLD, +			  rt2x00dev->default_ant.rx_chain_num == 2); +	rt2800_bbp_write(rt2x00dev, 105, value); + +	rt2800_bbp4_mac_if_ctrl(rt2x00dev); + +	rt2800_bbp_write(rt2x00dev, 20, 0x06); +	rt2800_bbp_write(rt2x00dev, 31, 0x08); +	rt2800_bbp_write(rt2x00dev, 65, 0x2C); +	rt2800_bbp_write(rt2x00dev, 68, 0xDD); +	rt2800_bbp_write(rt2x00dev, 69, 0x1A); +	rt2800_bbp_write(rt2x00dev, 70, 0x05); +	rt2800_bbp_write(rt2x00dev, 73, 0x13); +	rt2800_bbp_write(rt2x00dev, 74, 0x0F); +	rt2800_bbp_write(rt2x00dev, 75, 0x4F); +	rt2800_bbp_write(rt2x00dev, 76, 0x28); +	rt2800_bbp_write(rt2x00dev, 77, 0x59); +	rt2800_bbp_write(rt2x00dev, 84, 0x9A); +	rt2800_bbp_write(rt2x00dev, 86, 0x38); +	rt2800_bbp_write(rt2x00dev, 88, 0x90); +	rt2800_bbp_write(rt2x00dev, 91, 0x04); +	rt2800_bbp_write(rt2x00dev, 92, 0x02); +	rt2800_bbp_write(rt2x00dev, 95, 0x9a); +	rt2800_bbp_write(rt2x00dev, 98, 0x12); +	rt2800_bbp_write(rt2x00dev, 103, 0xC0); +	rt2800_bbp_write(rt2x00dev, 104, 0x92); +	/* FIXME BBP105 owerwrite */ +	rt2800_bbp_write(rt2x00dev, 105, 0x3C); +	rt2800_bbp_write(rt2x00dev, 106, 0x35); +	rt2800_bbp_write(rt2x00dev, 128, 0x12); +	rt2800_bbp_write(rt2x00dev, 134, 0xD0); +	rt2800_bbp_write(rt2x00dev, 135, 0xF6); +	rt2800_bbp_write(rt2x00dev, 137, 0x0F); + +	/* Initialize GLRT (Generalized Likehood Radio Test) */ +	rt2800_init_bbp_5592_glrt(rt2x00dev); + +	rt2800_bbp4_mac_if_ctrl(rt2x00dev); + +	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); +	div_mode = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_ANT_DIVERSITY); +	ant = (div_mode == 3) ? 1 : 0; +	rt2800_bbp_read(rt2x00dev, 152, &value); +	if (ant == 0) { +		/* Main antenna */ +		rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); +	} else { +		/* Auxiliary antenna */ +		rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 0); +	} +	rt2800_bbp_write(rt2x00dev, 152, value); + +	if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) { +		rt2800_bbp_read(rt2x00dev, 254, &value); +		rt2x00_set_field8(&value, BBP254_BIT7, 1); +		rt2800_bbp_write(rt2x00dev, 254, value); +	} + +	rt2800_init_freq_calibration(rt2x00dev); + +	rt2800_bbp_write(rt2x00dev, 84, 0x19); +	if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) +		rt2800_bbp_write(rt2x00dev, 103, 0xc0); +} +  static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)  {  	unsigned int i; @@ -3498,6 +4038,11 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)  		     rt2800_wait_bbp_ready(rt2x00dev)))  		return -EACCES; +	if (rt2x00_rt(rt2x00dev, RT5592)) { +		rt2800_init_bbp_5592(rt2x00dev); +		return 0; +	} +  	if (rt2x00_rt(rt2x00dev, RT3352)) {  		rt2800_bbp_write(rt2x00dev, 3, 0x00);  		rt2800_bbp_write(rt2x00dev, 4, 0x50); @@ -3505,11 +4050,8 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)  	if (rt2x00_rt(rt2x00dev, RT3290) ||  	    rt2x00_rt(rt2x00dev, RT5390) || -	    rt2x00_rt(rt2x00dev, RT5392)) { -		rt2800_bbp_read(rt2x00dev, 4, &value); -		rt2x00_set_field8(&value, BBP4_MAC_IF_CTRL, 1); -		rt2800_bbp_write(rt2x00dev, 4, value); -	} +	    rt2x00_rt(rt2x00dev, RT5392)) +		rt2800_bbp4_mac_if_ctrl(rt2x00dev);  	if (rt2800_is_305x_soc(rt2x00dev) ||  	    rt2x00_rt(rt2x00dev, RT3290) || @@ -3783,9 +4325,7 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)  			rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 0);  		rt2800_bbp_write(rt2x00dev, 152, value); -		/* Init frequency calibration */ -		rt2800_bbp_write(rt2x00dev, 142, 1); -		rt2800_bbp_write(rt2x00dev, 143, 57); +		rt2800_init_freq_calibration(rt2x00dev);  	}  	for (i = 0; i < EEPROM_BBP_SIZE; i++) { @@ -3801,8 +4341,17 @@ static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)  	return 0;  } -static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, -				bool bw40, u8 rfcsr24, u8 filter_target) +static void rt2800_led_open_drain_enable(struct rt2x00_dev *rt2x00dev) +{ +	u32 reg; + +	rt2800_register_read(rt2x00dev, OPT_14_CSR, ®); +	rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1); +	rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); +} + +static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40, +				u8 filter_target)  {  	unsigned int i;  	u8 bbp; @@ -3810,6 +4359,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,  	u8 passband;  	u8 stopband;  	u8 overtuned = 0; +	u8 rfcsr24 = (bw40) ? 0x27 : 0x07;  	rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); @@ -3865,8 +4415,169 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,  	return rfcsr24;  } +static void rt2800_rf_init_calibration(struct rt2x00_dev *rt2x00dev, +				       const unsigned int rf_reg) +{ +	u8 rfcsr; + +	rt2800_rfcsr_read(rt2x00dev, rf_reg, &rfcsr); +	rt2x00_set_field8(&rfcsr, FIELD8(0x80), 1); +	rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); +	msleep(1); +	rt2x00_set_field8(&rfcsr, FIELD8(0x80), 0); +	rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); +} + +static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev) +{ +	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; +	u8 filter_tgt_bw20; +	u8 filter_tgt_bw40; +	u8 rfcsr, bbp; + +	/* +	 * TODO: sync filter_tgt values with vendor driver +	 */ +	if (rt2x00_rt(rt2x00dev, RT3070)) { +		filter_tgt_bw20 = 0x16; +		filter_tgt_bw40 = 0x19; +	} else { +		filter_tgt_bw20 = 0x13; +		filter_tgt_bw40 = 0x15; +	} + +	drv_data->calibration_bw20 = +		rt2800_init_rx_filter(rt2x00dev, false, filter_tgt_bw20); +	drv_data->calibration_bw40 = +		rt2800_init_rx_filter(rt2x00dev, true, filter_tgt_bw40); + +	/* +	 * Save BBP 25 & 26 values for later use in channel switching (for 3052) +	 */ +	rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25); +	rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26); + +	/* +	 * Set back to initial state +	 */ +	rt2800_bbp_write(rt2x00dev, 24, 0); + +	rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0); +	rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); + +	/* +	 * Set BBP back to BW20 +	 */ +	rt2800_bbp_read(rt2x00dev, 4, &bbp); +	rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0); +	rt2800_bbp_write(rt2x00dev, 4, bbp); +} + +static void rt2800_normal_mode_setup_3xxx(struct rt2x00_dev *rt2x00dev) +{ +	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; +	u8 min_gain, rfcsr, bbp; +	u16 eeprom; + +	rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); + +	rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); +	if (rt2x00_rt(rt2x00dev, RT3070) || +	    rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || +	    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || +	    rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { +		if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) +			rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); +	} + +	min_gain = rt2x00_rt(rt2x00dev, RT3070) ? 1 : 2; +	if (drv_data->txmixer_gain_24g >= min_gain) { +		rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN, +				  drv_data->txmixer_gain_24g); +	} + +	rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); + +	if (rt2x00_rt(rt2x00dev, RT3090)) { +		/*  Turn off unused DAC1 and ADC1 to reduce power consumption */ +		rt2800_bbp_read(rt2x00dev, 138, &bbp); +		rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); +		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) +			rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); +		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) +			rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1); +		rt2800_bbp_write(rt2x00dev, 138, bbp); +	} + +	if (rt2x00_rt(rt2x00dev, RT3070)) { +		rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr); +		if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) +			rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3); +		else +			rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0); +		rt2x00_set_field8(&rfcsr, RFCSR27_R2, 0); +		rt2x00_set_field8(&rfcsr, RFCSR27_R3, 0); +		rt2x00_set_field8(&rfcsr, RFCSR27_R4, 0); +		rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); +	} else if (rt2x00_rt(rt2x00dev, RT3071) || +		   rt2x00_rt(rt2x00dev, RT3090) || +		   rt2x00_rt(rt2x00dev, RT3390)) { +		rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); +		rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); +		rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); +		rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); +		rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); +		rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); +		rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); + +		rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr); +		rt2x00_set_field8(&rfcsr, RFCSR15_TX_LO2_EN, 0); +		rt2800_rfcsr_write(rt2x00dev, 15, rfcsr); + +		rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr); +		rt2x00_set_field8(&rfcsr, RFCSR20_RX_LO1_EN, 0); +		rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); + +		rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr); +		rt2x00_set_field8(&rfcsr, RFCSR21_RX_LO2_EN, 0); +		rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); +	} +} + +static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev) +{ +	u8 reg; +	u16 eeprom; + +	/*  Turn off unused DAC1 and ADC1 to reduce power consumption */ +	rt2800_bbp_read(rt2x00dev, 138, ®); +	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); +	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) +		rt2x00_set_field8(®, BBP138_RX_ADC1, 0); +	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) +		rt2x00_set_field8(®, BBP138_TX_DAC1, 1); +	rt2800_bbp_write(rt2x00dev, 138, reg); + +	rt2800_rfcsr_read(rt2x00dev, 38, ®); +	rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0); +	rt2800_rfcsr_write(rt2x00dev, 38, reg); + +	rt2800_rfcsr_read(rt2x00dev, 39, ®); +	rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0); +	rt2800_rfcsr_write(rt2x00dev, 39, reg); + +	rt2800_bbp4_mac_if_ctrl(rt2x00dev); + +	rt2800_rfcsr_read(rt2x00dev, 30, ®); +	rt2x00_set_field8(®, RFCSR30_RX_VCM, 2); +	rt2800_rfcsr_write(rt2x00dev, 30, reg); +} +  static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)  { +	rt2800_rf_init_calibration(rt2x00dev, 30); +  	rt2800_rfcsr_write(rt2x00dev, 0, 0x50);  	rt2800_rfcsr_write(rt2x00dev, 1, 0x01);  	rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); @@ -3903,6 +4614,13 @@ static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev)  static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)  { +	u8 rfcsr; +	u16 eeprom; +	u32 reg; + +	/* XXX vendor driver do this only for 3070 */ +	rt2800_rf_init_calibration(rt2x00dev, 30); +  	rt2800_rfcsr_write(rt2x00dev, 4, 0x40);  	rt2800_rfcsr_write(rt2x00dev, 5, 0x03);  	rt2800_rfcsr_write(rt2x00dev, 6, 0x02); @@ -3922,10 +4640,54 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 24, 0x16);  	rt2800_rfcsr_write(rt2x00dev, 25, 0x01);  	rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); + +	if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { +		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); +		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); +		rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); +		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); +	} else if (rt2x00_rt(rt2x00dev, RT3071) || +		   rt2x00_rt(rt2x00dev, RT3090)) { +		rt2800_rfcsr_write(rt2x00dev, 31, 0x14); + +		rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); +		rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); +		rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); + +		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); +		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); +		if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || +		    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { +			rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); +			if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) +				rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); +			else +				rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); +		} +		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); + +		rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); +		rt2x00_set_field32(®, GPIO_SWITCH_5, 0); +		rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); +	} + +	rt2800_rx_filter_calibration(rt2x00dev); + +	if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) || +	    rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || +	    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) +		rt2800_rfcsr_write(rt2x00dev, 27, 0x03); + +	rt2800_led_open_drain_enable(rt2x00dev); +	rt2800_normal_mode_setup_3xxx(rt2x00dev);  }  static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)  { +	u8 rfcsr; + +	rt2800_rf_init_calibration(rt2x00dev, 2); +  	rt2800_rfcsr_write(rt2x00dev, 1, 0x0f);  	rt2800_rfcsr_write(rt2x00dev, 2, 0x80);  	rt2800_rfcsr_write(rt2x00dev, 3, 0x08); @@ -3972,10 +4734,19 @@ static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 59, 0x09);  	rt2800_rfcsr_write(rt2x00dev, 60, 0x45);  	rt2800_rfcsr_write(rt2x00dev, 61, 0xc1); + +	rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3); +	rt2800_rfcsr_write(rt2x00dev, 29, rfcsr); + +	rt2800_led_open_drain_enable(rt2x00dev); +	rt2800_normal_mode_setup_3xxx(rt2x00dev);  }  static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)  { +	rt2800_rf_init_calibration(rt2x00dev, 30); +  	rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);  	rt2800_rfcsr_write(rt2x00dev, 1, 0x23);  	rt2800_rfcsr_write(rt2x00dev, 2, 0x50); @@ -4039,10 +4810,18 @@ static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 61, 0x00);  	rt2800_rfcsr_write(rt2x00dev, 62, 0x00);  	rt2800_rfcsr_write(rt2x00dev, 63, 0x00); + +	rt2800_rx_filter_calibration(rt2x00dev); +	rt2800_led_open_drain_enable(rt2x00dev); +	rt2800_normal_mode_setup_3xxx(rt2x00dev);  }  static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)  { +	u32 reg; + +	rt2800_rf_init_calibration(rt2x00dev, 30); +  	rt2800_rfcsr_write(rt2x00dev, 0, 0xa0);  	rt2800_rfcsr_write(rt2x00dev, 1, 0xe1);  	rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); @@ -4075,10 +4854,27 @@ static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 29, 0x8f);  	rt2800_rfcsr_write(rt2x00dev, 30, 0x20);  	rt2800_rfcsr_write(rt2x00dev, 31, 0x0f); + +	rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); +	rt2x00_set_field32(®, GPIO_SWITCH_5, 0); +	rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); + +	rt2800_rx_filter_calibration(rt2x00dev); + +	if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) +		rt2800_rfcsr_write(rt2x00dev, 27, 0x03); + +	rt2800_led_open_drain_enable(rt2x00dev); +	rt2800_normal_mode_setup_3xxx(rt2x00dev);  }  static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)  { +	u8 rfcsr; +	u32 reg; + +	rt2800_rf_init_calibration(rt2x00dev, 30); +  	rt2800_rfcsr_write(rt2x00dev, 0, 0x70);  	rt2800_rfcsr_write(rt2x00dev, 1, 0x81);  	rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); @@ -4110,10 +4906,30 @@ static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 29, 0x9b);  	rt2800_rfcsr_write(rt2x00dev, 30, 0x09);  	rt2800_rfcsr_write(rt2x00dev, 31, 0x10); + +	rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); +	rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); +	rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); + +	rt2800_register_read(rt2x00dev, LDO_CFG0, ®); +	rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); +	rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); +	rt2800_register_write(rt2x00dev, LDO_CFG0, reg); +	msleep(1); +	rt2800_register_read(rt2x00dev, LDO_CFG0, ®); +	rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); +	rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); +	rt2800_register_write(rt2x00dev, LDO_CFG0, reg); + +	rt2800_rx_filter_calibration(rt2x00dev); +	rt2800_led_open_drain_enable(rt2x00dev); +	rt2800_normal_mode_setup_3xxx(rt2x00dev);  }  static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)  { +	rt2800_rf_init_calibration(rt2x00dev, 2); +  	rt2800_rfcsr_write(rt2x00dev, 1, 0x0f);  	rt2800_rfcsr_write(rt2x00dev, 2, 0x80);  	rt2800_rfcsr_write(rt2x00dev, 3, 0x88); @@ -4194,10 +5010,16 @@ static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)  		rt2800_rfcsr_write(rt2x00dev, 61, 0xdd);  	rt2800_rfcsr_write(rt2x00dev, 62, 0x00);  	rt2800_rfcsr_write(rt2x00dev, 63, 0x00); + +	rt2800_normal_mode_setup_5xxx(rt2x00dev); + +	rt2800_led_open_drain_enable(rt2x00dev);  }  static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)  { +	rt2800_rf_init_calibration(rt2x00dev, 2); +  	rt2800_rfcsr_write(rt2x00dev, 1, 0x17);  	rt2800_rfcsr_write(rt2x00dev, 2, 0x80);  	rt2800_rfcsr_write(rt2x00dev, 3, 0x88); @@ -4257,53 +5079,61 @@ static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev)  	rt2800_rfcsr_write(rt2x00dev, 61, 0x91);  	rt2800_rfcsr_write(rt2x00dev, 62, 0x39);  	rt2800_rfcsr_write(rt2x00dev, 63, 0x07); + +	rt2800_normal_mode_setup_5xxx(rt2x00dev); + +	rt2800_led_open_drain_enable(rt2x00dev);  } -static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) +static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev)  { -	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; -	u8 rfcsr; -	u8 bbp; -	u32 reg; -	u16 eeprom; +	rt2800_rf_init_calibration(rt2x00dev, 30); -	if (!rt2x00_rt(rt2x00dev, RT3070) && -	    !rt2x00_rt(rt2x00dev, RT3071) && -	    !rt2x00_rt(rt2x00dev, RT3090) && -	    !rt2x00_rt(rt2x00dev, RT3290) && -	    !rt2x00_rt(rt2x00dev, RT3352) && -	    !rt2x00_rt(rt2x00dev, RT3390) && -	    !rt2x00_rt(rt2x00dev, RT3572) && -	    !rt2x00_rt(rt2x00dev, RT5390) && -	    !rt2x00_rt(rt2x00dev, RT5392) && -	    !rt2800_is_305x_soc(rt2x00dev)) -		return 0; +	rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); +	rt2800_rfcsr_write(rt2x00dev, 3, 0x08); +	rt2800_rfcsr_write(rt2x00dev, 3, 0x08); +	rt2800_rfcsr_write(rt2x00dev, 5, 0x10); +	rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); +	rt2800_rfcsr_write(rt2x00dev, 7, 0x00); +	rt2800_rfcsr_write(rt2x00dev, 14, 0x00); +	rt2800_rfcsr_write(rt2x00dev, 15, 0x00); +	rt2800_rfcsr_write(rt2x00dev, 16, 0x00); +	rt2800_rfcsr_write(rt2x00dev, 18, 0x03); +	rt2800_rfcsr_write(rt2x00dev, 19, 0x4D); +	rt2800_rfcsr_write(rt2x00dev, 20, 0x10); +	rt2800_rfcsr_write(rt2x00dev, 21, 0x8D); +	rt2800_rfcsr_write(rt2x00dev, 26, 0x82); +	rt2800_rfcsr_write(rt2x00dev, 28, 0x00); +	rt2800_rfcsr_write(rt2x00dev, 29, 0x10); +	rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); +	rt2800_rfcsr_write(rt2x00dev, 34, 0x07); +	rt2800_rfcsr_write(rt2x00dev, 35, 0x12); +	rt2800_rfcsr_write(rt2x00dev, 47, 0x0C); +	rt2800_rfcsr_write(rt2x00dev, 53, 0x22); +	rt2800_rfcsr_write(rt2x00dev, 63, 0x07); -	/* -	 * Init RF calibration. -	 */ +	rt2800_rfcsr_write(rt2x00dev, 2, 0x80); +	msleep(1); -	if (rt2x00_rt(rt2x00dev, RT3290) || -	    rt2x00_rt(rt2x00dev, RT5390) || -	    rt2x00_rt(rt2x00dev, RT5392)) { -		rt2800_rfcsr_read(rt2x00dev, 2, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); -		rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -		msleep(1); -		rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -	} else { -		rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); -		rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -		msleep(1); -		rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); -		rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -	} +	rt2800_adjust_freq_offset(rt2x00dev); + +	/* Enable DC filter */ +	if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) +		rt2800_bbp_write(rt2x00dev, 103, 0xc0); + +	rt2800_normal_mode_setup_5xxx(rt2x00dev); +	if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C)) +		rt2800_rfcsr_write(rt2x00dev, 27, 0x03); + +	rt2800_led_open_drain_enable(rt2x00dev); +} + +static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) +{  	if (rt2800_is_305x_soc(rt2x00dev)) {  		rt2800_init_rfcsr_305x_soc(rt2x00dev); -		return 0; +		return;  	}  	switch (rt2x00dev->chip.rt) { @@ -4330,198 +5160,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)  	case RT5392:  		rt2800_init_rfcsr_5392(rt2x00dev);  		break; +	case RT5592: +		rt2800_init_rfcsr_5592(rt2x00dev); +		break;  	} - -	if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { -		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); -		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); -		rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); -		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); -	} else if (rt2x00_rt(rt2x00dev, RT3071) || -		   rt2x00_rt(rt2x00dev, RT3090)) { -		rt2800_rfcsr_write(rt2x00dev, 31, 0x14); - -		rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); -		rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - -		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); -		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); -		if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || -		    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { -			rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); -			if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) -				rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); -			else -				rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); -		} -		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - -		rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); -		rt2x00_set_field32(®, GPIO_SWITCH_5, 0); -		rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); -	} else if (rt2x00_rt(rt2x00dev, RT3390)) { -		rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); -		rt2x00_set_field32(®, GPIO_SWITCH_5, 0); -		rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); -	} else if (rt2x00_rt(rt2x00dev, RT3572)) { -		rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); -		rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - -		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); -		rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); -		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); -		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); -		msleep(1); -		rt2800_register_read(rt2x00dev, LDO_CFG0, ®); -		rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); -		rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); -		rt2800_register_write(rt2x00dev, LDO_CFG0, reg); -	} - -	/* -	 * Set RX Filter calibration for 20MHz and 40MHz -	 */ -	if (rt2x00_rt(rt2x00dev, RT3070)) { -		drv_data->calibration_bw20 = -			rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16); -		drv_data->calibration_bw40 = -			rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19); -	} else if (rt2x00_rt(rt2x00dev, RT3071) || -		   rt2x00_rt(rt2x00dev, RT3090) || -		   rt2x00_rt(rt2x00dev, RT3352) || -		   rt2x00_rt(rt2x00dev, RT3390) || -		   rt2x00_rt(rt2x00dev, RT3572)) { -		drv_data->calibration_bw20 = -			rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13); -		drv_data->calibration_bw40 = -			rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15); -	} - -	/* -	 * Save BBP 25 & 26 values for later use in channel switching -	 */ -	rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25); -	rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26); - -	if (!rt2x00_rt(rt2x00dev, RT5390) && -	    !rt2x00_rt(rt2x00dev, RT5392)) { -		/* -		 * Set back to initial state -		 */ -		rt2800_bbp_write(rt2x00dev, 24, 0); - -		rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0); -		rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); - -		/* -		 * Set BBP back to BW20 -		 */ -		rt2800_bbp_read(rt2x00dev, 4, &bbp); -		rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0); -		rt2800_bbp_write(rt2x00dev, 4, bbp); -	} - -	if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) || -	    rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || -	    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || -	    rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) -		rt2800_rfcsr_write(rt2x00dev, 27, 0x03); - -	rt2800_register_read(rt2x00dev, OPT_14_CSR, ®); -	rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1); -	rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); - -	if (!rt2x00_rt(rt2x00dev, RT5390) && -	    !rt2x00_rt(rt2x00dev, RT5392)) { -		rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); -		if (rt2x00_rt(rt2x00dev, RT3070) || -		    rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || -		    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || -		    rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { -			if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG, -				      &rt2x00dev->cap_flags)) -				rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); -		} -		rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN, -				  drv_data->txmixer_gain_24g); -		rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); -	} - -	if (rt2x00_rt(rt2x00dev, RT3090)) { -		rt2800_bbp_read(rt2x00dev, 138, &bbp); - -		/*  Turn off unused DAC1 and ADC1 to reduce power consumption */ -		rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); -		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) -			rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); -		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) -			rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1); - -		rt2800_bbp_write(rt2x00dev, 138, bbp); -	} - -	if (rt2x00_rt(rt2x00dev, RT3071) || -	    rt2x00_rt(rt2x00dev, RT3090) || -	    rt2x00_rt(rt2x00dev, RT3390)) { -		rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); -		rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); -		rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); -		rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); -		rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); -		rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - -		rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR15_TX_LO2_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 15, rfcsr); - -		rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR20_RX_LO1_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); - -		rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR21_RX_LO2_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); -	} - -	if (rt2x00_rt(rt2x00dev, RT3070)) { -		rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr); -		if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) -			rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3); -		else -			rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0); -		rt2x00_set_field8(&rfcsr, RFCSR27_R2, 0); -		rt2x00_set_field8(&rfcsr, RFCSR27_R3, 0); -		rt2x00_set_field8(&rfcsr, RFCSR27_R4, 0); -		rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); -	} - -	if (rt2x00_rt(rt2x00dev, RT3290)) { -		rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3); -		rt2800_rfcsr_write(rt2x00dev, 29, rfcsr); -	} - -	if (rt2x00_rt(rt2x00dev, RT5390) || -	    rt2x00_rt(rt2x00dev, RT5392)) { -		rt2800_rfcsr_read(rt2x00dev, 38, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR38_RX_LO1_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 38, rfcsr); - -		rt2800_rfcsr_read(rt2x00dev, 39, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR39_RX_LO2_EN, 0); -		rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); - -		rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); -		rt2x00_set_field8(&rfcsr, RFCSR30_RX_VCM, 2); -		rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -	} - -	return 0;  }  int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) @@ -4533,15 +5175,24 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev)  	 * Initialize all registers.  	 */  	if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || -		     rt2800_init_registers(rt2x00dev) || -		     rt2800_init_bbp(rt2x00dev) || -		     rt2800_init_rfcsr(rt2x00dev))) +		     rt2800_init_registers(rt2x00dev)))  		return -EIO;  	/*  	 * Send signal to firmware during boot time.  	 */ -	rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); +	rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); +	rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); +	if (rt2x00_is_usb(rt2x00dev)) { +		rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); +		rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); +	} +	msleep(1); + +	if (unlikely(rt2800_init_bbp(rt2x00dev))) +		return -EIO; + +	rt2800_init_rfcsr(rt2x00dev);  	if (rt2x00_is_usb(rt2x00dev) &&  	    (rt2x00_rt(rt2x00dev, RT3070) || @@ -4702,7 +5353,7 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &word); @@ -4711,7 +5362,7 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1);  		rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); -		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);  	} else if (rt2x00_rt(rt2x00dev, RT2860) ||  		   rt2x00_rt(rt2x00dev, RT2872)) {  		/* @@ -4740,14 +5391,14 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BT_COEXIST, 0);  		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_DAC_TEST, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word); -		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);  	if ((word & 0x00ff) == 0x00ff) {  		rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); -		EEPROM(rt2x00dev, "Freq: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word);  	}  	if ((word & 0xff00) == 0xff00) {  		rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE, @@ -4757,7 +5408,7 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8); -		EEPROM(rt2x00dev, "Led Mode: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Led Mode: 0x%04x\n", word);  	}  	/* @@ -4821,9 +5472,9 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)  static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)  { -	u32 reg;  	u16 value;  	u16 eeprom; +	u16 rf;  	/*  	 * Read EEPROM word for configuration. @@ -4835,41 +5486,14 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)  	 * RT28xx/RT30xx: defined in "EEPROM_NIC_CONF0_RF_TYPE" field  	 * RT53xx: defined in "EEPROM_CHIP_ID" field  	 */ -	if (rt2x00_rt(rt2x00dev, RT3290)) -		rt2800_register_read(rt2x00dev, MAC_CSR0_3290, ®); -	else -		rt2800_register_read(rt2x00dev, MAC_CSR0, ®); - -	if (rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT3290 || -	    rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5390 || -	    rt2x00_get_field32(reg, MAC_CSR0_CHIPSET) == RT5392) -		rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &value); +	if (rt2x00_rt(rt2x00dev, RT3290) || +	    rt2x00_rt(rt2x00dev, RT5390) || +	    rt2x00_rt(rt2x00dev, RT5392)) +		rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);  	else -		value = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); +		rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); -	rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), -			value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); - -	switch (rt2x00dev->chip.rt) { -	case RT2860: -	case RT2872: -	case RT2883: -	case RT3070: -	case RT3071: -	case RT3090: -	case RT3290: -	case RT3352: -	case RT3390: -	case RT3572: -	case RT5390: -	case RT5392: -		break; -	default: -		ERROR(rt2x00dev, "Invalid RT chipset 0x%04x detected.\n", rt2x00dev->chip.rt); -		return -ENODEV; -	} - -	switch (rt2x00dev->chip.rf) { +	switch (rf) {  	case RF2820:  	case RF2850:  	case RF2720: @@ -4887,13 +5511,16 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)  	case RF5372:  	case RF5390:  	case RF5392: +	case RF5592:  		break;  	default: -		ERROR(rt2x00dev, "Invalid RF chipset 0x%04x detected.\n", -		      rt2x00dev->chip.rf); +		rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n", +			   rf);  		return -ENODEV;  	} +	rt2x00_set_rf(rt2x00dev, rf); +  	/*  	 * Identify default antenna configuration.  	 */ @@ -5122,6 +5749,138 @@ static const struct rf_channel rf_vals_3x[] = {  	{173, 0x61, 0, 9},  }; +static const struct rf_channel rf_vals_5592_xtal20[] = { +	/* Channel, N, K, mod, R */ +	{1, 482, 4, 10, 3}, +	{2, 483, 4, 10, 3}, +	{3, 484, 4, 10, 3}, +	{4, 485, 4, 10, 3}, +	{5, 486, 4, 10, 3}, +	{6, 487, 4, 10, 3}, +	{7, 488, 4, 10, 3}, +	{8, 489, 4, 10, 3}, +	{9, 490, 4, 10, 3}, +	{10, 491, 4, 10, 3}, +	{11, 492, 4, 10, 3}, +	{12, 493, 4, 10, 3}, +	{13, 494, 4, 10, 3}, +	{14, 496, 8, 10, 3}, +	{36, 172, 8, 12, 1}, +	{38, 173, 0, 12, 1}, +	{40, 173, 4, 12, 1}, +	{42, 173, 8, 12, 1}, +	{44, 174, 0, 12, 1}, +	{46, 174, 4, 12, 1}, +	{48, 174, 8, 12, 1}, +	{50, 175, 0, 12, 1}, +	{52, 175, 4, 12, 1}, +	{54, 175, 8, 12, 1}, +	{56, 176, 0, 12, 1}, +	{58, 176, 4, 12, 1}, +	{60, 176, 8, 12, 1}, +	{62, 177, 0, 12, 1}, +	{64, 177, 4, 12, 1}, +	{100, 183, 4, 12, 1}, +	{102, 183, 8, 12, 1}, +	{104, 184, 0, 12, 1}, +	{106, 184, 4, 12, 1}, +	{108, 184, 8, 12, 1}, +	{110, 185, 0, 12, 1}, +	{112, 185, 4, 12, 1}, +	{114, 185, 8, 12, 1}, +	{116, 186, 0, 12, 1}, +	{118, 186, 4, 12, 1}, +	{120, 186, 8, 12, 1}, +	{122, 187, 0, 12, 1}, +	{124, 187, 4, 12, 1}, +	{126, 187, 8, 12, 1}, +	{128, 188, 0, 12, 1}, +	{130, 188, 4, 12, 1}, +	{132, 188, 8, 12, 1}, +	{134, 189, 0, 12, 1}, +	{136, 189, 4, 12, 1}, +	{138, 189, 8, 12, 1}, +	{140, 190, 0, 12, 1}, +	{149, 191, 6, 12, 1}, +	{151, 191, 10, 12, 1}, +	{153, 192, 2, 12, 1}, +	{155, 192, 6, 12, 1}, +	{157, 192, 10, 12, 1}, +	{159, 193, 2, 12, 1}, +	{161, 193, 6, 12, 1}, +	{165, 194, 2, 12, 1}, +	{184, 164, 0, 12, 1}, +	{188, 164, 4, 12, 1}, +	{192, 165, 8, 12, 1}, +	{196, 166, 0, 12, 1}, +}; + +static const struct rf_channel rf_vals_5592_xtal40[] = { +	/* Channel, N, K, mod, R */ +	{1, 241, 2, 10, 3}, +	{2, 241, 7, 10, 3}, +	{3, 242, 2, 10, 3}, +	{4, 242, 7, 10, 3}, +	{5, 243, 2, 10, 3}, +	{6, 243, 7, 10, 3}, +	{7, 244, 2, 10, 3}, +	{8, 244, 7, 10, 3}, +	{9, 245, 2, 10, 3}, +	{10, 245, 7, 10, 3}, +	{11, 246, 2, 10, 3}, +	{12, 246, 7, 10, 3}, +	{13, 247, 2, 10, 3}, +	{14, 248, 4, 10, 3}, +	{36, 86, 4, 12, 1}, +	{38, 86, 6, 12, 1}, +	{40, 86, 8, 12, 1}, +	{42, 86, 10, 12, 1}, +	{44, 87, 0, 12, 1}, +	{46, 87, 2, 12, 1}, +	{48, 87, 4, 12, 1}, +	{50, 87, 6, 12, 1}, +	{52, 87, 8, 12, 1}, +	{54, 87, 10, 12, 1}, +	{56, 88, 0, 12, 1}, +	{58, 88, 2, 12, 1}, +	{60, 88, 4, 12, 1}, +	{62, 88, 6, 12, 1}, +	{64, 88, 8, 12, 1}, +	{100, 91, 8, 12, 1}, +	{102, 91, 10, 12, 1}, +	{104, 92, 0, 12, 1}, +	{106, 92, 2, 12, 1}, +	{108, 92, 4, 12, 1}, +	{110, 92, 6, 12, 1}, +	{112, 92, 8, 12, 1}, +	{114, 92, 10, 12, 1}, +	{116, 93, 0, 12, 1}, +	{118, 93, 2, 12, 1}, +	{120, 93, 4, 12, 1}, +	{122, 93, 6, 12, 1}, +	{124, 93, 8, 12, 1}, +	{126, 93, 10, 12, 1}, +	{128, 94, 0, 12, 1}, +	{130, 94, 2, 12, 1}, +	{132, 94, 4, 12, 1}, +	{134, 94, 6, 12, 1}, +	{136, 94, 8, 12, 1}, +	{138, 94, 10, 12, 1}, +	{140, 95, 0, 12, 1}, +	{149, 95, 9, 12, 1}, +	{151, 95, 11, 12, 1}, +	{153, 96, 1, 12, 1}, +	{155, 96, 3, 12, 1}, +	{157, 96, 5, 12, 1}, +	{159, 96, 7, 12, 1}, +	{161, 96, 9, 12, 1}, +	{165, 97, 1, 12, 1}, +	{184, 82, 0, 12, 1}, +	{188, 82, 4, 12, 1}, +	{192, 82, 8, 12, 1}, +	{196, 83, 0, 12, 1}, +}; +  static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)  {  	struct hw_mode_spec *spec = &rt2x00dev->spec; @@ -5130,6 +5889,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)  	char *default_power2;  	unsigned int i;  	u16 eeprom; +	u32 reg;  	/*  	 * Disable powersaving as default on PCI devices. @@ -5211,8 +5971,22 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)  		spec->supported_bands |= SUPPORT_BAND_5GHZ;  		spec->num_channels = ARRAY_SIZE(rf_vals_3x);  		spec->channels = rf_vals_3x; +	} else if (rt2x00_rf(rt2x00dev, RF5592)) { +		spec->supported_bands |= SUPPORT_BAND_5GHZ; + +		rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, ®); +		if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { +			spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40); +			spec->channels = rf_vals_5592_xtal40; +		} else { +			spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal20); +			spec->channels = rf_vals_5592_xtal20; +		}  	} +	if (WARN_ON_ONCE(!spec->channels)) +		return -ENODEV; +  	/*  	 * Initialize HT information.  	 */ @@ -5300,11 +6074,55 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)  	return 0;  } +static int rt2800_probe_rt(struct rt2x00_dev *rt2x00dev) +{ +	u32 reg; +	u32 rt; +	u32 rev; + +	if (rt2x00_rt(rt2x00dev, RT3290)) +		rt2800_register_read(rt2x00dev, MAC_CSR0_3290, ®); +	else +		rt2800_register_read(rt2x00dev, MAC_CSR0, ®); + +	rt = rt2x00_get_field32(reg, MAC_CSR0_CHIPSET); +	rev = rt2x00_get_field32(reg, MAC_CSR0_REVISION); + +	switch (rt) { +	case RT2860: +	case RT2872: +	case RT2883: +	case RT3070: +	case RT3071: +	case RT3090: +	case RT3290: +	case RT3352: +	case RT3390: +	case RT3572: +	case RT5390: +	case RT5392: +	case RT5592: +		break; +	default: +		rt2x00_err(rt2x00dev, "Invalid RT chipset 0x%04x, rev %04x detected\n", +			   rt, rev); +		return -ENODEV; +	} + +	rt2x00_set_rt(rt2x00dev, rt, rev); + +	return 0; +} +  int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)  {  	int retval;  	u32 reg; +	retval = rt2800_probe_rt(rt2x00dev); +	if (retval) +		return retval; +  	/*  	 * Allocate eeprom data.  	 */ @@ -5546,7 +6364,8 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,  	case IEEE80211_AMPDU_TX_OPERATIONAL:  		break;  	default: -		WARNING((struct rt2x00_dev *)hw->priv, "Unknown AMPDU action\n"); +		rt2x00_warn((struct rt2x00_dev *)hw->priv, +			    "Unknown AMPDU action\n");  	}  	return ret; @@ -5563,7 +6382,7 @@ int rt2800_get_survey(struct ieee80211_hw *hw, int idx,  	if (idx != 0)  		return -ENOENT; -	survey->channel = conf->channel; +	survey->channel = conf->chandef.chan;  	rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle);  	rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy); diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index ba5a05625aa..6f4a861af33 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c @@ -72,7 +72,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)  		return;  	for (i = 0; i < 200; i++) { -		rt2x00pci_register_read(rt2x00dev, H2M_MAILBOX_CID, ®); +		rt2x00mmio_register_read(rt2x00dev, H2M_MAILBOX_CID, ®);  		if ((rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD0) == token) ||  		    (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD1) == token) || @@ -84,10 +84,10 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)  	}  	if (i == 200) -		ERROR(rt2x00dev, "MCU request failed, no response from hardware\n"); +		rt2x00_err(rt2x00dev, "MCU request failed, no response from hardware\n"); -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);  }  #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) @@ -116,7 +116,7 @@ static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)  	struct rt2x00_dev *rt2x00dev = eeprom->data;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®);  	eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN);  	eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); @@ -138,7 +138,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom)  	rt2x00_set_field32(®, E2PROM_CSR_CHIP_SELECT,  			   !!eeprom->reg_chip_select); -	rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, E2PROM_CSR, reg);  }  static int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) @@ -146,7 +146,7 @@ static int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)  	struct eeprom_93cx6 eeprom;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®);  	eeprom.data = rt2x00dev;  	eeprom.register_read = rt2800pci_eepromregister_read; @@ -210,20 +210,20 @@ static void rt2800pci_start_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_SYS_CTRL, ®);  		rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); -		rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); +		rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®);  		rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1);  		rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1);  		rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); -		rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); +		rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); -		rt2x00pci_register_read(rt2x00dev, INT_TIMER_EN, ®); +		rt2x00mmio_register_read(rt2x00dev, INT_TIMER_EN, ®);  		rt2x00_set_field32(®, INT_TIMER_EN_PRE_TBTT_TIMER, 1); -		rt2x00pci_register_write(rt2x00dev, INT_TIMER_EN, reg); +		rt2x00mmio_register_write(rt2x00dev, INT_TIMER_EN, reg);  		break;  	default:  		break; @@ -241,13 +241,13 @@ static void rt2800pci_kick_queue(struct data_queue *queue)  	case QID_AC_BE:  	case QID_AC_BK:  		entry = rt2x00queue_get_entry(queue, Q_INDEX); -		rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), -					 entry->entry_idx); +		rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), +					  entry->entry_idx);  		break;  	case QID_MGMT:  		entry = rt2x00queue_get_entry(queue, Q_INDEX); -		rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX(5), -					 entry->entry_idx); +		rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(5), +					  entry->entry_idx);  		break;  	default:  		break; @@ -261,20 +261,20 @@ static void rt2800pci_stop_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_SYS_CTRL, ®);  		rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); -		rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); +		rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®);  		rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0);  		rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0);  		rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); -		rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); +		rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); -		rt2x00pci_register_read(rt2x00dev, INT_TIMER_EN, ®); +		rt2x00mmio_register_read(rt2x00dev, INT_TIMER_EN, ®);  		rt2x00_set_field32(®, INT_TIMER_EN_PRE_TBTT_TIMER, 0); -		rt2x00pci_register_write(rt2x00dev, INT_TIMER_EN, reg); +		rt2x00mmio_register_write(rt2x00dev, INT_TIMER_EN, reg);  		/*  		 * Wait for current invocation to finish. The tasklet @@ -314,19 +314,19 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev,  	 */  	reg = 0;  	rt2x00_set_field32(®, PBF_SYS_CTRL_HOST_RAM_WRITE, 1); -	rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, reg); +	rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, reg);  	/*  	 * Write firmware to device.  	 */ -	rt2x00pci_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, -				      data, len); +	rt2x00mmio_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, +				       data, len); -	rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000); -	rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001); +	rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000); +	rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001); -	rt2x00pci_register_write(rt2x00dev, H2M_BBP_AGENT, 0); -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); +	rt2x00mmio_register_write(rt2x00dev, H2M_BBP_AGENT, 0); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);  	return 0;  } @@ -336,7 +336,7 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev,   */  static bool rt2800pci_get_entry_state(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word;  	if (entry->queue->qid == QID_RX) { @@ -352,7 +352,7 @@ static bool rt2800pci_get_entry_state(struct queue_entry *entry)  static void rt2800pci_clear_entry(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;  	u32 word; @@ -370,8 +370,8 @@ static void rt2800pci_clear_entry(struct queue_entry *entry)  		 * Set RX IDX in register to inform hardware that we have  		 * handled this entry and it is available for reuse again.  		 */ -		rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, -				      entry->entry_idx); +		rt2x00mmio_register_write(rt2x00dev, RX_CRX_IDX, +					  entry->entry_idx);  	} else {  		rt2x00_desc_read(entry_priv->desc, 1, &word);  		rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 1); @@ -381,60 +381,65 @@ static void rt2800pci_clear_entry(struct queue_entry *entry)  static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev)  { -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	/*  	 * Initialize registers.  	 */  	entry_priv = rt2x00dev->tx[0].entries[0].priv_data; -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR0, entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT0, -				 rt2x00dev->tx[0].limit); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX0, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX0, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, +				  entry_priv->desc_dma); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, +				  rt2x00dev->tx[0].limit); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0);  	entry_priv = rt2x00dev->tx[1].entries[0].priv_data; -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR1, entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT1, -				 rt2x00dev->tx[1].limit); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX1, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX1, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, +				  entry_priv->desc_dma); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, +				  rt2x00dev->tx[1].limit); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0);  	entry_priv = rt2x00dev->tx[2].entries[0].priv_data; -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR2, entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT2, -				 rt2x00dev->tx[2].limit); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX2, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX2, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, +				  entry_priv->desc_dma); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, +				  rt2x00dev->tx[2].limit); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0);  	entry_priv = rt2x00dev->tx[3].entries[0].priv_data; -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR3, entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT3, -				 rt2x00dev->tx[3].limit); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX3, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX3, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, +				  entry_priv->desc_dma); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, +				  rt2x00dev->tx[3].limit); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR4, 0); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT4, 0); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX4, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX4, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR4, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT4, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX4, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX4, 0); -	rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR5, 0); -	rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT5, 0); -	rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX5, 0); -	rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX5, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR5, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT5, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX5, 0); +	rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX5, 0);  	entry_priv = rt2x00dev->rx->entries[0].priv_data; -	rt2x00pci_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, RX_MAX_CNT, -				 rt2x00dev->rx[0].limit); -	rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, -				 rt2x00dev->rx[0].limit - 1); -	rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0); +	rt2x00mmio_register_write(rt2x00dev, RX_BASE_PTR, +				  entry_priv->desc_dma); +	rt2x00mmio_register_write(rt2x00dev, RX_MAX_CNT, +				  rt2x00dev->rx[0].limit); +	rt2x00mmio_register_write(rt2x00dev, RX_CRX_IDX, +				  rt2x00dev->rx[0].limit - 1); +	rt2x00mmio_register_write(rt2x00dev, RX_DRX_IDX, 0);  	rt2800_disable_wpdma(rt2x00dev); -	rt2x00pci_register_write(rt2x00dev, DELAY_INT_CFG, 0); +	rt2x00mmio_register_write(rt2x00dev, DELAY_INT_CFG, 0);  	return 0;  } @@ -453,8 +458,8 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 * should clear the register to assure a clean state.  	 */  	if (state == STATE_RADIO_IRQ_ON) { -		rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -		rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); +		rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); +		rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg);  	}  	spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); @@ -466,7 +471,7 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, INT_MASK_CSR_TX_FIFO_STATUS, 1);  		rt2x00_set_field32(®, INT_MASK_CSR_AUTO_WAKEUP, 1);  	} -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg);  	spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);  	if (state == STATE_RADIO_IRQ_OFF) { @@ -488,7 +493,7 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)  	/*  	 * Reset DMA indexes  	 */ -	rt2x00pci_register_read(rt2x00dev, WPDMA_RST_IDX, ®); +	rt2x00mmio_register_read(rt2x00dev, WPDMA_RST_IDX, ®);  	rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1);  	rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1);  	rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1); @@ -496,29 +501,29 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1);  	rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1);  	rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1); -	rt2x00pci_register_write(rt2x00dev, WPDMA_RST_IDX, reg); +	rt2x00mmio_register_write(rt2x00dev, WPDMA_RST_IDX, reg); -	rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); -	rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); +	rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); +	rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);  	if (rt2x00_is_pcie(rt2x00dev) &&  	    (rt2x00_rt(rt2x00dev, RT3572) ||  	     rt2x00_rt(rt2x00dev, RT5390) ||  	     rt2x00_rt(rt2x00dev, RT5392))) { -		rt2x00pci_register_read(rt2x00dev, AUX_CTRL, ®); +		rt2x00mmio_register_read(rt2x00dev, AUX_CTRL, ®);  		rt2x00_set_field32(®, AUX_CTRL_FORCE_PCIE_CLK, 1);  		rt2x00_set_field32(®, AUX_CTRL_WAKE_PCIE_EN, 1); -		rt2x00pci_register_write(rt2x00dev, AUX_CTRL, reg); +		rt2x00mmio_register_write(rt2x00dev, AUX_CTRL, reg);  	} -	rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); +	rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);  	reg = 0;  	rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1);  	rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -	rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); +	rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000);  	return 0;  } @@ -538,8 +543,8 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)  		return retval;  	/* After resume MCU_BOOT_SIGNAL will trash these. */ -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);  	rt2800_mcu_request(rt2x00dev, MCU_SLEEP, TOKEN_RADIO_OFF, 0xff, 0x02);  	rt2800pci_mcu_status(rt2x00dev, TOKEN_RADIO_OFF); @@ -554,8 +559,8 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)  {  	if (rt2x00_is_soc(rt2x00dev)) {  		rt2800_disable_radio(rt2x00dev); -		rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0); -		rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, 0); +		rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); +		rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0);  	}  } @@ -567,10 +572,10 @@ static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,  				   0, 0x02);  		rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKEUP);  	} else if (state == STATE_SLEEP) { -		rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS, -					 0xffffffff); -		rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, -					 0xffffffff); +		rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, +					  0xffffffff); +		rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, +					  0xffffffff);  		rt2800_mcu_request(rt2x00dev, MCU_SLEEP, TOKEN_SLEEP,  				   0xff, 0x01);  	} @@ -611,8 +616,8 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -629,7 +634,7 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry,  				    struct txentry_desc *txdesc)  {  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	__le32 *txd = entry_priv->desc;  	u32 word; @@ -683,7 +688,7 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry,  static void rt2800pci_fill_rxdone(struct queue_entry *entry,  				  struct rxdone_entry_desc *rxdesc)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	__le32 *rxd = entry_priv->desc;  	u32 word; @@ -743,10 +748,90 @@ static void rt2800pci_wakeup(struct rt2x00_dev *rt2x00dev)  	rt2800_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS);  } +static bool rt2800pci_txdone_entry_check(struct queue_entry *entry, u32 status) +{ +	__le32 *txwi; +	u32 word; +	int wcid, tx_wcid; + +	wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID); + +	txwi = rt2800_drv_get_txwi(entry); +	rt2x00_desc_read(txwi, 1, &word); +	tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); + +	return (tx_wcid == wcid); +} + +static bool rt2800pci_txdone_find_entry(struct queue_entry *entry, void *data) +{ +	u32 status = *(u32 *)data; + +	/* +	 * rt2800pci hardware might reorder frames when exchanging traffic +	 * with multiple BA enabled STAs. +	 * +	 * For example, a tx queue +	 *    [ STA1 | STA2 | STA1 | STA2 ] +	 * can result in tx status reports +	 *    [ STA1 | STA1 | STA2 | STA2 ] +	 * when the hw decides to aggregate the frames for STA1 into one AMPDU. +	 * +	 * To mitigate this effect, associate the tx status to the first frame +	 * in the tx queue with a matching wcid. +	 */ +	if (rt2800pci_txdone_entry_check(entry, status) && +	    !test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +		/* +		 * Got a matching frame, associate the tx status with +		 * the frame +		 */ +		entry->status = status; +		set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); +		return true; +	} + +	/* Check the next frame */ +	return false; +} + +static bool rt2800pci_txdone_match_first(struct queue_entry *entry, void *data) +{ +	u32 status = *(u32 *)data; + +	/* +	 * Find the first frame without tx status and assign this status to it +	 * regardless if it matches or not. +	 */ +	if (!test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +		/* +		 * Got a matching frame, associate the tx status with +		 * the frame +		 */ +		entry->status = status; +		set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); +		return true; +	} + +	/* Check the next frame */ +	return false; +} +static bool rt2800pci_txdone_release_entries(struct queue_entry *entry, +					     void *data) +{ +	if (test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +		rt2800_txdone_entry(entry, entry->status, +				    rt2800pci_get_txwi(entry)); +		return false; +	} + +	/* No more frames to release */ +	return true; +} +  static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)  {  	struct data_queue *queue; -	struct queue_entry *entry;  	u32 status;  	u8 qid;  	int max_tx_done = 16; @@ -758,8 +843,8 @@ static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)  			 * Unknown queue, this shouldn't happen. Just drop  			 * this tx status.  			 */ -			WARNING(rt2x00dev, "Got TX status report with " -					   "unexpected pid %u, dropping\n", qid); +			rt2x00_warn(rt2x00dev, "Got TX status report with unexpected pid %u, dropping\n", +				    qid);  			break;  		} @@ -769,8 +854,8 @@ static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)  			 * The queue is NULL, this shouldn't happen. Stop  			 * processing here and drop the tx status  			 */ -			WARNING(rt2x00dev, "Got TX status for an unavailable " -					   "queue %u, dropping\n", qid); +			rt2x00_warn(rt2x00dev, "Got TX status for an unavailable queue %u, dropping\n", +				    qid);  			break;  		} @@ -779,13 +864,37 @@ static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)  			 * The queue is empty. Stop processing here  			 * and drop the tx status.  			 */ -			WARNING(rt2x00dev, "Got TX status for an empty " -					   "queue %u, dropping\n", qid); +			rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", +				    qid);  			break;  		} -		entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); -		rt2800_txdone_entry(entry, status, rt2800pci_get_txwi(entry)); +		/* +		 * Let's associate this tx status with the first +		 * matching frame. +		 */ +		if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +						Q_INDEX, &status, +						rt2800pci_txdone_find_entry)) { +			/* +			 * We cannot match the tx status to any frame, so just +			 * use the first one. +			 */ +			if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +							Q_INDEX, &status, +							rt2800pci_txdone_match_first)) { +				rt2x00_warn(rt2x00dev, "No frame found for TX status on queue %u, dropping\n", +					    qid); +				break; +			} +		} + +		/* +		 * Release all frames with a valid tx status. +		 */ +		rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +					   Q_INDEX, NULL, +					   rt2800pci_txdone_release_entries);  		if (--max_tx_done == 0)  			break; @@ -804,9 +913,9 @@ static inline void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,  	 * access needs locking.  	 */  	spin_lock_irq(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®);  	rt2x00_set_field32(®, irq_field, 1); -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg);  	spin_unlock_irq(&rt2x00dev->irqmask_lock);  } @@ -847,15 +956,15 @@ static void rt2800pci_tbtt_tasklet(unsigned long data)  		 * interval every 64 beacons by 64us to mitigate this effect.  		 */  		if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 2)) { -			rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); +			rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®);  			rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL,  					   (rt2x00dev->beacon_int * 16) - 1); -			rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); +			rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg);  		} else if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 1)) { -			rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); +			rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®);  			rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL,  					   (rt2x00dev->beacon_int * 16)); -			rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); +			rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg);  		}  		drv_data->tbtt_tick++;  		drv_data->tbtt_tick %= BCN_TBTT_OFFSET; @@ -868,7 +977,7 @@ static void rt2800pci_tbtt_tasklet(unsigned long data)  static void rt2800pci_rxdone_tasklet(unsigned long data)  {  	struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -	if (rt2x00pci_rxdone(rt2x00dev)) +	if (rt2x00mmio_rxdone(rt2x00dev))  		tasklet_schedule(&rt2x00dev->rxdone_tasklet);  	else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))  		rt2800pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_RX_DONE); @@ -906,14 +1015,13 @@ static void rt2800pci_txstatus_interrupt(struct rt2x00_dev *rt2x00dev)  	 * need to lock the kfifo.  	 */  	for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) { -		rt2x00pci_register_read(rt2x00dev, TX_STA_FIFO, &status); +		rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO, &status);  		if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))  			break;  		if (!kfifo_put(&rt2x00dev->txstatus_fifo, &status)) { -			WARNING(rt2x00dev, "TX status FIFO overrun," -				"drop tx status report.\n"); +			rt2x00_warn(rt2x00dev, "TX status FIFO overrun, drop tx status report\n");  			break;  		}  	} @@ -928,8 +1036,8 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)  	u32 reg, mask;  	/* Read status and ACK all interrupts */ -	rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -	rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); +	rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); +	rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg);  	if (!reg)  		return IRQ_NONE; @@ -969,9 +1077,9 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)  	 * the tasklet will reenable the appropriate interrupts.  	 */  	spin_lock(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®);  	reg &= mask; -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg);  	spin_unlock(&rt2x00dev->irqmask_lock);  	return IRQ_HANDLED; @@ -1022,13 +1130,13 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = {  };  static const struct rt2800_ops rt2800pci_rt2800_ops = { -	.register_read		= rt2x00pci_register_read, -	.register_read_lock	= rt2x00pci_register_read, /* same for PCI */ -	.register_write		= rt2x00pci_register_write, -	.register_write_lock	= rt2x00pci_register_write, /* same for PCI */ -	.register_multiread	= rt2x00pci_register_multiread, -	.register_multiwrite	= rt2x00pci_register_multiwrite, -	.regbusy_read		= rt2x00pci_regbusy_read, +	.register_read		= rt2x00mmio_register_read, +	.register_read_lock	= rt2x00mmio_register_read, /* same for PCI */ +	.register_write		= rt2x00mmio_register_write, +	.register_write_lock	= rt2x00mmio_register_write, /* same for PCI */ +	.register_multiread	= rt2x00mmio_register_multiread, +	.register_multiwrite	= rt2x00mmio_register_multiwrite, +	.regbusy_read		= rt2x00mmio_regbusy_read,  	.read_eeprom		= rt2800pci_read_eeprom,  	.hwcrypt_disabled	= rt2800pci_hwcrypt_disabled,  	.drv_write_firmware	= rt2800pci_write_firmware, @@ -1047,8 +1155,8 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {  	.get_firmware_name	= rt2800pci_get_firmware_name,  	.check_firmware		= rt2800_check_firmware,  	.load_firmware		= rt2800_load_firmware, -	.initialize		= rt2x00pci_initialize, -	.uninitialize		= rt2x00pci_uninitialize, +	.initialize		= rt2x00mmio_initialize, +	.uninitialize		= rt2x00mmio_uninitialize,  	.get_entry_state	= rt2800pci_get_entry_state,  	.clear_entry		= rt2800pci_clear_entry,  	.set_device_state	= rt2800pci_set_device_state, @@ -1061,7 +1169,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {  	.start_queue		= rt2800pci_start_queue,  	.kick_queue		= rt2800pci_kick_queue,  	.stop_queue		= rt2800pci_stop_queue, -	.flush_queue		= rt2x00pci_flush_queue, +	.flush_queue		= rt2x00mmio_flush_queue,  	.write_tx_desc		= rt2800pci_write_tx_desc,  	.write_tx_data		= rt2800_write_tx_data,  	.write_beacon		= rt2800_write_beacon, @@ -1082,21 +1190,24 @@ static const struct data_queue_desc rt2800pci_queue_rx = {  	.entry_num		= 128,  	.data_size		= AGGREGATION_SIZE,  	.desc_size		= RXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.winfo_size		= RXWI_DESC_SIZE, +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2800pci_queue_tx = {  	.entry_num		= 64,  	.data_size		= AGGREGATION_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.winfo_size		= TXWI_DESC_SIZE, +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt2800pci_queue_bcn = {  	.entry_num		= 8,  	.data_size		= 0, /* No DMA required for beacons */ -	.desc_size		= TXWI_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.desc_size		= TXD_DESC_SIZE, +	.winfo_size		= TXWI_DESC_SIZE, +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct rt2x00_ops rt2800pci_ops = { diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 098613ed93f..ac854d75bd6 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c @@ -128,9 +128,9 @@ static inline bool rt2800usb_entry_txstatus_timeout(struct queue_entry *entry)  	tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(100));  	if (unlikely(tout)) -		WARNING(entry->queue->rt2x00dev, -			"TX status timeout for entry %d in queue %d\n", -			entry->entry_idx, entry->queue->qid); +		rt2x00_warn(entry->queue->rt2x00dev, +			    "TX status timeout for entry %d in queue %d\n", +			    entry->entry_idx, entry->queue->qid);  	return tout;  } @@ -154,7 +154,8 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,  	bool valid;  	if (urb_status) { -		WARNING(rt2x00dev, "TX status read failed %d\n", urb_status); +		rt2x00_warn(rt2x00dev, "TX status read failed %d\n", +			    urb_status);  		goto stop_reading;  	} @@ -162,7 +163,7 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,  	valid = rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID);  	if (valid) {  		if (!kfifo_put(&rt2x00dev->txstatus_fifo, &tx_status)) -			WARNING(rt2x00dev, "TX status FIFO overrun\n"); +			rt2x00_warn(rt2x00dev, "TX status FIFO overrun\n");  		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); @@ -269,7 +270,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,  					     0, USB_MODE_FIRMWARE,  					     REGISTER_TIMEOUT_FIRMWARE);  	if (status < 0) { -		ERROR(rt2x00dev, "Failed to write Firmware to device.\n"); +		rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n");  		return status;  	} @@ -392,8 +393,8 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -408,8 +409,7 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)  	rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, ®);  	if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) { -		WARNING(rt2x00dev, "TX HW queue 0 timed out," -			" invoke forced kick\n"); +		rt2x00_warn(rt2x00dev, "TX HW queue 0 timed out, invoke forced kick\n");  		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012); @@ -424,8 +424,7 @@ static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)  	rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, ®);  	if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) { -		WARNING(rt2x00dev, "TX HW queue 1 timed out," -			" invoke forced kick\n"); +		rt2x00_warn(rt2x00dev, "TX HW queue 1 timed out, invoke forced kick\n");  		rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a); @@ -485,7 +484,7 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry,  	 */  	skbdesc->flags |= SKBDESC_DESC_IN_SKB;  	skbdesc->desc = txi; -	skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; +	skbdesc->desc_len = TXINFO_DESC_SIZE + entry->queue->winfo_size;  }  /* @@ -540,9 +539,9 @@ rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg)  	tx_pid  = rt2x00_get_field32(word, TXWI_W1_PACKETID);  	if (wcid != tx_wcid || ack != tx_ack || (!is_agg && pid != tx_pid)) { -		DEBUG(entry->queue->rt2x00dev, -		      "TX status report missed for queue %d entry %d\n", -		      entry->queue->qid, entry->entry_idx); +		rt2x00_dbg(entry->queue->rt2x00dev, +			   "TX status report missed for queue %d entry %d\n", +			   entry->queue->qid, entry->entry_idx);  		return TXDONE_UNKNOWN;  	} @@ -566,8 +565,8 @@ static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)  		queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);  		if (unlikely(rt2x00queue_empty(queue))) { -			WARNING(rt2x00dev, "Got TX status for an empty " -					   "queue %u, dropping\n", qid); +			rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", +				    qid);  			break;  		} @@ -575,8 +574,8 @@ static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)  		if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||  			     !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) { -			WARNING(rt2x00dev, "Data pending for entry %u " -					   "in queue %u\n", entry->entry_idx, qid); +			rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n", +				    entry->entry_idx, qid);  			break;  		} @@ -677,8 +676,8 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,  	 */  	if (unlikely(rx_pkt_len == 0 ||  			rx_pkt_len > entry->queue->data_size)) { -		ERROR(entry->queue->rt2x00dev, -			"Bad frame size %d, forcing to 0\n", rx_pkt_len); +		rt2x00_err(entry->queue->rt2x00dev, +			   "Bad frame size %d, forcing to 0\n", rx_pkt_len);  		return;  	} @@ -853,21 +852,24 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {  static const struct data_queue_desc rt2800usb_queue_rx = {  	.entry_num		= 128,  	.data_size		= AGGREGATION_SIZE, -	.desc_size		= RXINFO_DESC_SIZE + RXWI_DESC_SIZE, +	.desc_size		= RXINFO_DESC_SIZE, +	.winfo_size		= RXWI_DESC_SIZE,  	.priv_size		= sizeof(struct queue_entry_priv_usb),  };  static const struct data_queue_desc rt2800usb_queue_tx = {  	.entry_num		= 16,  	.data_size		= AGGREGATION_SIZE, -	.desc_size		= TXINFO_DESC_SIZE + TXWI_DESC_SIZE, +	.desc_size		= TXINFO_DESC_SIZE, +	.winfo_size		= TXWI_DESC_SIZE,  	.priv_size		= sizeof(struct queue_entry_priv_usb),  };  static const struct data_queue_desc rt2800usb_queue_bcn = {  	.entry_num		= 8,  	.data_size		= MGMT_FRAME_SIZE, -	.desc_size		= TXINFO_DESC_SIZE + TXWI_DESC_SIZE, +	.desc_size		= TXINFO_DESC_SIZE, +	.winfo_size		= TXWI_DESC_SIZE,  	.priv_size		= sizeof(struct queue_entry_priv_usb),  }; @@ -890,6 +892,50 @@ static const struct rt2x00_ops rt2800usb_ops = {  #endif /* CONFIG_RT2X00_LIB_DEBUGFS */  }; +static const struct data_queue_desc rt2800usb_queue_rx_5592 = { +	.entry_num		= 128, +	.data_size		= AGGREGATION_SIZE, +	.desc_size		= RXINFO_DESC_SIZE, +	.winfo_size		= RXWI_DESC_SIZE_5592, +	.priv_size		= sizeof(struct queue_entry_priv_usb), +}; + +static const struct data_queue_desc rt2800usb_queue_tx_5592 = { +	.entry_num		= 16, +	.data_size		= AGGREGATION_SIZE, +	.desc_size		= TXINFO_DESC_SIZE, +	.winfo_size		= TXWI_DESC_SIZE_5592, +	.priv_size		= sizeof(struct queue_entry_priv_usb), +}; + +static const struct data_queue_desc rt2800usb_queue_bcn_5592 = { +	.entry_num		= 8, +	.data_size		= MGMT_FRAME_SIZE, +	.desc_size		= TXINFO_DESC_SIZE, +	.winfo_size		= TXWI_DESC_SIZE_5592, +	.priv_size		= sizeof(struct queue_entry_priv_usb), +}; + + +static const struct rt2x00_ops rt2800usb_ops_5592 = { +	.name			= KBUILD_MODNAME, +	.drv_data_size		= sizeof(struct rt2800_drv_data), +	.max_ap_intf		= 8, +	.eeprom_size		= EEPROM_SIZE, +	.rf_size		= RF_SIZE, +	.tx_queues		= NUM_TX_QUEUES, +	.extra_tx_headroom	= TXINFO_DESC_SIZE + TXWI_DESC_SIZE_5592, +	.rx			= &rt2800usb_queue_rx_5592, +	.tx			= &rt2800usb_queue_tx_5592, +	.bcn			= &rt2800usb_queue_bcn_5592, +	.lib			= &rt2800usb_rt2x00_ops, +	.drv			= &rt2800usb_rt2800_ops, +	.hw			= &rt2800usb_mac80211_ops, +#ifdef CONFIG_RT2X00_LIB_DEBUGFS +	.debugfs		= &rt2800_rt2x00debug, +#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ +}; +  /*   * rt2800usb module information.   */ @@ -1200,6 +1246,18 @@ static struct usb_device_id rt2800usb_device_table[] = {  	{ USB_DEVICE(0x148f, 0x5370) },  	{ USB_DEVICE(0x148f, 0x5372) },  #endif +#ifdef CONFIG_RT2800USB_RT55XX +	/* Arcadyan */ +	{ USB_DEVICE(0x043e, 0x7a32), .driver_info = 5592 }, +	/* AVM GmbH */ +	{ USB_DEVICE(0x057c, 0x8501), .driver_info = 5592 }, +	/* D-Link DWA-160-B2 */ +	{ USB_DEVICE(0x2001, 0x3c1a), .driver_info = 5592 }, +	/* Proware */ +	{ USB_DEVICE(0x043e, 0x7a13), .driver_info = 5592 }, +	/* Ralink */ +	{ USB_DEVICE(0x148f, 0x5572), .driver_info = 5592 }, +#endif  #ifdef CONFIG_RT2800USB_UNKNOWN  	/*  	 * Unclear what kind of devices these are (they aren't supported by the @@ -1303,6 +1361,9 @@ MODULE_LICENSE("GPL");  static int rt2800usb_probe(struct usb_interface *usb_intf,  			   const struct usb_device_id *id)  { +	if (id->driver_info == 5592) +		return rt2x00usb_probe(usb_intf, &rt2800usb_ops_5592); +  	return rt2x00usb_probe(usb_intf, &rt2800usb_ops);  } diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 086abb403a4..7510723a8c3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -54,47 +54,36 @@  #define DRV_VERSION	"2.3.0"  #define DRV_PROJECT	"http://rt2x00.serialmonkey.com" -/* - * Debug definitions. +/* Debug definitions.   * Debug output has to be enabled during compile time.   */ -#define DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, __args...)	\ -	printk(__kernlvl "%s -> %s: %s - " __msg,			\ -	       wiphy_name((__dev)->hw->wiphy), __func__, __lvl, ##__args) - -#define DEBUG_PRINTK_PROBE(__kernlvl, __lvl, __msg, __args...)	\ -	printk(__kernlvl "%s -> %s: %s - " __msg,		\ -	       KBUILD_MODNAME, __func__, __lvl, ##__args) -  #ifdef CONFIG_RT2X00_DEBUG -#define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...)	\ -	DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args) -#else -#define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...)	\ -	do { } while (0) +#define DEBUG  #endif /* CONFIG_RT2X00_DEBUG */ -/* - * Various debug levels. - * The debug levels PANIC and ERROR both indicate serious problems, - * for this reason they should never be ignored. - * The special ERROR_PROBE message is for messages that are generated - * when the rt2x00_dev is not yet initialized. +/* Utility printing macros + * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized   */ -#define PANIC(__dev, __msg, __args...) \ -	DEBUG_PRINTK_MSG(__dev, KERN_CRIT, "Panic", __msg, ##__args) -#define ERROR(__dev, __msg, __args...)	\ -	DEBUG_PRINTK_MSG(__dev, KERN_ERR, "Error", __msg, ##__args) -#define ERROR_PROBE(__msg, __args...) \ -	DEBUG_PRINTK_PROBE(KERN_ERR, "Error", __msg, ##__args) -#define WARNING(__dev, __msg, __args...) \ -	DEBUG_PRINTK_MSG(__dev, KERN_WARNING, "Warning", __msg, ##__args) -#define INFO(__dev, __msg, __args...) \ -	DEBUG_PRINTK_MSG(__dev, KERN_INFO, "Info", __msg, ##__args) -#define DEBUG(__dev, __msg, __args...) \ -	DEBUG_PRINTK(__dev, KERN_DEBUG, "Debug", __msg, ##__args) -#define EEPROM(__dev, __msg, __args...) \ -	DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args) +#define rt2x00_probe_err(fmt, ...)					\ +	printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt,		\ +	       __func__, ##__VA_ARGS__) +#define rt2x00_err(dev, fmt, ...)					\ +	wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt,			\ +		  __func__, ##__VA_ARGS__) +#define rt2x00_warn(dev, fmt, ...)					\ +	wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt,		\ +		   __func__, ##__VA_ARGS__) +#define rt2x00_info(dev, fmt, ...)					\ +	wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt,			\ +		   __func__, ##__VA_ARGS__) + +/* Various debug levels */ +#define rt2x00_dbg(dev, fmt, ...)					\ +	wiphy_dbg((dev)->hw->wiphy, "%s: Debug - " fmt,			\ +		  __func__, ##__VA_ARGS__) +#define rt2x00_eeprom_dbg(dev, fmt, ...)				\ +	wiphy_dbg((dev)->hw->wiphy, "%s: EEPROM recovery - " fmt,	\ +		  __func__, ##__VA_ARGS__)  /*   * Duration calculations @@ -193,6 +182,7 @@ struct rt2x00_chip {  #define RT3883		0x3883	/* WSOC */  #define RT5390		0x5390  /* 2.4GHz */  #define RT5392		0x5392  /* 2.4GHz */ +#define RT5592		0x5592  	u16 rf;  	u16 rev; @@ -1064,8 +1054,7 @@ static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,  }  /* - *  Generic EEPROM access. - * The EEPROM is being accessed by word index. + * Generic EEPROM access. The EEPROM is being accessed by word or byte index.   */  static inline void *rt2x00_eeprom_addr(struct rt2x00_dev *rt2x00dev,  				       const unsigned int word) @@ -1085,6 +1074,12 @@ static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev,  	rt2x00dev->eeprom[word] = cpu_to_le16(data);  } +static inline u8 rt2x00_eeprom_byte(struct rt2x00_dev *rt2x00dev, +				    const unsigned int byte) +{ +	return *(((u8 *)rt2x00dev->eeprom) + byte); +} +  /*   * Chipset handlers   */ @@ -1095,9 +1090,27 @@ static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev,  	rt2x00dev->chip.rf = rf;  	rt2x00dev->chip.rev = rev; -	INFO(rt2x00dev, -	     "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n", -	     rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); +	rt2x00_info(rt2x00dev, "Chipset detected - rt: %04x, rf: %04x, rev: %04x\n", +		    rt2x00dev->chip.rt, rt2x00dev->chip.rf, +		    rt2x00dev->chip.rev); +} + +static inline void rt2x00_set_rt(struct rt2x00_dev *rt2x00dev, +				 const u16 rt, const u16 rev) +{ +	rt2x00dev->chip.rt = rt; +	rt2x00dev->chip.rev = rev; + +	rt2x00_info(rt2x00dev, "RT chipset %04x, rev %04x detected\n", +		    rt2x00dev->chip.rt, rt2x00dev->chip.rev); +} + +static inline void rt2x00_set_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) +{ +	rt2x00dev->chip.rf = rf; + +	rt2x00_info(rt2x00dev, "RF chipset %04x detected\n", +		    rt2x00dev->chip.rf);  }  static inline bool rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt) @@ -1360,7 +1373,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw,  		      struct ieee80211_vif *vif, u16 queue,  		      const struct ieee80211_tx_queue_params *params);  void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); -void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop); +void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop);  int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);  int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);  void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index 49a63e97393..8cb43f8f3ef 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c @@ -184,7 +184,7 @@ static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,  	/*  	 * Initialize center channel to current channel.  	 */ -	center_channel = spec->channels[conf->channel->hw_value].channel; +	center_channel = spec->channels[conf->chandef.chan->hw_value].channel;  	/*  	 * Adjust center channel to HT40+ and HT40- operation. @@ -199,7 +199,7 @@ static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,  			return i;  	WARN_ON(1); -	return conf->channel->hw_value; +	return conf->chandef.chan->hw_value;  }  void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, @@ -227,7 +227,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,  			hw_value = rt2x00ht_center_channel(rt2x00dev, conf);  		} else {  			clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); -			hw_value = conf->channel->hw_value; +			hw_value = conf->chandef.chan->hw_value;  		}  		memcpy(&libconf.rf, @@ -279,8 +279,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,  	else  		clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); -	rt2x00dev->curr_band = conf->channel->band; -	rt2x00dev->curr_freq = conf->channel->center_freq; +	rt2x00dev->curr_band = conf->chandef.chan->band; +	rt2x00dev->curr_freq = conf->chandef.chan->center_freq;  	rt2x00dev->tx_power = conf->power_level;  	rt2x00dev->short_retry = conf->short_frame_max_tx_count;  	rt2x00dev->long_retry = conf->long_frame_max_tx_count; diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 3bb8cafbac5..fe7a7f63a9e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c @@ -174,7 +174,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,  	do_gettimeofday(×tamp);  	if (skb_queue_len(&intf->frame_dump_skbqueue) > 20) { -		DEBUG(rt2x00dev, "txrx dump queue length exceeded.\n"); +		rt2x00_dbg(rt2x00dev, "txrx dump queue length exceeded\n");  		return;  	} @@ -185,7 +185,7 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,  	skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + data_len,  			    GFP_ATOMIC);  	if (!skbcopy) { -		DEBUG(rt2x00dev, "Failed to copy skb for dump.\n"); +		rt2x00_dbg(rt2x00dev, "Failed to copy skb for dump\n");  		return;  	} @@ -657,7 +657,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)  	intf = kzalloc(sizeof(struct rt2x00debug_intf), GFP_KERNEL);  	if (!intf) { -		ERROR(rt2x00dev, "Failed to allocate debug handler.\n"); +		rt2x00_err(rt2x00dev, "Failed to allocate debug handler\n");  		return;  	} @@ -760,7 +760,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)  exit:  	rt2x00debug_deregister(rt2x00dev); -	ERROR(rt2x00dev, "Failed to register debug handler.\n"); +	rt2x00_err(rt2x00dev, "Failed to register debug handler\n");  }  void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 189744db65e..90dc1433698 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -171,7 +171,7 @@ static void rt2x00lib_autowakeup(struct work_struct *work)  		return;  	if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) -		ERROR(rt2x00dev, "Device failed to wakeup.\n"); +		rt2x00_err(rt2x00dev, "Device failed to wakeup\n");  	clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);  } @@ -673,9 +673,8 @@ static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,  		break;  	} -	WARNING(rt2x00dev, "Frame received with unrecognized signal, " -		"mode=0x%.4x, signal=0x%.4x, type=%d.\n", -		rxdesc->rate_mode, signal, type); +	rt2x00_warn(rt2x00dev, "Frame received with unrecognized signal, mode=0x%.4x, signal=0x%.4x, type=%d\n", +		    rxdesc->rate_mode, signal, type);  	return 0;  } @@ -720,8 +719,8 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)  	 */  	if (unlikely(rxdesc.size == 0 ||  		     rxdesc.size > entry->queue->data_size)) { -		ERROR(rt2x00dev, "Wrong frame size %d max %d.\n", -			rxdesc.size, entry->queue->data_size); +		rt2x00_err(rt2x00dev, "Wrong frame size %d max %d\n", +			   rxdesc.size, entry->queue->data_size);  		dev_kfree_skb(entry->skb);  		goto renew_skb;  	} @@ -1006,7 +1005,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,   exit_free_channels:  	kfree(channels); -	ERROR(rt2x00dev, "Allocation ieee80211 modes failed.\n"); +	rt2x00_err(rt2x00dev, "Allocation ieee80211 modes failed\n");  	return -ENOMEM;  } @@ -1337,7 +1336,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)  	 */  	retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev);  	if (retval) { -		ERROR(rt2x00dev, "Failed to allocate device.\n"); +		rt2x00_err(rt2x00dev, "Failed to allocate device\n");  		goto exit;  	} @@ -1353,7 +1352,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)  	 */  	retval = rt2x00lib_probe_hw(rt2x00dev);  	if (retval) { -		ERROR(rt2x00dev, "Failed to initialize hw.\n"); +		rt2x00_err(rt2x00dev, "Failed to initialize hw\n");  		goto exit;  	} @@ -1451,7 +1450,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);  #ifdef CONFIG_PM  int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)  { -	DEBUG(rt2x00dev, "Going to sleep.\n"); +	rt2x00_dbg(rt2x00dev, "Going to sleep\n");  	/*  	 * Prevent mac80211 from accessing driver while suspended. @@ -1482,8 +1481,7 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)  	 * device is as good as disabled.  	 */  	if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) -		WARNING(rt2x00dev, "Device failed to enter sleep state, " -			"continue suspending.\n"); +		rt2x00_warn(rt2x00dev, "Device failed to enter sleep state, continue suspending\n");  	return 0;  } @@ -1491,7 +1489,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_suspend);  int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)  { -	DEBUG(rt2x00dev, "Waking up.\n"); +	rt2x00_dbg(rt2x00dev, "Waking up\n");  	/*  	 * Restore/enable extra components. diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c index f316aad3061..1b4254b4272 100644 --- a/drivers/net/wireless/rt2x00/rt2x00firmware.c +++ b/drivers/net/wireless/rt2x00/rt2x00firmware.c @@ -42,28 +42,28 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)  	 */  	fw_name = rt2x00dev->ops->lib->get_firmware_name(rt2x00dev);  	if (!fw_name) { -		ERROR(rt2x00dev, -		      "Invalid firmware filename.\n" -		      "Please file bug report to %s.\n", DRV_PROJECT); +		rt2x00_err(rt2x00dev, +			   "Invalid firmware filename\n" +			   "Please file bug report to %s\n", DRV_PROJECT);  		return -EINVAL;  	} -	INFO(rt2x00dev, "Loading firmware file '%s'.\n", fw_name); +	rt2x00_info(rt2x00dev, "Loading firmware file '%s'\n", fw_name);  	retval = request_firmware(&fw, fw_name, device);  	if (retval) { -		ERROR(rt2x00dev, "Failed to request Firmware.\n"); +		rt2x00_err(rt2x00dev, "Failed to request Firmware\n");  		return retval;  	}  	if (!fw || !fw->size || !fw->data) { -		ERROR(rt2x00dev, "Failed to read Firmware.\n"); +		rt2x00_err(rt2x00dev, "Failed to read Firmware\n");  		release_firmware(fw);  		return -ENOENT;  	} -	INFO(rt2x00dev, "Firmware detected - version: %d.%d.\n", -	     fw->data[fw->size - 4], fw->data[fw->size - 3]); +	rt2x00_info(rt2x00dev, "Firmware detected - version: %d.%d\n", +		    fw->data[fw->size - 4], fw->data[fw->size - 3]);  	snprintf(rt2x00dev->hw->wiphy->fw_version,  			sizeof(rt2x00dev->hw->wiphy->fw_version), "%d.%d",  			fw->data[fw->size - 4], fw->data[fw->size - 3]); @@ -73,15 +73,14 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)  	case FW_OK:  		break;  	case FW_BAD_CRC: -		ERROR(rt2x00dev, "Firmware checksum error.\n"); +		rt2x00_err(rt2x00dev, "Firmware checksum error\n");  		goto exit;  	case FW_BAD_LENGTH: -		ERROR(rt2x00dev, -		      "Invalid firmware file length (len=%zu)\n", fw->size); +		rt2x00_err(rt2x00dev, "Invalid firmware file length (len=%zu)\n", +			   fw->size);  		goto exit;  	case FW_BAD_VERSION: -		ERROR(rt2x00dev, -		      "Current firmware does not support detected chipset.\n"); +		rt2x00_err(rt2x00dev, "Current firmware does not support detected chipset\n");  		goto exit;  	} diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c index 8679d781a26..997a6c89e66 100644 --- a/drivers/net/wireless/rt2x00/rt2x00leds.c +++ b/drivers/net/wireless/rt2x00/rt2x00leds.c @@ -113,7 +113,7 @@ static int rt2x00leds_register_led(struct rt2x00_dev *rt2x00dev,  	retval = led_classdev_register(device, &led->led_dev);  	if (retval) { -		ERROR(rt2x00dev, "Failed to register led handler.\n"); +		rt2x00_err(rt2x00dev, "Failed to register led handler\n");  		return retval;  	} diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 20c6eccce5a..f883802f350 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -46,7 +46,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,  	skb = dev_alloc_skb(data_length + rt2x00dev->hw->extra_tx_headroom);  	if (unlikely(!skb)) { -		WARNING(rt2x00dev, "Failed to create RTS/CTS frame.\n"); +		rt2x00_warn(rt2x00dev, "Failed to create RTS/CTS frame\n");  		return -ENOMEM;  	} @@ -93,7 +93,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,  	retval = rt2x00queue_write_tx_frame(queue, skb, true);  	if (retval) {  		dev_kfree_skb_any(skb); -		WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); +		rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n");  	}  	return retval; @@ -126,9 +126,9 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,  	queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);  	if (unlikely(!queue)) { -		ERROR(rt2x00dev, -		      "Attempt to send packet over invalid queue %d.\n" -		      "Please file bug report to %s.\n", qid, DRV_PROJECT); +		rt2x00_err(rt2x00dev, +			   "Attempt to send packet over invalid queue %d\n" +			   "Please file bug report to %s\n", qid, DRV_PROJECT);  		goto exit_free_skb;  	} @@ -731,9 +731,10 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw,  	queue->aifs = params->aifs;  	queue->txop = params->txop; -	DEBUG(rt2x00dev, -	      "Configured TX queue %d - CWmin: %d, CWmax: %d, Aifs: %d, TXop: %d.\n", -	      queue_idx, queue->cw_min, queue->cw_max, queue->aifs, queue->txop); +	rt2x00_dbg(rt2x00dev, +		   "Configured TX queue %d - CWmin: %d, CWmax: %d, Aifs: %d, TXop: %d\n", +		   queue_idx, queue->cw_min, queue->cw_max, queue->aifs, +		   queue->txop);  	return 0;  } @@ -748,7 +749,7 @@ void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw)  }  EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); -void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop) +void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop)  {  	struct rt2x00_dev *rt2x00dev = hw->priv;  	struct data_queue *queue; diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.c b/drivers/net/wireless/rt2x00/rt2x00mmio.c index d84a680ba0c..64b06c6abe5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mmio.c +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.c @@ -34,10 +34,10 @@  /*   * Register access.   */ -int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, -			   const unsigned int offset, -			   const struct rt2x00_field32 field, -			   u32 *reg) +int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev, +			    const unsigned int offset, +			    const struct rt2x00_field32 field, +			    u32 *reg)  {  	unsigned int i; @@ -45,7 +45,7 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,  		return 0;  	for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -		rt2x00pci_register_read(rt2x00dev, offset, reg); +		rt2x00mmio_register_read(rt2x00dev, offset, reg);  		if (!rt2x00_get_field32(*reg, field))  			return 1;  		udelay(REGISTER_BUSY_DELAY); @@ -57,13 +57,13 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,  	return 0;  } -EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); +EXPORT_SYMBOL_GPL(rt2x00mmio_regbusy_read); -bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) +bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev)  {  	struct data_queue *queue = rt2x00dev->rx;  	struct queue_entry *entry; -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	struct skb_frame_desc *skbdesc;  	int max_rx = 16; @@ -96,24 +96,24 @@ bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)  	return !max_rx;  } -EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); +EXPORT_SYMBOL_GPL(rt2x00mmio_rxdone); -void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) +void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop)  {  	unsigned int i;  	for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++)  		msleep(10);  } -EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); +EXPORT_SYMBOL_GPL(rt2x00mmio_flush_queue);  /*   * Device initialization handlers.   */ -static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, -				     struct data_queue *queue) +static int rt2x00mmio_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, +				      struct data_queue *queue)  { -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	void *addr;  	dma_addr_t dma;  	unsigned int i; @@ -141,10 +141,10 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,  	return 0;  } -static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, -				     struct data_queue *queue) +static void rt2x00mmio_free_queue_dma(struct rt2x00_dev *rt2x00dev, +				      struct data_queue *queue)  { -	struct queue_entry_priv_pci *entry_priv = +	struct queue_entry_priv_mmio *entry_priv =  	    queue->entries[0].priv_data;  	if (entry_priv->desc) @@ -154,7 +154,7 @@ static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev,  	entry_priv->desc = NULL;  } -int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) +int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev)  {  	struct data_queue *queue;  	int status; @@ -163,7 +163,7 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)  	 * Allocate DMA  	 */  	queue_for_each(rt2x00dev, queue) { -		status = rt2x00pci_alloc_queue_dma(rt2x00dev, queue); +		status = rt2x00mmio_alloc_queue_dma(rt2x00dev, queue);  		if (status)  			goto exit;  	} @@ -175,8 +175,8 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)  			     rt2x00dev->ops->lib->irq_handler,  			     IRQF_SHARED, rt2x00dev->name, rt2x00dev);  	if (status) { -		ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", -		      rt2x00dev->irq, status); +		rt2x00_err(rt2x00dev, "IRQ %d allocation failed (error %d)\n", +			   rt2x00dev->irq, status);  		goto exit;  	} @@ -184,13 +184,13 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev)  exit:  	queue_for_each(rt2x00dev, queue) -		rt2x00pci_free_queue_dma(rt2x00dev, queue); +		rt2x00mmio_free_queue_dma(rt2x00dev, queue);  	return status;  } -EXPORT_SYMBOL_GPL(rt2x00pci_initialize); +EXPORT_SYMBOL_GPL(rt2x00mmio_initialize); -void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) +void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev)  {  	struct data_queue *queue; @@ -203,9 +203,9 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev)  	 * Free DMA  	 */  	queue_for_each(rt2x00dev, queue) -		rt2x00pci_free_queue_dma(rt2x00dev, queue); +		rt2x00mmio_free_queue_dma(rt2x00dev, queue);  } -EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize); +EXPORT_SYMBOL_GPL(rt2x00mmio_uninitialize);  /*   * rt2x00mmio module information. diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.h b/drivers/net/wireless/rt2x00/rt2x00mmio.h index 4ecaf60175b..cda3dbcf7ea 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mmio.h +++ b/drivers/net/wireless/rt2x00/rt2x00mmio.h @@ -31,37 +31,37 @@  /*   * Register access.   */ -static inline void rt2x00pci_register_read(struct rt2x00_dev *rt2x00dev, -					   const unsigned int offset, -					   u32 *value) +static inline void rt2x00mmio_register_read(struct rt2x00_dev *rt2x00dev, +					    const unsigned int offset, +					    u32 *value)  {  	*value = readl(rt2x00dev->csr.base + offset);  } -static inline void rt2x00pci_register_multiread(struct rt2x00_dev *rt2x00dev, -						const unsigned int offset, -						void *value, const u32 length) +static inline void rt2x00mmio_register_multiread(struct rt2x00_dev *rt2x00dev, +						 const unsigned int offset, +						 void *value, const u32 length)  {  	memcpy_fromio(value, rt2x00dev->csr.base + offset, length);  } -static inline void rt2x00pci_register_write(struct rt2x00_dev *rt2x00dev, -					    const unsigned int offset, -					    u32 value) +static inline void rt2x00mmio_register_write(struct rt2x00_dev *rt2x00dev, +					     const unsigned int offset, +					     u32 value)  {  	writel(value, rt2x00dev->csr.base + offset);  } -static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev, -						 const unsigned int offset, -						 const void *value, -						 const u32 length) +static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev *rt2x00dev, +						  const unsigned int offset, +						  const void *value, +						  const u32 length)  {  	__iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2);  }  /** - * rt2x00pci_regbusy_read - Read from register with busy check + * rt2x00mmio_regbusy_read - Read from register with busy check   * @rt2x00dev: Device pointer, see &struct rt2x00_dev.   * @offset: Register offset   * @field: Field to check if register is busy @@ -73,47 +73,47 @@ static inline void rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev,   * is not read after a certain timeout, this function will return   * FALSE.   */ -int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, -			   const unsigned int offset, -			   const struct rt2x00_field32 field, -			   u32 *reg); +int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev, +			    const unsigned int offset, +			    const struct rt2x00_field32 field, +			    u32 *reg);  /** - * struct queue_entry_priv_pci: Per entry PCI specific information + * struct queue_entry_priv_mmio: Per entry PCI specific information   *   * @desc: Pointer to device descriptor   * @desc_dma: DMA pointer to &desc.   * @data: Pointer to device's entry memory.   * @data_dma: DMA pointer to &data.   */ -struct queue_entry_priv_pci { +struct queue_entry_priv_mmio {  	__le32 *desc;  	dma_addr_t desc_dma;  };  /** - * rt2x00pci_rxdone - Handle RX done events + * rt2x00mmio_rxdone - Handle RX done events   * @rt2x00dev: Device pointer, see &struct rt2x00_dev.   *   * Returns true if there are still rx frames pending and false if all   * pending rx frames were processed.   */ -bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); +bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev);  /** - * rt2x00pci_flush_queue - Flush data queue + * rt2x00mmio_flush_queue - Flush data queue   * @queue: Data queue to stop   * @drop: True to drop all pending frames.   *   * This will wait for a maximum of 100ms, waiting for the queues   * to become empty.   */ -void rt2x00pci_flush_queue(struct data_queue *queue, bool drop); +void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop);  /*   * Device initialization handlers.   */ -int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev); -void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev); +int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev); +void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev);  #endif /* RT2X00MMIO_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index e87865e3311..dc49e525ae5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c @@ -68,7 +68,7 @@ static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev)  	return 0;  exit: -	ERROR_PROBE("Failed to allocate registers.\n"); +	rt2x00_probe_err("Failed to allocate registers\n");  	rt2x00pci_free_reg(rt2x00dev); @@ -84,30 +84,30 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)  	retval = pci_enable_device(pci_dev);  	if (retval) { -		ERROR_PROBE("Enable device failed.\n"); +		rt2x00_probe_err("Enable device failed\n");  		return retval;  	}  	retval = pci_request_regions(pci_dev, pci_name(pci_dev));  	if (retval) { -		ERROR_PROBE("PCI request regions failed.\n"); +		rt2x00_probe_err("PCI request regions failed\n");  		goto exit_disable_device;  	}  	pci_set_master(pci_dev);  	if (pci_set_mwi(pci_dev)) -		ERROR_PROBE("MWI not available.\n"); +		rt2x00_probe_err("MWI not available\n");  	if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32))) { -		ERROR_PROBE("PCI DMA not supported.\n"); +		rt2x00_probe_err("PCI DMA not supported\n");  		retval = -EIO;  		goto exit_release_regions;  	}  	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);  	if (!hw) { -		ERROR_PROBE("Failed to allocate hardware.\n"); +		rt2x00_probe_err("Failed to allocate hardware\n");  		retval = -ENOMEM;  		goto exit_release_regions;  	} @@ -207,7 +207,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)  	if (pci_set_power_state(pci_dev, PCI_D0) ||  	    pci_enable_device(pci_dev)) { -		ERROR(rt2x00dev, "Failed to resume device.\n"); +		rt2x00_err(rt2x00dev, "Failed to resume device\n");  		return -EIO;  	} diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 4d91795dc6a..2c12311467a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c @@ -35,7 +35,8 @@  struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp)  { -	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; +	struct data_queue *queue = entry->queue; +	struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;  	struct sk_buff *skb;  	struct skb_frame_desc *skbdesc;  	unsigned int frame_size; @@ -46,7 +47,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp)  	 * The frame size includes descriptor size, because the  	 * hardware directly receive the frame into the skbuffer.  	 */ -	frame_size = entry->queue->data_size + entry->queue->desc_size; +	frame_size = queue->data_size + queue->desc_size + queue->winfo_size;  	/*  	 * The payload should be aligned to a 4-byte boundary, @@ -531,10 +532,10 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry,  	 */  	if (unlikely(rt2x00dev->ops->lib->get_entry_state &&  		     rt2x00dev->ops->lib->get_entry_state(entry))) { -		ERROR(rt2x00dev, -		      "Corrupt queue %d, accessing entry which is not ours.\n" -		      "Please file bug report to %s.\n", -		      entry->queue->qid, DRV_PROJECT); +		rt2x00_err(rt2x00dev, +			   "Corrupt queue %d, accessing entry which is not ours\n" +			   "Please file bug report to %s\n", +			   entry->queue->qid, DRV_PROJECT);  		return -EINVAL;  	} @@ -698,8 +699,8 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,  	spin_lock(&queue->tx_lock);  	if (unlikely(rt2x00queue_full(queue))) { -		ERROR(queue->rt2x00dev, -		      "Dropping frame due to full tx queue %d.\n", queue->qid); +		rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", +			   queue->qid);  		ret = -ENOBUFS;  		goto out;  	} @@ -708,10 +709,10 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,  	if (unlikely(test_and_set_bit(ENTRY_OWNER_DEVICE_DATA,  				      &entry->flags))) { -		ERROR(queue->rt2x00dev, -		      "Arrived at non-free entry in the non-full queue %d.\n" -		      "Please file bug report to %s.\n", -		      queue->qid, DRV_PROJECT); +		rt2x00_err(queue->rt2x00dev, +			   "Arrived at non-free entry in the non-full queue %d\n" +			   "Please file bug report to %s\n", +			   queue->qid, DRV_PROJECT);  		ret = -EINVAL;  		goto out;  	} @@ -832,7 +833,9 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,  bool rt2x00queue_for_each_entry(struct data_queue *queue,  				enum queue_index start,  				enum queue_index end, -				bool (*fn)(struct queue_entry *entry)) +				void *data, +				bool (*fn)(struct queue_entry *entry, +					   void *data))  {  	unsigned long irqflags;  	unsigned int index_start; @@ -840,9 +843,9 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue,  	unsigned int i;  	if (unlikely(start >= Q_INDEX_MAX || end >= Q_INDEX_MAX)) { -		ERROR(queue->rt2x00dev, -		      "Entry requested from invalid index range (%d - %d)\n", -		      start, end); +		rt2x00_err(queue->rt2x00dev, +			   "Entry requested from invalid index range (%d - %d)\n", +			   start, end);  		return true;  	} @@ -863,17 +866,17 @@ bool rt2x00queue_for_each_entry(struct data_queue *queue,  	 */  	if (index_start < index_end) {  		for (i = index_start; i < index_end; i++) { -			if (fn(&queue->entries[i])) +			if (fn(&queue->entries[i], data))  				return true;  		}  	} else {  		for (i = index_start; i < queue->limit; i++) { -			if (fn(&queue->entries[i])) +			if (fn(&queue->entries[i], data))  				return true;  		}  		for (i = 0; i < index_end; i++) { -			if (fn(&queue->entries[i])) +			if (fn(&queue->entries[i], data))  				return true;  		}  	} @@ -889,8 +892,8 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,  	unsigned long irqflags;  	if (unlikely(index >= Q_INDEX_MAX)) { -		ERROR(queue->rt2x00dev, -		      "Entry requested from invalid index type (%d)\n", index); +		rt2x00_err(queue->rt2x00dev, "Entry requested from invalid index type (%d)\n", +			   index);  		return NULL;  	} @@ -910,8 +913,8 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)  	unsigned long irqflags;  	if (unlikely(index >= Q_INDEX_MAX)) { -		ERROR(queue->rt2x00dev, -		      "Index change on invalid index type (%d)\n", index); +		rt2x00_err(queue->rt2x00dev, +			   "Index change on invalid index type (%d)\n", index);  		return;  	} @@ -1071,7 +1074,8 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)  	 * The queue flush has failed...  	 */  	if (unlikely(!rt2x00queue_empty(queue))) -		WARNING(queue->rt2x00dev, "Queue %d failed to flush\n", queue->qid); +		rt2x00_warn(queue->rt2x00dev, "Queue %d failed to flush\n", +			    queue->qid);  	/*  	 * Restore the queue to the previous status @@ -1170,6 +1174,7 @@ static int rt2x00queue_alloc_entries(struct data_queue *queue,  	queue->threshold = DIV_ROUND_UP(qdesc->entry_num, 10);  	queue->data_size = qdesc->data_size;  	queue->desc_size = qdesc->desc_size; +	queue->winfo_size = qdesc->winfo_size;  	/*  	 * Allocate all queue entries. @@ -1260,7 +1265,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)  	return 0;  exit: -	ERROR(rt2x00dev, "Queue entries allocation failed.\n"); +	rt2x00_err(rt2x00dev, "Queue entries allocation failed\n");  	rt2x00queue_uninitialize(rt2x00dev); @@ -1312,7 +1317,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)  	queue = kcalloc(rt2x00dev->data_queues, sizeof(*queue), GFP_KERNEL);  	if (!queue) { -		ERROR(rt2x00dev, "Queue allocation failed.\n"); +		rt2x00_err(rt2x00dev, "Queue allocation failed\n");  		return -ENOMEM;  	} diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 9b8c10a86de..4a7b34e9261 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h @@ -359,6 +359,7 @@ enum queue_entry_flags {  	ENTRY_DATA_PENDING,  	ENTRY_DATA_IO_FAILED,  	ENTRY_DATA_STATUS_PENDING, +	ENTRY_DATA_STATUS_SET,  };  /** @@ -372,6 +373,7 @@ enum queue_entry_flags {   * @entry_idx: The entry index number.   * @priv_data: Private data belonging to this queue entry. The pointer   *	points to data specific to a particular driver and queue type. + * @status: Device specific status   */  struct queue_entry {  	unsigned long flags; @@ -383,6 +385,8 @@ struct queue_entry {  	unsigned int entry_idx; +	u32 status; +  	void *priv_data;  }; @@ -475,7 +479,8 @@ struct data_queue {  	unsigned short cw_max;  	unsigned short data_size; -	unsigned short desc_size; +	unsigned char  desc_size; +	unsigned char  winfo_size;  	unsigned short usb_endpoint;  	unsigned short usb_maxpacket; @@ -495,7 +500,8 @@ struct data_queue {  struct data_queue_desc {  	unsigned short entry_num;  	unsigned short data_size; -	unsigned short desc_size; +	unsigned char  desc_size; +	unsigned char  winfo_size;  	unsigned short priv_size;  }; @@ -584,6 +590,7 @@ struct data_queue_desc {   * @queue: Pointer to @data_queue   * @start: &enum queue_index Pointer to start index   * @end: &enum queue_index Pointer to end index + * @data: Data to pass to the callback function   * @fn: The function to call for each &struct queue_entry   *   * This will walk through all entries in the queue, in chronological @@ -596,7 +603,9 @@ struct data_queue_desc {  bool rt2x00queue_for_each_entry(struct data_queue *queue,  				enum queue_index start,  				enum queue_index end, -				bool (*fn)(struct queue_entry *entry)); +				void *data, +				bool (*fn)(struct queue_entry *entry, +					   void *data));  /**   * rt2x00queue_empty - Check if the queue is empty. diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.c b/drivers/net/wireless/rt2x00/rt2x00soc.c index 2aa5c38022f..9271a5fce0a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00soc.c +++ b/drivers/net/wireless/rt2x00/rt2x00soc.c @@ -68,7 +68,7 @@ static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)  	return 0;  exit: -	ERROR_PROBE("Failed to allocate registers.\n"); +	rt2x00_probe_err("Failed to allocate registers\n");  	rt2x00soc_free_reg(rt2x00dev);  	return -ENOMEM; @@ -82,7 +82,7 @@ int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)  	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);  	if (!hw) { -		ERROR_PROBE("Failed to allocate hardware.\n"); +		rt2x00_probe_err("Failed to allocate hardware\n");  		return -ENOMEM;  	} diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 40ea80725a9..88289873c0c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c @@ -70,9 +70,9 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,  		}  	} -	ERROR(rt2x00dev, -	      "Vendor Request 0x%02x failed for offset 0x%04x with error %d.\n", -	      request, offset, status); +	rt2x00_err(rt2x00dev, +		   "Vendor Request 0x%02x failed for offset 0x%04x with error %d\n", +		   request, offset, status);  	return status;  } @@ -91,7 +91,7 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,  	 * Check for Cache availability.  	 */  	if (unlikely(!rt2x00dev->csr.cache || buffer_length > CSR_CACHE_SIZE)) { -		ERROR(rt2x00dev, "CSR cache not available.\n"); +		rt2x00_err(rt2x00dev, "CSR cache not available\n");  		return -ENOMEM;  	} @@ -157,8 +157,8 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "Indirect register access failed: " -	      "offset=0x%.08x, value=0x%.08x\n", offset, *reg); +	rt2x00_err(rt2x00dev, "Indirect register access failed: offset=0x%.08x, value=0x%.08x\n", +		   offset, *reg);  	*reg = ~0;  	return 0; @@ -285,7 +285,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)  		queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);  } -static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry) +static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void *data)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;  	struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); @@ -307,7 +307,7 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry)  	status = skb_padto(entry->skb, length);  	if (unlikely(status)) {  		/* TODO: report something more appropriate than IO_FAILED. */ -		WARNING(rt2x00dev, "TX SKB padding error, out of memory\n"); +		rt2x00_warn(rt2x00dev, "TX SKB padding error, out of memory\n");  		set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);  		rt2x00lib_dmadone(entry); @@ -390,7 +390,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)  	queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work);  } -static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry) +static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void *data)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;  	struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); @@ -427,12 +427,18 @@ void rt2x00usb_kick_queue(struct data_queue *queue)  	case QID_AC_BE:  	case QID_AC_BK:  		if (!rt2x00queue_empty(queue)) -			rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, +			rt2x00queue_for_each_entry(queue, +						   Q_INDEX_DONE, +						   Q_INDEX, +						   NULL,  						   rt2x00usb_kick_tx_entry);  		break;  	case QID_RX:  		if (!rt2x00queue_full(queue)) -			rt2x00queue_for_each_entry(queue, Q_INDEX, Q_INDEX_DONE, +			rt2x00queue_for_each_entry(queue, +						   Q_INDEX, +						   Q_INDEX_DONE, +						   NULL,  						   rt2x00usb_kick_rx_entry);  		break;  	default: @@ -441,7 +447,7 @@ void rt2x00usb_kick_queue(struct data_queue *queue)  }  EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue); -static bool rt2x00usb_flush_entry(struct queue_entry *entry) +static bool rt2x00usb_flush_entry(struct queue_entry *entry, void *data)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;  	struct queue_entry_priv_usb *entry_priv = entry->priv_data; @@ -468,7 +474,7 @@ void rt2x00usb_flush_queue(struct data_queue *queue, bool drop)  	unsigned int i;  	if (drop) -		rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, +		rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, NULL,  					   rt2x00usb_flush_entry);  	/* @@ -514,8 +520,8 @@ EXPORT_SYMBOL_GPL(rt2x00usb_flush_queue);  static void rt2x00usb_watchdog_tx_dma(struct data_queue *queue)  { -	WARNING(queue->rt2x00dev, "TX queue %d DMA timed out," -		" invoke forced forced reset\n", queue->qid); +	rt2x00_warn(queue->rt2x00dev, "TX queue %d DMA timed out, invoke forced forced reset\n", +		    queue->qid);  	rt2x00queue_flush_queue(queue, true);  } @@ -559,7 +565,7 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)  	entry->flags = 0;  	if (entry->queue->qid == QID_RX) -		rt2x00usb_kick_rx_entry(entry); +		rt2x00usb_kick_rx_entry(entry, NULL);  }  EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); @@ -616,7 +622,7 @@ static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev)  	 * At least 1 endpoint for RX and 1 endpoint for TX must be available.  	 */  	if (!rt2x00dev->rx->usb_endpoint || !rt2x00dev->tx->usb_endpoint) { -		ERROR(rt2x00dev, "Bulk-in/Bulk-out endpoints not found\n"); +		rt2x00_err(rt2x00dev, "Bulk-in/Bulk-out endpoints not found\n");  		return -EPIPE;  	} @@ -769,7 +775,7 @@ static int rt2x00usb_alloc_reg(struct rt2x00_dev *rt2x00dev)  	return 0;  exit: -	ERROR_PROBE("Failed to allocate registers.\n"); +	rt2x00_probe_err("Failed to allocate registers\n");  	rt2x00usb_free_reg(rt2x00dev); @@ -789,7 +795,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,  	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);  	if (!hw) { -		ERROR_PROBE("Failed to allocate hardware.\n"); +		rt2x00_probe_err("Failed to allocate hardware\n");  		retval = -ENOMEM;  		goto exit_put_device;  	} diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 9e3c8ff53e3..0dc8180e251 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c @@ -58,12 +58,12 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");   * and we will print an error.   */  #define WAIT_FOR_BBP(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), PHY_CSR3, PHY_CSR3_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), PHY_CSR3, PHY_CSR3_BUSY, (__reg))  #define WAIT_FOR_RF(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), PHY_CSR4, PHY_CSR4_BUSY, (__reg)) +	rt2x00mmio_regbusy_read((__dev), PHY_CSR4, PHY_CSR4_BUSY, (__reg))  #define WAIT_FOR_MCU(__dev, __reg) \ -	rt2x00pci_regbusy_read((__dev), H2M_MAILBOX_CSR, \ -			       H2M_MAILBOX_CSR_OWNER, (__reg)) +	rt2x00mmio_regbusy_read((__dev), H2M_MAILBOX_CSR, \ +				H2M_MAILBOX_CSR_OWNER, (__reg))  static void rt61pci_bbp_write(struct rt2x00_dev *rt2x00dev,  			      const unsigned int word, const u8 value) @@ -83,7 +83,7 @@ static void rt61pci_bbp_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, PHY_CSR3_BUSY, 1);  		rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 0); -		rt2x00pci_register_write(rt2x00dev, PHY_CSR3, reg); +		rt2x00mmio_register_write(rt2x00dev, PHY_CSR3, reg);  	}  	mutex_unlock(&rt2x00dev->csr_mutex); @@ -110,7 +110,7 @@ static void rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, PHY_CSR3_BUSY, 1);  		rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 1); -		rt2x00pci_register_write(rt2x00dev, PHY_CSR3, reg); +		rt2x00mmio_register_write(rt2x00dev, PHY_CSR3, reg);  		WAIT_FOR_BBP(rt2x00dev, ®);  	} @@ -138,7 +138,7 @@ static void rt61pci_rf_write(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0);  		rt2x00_set_field32(®, PHY_CSR4_BUSY, 1); -		rt2x00pci_register_write(rt2x00dev, PHY_CSR4, reg); +		rt2x00mmio_register_write(rt2x00dev, PHY_CSR4, reg);  		rt2x00_rf_write(rt2x00dev, word, value);  	} @@ -162,12 +162,12 @@ static void rt61pci_mcu_request(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, H2M_MAILBOX_CSR_CMD_TOKEN, token);  		rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG0, arg0);  		rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG1, arg1); -		rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, reg); -		rt2x00pci_register_read(rt2x00dev, HOST_CMD_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, HOST_CMD_CSR, ®);  		rt2x00_set_field32(®, HOST_CMD_CSR_HOST_COMMAND, command);  		rt2x00_set_field32(®, HOST_CMD_CSR_INTERRUPT_MCU, 1); -		rt2x00pci_register_write(rt2x00dev, HOST_CMD_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, HOST_CMD_CSR, reg);  	}  	mutex_unlock(&rt2x00dev->csr_mutex); @@ -179,7 +179,7 @@ static void rt61pci_eepromregister_read(struct eeprom_93cx6 *eeprom)  	struct rt2x00_dev *rt2x00dev = eeprom->data;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®);  	eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN);  	eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); @@ -201,15 +201,15 @@ static void rt61pci_eepromregister_write(struct eeprom_93cx6 *eeprom)  	rt2x00_set_field32(®, E2PROM_CSR_CHIP_SELECT,  			   !!eeprom->reg_chip_select); -	rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, E2PROM_CSR, reg);  }  #ifdef CONFIG_RT2X00_LIB_DEBUGFS  static const struct rt2x00debug rt61pci_rt2x00debug = {  	.owner	= THIS_MODULE,  	.csr	= { -		.read		= rt2x00pci_register_read, -		.write		= rt2x00pci_register_write, +		.read		= rt2x00mmio_register_read, +		.write		= rt2x00mmio_register_write,  		.flags		= RT2X00DEBUGFS_OFFSET,  		.word_base	= CSR_REG_BASE,  		.word_size	= sizeof(u32), @@ -243,7 +243,7 @@ static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®);  	return rt2x00_get_field32(reg, MAC_CSR13_VAL5);  } @@ -294,10 +294,10 @@ static int rt61pci_blink_set(struct led_classdev *led_cdev,  	    container_of(led_cdev, struct rt2x00_led, led_dev);  	u32 reg; -	rt2x00pci_register_read(led->rt2x00dev, MAC_CSR14, ®); +	rt2x00mmio_register_read(led->rt2x00dev, MAC_CSR14, ®);  	rt2x00_set_field32(®, MAC_CSR14_ON_PERIOD, *delay_on);  	rt2x00_set_field32(®, MAC_CSR14_OFF_PERIOD, *delay_off); -	rt2x00pci_register_write(led->rt2x00dev, MAC_CSR14, reg); +	rt2x00mmio_register_write(led->rt2x00dev, MAC_CSR14, reg);  	return 0;  } @@ -339,7 +339,7 @@ static int rt61pci_config_shared_key(struct rt2x00_dev *rt2x00dev,  		 */  		mask = (0xf << crypto->bssidx); -		rt2x00pci_register_read(rt2x00dev, SEC_CSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, SEC_CSR0, ®);  		reg &= mask;  		if (reg && reg == mask) @@ -358,8 +358,8 @@ static int rt61pci_config_shared_key(struct rt2x00_dev *rt2x00dev,  		       sizeof(key_entry.rx_mic));  		reg = SHARED_KEY_ENTRY(key->hw_key_idx); -		rt2x00pci_register_multiwrite(rt2x00dev, reg, -					      &key_entry, sizeof(key_entry)); +		rt2x00mmio_register_multiwrite(rt2x00dev, reg, +					       &key_entry, sizeof(key_entry));  		/*  		 * The cipher types are stored over 2 registers. @@ -372,16 +372,16 @@ static int rt61pci_config_shared_key(struct rt2x00_dev *rt2x00dev,  			field.bit_offset = (3 * key->hw_key_idx);  			field.bit_mask = 0x7 << field.bit_offset; -			rt2x00pci_register_read(rt2x00dev, SEC_CSR1, ®); +			rt2x00mmio_register_read(rt2x00dev, SEC_CSR1, ®);  			rt2x00_set_field32(®, field, crypto->cipher); -			rt2x00pci_register_write(rt2x00dev, SEC_CSR1, reg); +			rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, reg);  		} else {  			field.bit_offset = (3 * (key->hw_key_idx - 8));  			field.bit_mask = 0x7 << field.bit_offset; -			rt2x00pci_register_read(rt2x00dev, SEC_CSR5, ®); +			rt2x00mmio_register_read(rt2x00dev, SEC_CSR5, ®);  			rt2x00_set_field32(®, field, crypto->cipher); -			rt2x00pci_register_write(rt2x00dev, SEC_CSR5, reg); +			rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, reg);  		}  		/* @@ -404,12 +404,12 @@ static int rt61pci_config_shared_key(struct rt2x00_dev *rt2x00dev,  	 */  	mask = 1 << key->hw_key_idx; -	rt2x00pci_register_read(rt2x00dev, SEC_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, SEC_CSR0, ®);  	if (crypto->cmd == SET_KEY)  		reg |= mask;  	else if (crypto->cmd == DISABLE_KEY)  		reg &= ~mask; -	rt2x00pci_register_write(rt2x00dev, SEC_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, reg);  	return 0;  } @@ -433,10 +433,10 @@ static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev,  		 * When both registers are full, we drop the key.  		 * Otherwise, we use the first invalid entry.  		 */ -		rt2x00pci_register_read(rt2x00dev, SEC_CSR2, ®); +		rt2x00mmio_register_read(rt2x00dev, SEC_CSR2, ®);  		if (reg && reg == ~0) {  			key->hw_key_idx = 32; -			rt2x00pci_register_read(rt2x00dev, SEC_CSR3, ®); +			rt2x00mmio_register_read(rt2x00dev, SEC_CSR3, ®);  			if (reg && reg == ~0)  				return -ENOSPC;  		} @@ -458,21 +458,21 @@ static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev,  		addr_entry.cipher = crypto->cipher;  		reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx); -		rt2x00pci_register_multiwrite(rt2x00dev, reg, -					      &key_entry, sizeof(key_entry)); +		rt2x00mmio_register_multiwrite(rt2x00dev, reg, +					       &key_entry, sizeof(key_entry));  		reg = PAIRWISE_TA_ENTRY(key->hw_key_idx); -		rt2x00pci_register_multiwrite(rt2x00dev, reg, -					      &addr_entry, sizeof(addr_entry)); +		rt2x00mmio_register_multiwrite(rt2x00dev, reg, +					       &addr_entry, sizeof(addr_entry));  		/*  		 * Enable pairwise lookup table for given BSS idx.  		 * Without this, received frames will not be decrypted  		 * by the hardware.  		 */ -		rt2x00pci_register_read(rt2x00dev, SEC_CSR4, ®); +		rt2x00mmio_register_read(rt2x00dev, SEC_CSR4, ®);  		reg |= (1 << crypto->bssidx); -		rt2x00pci_register_write(rt2x00dev, SEC_CSR4, reg); +		rt2x00mmio_register_write(rt2x00dev, SEC_CSR4, reg);  		/*  		 * The driver does not support the IV/EIV generation @@ -495,21 +495,21 @@ static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev,  	if (key->hw_key_idx < 32) {  		mask = 1 << key->hw_key_idx; -		rt2x00pci_register_read(rt2x00dev, SEC_CSR2, ®); +		rt2x00mmio_register_read(rt2x00dev, SEC_CSR2, ®);  		if (crypto->cmd == SET_KEY)  			reg |= mask;  		else if (crypto->cmd == DISABLE_KEY)  			reg &= ~mask; -		rt2x00pci_register_write(rt2x00dev, SEC_CSR2, reg); +		rt2x00mmio_register_write(rt2x00dev, SEC_CSR2, reg);  	} else {  		mask = 1 << (key->hw_key_idx - 32); -		rt2x00pci_register_read(rt2x00dev, SEC_CSR3, ®); +		rt2x00mmio_register_read(rt2x00dev, SEC_CSR3, ®);  		if (crypto->cmd == SET_KEY)  			reg |= mask;  		else if (crypto->cmd == DISABLE_KEY)  			reg &= ~mask; -		rt2x00pci_register_write(rt2x00dev, SEC_CSR3, reg); +		rt2x00mmio_register_write(rt2x00dev, SEC_CSR3, reg);  	}  	return 0; @@ -526,7 +526,7 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,  	 * and broadcast frames will always be accepted since  	 * there is no filter for it at this time.  	 */ -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®);  	rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC,  			   !(filter_flags & FIF_FCSFAIL));  	rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL, @@ -544,7 +544,7 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,  	rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0);  	rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS,  			   !(filter_flags & FIF_CONTROL)); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg);  }  static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev, @@ -558,9 +558,9 @@ static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,  		/*  		 * Enable synchronisation.  		 */ -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  		rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, conf->sync); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  	}  	if (flags & CONFIG_UPDATE_MAC) { @@ -568,8 +568,8 @@ static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);  		conf->mac[1] = cpu_to_le32(reg); -		rt2x00pci_register_multiwrite(rt2x00dev, MAC_CSR2, -					      conf->mac, sizeof(conf->mac)); +		rt2x00mmio_register_multiwrite(rt2x00dev, MAC_CSR2, +					       conf->mac, sizeof(conf->mac));  	}  	if (flags & CONFIG_UPDATE_BSSID) { @@ -577,8 +577,9 @@ static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,  		rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3);  		conf->bssid[1] = cpu_to_le32(reg); -		rt2x00pci_register_multiwrite(rt2x00dev, MAC_CSR4, -					      conf->bssid, sizeof(conf->bssid)); +		rt2x00mmio_register_multiwrite(rt2x00dev, MAC_CSR4, +					       conf->bssid, +					       sizeof(conf->bssid));  	}  } @@ -588,40 +589,40 @@ static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®);  	rt2x00_set_field32(®, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32);  	rt2x00_set_field32(®, TXRX_CSR0_TSF_OFFSET, IEEE80211_HEADER); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg);  	if (changed & BSS_CHANGED_ERP_PREAMBLE) { -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR4, ®);  		rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_ENABLE, 1);  		rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE,  				   !!erp->short_preamble); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR4, reg);  	}  	if (changed & BSS_CHANGED_BASIC_RATES) -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR5, -					 erp->basic_rates); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR5, +					  erp->basic_rates);  	if (changed & BSS_CHANGED_BEACON_INT) { -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  		rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL,  				   erp->beacon_int * 16); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  	}  	if (changed & BSS_CHANGED_ERP_SLOT) { -		rt2x00pci_register_read(rt2x00dev, MAC_CSR9, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR9, ®);  		rt2x00_set_field32(®, MAC_CSR9_SLOT_TIME, erp->slot_time); -		rt2x00pci_register_write(rt2x00dev, MAC_CSR9, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR9, reg); -		rt2x00pci_register_read(rt2x00dev, MAC_CSR8, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR8, ®);  		rt2x00_set_field32(®, MAC_CSR8_SIFS, erp->sifs);  		rt2x00_set_field32(®, MAC_CSR8_SIFS_AFTER_RX_OFDM, 3);  		rt2x00_set_field32(®, MAC_CSR8_EIFS, erp->eifs); -		rt2x00pci_register_write(rt2x00dev, MAC_CSR8, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR8, reg);  	}  } @@ -714,7 +715,7 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®);  	rt2x00_set_field32(®, MAC_CSR13_DIR4, 0);  	rt2x00_set_field32(®, MAC_CSR13_VAL4, p1); @@ -722,7 +723,7 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev,  	rt2x00_set_field32(®, MAC_CSR13_DIR3, 0);  	rt2x00_set_field32(®, MAC_CSR13_VAL3, !p2); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR13, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, reg);  }  static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, @@ -821,14 +822,14 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,  	for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)  		rt61pci_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); -	rt2x00pci_register_read(rt2x00dev, PHY_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, PHY_CSR0, ®);  	rt2x00_set_field32(®, PHY_CSR0_PA_PE_BG,  			   rt2x00dev->curr_band == IEEE80211_BAND_2GHZ);  	rt2x00_set_field32(®, PHY_CSR0_PA_PE_A,  			   rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); -	rt2x00pci_register_write(rt2x00dev, PHY_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, PHY_CSR0, reg);  	if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325))  		rt61pci_config_antenna_5x(rt2x00dev, ant); @@ -848,7 +849,7 @@ static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev,  	u16 eeprom;  	short lna_gain = 0; -	if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { +	if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {  		if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))  			lna_gain += 14; @@ -928,7 +929,7 @@ static void rt61pci_config_retry_limit(struct rt2x00_dev *rt2x00dev,  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR4, ®);  	rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_DOWN, 1);  	rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_STEP, 0);  	rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_FALLBACK_CCK, 0); @@ -936,7 +937,7 @@ static void rt61pci_config_retry_limit(struct rt2x00_dev *rt2x00dev,  			   libconf->conf->long_frame_max_tx_count);  	rt2x00_set_field32(®, TXRX_CSR4_SHORT_RETRY_LIMIT,  			   libconf->conf->short_frame_max_tx_count); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR4, reg);  }  static void rt61pci_config_ps(struct rt2x00_dev *rt2x00dev, @@ -948,7 +949,7 @@ static void rt61pci_config_ps(struct rt2x00_dev *rt2x00dev,  	u32 reg;  	if (state == STATE_SLEEP) { -		rt2x00pci_register_read(rt2x00dev, MAC_CSR11, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR11, ®);  		rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN,  				   rt2x00dev->beacon_int - 10);  		rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, @@ -957,27 +958,29 @@ static void rt61pci_config_ps(struct rt2x00_dev *rt2x00dev,  		/* We must first disable autowake before it can be enabled */  		rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0); -		rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg);  		rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 1); -		rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg); -		rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000005); -		rt2x00pci_register_write(rt2x00dev, IO_CNTL_CSR, 0x0000001c); -		rt2x00pci_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000060); +		rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, +					  0x00000005); +		rt2x00mmio_register_write(rt2x00dev, IO_CNTL_CSR, 0x0000001c); +		rt2x00mmio_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000060);  		rt61pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);  	} else { -		rt2x00pci_register_read(rt2x00dev, MAC_CSR11, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR11, ®);  		rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN, 0);  		rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, 0);  		rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0);  		rt2x00_set_field32(®, MAC_CSR11_WAKEUP_LATENCY, 0); -		rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg); -		rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007); -		rt2x00pci_register_write(rt2x00dev, IO_CNTL_CSR, 0x00000018); -		rt2x00pci_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000020); +		rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, +					  0x00000007); +		rt2x00mmio_register_write(rt2x00dev, IO_CNTL_CSR, 0x00000018); +		rt2x00mmio_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000020);  		rt61pci_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);  	} @@ -1013,13 +1016,13 @@ static void rt61pci_link_stats(struct rt2x00_dev *rt2x00dev,  	/*  	 * Update FCS error count from register.  	 */ -	rt2x00pci_register_read(rt2x00dev, STA_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, STA_CSR0, ®);  	qual->rx_failed = rt2x00_get_field32(reg, STA_CSR0_FCS_ERROR);  	/*  	 * Update False CCA count from register.  	 */ -	rt2x00pci_register_read(rt2x00dev, STA_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, STA_CSR1, ®);  	qual->false_cca = rt2x00_get_field32(reg, STA_CSR1_FALSE_CCA_ERROR);  } @@ -1138,16 +1141,16 @@ static void rt61pci_start_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®);  		rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  		rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1);  		rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1);  		rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  		break;  	default:  		break; @@ -1161,24 +1164,24 @@ static void rt61pci_kick_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_AC_VO: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_VI: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_BE: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_BK: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	default:  		break; @@ -1192,36 +1195,36 @@ static void rt61pci_stop_queue(struct data_queue *queue)  	switch (queue->qid) {  	case QID_AC_VO: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_VI: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_BE: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_AC_BK: -		rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®);  		rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, 1); -		rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); +		rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg);  		break;  	case QID_RX: -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®);  		rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 1); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg);  		break;  	case QID_BEACON: -		rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +		rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  		rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0);  		rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0);  		rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  		/*  		 * Wait for possibly running tbtt tasklets. @@ -1299,14 +1302,14 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,  	 * Wait for stable hardware.  	 */  	for (i = 0; i < 100; i++) { -		rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR0, ®);  		if (reg)  			break;  		msleep(1);  	}  	if (!reg) { -		ERROR(rt2x00dev, "Unstable hardware.\n"); +		rt2x00_err(rt2x00dev, "Unstable hardware\n");  		return -EBUSY;  	} @@ -1315,10 +1318,10 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,  	 */  	reg = 0;  	rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 1); -	rt2x00pci_register_write(rt2x00dev, MCU_CNTL_CSR, reg); -	rt2x00pci_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff); -	rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -	rt2x00pci_register_write(rt2x00dev, HOST_CMD_CSR, 0); +	rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff); +	rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); +	rt2x00mmio_register_write(rt2x00dev, HOST_CMD_CSR, 0);  	/*  	 * Write firmware to device. @@ -1326,26 +1329,26 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,  	reg = 0;  	rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 1);  	rt2x00_set_field32(®, MCU_CNTL_CSR_SELECT_BANK, 1); -	rt2x00pci_register_write(rt2x00dev, MCU_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); -	rt2x00pci_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, -				      data, len); +	rt2x00mmio_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, +				       data, len);  	rt2x00_set_field32(®, MCU_CNTL_CSR_SELECT_BANK, 0); -	rt2x00pci_register_write(rt2x00dev, MCU_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg);  	rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 0); -	rt2x00pci_register_write(rt2x00dev, MCU_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg);  	for (i = 0; i < 100; i++) { -		rt2x00pci_register_read(rt2x00dev, MCU_CNTL_CSR, ®); +		rt2x00mmio_register_read(rt2x00dev, MCU_CNTL_CSR, ®);  		if (rt2x00_get_field32(reg, MCU_CNTL_CSR_READY))  			break;  		msleep(1);  	}  	if (i == 100) { -		ERROR(rt2x00dev, "MCU Control register not ready.\n"); +		rt2x00_err(rt2x00dev, "MCU Control register not ready\n");  		return -EBUSY;  	} @@ -1360,16 +1363,16 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,  	reg = 0;  	rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 1);  	rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®);  	rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 0);  	rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 0); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®);  	rt2x00_set_field32(®, MAC_CSR1_HOST_READY, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg);  	return 0;  } @@ -1379,7 +1382,7 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,   */  static bool rt61pci_get_entry_state(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word;  	if (entry->queue->qid == QID_RX) { @@ -1396,7 +1399,7 @@ static bool rt61pci_get_entry_state(struct queue_entry *entry)  static void rt61pci_clear_entry(struct queue_entry *entry)  { -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);  	u32 word; @@ -1419,13 +1422,13 @@ static void rt61pci_clear_entry(struct queue_entry *entry)  static int rt61pci_init_queues(struct rt2x00_dev *rt2x00dev)  { -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	u32 reg;  	/*  	 * Initialize registers.  	 */ -	rt2x00pci_register_read(rt2x00dev, TX_RING_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, TX_RING_CSR0, ®);  	rt2x00_set_field32(®, TX_RING_CSR0_AC0_RING_SIZE,  			   rt2x00dev->tx[0].limit);  	rt2x00_set_field32(®, TX_RING_CSR0_AC1_RING_SIZE, @@ -1434,67 +1437,67 @@ static int rt61pci_init_queues(struct rt2x00_dev *rt2x00dev)  			   rt2x00dev->tx[2].limit);  	rt2x00_set_field32(®, TX_RING_CSR0_AC3_RING_SIZE,  			   rt2x00dev->tx[3].limit); -	rt2x00pci_register_write(rt2x00dev, TX_RING_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, TX_RING_CSR0, reg); -	rt2x00pci_register_read(rt2x00dev, TX_RING_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, TX_RING_CSR1, ®);  	rt2x00_set_field32(®, TX_RING_CSR1_TXD_SIZE,  			   rt2x00dev->tx[0].desc_size / 4); -	rt2x00pci_register_write(rt2x00dev, TX_RING_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, TX_RING_CSR1, reg);  	entry_priv = rt2x00dev->tx[0].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, AC0_BASE_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, AC0_BASE_CSR, ®);  	rt2x00_set_field32(®, AC0_BASE_CSR_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, AC0_BASE_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, AC0_BASE_CSR, reg);  	entry_priv = rt2x00dev->tx[1].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, AC1_BASE_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, AC1_BASE_CSR, ®);  	rt2x00_set_field32(®, AC1_BASE_CSR_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, AC1_BASE_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, AC1_BASE_CSR, reg);  	entry_priv = rt2x00dev->tx[2].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, AC2_BASE_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, AC2_BASE_CSR, ®);  	rt2x00_set_field32(®, AC2_BASE_CSR_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, AC2_BASE_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, AC2_BASE_CSR, reg);  	entry_priv = rt2x00dev->tx[3].entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, AC3_BASE_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, AC3_BASE_CSR, ®);  	rt2x00_set_field32(®, AC3_BASE_CSR_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, AC3_BASE_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, AC3_BASE_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, RX_RING_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RX_RING_CSR, ®);  	rt2x00_set_field32(®, RX_RING_CSR_RING_SIZE, rt2x00dev->rx->limit);  	rt2x00_set_field32(®, RX_RING_CSR_RXD_SIZE,  			   rt2x00dev->rx->desc_size / 4);  	rt2x00_set_field32(®, RX_RING_CSR_RXD_WRITEBACK_SIZE, 4); -	rt2x00pci_register_write(rt2x00dev, RX_RING_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RX_RING_CSR, reg);  	entry_priv = rt2x00dev->rx->entries[0].priv_data; -	rt2x00pci_register_read(rt2x00dev, RX_BASE_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RX_BASE_CSR, ®);  	rt2x00_set_field32(®, RX_BASE_CSR_RING_REGISTER,  			   entry_priv->desc_dma); -	rt2x00pci_register_write(rt2x00dev, RX_BASE_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RX_BASE_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, TX_DMA_DST_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, TX_DMA_DST_CSR, ®);  	rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC0, 2);  	rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC1, 2);  	rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC2, 2);  	rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC3, 2); -	rt2x00pci_register_write(rt2x00dev, TX_DMA_DST_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, TX_DMA_DST_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, LOAD_TX_RING_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, LOAD_TX_RING_CSR, ®);  	rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC0, 1);  	rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC1, 1);  	rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC2, 1);  	rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC3, 1); -	rt2x00pci_register_write(rt2x00dev, LOAD_TX_RING_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, LOAD_TX_RING_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, RX_CNTL_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RX_CNTL_CSR, ®);  	rt2x00_set_field32(®, RX_CNTL_CSR_LOAD_RXD, 1); -	rt2x00pci_register_write(rt2x00dev, RX_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RX_CNTL_CSR, reg);  	return 0;  } @@ -1503,13 +1506,13 @@ static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev)  {  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®);  	rt2x00_set_field32(®, TXRX_CSR0_AUTO_TX_SEQ, 1);  	rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0);  	rt2x00_set_field32(®, TXRX_CSR0_TX_WITHOUT_WAITING, 0); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR1, ®);  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0, 47); /* CCK Signal */  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID1, 30); /* Rssi */ @@ -1518,12 +1521,12 @@ static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID2_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3, 30); /* Rssi */  	rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR1, reg);  	/*  	 * CCK TXD BBP registers  	 */ -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR2, ®);  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0, 13);  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID1, 12); @@ -1532,76 +1535,76 @@ static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev)  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID2_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3, 10);  	rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR2, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR2, reg);  	/*  	 * OFDM TXD BBP registers  	 */ -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR3, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR3, ®);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0, 7);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1, 6);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1_VALID, 1);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2, 5);  	rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2_VALID, 1); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR3, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR3, reg); -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR7, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR7, ®);  	rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_6MBS, 59);  	rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_9MBS, 53);  	rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_12MBS, 49);  	rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_18MBS, 46); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR7, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR7, reg); -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR8, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR8, ®);  	rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_24MBS, 44);  	rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_36MBS, 42);  	rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_48MBS, 42);  	rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_54MBS, 42); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR8, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR8, reg); -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL, 0);  	rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0);  	rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 0);  	rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0);  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0);  	rt2x00_set_field32(®, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR6, 0x00000fff); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR6, 0x00000fff); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR9, ®);  	rt2x00_set_field32(®, MAC_CSR9_CW_SELECT, 0); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR9, reg); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR10, 0x0000071c); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR10, 0x0000071c);  	if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE))  		return -EBUSY; -	rt2x00pci_register_write(rt2x00dev, MAC_CSR13, 0x0000e000); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, 0x0000e000);  	/*  	 * Invalidate all Shared Keys (SEC_CSR0),  	 * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5)  	 */ -	rt2x00pci_register_write(rt2x00dev, SEC_CSR0, 0x00000000); -	rt2x00pci_register_write(rt2x00dev, SEC_CSR1, 0x00000000); -	rt2x00pci_register_write(rt2x00dev, SEC_CSR5, 0x00000000); +	rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, 0x00000000); +	rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, 0x00000000); +	rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, 0x00000000); -	rt2x00pci_register_write(rt2x00dev, PHY_CSR1, 0x000023b0); -	rt2x00pci_register_write(rt2x00dev, PHY_CSR5, 0x060a100c); -	rt2x00pci_register_write(rt2x00dev, PHY_CSR6, 0x00080606); -	rt2x00pci_register_write(rt2x00dev, PHY_CSR7, 0x00000a08); +	rt2x00mmio_register_write(rt2x00dev, PHY_CSR1, 0x000023b0); +	rt2x00mmio_register_write(rt2x00dev, PHY_CSR5, 0x060a100c); +	rt2x00mmio_register_write(rt2x00dev, PHY_CSR6, 0x00080606); +	rt2x00mmio_register_write(rt2x00dev, PHY_CSR7, 0x00000a08); -	rt2x00pci_register_write(rt2x00dev, PCI_CFG_CSR, 0x28ca4404); +	rt2x00mmio_register_write(rt2x00dev, PCI_CFG_CSR, 0x28ca4404); -	rt2x00pci_register_write(rt2x00dev, TEST_MODE_CSR, 0x00000200); +	rt2x00mmio_register_write(rt2x00dev, TEST_MODE_CSR, 0x00000200); -	rt2x00pci_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff); +	rt2x00mmio_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff);  	/*  	 * Clear all beacons @@ -1609,36 +1612,36 @@ static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev)  	 * the first byte since that byte contains the VALID and OWNER  	 * bits which (when set to 0) will invalidate the entire beacon.  	 */ -	rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE0, 0); -	rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE1, 0); -	rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE2, 0); -	rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE3, 0); +	rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE0, 0); +	rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE1, 0); +	rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE2, 0); +	rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE3, 0);  	/*  	 * We must clear the error counters.  	 * These registers are cleared on read,  	 * so we may pass a useless variable to store the value.  	 */ -	rt2x00pci_register_read(rt2x00dev, STA_CSR0, ®); -	rt2x00pci_register_read(rt2x00dev, STA_CSR1, ®); -	rt2x00pci_register_read(rt2x00dev, STA_CSR2, ®); +	rt2x00mmio_register_read(rt2x00dev, STA_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, STA_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, STA_CSR2, ®);  	/*  	 * Reset MAC and BBP registers.  	 */ -	rt2x00pci_register_read(rt2x00dev, MAC_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®);  	rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 1);  	rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®);  	rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 0);  	rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 0); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR1, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®);  	rt2x00_set_field32(®, MAC_CSR1_HOST_READY, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR1, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg);  	return 0;  } @@ -1655,7 +1658,7 @@ static int rt61pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } @@ -1722,11 +1725,11 @@ static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 * should clear the register to assure a clean state.  	 */  	if (state == STATE_RADIO_IRQ_ON) { -		rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -		rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); +		rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); +		rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); -		rt2x00pci_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®); -		rt2x00pci_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg); +		rt2x00mmio_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®); +		rt2x00mmio_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg);  	}  	/* @@ -1735,15 +1738,15 @@ static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); -	rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®);  	rt2x00_set_field32(®, INT_MASK_CSR_TXDONE, mask);  	rt2x00_set_field32(®, INT_MASK_CSR_RXDONE, mask);  	rt2x00_set_field32(®, INT_MASK_CSR_BEACON_DONE, mask);  	rt2x00_set_field32(®, INT_MASK_CSR_ENABLE_MITIGATION, mask);  	rt2x00_set_field32(®, INT_MASK_CSR_MITIGATION_PERIOD, 0xff); -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®);  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_0, mask);  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_1, mask);  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_2, mask); @@ -1753,7 +1756,7 @@ static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev,  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_6, mask);  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_7, mask);  	rt2x00_set_field32(®, MCU_INT_MASK_CSR_TWAKEUP, mask); -	rt2x00pci_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg);  	spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); @@ -1783,9 +1786,9 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)  	/*  	 * Enable RX.  	 */ -	rt2x00pci_register_read(rt2x00dev, RX_CNTL_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, RX_CNTL_CSR, ®);  	rt2x00_set_field32(®, RX_CNTL_CSR_ENABLE_RX_DMA, 1); -	rt2x00pci_register_write(rt2x00dev, RX_CNTL_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, RX_CNTL_CSR, reg);  	return 0;  } @@ -1795,7 +1798,7 @@ static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev)  	/*  	 * Disable power  	 */ -	rt2x00pci_register_write(rt2x00dev, MAC_CSR10, 0x00001818); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR10, 0x00001818);  }  static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) @@ -1806,10 +1809,10 @@ static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state)  	put_to_sleep = (state != STATE_AWAKE); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR12, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR12, ®);  	rt2x00_set_field32(®, MAC_CSR12_FORCE_WAKEUP, !put_to_sleep);  	rt2x00_set_field32(®, MAC_CSR12_PUT_TO_SLEEP, put_to_sleep); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR12, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR12, reg);  	/*  	 * Device is not guaranteed to be in the requested state yet. @@ -1817,11 +1820,11 @@ static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state)  	 * device has entered the correct state.  	 */  	for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -		rt2x00pci_register_read(rt2x00dev, MAC_CSR12, ®2); +		rt2x00mmio_register_read(rt2x00dev, MAC_CSR12, ®2);  		state = rt2x00_get_field32(reg2, MAC_CSR12_BBP_CURRENT_STATE);  		if (state == !put_to_sleep)  			return 0; -		rt2x00pci_register_write(rt2x00dev, MAC_CSR12, reg); +		rt2x00mmio_register_write(rt2x00dev, MAC_CSR12, reg);  		msleep(10);  	} @@ -1856,8 +1859,8 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -1869,7 +1872,7 @@ static void rt61pci_write_tx_desc(struct queue_entry *entry,  				  struct txentry_desc *txdesc)  {  	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	__le32 *txd = entry_priv->desc;  	u32 word; @@ -1967,7 +1970,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry,  				 struct txentry_desc *txdesc)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	unsigned int beacon_base;  	unsigned int padding_len;  	u32 orig_reg, reg; @@ -1976,10 +1979,10 @@ static void rt61pci_write_beacon(struct queue_entry *entry,  	 * Disable beaconing while we are reloading the beacon data,  	 * otherwise we might be sending out invalid data.  	 */ -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  	orig_reg = reg;  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  	/*  	 * Write the TX descriptor for the beacon. @@ -1996,19 +1999,19 @@ static void rt61pci_write_beacon(struct queue_entry *entry,  	 */  	padding_len = roundup(entry->skb->len, 4) - entry->skb->len;  	if (padding_len && skb_pad(entry->skb, padding_len)) { -		ERROR(rt2x00dev, "Failure padding beacon, aborting\n"); +		rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n");  		/* skb freed by skb_pad() on failure */  		entry->skb = NULL; -		rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, orig_reg); +		rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, orig_reg);  		return;  	}  	beacon_base = HW_BEACON_OFFSET(entry->entry_idx); -	rt2x00pci_register_multiwrite(rt2x00dev, beacon_base, -				      entry_priv->desc, TXINFO_SIZE); -	rt2x00pci_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, -				      entry->skb->data, -				      entry->skb->len + padding_len); +	rt2x00mmio_register_multiwrite(rt2x00dev, beacon_base, +				       entry_priv->desc, TXINFO_SIZE); +	rt2x00mmio_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, +				       entry->skb->data, +				       entry->skb->len + padding_len);  	/*  	 * Enable beaconing again. @@ -2016,10 +2019,10 @@ static void rt61pci_write_beacon(struct queue_entry *entry,  	 * For Wi-Fi faily generated beacons between participating  	 * stations. Set TBTT phase adaptive adjustment step to 8us.  	 */ -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR10, 0x00001008);  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  	/*  	 * Clean up beacon skb. @@ -2037,21 +2040,21 @@ static void rt61pci_clear_beacon(struct queue_entry *entry)  	 * Disable beaconing while we are reloading the beacon data,  	 * otherwise we might be sending out invalid data.  	 */ -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®);  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  	/*  	 * Clear beacon.  	 */ -	rt2x00pci_register_write(rt2x00dev, -				 HW_BEACON_OFFSET(entry->entry_idx), 0); +	rt2x00mmio_register_write(rt2x00dev, +				  HW_BEACON_OFFSET(entry->entry_idx), 0);  	/*  	 * Enable beaconing again.  	 */  	rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); -	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); +	rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);  }  /* @@ -2089,7 +2092,7 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,  				struct rxdone_entry_desc *rxdesc)  {  	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -	struct queue_entry_priv_pci *entry_priv = entry->priv_data; +	struct queue_entry_priv_mmio *entry_priv = entry->priv_data;  	u32 word0;  	u32 word1; @@ -2155,7 +2158,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)  	struct data_queue *queue;  	struct queue_entry *entry;  	struct queue_entry *entry_done; -	struct queue_entry_priv_pci *entry_priv; +	struct queue_entry_priv_mmio *entry_priv;  	struct txdone_entry_desc txdesc;  	u32 word;  	u32 reg; @@ -2173,7 +2176,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)  	 * tx ring size for now.  	 */  	for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) { -		rt2x00pci_register_read(rt2x00dev, STA_CSR4, ®); +		rt2x00mmio_register_read(rt2x00dev, STA_CSR4, ®);  		if (!rt2x00_get_field32(reg, STA_CSR4_VALID))  			break; @@ -2207,9 +2210,8 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)  			/* Catch up.  			 * Just report any entries we missed as failed.  			 */ -			WARNING(rt2x00dev, -				"TX status report missed for entry %d\n", -				entry_done->entry_idx); +			rt2x00_warn(rt2x00dev, "TX status report missed for entry %d\n", +				    entry_done->entry_idx);  			rt2x00lib_txdone_noinfo(entry_done, TXDONE_UNKNOWN);  			entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); @@ -2260,9 +2262,9 @@ static inline void rt61pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irq(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®);  	rt2x00_set_field32(®, irq_field, 0); -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg);  	spin_unlock_irq(&rt2x00dev->irqmask_lock);  } @@ -2278,9 +2280,9 @@ static void rt61pci_enable_mcu_interrupt(struct rt2x00_dev *rt2x00dev,  	 */  	spin_lock_irq(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®);  	rt2x00_set_field32(®, irq_field, 0); -	rt2x00pci_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg);  	spin_unlock_irq(&rt2x00dev->irqmask_lock);  } @@ -2304,7 +2306,7 @@ static void rt61pci_tbtt_tasklet(unsigned long data)  static void rt61pci_rxdone_tasklet(unsigned long data)  {  	struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -	if (rt2x00pci_rxdone(rt2x00dev)) +	if (rt2x00mmio_rxdone(rt2x00dev))  		tasklet_schedule(&rt2x00dev->rxdone_tasklet);  	else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))  		rt61pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_RXDONE); @@ -2314,8 +2316,8 @@ static void rt61pci_autowake_tasklet(unsigned long data)  {  	struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data;  	rt61pci_wakeup(rt2x00dev); -	rt2x00pci_register_write(rt2x00dev, -				 M2H_CMD_DONE_CSR, 0xffffffff); +	rt2x00mmio_register_write(rt2x00dev, +				  M2H_CMD_DONE_CSR, 0xffffffff);  	if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))  		rt61pci_enable_mcu_interrupt(rt2x00dev, MCU_INT_MASK_CSR_TWAKEUP);  } @@ -2330,11 +2332,11 @@ static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance)  	 * Get the interrupt sources & saved to local variable.  	 * Write register value back to clear pending interrupts.  	 */ -	rt2x00pci_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®_mcu); -	rt2x00pci_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg_mcu); +	rt2x00mmio_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®_mcu); +	rt2x00mmio_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg_mcu); -	rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -	rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); +	rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); +	rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg);  	if (!reg && !reg_mcu)  		return IRQ_NONE; @@ -2371,13 +2373,13 @@ static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance)  	 */  	spin_lock(&rt2x00dev->irqmask_lock); -	rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®);  	reg |= mask; -	rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®);  	reg |= mask_mcu; -	rt2x00pci_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg);  	spin_unlock(&rt2x00dev->irqmask_lock); @@ -2395,7 +2397,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	u8 *mac;  	s8 value; -	rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®);  	eeprom.data = rt2x00dev;  	eeprom.register_read = rt61pci_eepromregister_read; @@ -2416,7 +2418,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); @@ -2431,7 +2433,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0);  		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF5225);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); @@ -2444,7 +2446,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);  		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); -		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &word); @@ -2452,7 +2454,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_LED_LED_MODE,  				   LED_MODE_DEFAULT);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED, word); -		EEPROM(rt2x00dev, "Led: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Led: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); @@ -2460,7 +2462,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);  		rt2x00_set_field16(&word, EEPROM_FREQ_SEQ, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); -		EEPROM(rt2x00dev, "Freq: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &word); @@ -2468,7 +2470,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0);  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); -		EEPROM(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word);  	} else {  		value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_1);  		if (value < -10 || value > 10) @@ -2484,7 +2486,7 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0);  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); -		EEPROM(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word);  	} else {  		value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_1);  		if (value < -10 || value > 10) @@ -2513,7 +2515,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)  	 * Identify RF chipset.  	 */  	value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); -	rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR0, ®);  	rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET),  			value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); @@ -2521,7 +2523,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)  	    !rt2x00_rf(rt2x00dev, RF5325) &&  	    !rt2x00_rf(rt2x00dev, RF2527) &&  	    !rt2x00_rf(rt2x00dev, RF2529)) { -		ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n");  		return -ENODEV;  	} @@ -2838,7 +2840,7 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)  	/*  	 * Disable power saving.  	 */ -	rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007); +	rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007);  	/*  	 * Allocate eeprom data. @@ -2855,9 +2857,9 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)  	 * Enable rfkill polling by setting GPIO direction of the  	 * rfkill switch GPIO pin correctly.  	 */ -	rt2x00pci_register_read(rt2x00dev, MAC_CSR13, ®); +	rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®);  	rt2x00_set_field32(®, MAC_CSR13_DIR5, 1); -	rt2x00pci_register_write(rt2x00dev, MAC_CSR13, reg); +	rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, reg);  	/*  	 * Initialize hw specifications. @@ -2927,25 +2929,25 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw,  	field.bit_offset = (queue_idx & 1) * 16;  	field.bit_mask = 0xffff << field.bit_offset; -	rt2x00pci_register_read(rt2x00dev, offset, ®); +	rt2x00mmio_register_read(rt2x00dev, offset, ®);  	rt2x00_set_field32(®, field, queue->txop); -	rt2x00pci_register_write(rt2x00dev, offset, reg); +	rt2x00mmio_register_write(rt2x00dev, offset, reg);  	/* Update WMM registers */  	field.bit_offset = queue_idx * 4;  	field.bit_mask = 0xf << field.bit_offset; -	rt2x00pci_register_read(rt2x00dev, AIFSN_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, AIFSN_CSR, ®);  	rt2x00_set_field32(®, field, queue->aifs); -	rt2x00pci_register_write(rt2x00dev, AIFSN_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, AIFSN_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, CWMIN_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, CWMIN_CSR, ®);  	rt2x00_set_field32(®, field, queue->cw_min); -	rt2x00pci_register_write(rt2x00dev, CWMIN_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, CWMIN_CSR, reg); -	rt2x00pci_register_read(rt2x00dev, CWMAX_CSR, ®); +	rt2x00mmio_register_read(rt2x00dev, CWMAX_CSR, ®);  	rt2x00_set_field32(®, field, queue->cw_max); -	rt2x00pci_register_write(rt2x00dev, CWMAX_CSR, reg); +	rt2x00mmio_register_write(rt2x00dev, CWMAX_CSR, reg);  	return 0;  } @@ -2956,9 +2958,9 @@ static u64 rt61pci_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)  	u64 tsf;  	u32 reg; -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR13, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR13, ®);  	tsf = (u64) rt2x00_get_field32(reg, TXRX_CSR13_HIGH_TSFTIMER) << 32; -	rt2x00pci_register_read(rt2x00dev, TXRX_CSR12, ®); +	rt2x00mmio_register_read(rt2x00dev, TXRX_CSR12, ®);  	tsf |= rt2x00_get_field32(reg, TXRX_CSR12_LOW_TSFTIMER);  	return tsf; @@ -2997,8 +2999,8 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {  	.get_firmware_name	= rt61pci_get_firmware_name,  	.check_firmware		= rt61pci_check_firmware,  	.load_firmware		= rt61pci_load_firmware, -	.initialize		= rt2x00pci_initialize, -	.uninitialize		= rt2x00pci_uninitialize, +	.initialize		= rt2x00mmio_initialize, +	.uninitialize		= rt2x00mmio_uninitialize,  	.get_entry_state	= rt61pci_get_entry_state,  	.clear_entry		= rt61pci_clear_entry,  	.set_device_state	= rt61pci_set_device_state, @@ -3009,7 +3011,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {  	.start_queue		= rt61pci_start_queue,  	.kick_queue		= rt61pci_kick_queue,  	.stop_queue		= rt61pci_stop_queue, -	.flush_queue		= rt2x00pci_flush_queue, +	.flush_queue		= rt2x00mmio_flush_queue,  	.write_tx_desc		= rt61pci_write_tx_desc,  	.write_beacon		= rt61pci_write_beacon,  	.clear_beacon		= rt61pci_clear_beacon, @@ -3027,21 +3029,21 @@ static const struct data_queue_desc rt61pci_queue_rx = {  	.entry_num		= 32,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= RXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt61pci_queue_tx = {  	.entry_num		= 32,  	.data_size		= DATA_FRAME_SIZE,  	.desc_size		= TXD_DESC_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct data_queue_desc rt61pci_queue_bcn = {  	.entry_num		= 4,  	.data_size		= 0, /* No DMA required for beacons */  	.desc_size		= TXINFO_SIZE, -	.priv_size		= sizeof(struct queue_entry_priv_pci), +	.priv_size		= sizeof(struct queue_entry_priv_mmio),  };  static const struct rt2x00_ops rt61pci_ops = { diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 24eec66e9fd..377e09bb0b8 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -739,7 +739,7 @@ static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev,  	u16 eeprom;  	short lna_gain = 0; -	if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { +	if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {  		if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))  			lna_gain += 14; @@ -1122,7 +1122,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev,  	}  	if (!reg) { -		ERROR(rt2x00dev, "Unstable hardware.\n"); +		rt2x00_err(rt2x00dev, "Unstable hardware\n");  		return -EBUSY;  	} @@ -1139,7 +1139,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev,  					     0, USB_MODE_FIRMWARE,  					     REGISTER_TIMEOUT_FIRMWARE);  	if (status < 0) { -		ERROR(rt2x00dev, "Failed to write Firmware to device.\n"); +		rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n");  		return status;  	} @@ -1305,7 +1305,7 @@ static int rt73usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)  		udelay(REGISTER_BUSY_DELAY);  	} -	ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); +	rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n");  	return -EACCES;  } @@ -1443,8 +1443,8 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,  	}  	if (unlikely(retval)) -		ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -		      state, retval); +		rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", +			   state, retval);  	return retval;  } @@ -1567,7 +1567,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry,  	 */  	padding_len = roundup(entry->skb->len, 4) - entry->skb->len;  	if (padding_len && skb_pad(entry->skb, padding_len)) { -		ERROR(rt2x00dev, "Failure padding beacon, aborting\n"); +		rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n");  		/* skb freed by skb_pad() on failure */  		entry->skb = NULL;  		rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, orig_reg); @@ -1771,7 +1771,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);  	if (!is_valid_ether_addr(mac)) {  		eth_random_addr(mac); -		EEPROM(rt2x00dev, "MAC: %pM\n", mac); +		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); @@ -1786,14 +1786,14 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0);  		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF5226);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);  	if (word == 0xffff) {  		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); -		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &word); @@ -1809,7 +1809,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_LED_LED_MODE,  				   LED_MODE_DEFAULT);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED, word); -		EEPROM(rt2x00dev, "Led: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Led: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); @@ -1817,7 +1817,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);  		rt2x00_set_field16(&word, EEPROM_FREQ_SEQ, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); -		EEPROM(rt2x00dev, "Freq: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word);  	}  	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &word); @@ -1825,7 +1825,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0);  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); -		EEPROM(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word);  	} else {  		value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_1);  		if (value < -10 || value > 10) @@ -1841,7 +1841,7 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0);  		rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0);  		rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); -		EEPROM(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word); +		rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word);  	} else {  		value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_1);  		if (value < -10 || value > 10) @@ -1875,7 +1875,7 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)  			value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));  	if (!rt2x00_rt(rt2x00dev, RT2573) || (rt2x00_rev(rt2x00dev) == 0)) { -		ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RT chipset detected\n");  		return -ENODEV;  	} @@ -1883,7 +1883,7 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)  	    !rt2x00_rf(rt2x00dev, RF2528) &&  	    !rt2x00_rf(rt2x00dev, RF5225) &&  	    !rt2x00_rf(rt2x00dev, RF2527)) { -		ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); +		rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n");  		return -ENODEV;  	}  |