Commit 0e25b4ef authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

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: default avatarHin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5c036b21
...@@ -981,8 +981,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, ...@@ -981,8 +981,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
} }
priv = dev->priv; priv = dev->priv;
priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B) || priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
!memcmp(udev->product, "RTL8187B", 8);
SET_IEEE80211_DEV(dev, &intf->dev); SET_IEEE80211_DEV(dev, &intf->dev);
usb_set_intfdata(intf, dev); usb_set_intfdata(intf, dev);
...@@ -1011,13 +1010,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, ...@@ -1011,13 +1010,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
IEEE80211_HW_RX_INCLUDES_FCS | IEEE80211_HW_RX_INCLUDES_FCS |
IEEE80211_HW_SIGNAL_UNSPEC; IEEE80211_HW_SIGNAL_UNSPEC;
dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
sizeof(struct rtl8187_tx_hdr) :
sizeof(struct rtl8187b_tx_hdr);
if (!priv->is_rtl8187b)
dev->queues = 1;
else
dev->queues = 4;
dev->max_signal = 65; dev->max_signal = 65;
eeprom.data = dev; eeprom.data = dev;
...@@ -1052,26 +1044,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, ...@@ -1052,26 +1044,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
(*channel++).hw_value = txpwr & 0xFF; (*channel++).hw_value = txpwr & 0xFF;
(*channel++).hw_value = txpwr >> 8; (*channel++).hw_value = txpwr >> 8;
} }
if (!priv->is_rtl8187b) {
for (i = 0; i < 2; i++) {
eeprom_93cx6_read(&eeprom,
RTL8187_EEPROM_TXPWR_CHAN_6 + i,
&txpwr);
(*channel++).hw_value = txpwr & 0xFF;
(*channel++).hw_value = txpwr >> 8;
}
} else {
eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
&txpwr);
(*channel++).hw_value = txpwr & 0xFF;
eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
(*channel++).hw_value = txpwr & 0xFF;
eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
(*channel++).hw_value = txpwr & 0xFF;
(*channel++).hw_value = txpwr >> 8;
}
eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE, eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE,
&priv->txpwr_base); &priv->txpwr_base);
...@@ -1090,17 +1062,20 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, ...@@ -1090,17 +1062,20 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF); reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF);
reg32 &= RTL818X_TX_CONF_HWVER_MASK; reg32 &= RTL818X_TX_CONF_HWVER_MASK;
switch (reg32) { switch (reg32) {
case RTL818X_TX_CONF_R8187vD_1: case RTL818X_TX_CONF_R8187vD_B:
case RTL818X_TX_CONF_R8187vD_2: /* Some RTL8187B devices have a USB ID of 0x8187
* detect them here */
chip_name = "RTL8187BvB(early)";
priv->is_rtl8187b = 1;
priv->hw_rev = RTL8187BvB;
break;
case RTL818X_TX_CONF_R8187vD:
chip_name = "RTL8187vD"; chip_name = "RTL8187vD";
break; break;
default: default:
chip_name = "RTL8187vB (default)"; chip_name = "RTL8187vB (default)";
} }
} else { } else {
printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
"is EXPERIMENTAL, and could damage your\n"
" hardware, use at your own risk\n");
/* /*
* Force USB request to write radio registers for 8187B, Realtek * Force USB request to write radio registers for 8187B, Realtek
* only uses it in their sources * only uses it in their sources
...@@ -1129,7 +1104,43 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, ...@@ -1129,7 +1104,43 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
} }
} }
if (!priv->is_rtl8187b) {
for (i = 0; i < 2; i++) {
eeprom_93cx6_read(&eeprom,
RTL8187_EEPROM_TXPWR_CHAN_6 + i,
&txpwr);
(*channel++).hw_value = txpwr & 0xFF;
(*channel++).hw_value = txpwr >> 8;
}
} else {
eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
&txpwr);
(*channel++).hw_value = txpwr & 0xFF;
eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
(*channel++).hw_value = txpwr & 0xFF;
eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
(*channel++).hw_value = txpwr & 0xFF;
(*channel++).hw_value = txpwr >> 8;
}
if (priv->is_rtl8187b)
printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
"is EXPERIMENTAL, and could damage your\n"
" hardware, use at your own risk\n");
if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
" info!\n");
priv->rf = rtl8187_detect_rf(dev); priv->rf = rtl8187_detect_rf(dev);
dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
sizeof(struct rtl8187_tx_hdr) :
sizeof(struct rtl8187b_tx_hdr);
if (!priv->is_rtl8187b)
dev->queues = 1;
else
dev->queues = 4;
err = ieee80211_register_hw(dev); err = ieee80211_register_hw(dev);
if (err) { if (err) {
......
...@@ -66,8 +66,8 @@ struct rtl818x_csr { ...@@ -66,8 +66,8 @@ struct rtl818x_csr {
#define RTL818X_TX_CONF_R8180_F (3 << 25) #define RTL818X_TX_CONF_R8180_F (3 << 25)
#define RTL818X_TX_CONF_R8185_ABC (4 << 25) #define RTL818X_TX_CONF_R8185_ABC (4 << 25)
#define RTL818X_TX_CONF_R8185_D (5 << 25) #define RTL818X_TX_CONF_R8185_D (5 << 25)
#define RTL818X_TX_CONF_R8187vD_1 (5 << 25) #define RTL818X_TX_CONF_R8187vD (5 << 25)
#define RTL818X_TX_CONF_R8187vD_2 (6 << 25) #define RTL818X_TX_CONF_R8187vD_B (6 << 25)
#define RTL818X_TX_CONF_HWVER_MASK (7 << 25) #define RTL818X_TX_CONF_HWVER_MASK (7 << 25)
#define RTL818X_TX_CONF_DISREQQSIZE (1 << 28) #define RTL818X_TX_CONF_DISREQQSIZE (1 << 28)
#define RTL818X_TX_CONF_PROBE_DTS (1 << 29) #define RTL818X_TX_CONF_PROBE_DTS (1 << 29)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment