linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] rtl8187: Adding Realtek rtl8187B support
@ 2008-07-08  6:26 Hin-Tak Leung
  2008-07-08  6:30 ` [PATCH 1/6] " Hin-Tak Leung
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Hin-Tak Leung @ 2008-07-08  6:26 UTC (permalink / raw)
  To: linux-wireless, John W. Linville, flamingice, Andrea Merello
  Cc: Herton Ronaldo Krzesinski, Larry Finger, Pavel Roskin

There was a problem with the integrated patch posted by Pavel on May 22 -
for those who did not get good result, please retry; We identified some code
for detecting early 8187B's with an 8187 id which seems to have a weaker
chip and Larry is working on a 7th patch for it - people having 8187B's with an
0x8187 id should get in touch.

Each of the 6 passes checkpatch.pl, and compiles cleanly with wireless-testing 
head one after the other. The first two modifies the header files, the 3rd adds
radio routines. 4th and 5th modifies the main driver code and the division
is somewhat arbitrary; the 6th updates Kconfig.

---------
rtl8187: Adding Realtek rtl8187B support

Herton wrote most of this based on the Realtek vendor driver, with
contributions from John W. Linville and feedbacks from Pavel. Hin-Tak
fixed tranmission of management frames and got it to work. Pavel removed
procfs support and tidied up the patch. Larry split the patch into 6 parts.

HTL, 2008-07-01:
There is occasional problem with unloading - modprobe -r and ksoftirqd
takes up all CPU time (on x86_64, dual core).

HRK, 2008-04-09:
Rate control doesn't work for 8187b, for 8187 it never worked either.
If you set rate manually to something lower (I found that for 2-3 meters
from AP 11M seems to be the best setting) it works much better (there aren't
stalls/packet drops).

PR, 2008-05-22:
The driver loads and initializes the device successfully.  Bringing the
interface up is very slow (10 to 20 seconds), but it works.  Scanning
works, ... [Edited] Association to APs without encryption works ...
[Edited] Unloading the module is working.

Matthew Garrett wrote on 2008-06-23:
Some vendors are shipping 8187bs with the 0x8187 product id, so the driver
really needs to probe rather than having a static setup of which is which.

Hauke Mehrtens wrote on 2008-01-12 regarding 8187 rate control:
If the rate goes over 11M no TCP/IP traffic goes through the wireless
connecting. If rate is set to auto and the rate control algorithm changes
it to something less than 11M TCP/IP traffic goes through, but if it is more
than 11M no TCP/IP traffic goes through the wireless link. With
"iwconfig wlan0 rate 11M" everything works.

Michael Wu wrote on 6 Nov 2007 on 8187 rate control:
.... you can find the specs for the 8186 floating around on the net
which tells you a bit about the registers. Doesn't tell you anything about
the rx/tx path of the usb variant, which is a bit inferior to the rx/tx path
of the pci chips. There's no easy way to do tx ack reporting on the rtl8187.
The only solutions that could work involve some polling or a different rate
control algorithm.



^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 6/6] rtl8187: updating Kconfig to support RTL8187B
@ 2008-07-08 11:38 Hin-Tak Leung
  0 siblings, 0 replies; 10+ messages in thread
From: Hin-Tak Leung @ 2008-07-08 11:38 UTC (permalink / raw)
  To: linux-wireless, linville, flamingice, andreamrl
  Cc: herton, Larry.Finger, proski

rtl8187: updating Kconfig to support RTL8187B

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 6d1e4de..5e0eda0 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -619,14 +619,20 @@ config RTL8180
 	  Thanks to Realtek for their support!

 config RTL8187
-	tristate "Realtek 8187 USB support"
+	tristate "Realtek 8187 and 8187B USB support"
 	depends on MAC80211 && USB && WLAN_80211 && EXPERIMENTAL
 	select EEPROM_93CX6
 	---help---
-	  This is a driver for RTL8187 based cards.
-	  These are USB based chips found in cards such as:
+	  This is a driver for RTL8187 and RTL8187B based cards.
+	  These are USB based chips found in devices such as:

 	  Netgear WG111v2
+	  Level 1 WNC-0301USB
+	  Micronet SP907GK V5
+	  Encore ENUWI-G2
+	  Trendnet TEW-424UB
+	  ASUS P5B Deluxe
+	  Toshiba Satellite Pro series of laptops

 	  Thanks to Realtek for their support!

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH 1/6] rtl8187: updating rtl8187.h to support RTL8187B
@ 2008-07-08 16:18 Hin-Tak Leung
  2008-07-08 16:18 ` [PATCH 2/6] rtl8187: updating rtl818x.h " Hin-Tak Leung
  0 siblings, 1 reply; 10+ messages in thread
