aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtl818x
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtl818x')
-rw-r--r--drivers/net/wireless/rtl818x/Makefile9
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/Makefile5
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c (renamed from drivers/net/wireless/rtl818x/rtl8180_dev.c)33
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/grf5101.c (renamed from drivers/net/wireless/rtl818x/rtl8180_grf5101.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/grf5101.h (renamed from drivers/net/wireless/rtl818x/rtl8180_grf5101.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/max2820.c (renamed from drivers/net/wireless/rtl818x/rtl8180_max2820.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/max2820.h (renamed from drivers/net/wireless/rtl818x/rtl8180_max2820.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/rtl8180.h (renamed from drivers/net/wireless/rtl818x/rtl8180.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/rtl8225.c (renamed from drivers/net/wireless/rtl818x/rtl8180_rtl8225.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/rtl8225.h (renamed from drivers/net/wireless/rtl818x/rtl8180_rtl8225.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/sa2400.c (renamed from drivers/net/wireless/rtl818x/rtl8180_sa2400.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/sa2400.h (renamed from drivers/net/wireless/rtl818x/rtl8180_sa2400.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/Makefile5
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c (renamed from drivers/net/wireless/rtl818x/rtl8187_dev.c)188
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/leds.c (renamed from drivers/net/wireless/rtl818x/rtl8187_leds.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/leds.h (renamed from drivers/net/wireless/rtl818x/rtl8187_leds.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rfkill.c (renamed from drivers/net/wireless/rtl818x/rtl8187_rfkill.c)2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rfkill.h (renamed from drivers/net/wireless/rtl818x/rtl8187_rfkill.h)0
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rtl8187.h (renamed from drivers/net/wireless/rtl818x/rtl8187.h)4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rtl8225.c (renamed from drivers/net/wireless/rtl818x/rtl8187_rtl8225.c)24
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rtl8225.h (renamed from drivers/net/wireless/rtl818x/rtl8187_rtl8225.h)0
21 files changed, 139 insertions, 141 deletions
diff --git a/drivers/net/wireless/rtl818x/Makefile b/drivers/net/wireless/rtl818x/Makefile
index 93cbfbedb46d..997569076923 100644
--- a/drivers/net/wireless/rtl818x/Makefile
+++ b/drivers/net/wireless/rtl818x/Makefile
@@ -1,7 +1,2 @@
1rtl8180-objs := rtl8180_dev.o rtl8180_rtl8225.o rtl8180_sa2400.o rtl8180_max2820.o rtl8180_grf5101.o 1obj-$(CONFIG_RTL8180) += rtl8180/
2rtl8187-objs := rtl8187_dev.o rtl8187_rtl8225.o rtl8187_leds.o rtl8187_rfkill.o 2obj-$(CONFIG_RTL8187) += rtl8187/
3
4obj-$(CONFIG_RTL8180) += rtl8180.o
5obj-$(CONFIG_RTL8187) += rtl8187.o
6
7
diff --git a/drivers/net/wireless/rtl818x/rtl8180/Makefile b/drivers/net/wireless/rtl818x/rtl8180/Makefile
new file mode 100644
index 000000000000..cb4fb8596f0b
--- /dev/null
+++ b/drivers/net/wireless/rtl818x/rtl8180/Makefile
@@ -0,0 +1,5 @@
1rtl8180-objs := dev.o rtl8225.o sa2400.o max2820.o grf5101.o
2
3obj-$(CONFIG_RTL8180) += rtl8180.o
4
5ccflags-y += -Idrivers/net/wireless/rtl818x
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 30107ce78dfb..80db5cabc9b9 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -24,10 +24,10 @@
24#include <net/mac80211.h> 24#include <net/mac80211.h>
25 25
26#include "rtl8180.h" 26#include "rtl8180.h"
27#include "rtl8180_rtl8225.h" 27#include "rtl8225.h"
28#include "rtl8180_sa2400.h" 28#include "sa2400.h"
29#include "rtl8180_max2820.h" 29#include "max2820.h"
30#include "rtl8180_grf5101.h" 30#include "grf5101.h"
31 31
32MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); 32MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
33MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); 33MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
@@ -146,7 +146,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
146 rx_status.freq = dev->conf.channel->center_freq; 146 rx_status.freq = dev->conf.channel->center_freq;
147 rx_status.band = dev->conf.channel->band; 147 rx_status.band = dev->conf.channel->band;
148 rx_status.mactime = le64_to_cpu(entry->tsft); 148 rx_status.mactime = le64_to_cpu(entry->tsft);
149 rx_status.flag |= RX_FLAG_TSFT; 149 rx_status.flag |= RX_FLAG_MACTIME_MPDU;
150 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 150 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
151 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; 151 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
152 152
@@ -240,7 +240,7 @@ static irqreturn_t rtl8180_interrupt(int irq, void *dev_id)
240 return IRQ_HANDLED; 240 return IRQ_HANDLED;
241} 241}
242 242
243static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 243static void rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
244{ 244{
245 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 245 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
246 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 246 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -321,8 +321,6 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
321 spin_unlock_irqrestore(&priv->lock, flags); 321 spin_unlock_irqrestore(&priv->lock, flags);
322 322
323 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); 323 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));
324
325 return 0;
326} 324}
327 325
328void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam) 326void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam)
@@ -687,7 +685,6 @@ static void rtl8180_beacon_work(struct work_struct *work)
687 struct ieee80211_hw *dev = vif_priv->dev; 685 struct ieee80211_hw *dev = vif_priv->dev;
688 struct ieee80211_mgmt *mgmt; 686 struct ieee80211_mgmt *mgmt;
689 struct sk_buff *skb; 687 struct sk_buff *skb;
690 int err = 0;
691 688
692 /* don't overflow the tx ring */ 689 /* don't overflow the tx ring */
693 if (ieee80211_queue_stopped(dev, 0)) 690 if (ieee80211_queue_stopped(dev, 0))
@@ -708,8 +705,7 @@ static void rtl8180_beacon_work(struct work_struct *work)
708 /* TODO: use actual beacon queue */ 705 /* TODO: use actual beacon queue */
709 skb_set_queue_mapping(skb, 0); 706 skb_set_queue_mapping(skb, 0);
710 707
711 err = rtl8180_tx(dev, skb); 708 rtl8180_tx(dev, skb);
712 WARN_ON(err);
713 709
714resched: 710resched:
715 /* 711 /*
@@ -783,6 +779,7 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
783 struct rtl8180_priv *priv = dev->priv; 779 struct rtl8180_priv *priv = dev->priv;
784 struct rtl8180_vif *vif_priv; 780 struct rtl8180_vif *vif_priv;
785 int i; 781 int i;
782 u8 reg;
786 783
787 vif_priv = (struct rtl8180_vif *)&vif->drv_priv; 784 vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
788 785
@@ -791,12 +788,14 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
791 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 788 rtl818x_iowrite8(priv, &priv->map->BSSID[i],
792 info->bssid[i]); 789 info->bssid[i]);
793 790
794 if (is_valid_ether_addr(info->bssid)) 791 if (is_valid_ether_addr(info->bssid)) {
795 rtl818x_iowrite8(priv, &priv->map->MSR, 792 if (vif->type == NL80211_IFTYPE_ADHOC)
796 RTL818X_MSR_INFRA); 793 reg = RTL818X_MSR_ADHOC;
797 else 794 else
798 rtl818x_iowrite8(priv, &priv->map->MSR, 795 reg = RTL818X_MSR_INFRA;
799 RTL818X_MSR_NO_LINK); 796 } else
797 reg = RTL818X_MSR_NO_LINK;
798 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
800 } 799 }
801 800
802 if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) 801 if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp)
diff --git a/drivers/net/wireless/rtl818x/rtl8180_grf5101.c b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
index 5cab9dfa8c07..5ee7589dd546 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_grf5101.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
@@ -25,7 +25,7 @@
25#include <net/mac80211.h> 25#include <net/mac80211.h>
26 26
27#include "rtl8180.h" 27#include "rtl8180.h"
28#include "rtl8180_grf5101.h" 28#include "grf5101.h"
29 29
30static const int grf5101_encode[] = { 30static const int grf5101_encode[] = {
31 0x0, 0x8, 0x4, 0xC, 31 0x0, 0x8, 0x4, 0xC,
diff --git a/drivers/net/wireless/rtl818x/rtl8180_grf5101.h b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h
index 76647111bcff..76647111bcff 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_grf5101.h
+++ b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h
diff --git a/drivers/net/wireless/rtl818x/rtl8180_max2820.c b/drivers/net/wireless/rtl818x/rtl8180/max2820.c
index 16c4655181c0..667b3363d437 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_max2820.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/max2820.c
@@ -24,7 +24,7 @@
24#include <net/mac80211.h> 24#include <net/mac80211.h>
25 25
26#include "rtl8180.h" 26#include "rtl8180.h"
27#include "rtl8180_max2820.h" 27#include "max2820.h"
28 28
29static const u32 max2820_chan[] = { 29static const u32 max2820_chan[] = {
30 12, /* CH 1 */ 30 12, /* CH 1 */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_max2820.h b/drivers/net/wireless/rtl818x/rtl8180/max2820.h
index 61cf6d1e7d57..61cf6d1e7d57 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_max2820.h
+++ b/drivers/net/wireless/rtl818x/rtl8180/max2820.h
diff --git a/drivers/net/wireless/rtl818x/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h
index 30523314da43..30523314da43 100644
--- a/drivers/net/wireless/rtl818x/rtl8180.h
+++ b/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h
diff --git a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
index 69e4d4745dae..7c4574ba9d75 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
@@ -21,7 +21,7 @@
21#include <net/mac80211.h> 21#include <net/mac80211.h>
22 22
23#include "rtl8180.h" 23#include "rtl8180.h"
24#include "rtl8180_rtl8225.h" 24#include "rtl8225.h"
25 25
26static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data) 26static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
27{ 27{
diff --git a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h
index 310013a2d726..310013a2d726 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.h
+++ b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h
diff --git a/drivers/net/wireless/rtl818x/rtl8180_sa2400.c b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
index d064fcc5ec08..44771a6286af 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_sa2400.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
@@ -25,7 +25,7 @@
25#include <net/mac80211.h> 25#include <net/mac80211.h>
26 26
27#include "rtl8180.h" 27#include "rtl8180.h"
28#include "rtl8180_sa2400.h" 28#include "sa2400.h"
29 29
30static const u32 sa2400_chan[] = { 30static const u32 sa2400_chan[] = {
31 0x00096c, /* ch1 */ 31 0x00096c, /* ch1 */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_sa2400.h b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h
index a4aaa0d413f1..a4aaa0d413f1 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_sa2400.h
+++ b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h
diff --git a/drivers/net/wireless/rtl818x/rtl8187/Makefile b/drivers/net/wireless/rtl818x/rtl8187/Makefile
new file mode 100644
index 000000000000..7b6299268ecf
--- /dev/null
+++ b/drivers/net/wireless/rtl818x/rtl8187/Makefile
@@ -0,0 +1,5 @@
1rtl8187-objs := dev.o rtl8225.o leds.o rfkill.o
2
3obj-$(CONFIG_RTL8187) += rtl8187.o
4
5ccflags-y += -Idrivers/net/wireless/rtl818x
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 98e0351c1dd6..1e0be14d10d4 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -29,11 +29,11 @@
29#include <net/mac80211.h> 29#include <net/mac80211.h>
30 30
31#include "rtl8187.h" 31#include "rtl8187.h"
32#include "rtl8187_rtl8225.h" 32#include "rtl8225.h"
33#ifdef CONFIG_RTL8187_LEDS 33#ifdef CONFIG_RTL8187_LEDS
34#include "rtl8187_leds.h" 34#include "leds.h"
35#endif 35#endif
36#include "rtl8187_rfkill.h" 36#include "rfkill.h"
37 37
38MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); 38MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
39MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); 39MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
@@ -227,7 +227,7 @@ static void rtl8187_tx_cb(struct urb *urb)
227 } 227 }
228} 228}
229 229
230static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 230static void rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
231{ 231{
232 struct rtl8187_priv *priv = dev->priv; 232 struct rtl8187_priv *priv = dev->priv;
233 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 233 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -241,7 +241,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
241 urb = usb_alloc_urb(0, GFP_ATOMIC); 241 urb = usb_alloc_urb(0, GFP_ATOMIC);
242 if (!urb) { 242 if (!urb) {
243 kfree_skb(skb); 243 kfree_skb(skb);
244 return NETDEV_TX_OK; 244 return;
245 } 245 }
246 246
247 flags = skb->len; 247 flags = skb->len;
@@ -309,8 +309,6 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
309 kfree_skb(skb); 309 kfree_skb(skb);
310 } 310 }
311 usb_free_urb(urb); 311 usb_free_urb(urb);
312
313 return NETDEV_TX_OK;
314} 312}
315 313
316static void rtl8187_rx_cb(struct urb *urb) 314static void rtl8187_rx_cb(struct urb *urb)
@@ -373,7 +371,7 @@ static void rtl8187_rx_cb(struct urb *urb)
373 rx_status.rate_idx = rate; 371 rx_status.rate_idx = rate;
374 rx_status.freq = dev->conf.channel->center_freq; 372 rx_status.freq = dev->conf.channel->center_freq;
375 rx_status.band = dev->conf.channel->band; 373 rx_status.band = dev->conf.channel->band;
376 rx_status.flag |= RX_FLAG_TSFT; 374 rx_status.flag |= RX_FLAG_MACTIME_MPDU;
377 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 375 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
378 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; 376 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
379 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); 377 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
@@ -553,6 +551,46 @@ static int rtl8187b_init_status_urb(struct ieee80211_hw *dev)
553 return ret; 551 return ret;
554} 552}
555 553
554static void rtl8187_set_anaparam(struct rtl8187_priv *priv, bool rfon)
555{
556 u32 anaparam, anaparam2;
557 u8 anaparam3, reg;
558
559 if (!priv->is_rtl8187b) {
560 if (rfon) {
561 anaparam = RTL8187_RTL8225_ANAPARAM_ON;
562 anaparam2 = RTL8187_RTL8225_ANAPARAM2_ON;
563 } else {
564 anaparam = RTL8187_RTL8225_ANAPARAM_OFF;
565 anaparam2 = RTL8187_RTL8225_ANAPARAM2_OFF;
566 }
567 } else {
568 if (rfon) {
569 anaparam = RTL8187B_RTL8225_ANAPARAM_ON;
570 anaparam2 = RTL8187B_RTL8225_ANAPARAM2_ON;
571 anaparam3 = RTL8187B_RTL8225_ANAPARAM3_ON;
572 } else {
573 anaparam = RTL8187B_RTL8225_ANAPARAM_OFF;
574 anaparam2 = RTL8187B_RTL8225_ANAPARAM2_OFF;
575 anaparam3 = RTL8187B_RTL8225_ANAPARAM3_OFF;
576 }
577 }
578
579 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
580 RTL818X_EEPROM_CMD_CONFIG);
581 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
582 reg |= RTL818X_CONFIG3_ANAPARAM_WRITE;
583 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
584 rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam);
585 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, anaparam2);
586 if (priv->is_rtl8187b)
587 rtl818x_iowrite8(priv, &priv->map->ANAPARAM3, anaparam3);
588 reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE;
589 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
590 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
591 RTL818X_EEPROM_CMD_NORMAL);
592}
593
556static int rtl8187_cmd_reset(struct ieee80211_hw *dev) 594static int rtl8187_cmd_reset(struct ieee80211_hw *dev)
557{ 595{
558 struct rtl8187_priv *priv = dev->priv; 596 struct rtl8187_priv *priv = dev->priv;
@@ -603,19 +641,7 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev)
603 int res; 641 int res;
604 642
605 /* reset */ 643 /* reset */
606 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, 644 rtl8187_set_anaparam(priv, true);
607 RTL818X_EEPROM_CMD_CONFIG);
608 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
609 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg |
610 RTL818X_CONFIG3_ANAPARAM_WRITE);
611 rtl818x_iowrite32(priv, &priv->map->ANAPARAM,
612 RTL8187_RTL8225_ANAPARAM_ON);
613 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
614 RTL8187_RTL8225_ANAPARAM2_ON);
615 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg &
616 ~RTL818X_CONFIG3_ANAPARAM_WRITE);
617 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
618 RTL818X_EEPROM_CMD_NORMAL);
619 645
620 rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); 646 rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
621 647
@@ -629,17 +655,7 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev)
629 if (res) 655 if (res)
630 return res; 656 return res;
631 657
632 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); 658 rtl8187_set_anaparam(priv, true);
633 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
634 rtl818x_iowrite8(priv, &priv->map->CONFIG3,
635 reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
636 rtl818x_iowrite32(priv, &priv->map->ANAPARAM,
637 RTL8187_RTL8225_ANAPARAM_ON);
638 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
639 RTL8187_RTL8225_ANAPARAM2_ON);
640 rtl818x_iowrite8(priv, &priv->map->CONFIG3,
641 reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
642 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
643 659
644 /* setup card */ 660 /* setup card */
645 rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); 661 rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0);
@@ -712,10 +728,9 @@ static const u8 rtl8187b_reg_table[][3] = {
712 728
713 {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1}, 729 {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1},
714 {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1}, 730 {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1},
715 {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xE0, 0xFF, 1}, {0xE1, 0x0F, 1}, 731 {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1},
716 {0xE2, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1}, {0xF2, 0x02, 1}, 732 {0xF2, 0x02, 1}, {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1},
717 {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1}, {0xF6, 0x06, 1}, 733 {0xF6, 0x06, 1}, {0xF7, 0x07, 1}, {0xF8, 0x08, 1},
718 {0xF7, 0x07, 1}, {0xF8, 0x08, 1},
719 734
720 {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2}, 735 {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2},
721 {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2}, 736 {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2},
@@ -723,14 +738,13 @@ static const u8 rtl8187b_reg_table[][3] = {
723 {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2}, 738 {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2},
724 {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2}, 739 {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2},
725 {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2}, 740 {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2},
726 {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2}, {0x72, 0x56, 2}, 741 {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2},
727 {0x73, 0x9A, 2},
728 742
729 {0x34, 0xF0, 0}, {0x35, 0x0F, 0}, {0x5B, 0x40, 0}, {0x84, 0x88, 0}, 743 {0x5B, 0x40, 0}, {0x84, 0x88, 0}, {0x85, 0x24, 0}, {0x88, 0x54, 0},
730 {0x85, 0x24, 0}, {0x88, 0x54, 0}, {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, 744 {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, {0x8D, 0x00, 0}, {0x94, 0x1B, 0},
731 {0x8D, 0x00, 0}, {0x94, 0x1B, 0}, {0x95, 0x12, 0}, {0x96, 0x00, 0}, 745 {0x95, 0x12, 0}, {0x96, 0x00, 0}, {0x97, 0x06, 0}, {0x9D, 0x1A, 0},
732 {0x97, 0x06, 0}, {0x9D, 0x1A, 0}, {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, 746 {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, {0xBE, 0x80, 0}, {0xDB, 0x00, 0},
733 {0xBE, 0x80, 0}, {0xDB, 0x00, 0}, {0xEE, 0x00, 0}, {0x4C, 0x00, 2}, 747 {0xEE, 0x00, 0}, {0x4C, 0x00, 2},
734 748
735 {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, {0x8E, 0x08, 0}, 749 {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, {0x8E, 0x08, 0},
736 {0x8F, 0x00, 0} 750 {0x8F, 0x00, 0}
@@ -742,48 +756,34 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
742 int res, i; 756 int res, i;
743 u8 reg; 757 u8 reg;
744 758
745 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, 759 rtl8187_set_anaparam(priv, true);
746 RTL818X_EEPROM_CMD_CONFIG);
747
748 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
749 reg |= RTL818X_CONFIG3_ANAPARAM_WRITE | RTL818X_CONFIG3_GNT_SELECT;
750 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
751 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
752 RTL8187B_RTL8225_ANAPARAM2_ON);
753 rtl818x_iowrite32(priv, &priv->map->ANAPARAM,
754 RTL8187B_RTL8225_ANAPARAM_ON);
755 rtl818x_iowrite8(priv, &priv->map->ANAPARAM3,
756 RTL8187B_RTL8225_ANAPARAM3_ON);
757 760
761 /* Reset PLL sequence on 8187B. Realtek note: reduces power
762 * consumption about 30 mA */
758 rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10); 763 rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10);
759 reg = rtl818x_ioread8(priv, (u8 *)0xFF62); 764 reg = rtl818x_ioread8(priv, (u8 *)0xFF62);
760 rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5)); 765 rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5));
761 rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5)); 766 rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5));
762 767
763 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
764 reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE;
765 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
766
767 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
768 RTL818X_EEPROM_CMD_NORMAL);
769
770 res = rtl8187_cmd_reset(dev); 768 res = rtl8187_cmd_reset(dev);
771 if (res) 769 if (res)
772 return res; 770 return res;
773 771
774 rtl818x_iowrite16(priv, (__le16 *)0xFF2D, 0x0FFF); 772 rtl8187_set_anaparam(priv, true);
773
774 /* BRSR (Basic Rate Set Register) on 8187B looks to be the same as
775 * RESP_RATE on 8187L in Realtek sources: each bit should be each
776 * one of the 12 rates, all are enabled */
777 rtl818x_iowrite16(priv, (__le16 *)0xFF34, 0x0FFF);
778
775 reg = rtl818x_ioread8(priv, &priv->map->CW_CONF); 779 reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
776 reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT; 780 reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
777 rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg); 781 rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
778 reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
779 reg |= RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT |
780 RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
781 rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
782 782
783 /* Auto Rate Fallback Register (ARFR): 1M-54M setting */
783 rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1); 784 rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1);
785 rtl818x_iowrite8_idx(priv, (u8 *)0xFFE2, 0x00, 1);
784 786
785 rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100);
786 rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2);
787 rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1); 787 rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1);
788 788
789 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, 789 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
@@ -811,16 +811,9 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
811 811
812 rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001); 812 rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001);
813 813
814 /* RFSW_CTRL register */
814 rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2); 815 rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2);
815 816
816 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
817 RTL818X_EEPROM_CMD_CONFIG);
818 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
819 reg |= RTL818X_CONFIG3_ANAPARAM_WRITE;
820 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
821 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
822 RTL818X_EEPROM_CMD_NORMAL);
823
824 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); 817 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
825 rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488); 818 rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488);
826 rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); 819 rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
@@ -876,23 +869,35 @@ static void rtl8187_work(struct work_struct *work)
876 /* The RTL8187 returns the retry count through register 0xFFFA. In 869 /* The RTL8187 returns the retry count through register 0xFFFA. In
877 * addition, it appears to be a cumulative retry count, not the 870 * addition, it appears to be a cumulative retry count, not the
878 * value for the current TX packet. When multiple TX entries are 871 * value for the current TX packet. When multiple TX entries are
879 * queued, the retry count will be valid for the last one in the queue. 872 * waiting in the queue, the retry count will be the total for all.
880 * The "error" should not matter for purposes of rate setting. */ 873 * The "error" may matter for purposes of rate setting, but there is
874 * no other choice with this hardware.
875 */
881 struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, 876 struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
882 work.work); 877 work.work);
883 struct ieee80211_tx_info *info; 878 struct ieee80211_tx_info *info;
884 struct ieee80211_hw *dev = priv->dev; 879 struct ieee80211_hw *dev = priv->dev;
885 static u16 retry; 880 static u16 retry;
886 u16 tmp; 881 u16 tmp;
882 u16 avg_retry;
883 int length;
887 884
888 mutex_lock(&priv->conf_mutex); 885 mutex_lock(&priv->conf_mutex);
889 tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA); 886 tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
887 length = skb_queue_len(&priv->b_tx_status.queue);
888 if (unlikely(!length))
889 length = 1;
890 if (unlikely(tmp < retry))
891 tmp = retry;
892 avg_retry = (tmp - retry) / length;
890 while (skb_queue_len(&priv->b_tx_status.queue) > 0) { 893 while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
891 struct sk_buff *old_skb; 894 struct sk_buff *old_skb;
892 895
893 old_skb = skb_dequeue(&priv->b_tx_status.queue); 896 old_skb = skb_dequeue(&priv->b_tx_status.queue);
894 info = IEEE80211_SKB_CB(old_skb); 897 info = IEEE80211_SKB_CB(old_skb);
895 info->status.rates[0].count = tmp - retry + 1; 898 info->status.rates[0].count = avg_retry + 1;
899 if (info->status.rates[0].count > RETRY_COUNT)
900 info->flags &= ~IEEE80211_TX_STAT_ACK;
896 ieee80211_tx_status_irqsafe(dev, old_skb); 901 ieee80211_tx_status_irqsafe(dev, old_skb);
897 } 902 }
898 retry = tmp; 903 retry = tmp;
@@ -929,11 +934,17 @@ static int rtl8187_start(struct ieee80211_hw *dev)
929 priv->rx_conf = reg; 934 priv->rx_conf = reg;
930 rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg); 935 rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
931 936
937 reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
938 reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
939 reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
940 reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
941 rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
942
932 rtl818x_iowrite32(priv, &priv->map->TX_CONF, 943 rtl818x_iowrite32(priv, &priv->map->TX_CONF,
933 RTL818X_TX_CONF_HW_SEQNUM | 944 RTL818X_TX_CONF_HW_SEQNUM |
934 RTL818X_TX_CONF_DISREQQSIZE | 945 RTL818X_TX_CONF_DISREQQSIZE |
935 (7 << 8 /* short retry limit */) | 946 (RETRY_COUNT << 8 /* short retry limit */) |
936 (7 << 0 /* long retry limit */) | 947 (RETRY_COUNT << 0 /* long retry limit */) |
937 (7 << 21 /* MAX TX DMA */)); 948 (7 << 21 /* MAX TX DMA */));
938 rtl8187_init_urbs(dev); 949 rtl8187_init_urbs(dev);
939 rtl8187b_init_status_urb(dev); 950 rtl8187b_init_status_urb(dev);
@@ -1002,6 +1013,7 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
1002 rtl818x_iowrite8(priv, &priv->map->CMD, reg); 1013 rtl818x_iowrite8(priv, &priv->map->CMD, reg);
1003 1014
1004 priv->rf->stop(dev); 1015 priv->rf->stop(dev);
1016 rtl8187_set_anaparam(priv, false);
1005 1017
1006 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); 1018 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
1007 reg = rtl818x_ioread8(priv, &priv->map->CONFIG4); 1019 reg = rtl818x_ioread8(priv, &priv->map->CONFIG4);
@@ -1176,13 +1188,12 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
1176 else 1188 else
1177 reg = 0; 1189 reg = 0;
1178 1190
1179 if (is_valid_ether_addr(info->bssid)) { 1191 if (is_valid_ether_addr(info->bssid))
1180 reg |= RTL818X_MSR_INFRA; 1192 reg |= RTL818X_MSR_INFRA;
1181 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1193 else
1182 } else {
1183 reg |= RTL818X_MSR_NO_LINK; 1194 reg |= RTL818X_MSR_NO_LINK;
1184 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1195
1185 } 1196 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1186 1197
1187 mutex_unlock(&priv->conf_mutex); 1198 mutex_unlock(&priv->conf_mutex);
1188 } 1199 }
@@ -1377,6 +1388,9 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1377 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1388 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1378 IEEE80211_HW_SIGNAL_DBM | 1389 IEEE80211_HW_SIGNAL_DBM |
1379 IEEE80211_HW_RX_INCLUDES_FCS; 1390 IEEE80211_HW_RX_INCLUDES_FCS;
1391 /* Initialize rate-control variables */
1392 dev->max_rates = 1;
1393 dev->max_rate_tries = RETRY_COUNT;
1380 1394
1381 eeprom.data = dev; 1395 eeprom.data = dev;
1382 eeprom.register_read = rtl8187_eeprom_register_read; 1396 eeprom.register_read = rtl8187_eeprom_register_read;
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187/leds.c
index 4637337d5ce6..2e0de2f5f0f9 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_leds.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/leds.c
@@ -20,7 +20,7 @@
20#include <linux/eeprom_93cx6.h> 20#include <linux/eeprom_93cx6.h>
21 21
22#include "rtl8187.h" 22#include "rtl8187.h"
23#include "rtl8187_leds.h" 23#include "leds.h"
24 24
25static void led_turn_on(struct work_struct *work) 25static void led_turn_on(struct work_struct *work)
26{ 26{
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.h b/drivers/net/wireless/rtl818x/rtl8187/leds.h
index d743c96d4a20..d743c96d4a20 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_leds.h
+++ b/drivers/net/wireless/rtl818x/rtl8187/leds.h
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c b/drivers/net/wireless/rtl818x/rtl8187/rfkill.c
index 03555e1e0cab..34116719974a 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/rfkill.c
@@ -18,7 +18,7 @@
18#include <net/mac80211.h> 18#include <net/mac80211.h>
19 19
20#include "rtl8187.h" 20#include "rtl8187.h"
21#include "rtl8187_rfkill.h" 21#include "rfkill.h"
22 22
23static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv) 23static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv)
24{ 24{
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.h b/drivers/net/wireless/rtl818x/rtl8187/rfkill.h
index e12575e96d11..e12575e96d11 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rfkill.h
+++ b/drivers/net/wireless/rtl818x/rtl8187/rfkill.h
diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
index 98878160a65a..f1cc90751dbf 100644
--- a/drivers/net/wireless/rtl818x/rtl8187.h
+++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
@@ -16,7 +16,7 @@
16#define RTL8187_H 16#define RTL8187_H
17 17
18#include "rtl818x.h" 18#include "rtl818x.h"
19#include "rtl8187_leds.h" 19#include "leds.h"
20 20
21#define RTL8187_EEPROM_TXPWR_BASE 0x05 21#define RTL8187_EEPROM_TXPWR_BASE 0x05
22#define RTL8187_EEPROM_MAC_ADDR 0x07 22#define RTL8187_EEPROM_MAC_ADDR 0x07
@@ -35,6 +35,8 @@
35#define RFKILL_MASK_8187_89_97 0x2 35#define RFKILL_MASK_8187_89_97 0x2
36#define RFKILL_MASK_8198 0x4 36#define RFKILL_MASK_8198 0x4
37 37
38#define RETRY_COUNT 7
39
38struct rtl8187_rx_info { 40struct rtl8187_rx_info {
39 struct urb *urb; 41 struct urb *urb;
40 struct ieee80211_hw *dev; 42 struct ieee80211_hw *dev;
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
index 97eebdcf7eb9..908903f721f5 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
@@ -21,7 +21,7 @@
21#include <net/mac80211.h> 21#include <net/mac80211.h>
22 22
23#include "rtl8187.h" 23#include "rtl8187.h"
24#include "rtl8187_rtl8225.h" 24#include "rtl8225.h"
25 25
26static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data) 26static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data)
27{ 27{
@@ -898,29 +898,7 @@ static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)
898 898
899static void rtl8225_rf_stop(struct ieee80211_hw *dev) 899static void rtl8225_rf_stop(struct ieee80211_hw *dev)
900{ 900{
901 u8 reg;
902 struct rtl8187_priv *priv = dev->priv;
903
904 rtl8225_write(dev, 0x4, 0x1f); 901 rtl8225_write(dev, 0x4, 0x1f);
905
906 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
907 reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
908 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
909 if (!priv->is_rtl8187b) {
910 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
911 RTL8187_RTL8225_ANAPARAM2_OFF);
912 rtl818x_iowrite32(priv, &priv->map->ANAPARAM,
913 RTL8187_RTL8225_ANAPARAM_OFF);
914 } else {
915 rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
916 RTL8187B_RTL8225_ANAPARAM2_OFF);
917 rtl818x_iowrite32(priv, &priv->map->ANAPARAM,
918 RTL8187B_RTL8225_ANAPARAM_OFF);
919 rtl818x_iowrite8(priv, &priv->map->ANAPARAM3,
920 RTL8187B_RTL8225_ANAPARAM3_OFF);
921 }
922 rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
923 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
924} 902}
925 903
926static void rtl8225_rf_set_channel(struct ieee80211_hw *dev, 904static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h
index 20c5b6ead0f6..20c5b6ead0f6 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.h
+++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h