aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2008-07-08 10:43:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-08 14:16:07 -0400
commit0e25b4ef220f6ef4eed120543182385b13005db9 (patch)
tree8c76baf2ad89cf1f703b4b0cb46f4c2b52ef2da2 /drivers
parent5c036b217a1fe3ae0616e9c43c6bcd13b3c134b6 (diff)
rtl8187: Change detection of RTL8187B with USB ID of 8187
Some early versions of RTL8187B devices have a USB ID of 0x8187 rather than the 0x8189 of later models. In addition, it appears that these early units also must be programmed with lower power. Previous patches used the Product ID string to detect this situation, but did not address the low power question. This patch uses the hardware version and sets the power accordingly. Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rtl8187_dev.c79
-rw-r--r--drivers/net/wireless/rtl818x.h4
2 files changed, 47 insertions, 36 deletions
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 3bc4a1c39258..33527e58256f 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -981,8 +981,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
981 } 981 }
982 982
983 priv = dev->priv; 983 priv = dev->priv;
984 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B) || 984 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
985 !memcmp(udev->product, "RTL8187B", 8);
986 985
987 SET_IEEE80211_DEV(dev, &intf->dev); 986 SET_IEEE80211_DEV(dev, &intf->dev);
988 usb_set_intfdata(intf, dev); 987 usb_set_intfdata(intf, dev);
@@ -1011,13 +1010,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1011 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1010 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1012 IEEE80211_HW_RX_INCLUDES_FCS | 1011 IEEE80211_HW_RX_INCLUDES_FCS |
1013 IEEE80211_HW_SIGNAL_UNSPEC; 1012 IEEE80211_HW_SIGNAL_UNSPEC;
1014 dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
1015 sizeof(struct rtl8187_tx_hdr) :
1016 sizeof(struct rtl8187b_tx_hdr);
1017 if (!priv->is_rtl8187b)
1018 dev->queues = 1;
1019 else
1020 dev->queues = 4;
1021 dev->max_signal = 65; 1013 dev->max_signal = 65;
1022 1014
1023 eeprom.data = dev; 1015 eeprom.data = dev;
@@ -1052,26 +1044,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1052 (*channel++).hw_value = txpwr & 0xFF; 1044 (*channel++).hw_value = txpwr & 0xFF;
1053 (*channel++).hw_value = txpwr >> 8; 1045 (*channel++).hw_value = txpwr >> 8;
1054 } 1046 }
1055 if (!priv->is_rtl8187b) {
1056 for (i = 0; i < 2; i++) {
1057 eeprom_93cx6_read(&eeprom,
1058 RTL8187_EEPROM_TXPWR_CHAN_6 + i,
1059 &txpwr);
1060 (*channel++).hw_value = txpwr & 0xFF;
1061 (*channel++).hw_value = txpwr >> 8;
1062 }
1063 } else {
1064 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
1065 &txpwr);
1066 (*channel++).hw_value = txpwr & 0xFF;
1067
1068 eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
1069 (*channel++).hw_value = txpwr & 0xFF;
1070
1071 eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
1072 (*channel++).hw_value = txpwr & 0xFF;
1073 (*channel++).hw_value = txpwr >> 8;
1074 }
1075 1047
1076 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE, 1048 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE,
1077 &priv->txpwr_base); 1049 &priv->txpwr_base);
@@ -1090,17 +1062,20 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1090 reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF); 1062 reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF);
1091 reg32 &= RTL818X_TX_CONF_HWVER_MASK; 1063 reg32 &= RTL818X_TX_CONF_HWVER_MASK;
1092 switch (reg32) { 1064 switch (reg32) {
1093 case RTL818X_TX_CONF_R8187vD_1: 1065 case RTL818X_TX_CONF_R8187vD_B:
1094 case RTL818X_TX_CONF_R8187vD_2: 1066 /* Some RTL8187B devices have a USB ID of 0x8187
1067 * detect them here */
1068 chip_name = "RTL8187BvB(early)";
1069 priv->is_rtl8187b = 1;
1070 priv->hw_rev = RTL8187BvB;
1071 break;
1072 case RTL818X_TX_CONF_R8187vD:
1095 chip_name = "RTL8187vD"; 1073 chip_name = "RTL8187vD";
1096 break; 1074 break;
1097 default: 1075 default:
1098 chip_name = "RTL8187vB (default)"; 1076 chip_name = "RTL8187vB (default)";
1099 } 1077 }
1100 } else { 1078 } else {
1101 printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
1102 "is EXPERIMENTAL, and could damage your\n"
1103 " hardware, use at your own risk\n");
1104 /* 1079 /*
1105 * Force USB request to write radio registers for 8187B, Realtek 1080 * Force USB request to write radio registers for 8187B, Realtek
1106 * only uses it in their sources 1081 * only uses it in their sources
@@ -1129,7 +1104,43 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1129 } 1104 }
1130 } 1105 }
1131 1106
1107 if (!priv->is_rtl8187b) {
1108 for (i = 0; i < 2; i++) {
1109 eeprom_93cx6_read(&eeprom,
1110 RTL8187_EEPROM_TXPWR_CHAN_6 + i,
1111 &txpwr);
1112 (*channel++).hw_value = txpwr & 0xFF;
1113 (*channel++).hw_value = txpwr >> 8;
1114 }
1115 } else {
1116 eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
1117 &txpwr);
1118 (*channel++).hw_value = txpwr & 0xFF;
1119
1120 eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
1121 (*channel++).hw_value = txpwr & 0xFF;
1122
1123 eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
1124 (*channel++).hw_value = txpwr & 0xFF;
1125 (*channel++).hw_value = txpwr >> 8;
1126 }
1127
1128 if (priv->is_rtl8187b)
1129 printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
1130 "is EXPERIMENTAL, and could damage your\n"
1131 " hardware, use at your own risk\n");
1132 if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
1133 printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
1134 " info!\n");
1135
1132 priv->rf = rtl8187_detect_rf(dev); 1136 priv->rf = rtl8187_detect_rf(dev);
1137 dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
1138 sizeof(struct rtl8187_tx_hdr) :
1139 sizeof(struct rtl8187b_tx_hdr);
1140 if (!priv->is_rtl8187b)
1141 dev->queues = 1;
1142 else
1143 dev->queues = 4;
1133 1144
1134 err = ieee80211_register_hw(dev); 1145 err = ieee80211_register_hw(dev);
1135 if (err) { 1146 if (err) {
diff --git a/drivers/net/wireless/rtl818x.h b/drivers/net/wireless/rtl818x.h
index 85a6394e4309..00900fe16fce 100644
--- a/drivers/net/wireless/rtl818x.h
+++ b/drivers/net/wireless/rtl818x.h
@@ -66,8 +66,8 @@ struct rtl818x_csr {
66#define RTL818X_TX_CONF_R8180_F (3 << 25) 66#define RTL818X_TX_CONF_R8180_F (3 << 25)
67#define RTL818X_TX_CONF_R8185_ABC (4 << 25) 67#define RTL818X_TX_CONF_R8185_ABC (4 << 25)
68#define RTL818X_TX_CONF_R8185_D (5 << 25) 68#define RTL818X_TX_CONF_R8185_D (5 << 25)
69#define RTL818X_TX_CONF_R8187vD_1 (5 << 25) 69#define RTL818X_TX_CONF_R8187vD (5 << 25)
70#define RTL818X_TX_CONF_R8187vD_2 (6 << 25) 70#define RTL818X_TX_CONF_R8187vD_B (6 << 25)
71#define RTL818X_TX_CONF_HWVER_MASK (7 << 25) 71#define RTL818X_TX_CONF_HWVER_MASK (7 << 25)
72#define RTL818X_TX_CONF_DISREQQSIZE (1 << 28) 72#define RTL818X_TX_CONF_DISREQQSIZE (1 << 28)
73#define RTL818X_TX_CONF_PROBE_DTS (1 << 29) 73#define RTL818X_TX_CONF_PROBE_DTS (1 << 29)