From: Hin-Tak Leung @ 2008-07-08 16:18 UTC (permalink / raw)
  To: linux-wireless, linville
  Cc: Hin-Tak Leung, Larry Finger, Herton Ronaldo Krzesinski,
	Hin-Tak Leung, Pavel Roskin

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
 drivers/net/wireless/rtl8187.h |  113 ++++++++++++++++++++++++++++++++++------
 1 files changed, 97 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h
index a0cfb66..3afb49f 100644
--- a/drivers/net/wireless/rtl8187.h
+++ b/drivers/net/wireless/rtl8187.h
@@ -44,17 +44,48 @@ struct rtl8187_rx_hdr {
 	__le64 mac_time;
 } __attribute__((packed));
 
-struct rtl8187_tx_hdr {
+struct rtl8187b_rx_hdr {
 	__le32 flags;
+	__le64 mac_time;
+	u8 noise;
+	u8 signal;
+	u8 agc;
+	u8 reserved;
+	__le32 unused;
+} __attribute__((packed));
+
+/* {rtl8187,rtl8187b}_tx_info is in skb */
+
+/* Tx flags are common between rtl8187 and rtl8187b */
 #define RTL8187_TX_FLAG_NO_ENCRYPT	(1 << 15)
 #define RTL8187_TX_FLAG_MORE_FRAG	(1 << 17)
 #define RTL8187_TX_FLAG_CTS		(1 << 18)
 #define RTL8187_TX_FLAG_RTS		(1 << 23)
+
+struct rtl8187_tx_hdr {
+	__le32 flags;
 	__le16 rts_duration;
 	__le16 len;
 	__le32 retry;
 } __attribute__((packed));
 
+struct rtl8187b_tx_hdr {
+	__le32 flags;
+	__le16 rts_duration;
+	__le16 len;
+	__le32 unused_1;
+	__le16 unused_2;
+	__le16 tx_duration;
+	__le32 unused_3;
+	__le32 retry;
+	__le32 unused_4[2];
+} __attribute__((packed));
+
+enum {
+	DEVICE_RTL8187,
+	DEVICE_RTL8187B
+};
+
 struct rtl8187_priv {
 	/* common between rtl818x drivers */
 	struct rtl818x_csr *map;
@@ -70,70 +101,120 @@ struct rtl8187_priv {
 	u32 rx_conf;
 	u16 txpwr_base;
 	u8 asic_rev;
+	u8 is_rtl8187b;
+	enum {
+		RTL8187BvB,
+		RTL8187BvD,
+		RTL8187BvE
+	} hw_rev;
 	struct sk_buff_head rx_queue;
+	u8 signal;
+	u8 quality;
+	u8 noise;
 };
 
 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
 
-static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
+static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
+				     u8 *addr, u8 idx)
 {
 	u8 val;
 
 	usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
 			RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-			(unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &val,
+			sizeof(val), HZ / 2);
 
 	return val;
 }
 
-static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
+static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
+{
+	return rtl818x_ioread8_idx(priv, addr, 0);
+}
+
+static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
+				       __le16 *addr, u8 idx)
 {
 	__le16 val;
 
 	usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
 			RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-			(unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &val,
+			sizeof(val), HZ / 2);
 
 	return le16_to_cpu(val);
 }
 
-static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
+static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
+{
+	return rtl818x_ioread16_idx(priv, addr, 0);
+}
+
+static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
+				       __le32 *addr, u8 idx)
 {
 	__le32 val;
 
 	usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
 			RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-			(unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &val,
+			sizeof(val), HZ / 2);
 
 	return le32_to_cpu(val);
 }
 
-static inline void rtl818x_iowrite8(struct rtl8187_priv *priv,
-				    u8 *addr, u8 val)
+static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
+{
+	return rtl818x_ioread32_idx(priv, addr, 0);
+}
+
+static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
+					u8 *addr, u8 val, u8 idx)
 {
 	usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
 			RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-			(unsigned long)addr, 0, &val, sizeof(val), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &val,
+			sizeof(val), HZ / 2);
+}
+
+static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
+{
+	rtl818x_iowrite8_idx(priv, addr, val, 0);
 }
 
-static inline void rtl818x_iowrite16(struct rtl8187_priv *priv,
-				     __le16 *addr, u16 val)
+static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
+					 __le16 *addr, u16 val, u8 idx)
 {
 	__le16 buf = cpu_to_le16(val);
 
 	usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
 			RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-			(unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &buf, sizeof(buf),
+			HZ / 2);
 }
 
-static inline void rtl818x_iowrite32(struct rtl8187_priv *priv,
-				     __le32 *addr, u32 val)
+static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
+				     u16 val)
+{
+	rtl818x_iowrite16_idx(priv, addr, val, 0);
+}
+
+static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
+					 __le32 *addr, u32 val, u8 idx)
 {
 	__le32 buf = cpu_to_le32(val);
 
 	usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
 			RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-			(unsigned long)addr, 0, &buf, sizeof(buf), HZ / 2);
+			(unsigned long)addr, idx & 0x03, &buf, sizeof(buf),
+			HZ / 2);
+}
+
+static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
+				     u32 val)
+{
+	rtl818x_iowrite32_idx(priv, addr, val, 0);
 }
 
 #endif /* RTL8187_H */
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-07-08 16:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08  6:26 [PATCH 0/6] rtl8187: Adding Realtek rtl8187B support Hin-Tak Leung
2008-07-08  6:30 ` [PATCH 1/6] " Hin-Tak Leung
2008-07-08  6:38 ` [PATCH 1/6] rtl8187: updating rtl8187.h to support RTL8187B Hin-Tak Leung
2008-07-08  6:41 ` [PATCH 2/6] rtl8187: updating rtl818x.h " Hin-Tak Leung
2008-07-08  6:46 ` [PATCH 3/6] rtl8187: updating rtl8187_rtl8225.c " Hin-Tak Leung
2008-07-08  6:52 ` [PATCH 4/6] rtl8187: change part 1 of rtl8187_dev.c " Hin-Tak Leung
2008-07-08  6:54 ` [PATCH 5/6] rtl8187: change part 2 " Hin-Tak Leung
2008-07-08  6:57 ` [PATCH 6/6] rtl8187: updating Kconfig " Hin-Tak Leung
  -- strict thread matches above, loose matches on Subject: below --
2008-07-08 11:38 Hin-Tak Leung
2008-07-08 16:18 [PATCH 1/6] rtl8187: updating rtl8187.h " Hin-Tak Leung
2008-07-08 16:18 ` [PATCH 2/6] rtl8187: updating rtl818x.h " Hin-Tak Leung
2008-07-08 16:18   ` [PATCH 3/6] rtl8187: updating rtl8187_rtl8225.c " Hin-Tak Leung
2008-07-08 16:18     ` [PATCH 4/6] rtl8187: change part 1 of rtl8187_dev.c " Hin-Tak Leung
2008-07-08 16:18       ` [PATCH 5/6] rtl8187: change part 2 " Hin-Tak Leung
2008-07-08 16:18         ` [PATCH 6/6] rtl8187: updating Kconfig " Hin-Tak Leung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).