Skip to contentSkip to conversation

rtl8187: restore anaparam registers after reset with 8187B

PATCH Hin-Tak Leung 1 participant 1 message Nov 7, 2010 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Larry Finger
Quoted 1 line

Do you have any pointer to it? (I can't find in the

archives in April

Quoted 1 line

9 2009). Never saw it, if was posted in the mailing

list certainly

Quoted 1 line

missed it (and probably I was not in CC).

Quoted 8 lines

There is a reference to it at
http://www.spinics.net/lists/linux-wireless/msg31345.html.
The patches were
never done quite right, and I do not remember testing. As I have only 1 antenna
(I think), it likely would not have affected the results.

Larry

Yes, that's the one. Here is the patch from my stash anyway, it looks like it is exactly that.

Hin-Tak

drivers/net/wireless/Makefile +1 -0
diff -urN compat-wireless-2.6-old.orig/drivers/net/wireless/Makefile compat-wireless-2.6-old/drivers/net/wireless/Makefile
@@ -1,6 +1,7 @@
 #
 # Makefile for the Linux Wireless network device drivers.
 #
+EXTRA_CFLAGS += -DSW_ANTENNA_DIVERSITY
 
 obj-$(CONFIG_IPW2100) += ipw2100.o
 
drivers/net/wireless/rtl8187_dev.c +210 -0

282 lines not on this page · raw message

drivers/net/wireless/rtl8187.h +40 -0
diff -urN compat-wireless-2.6-old.orig/drivers/net/wireless/rtl8187.h compat-wireless-2.6-old/drivers/net/wireless/rtl8187.h
@@ -82,11 +82,28 @@
 	DEVICE_RTL8187B
 };
 
+#ifdef SW_ANTENNA_DIVERSITY
+
+#define VAL_ARRAY_SIZE 10
+
+#define ANTSEL 0x9F
+
+struct rtl8187_ant_diversity {
+	int count;
+	u8 agc_array[VAL_ARRAY_SIZE];
+
+    u8 switch_to;
+    u8 curr_ant_index;
+} __attribute__ ((packed));
+
+#endif /* SW_ANTENNA_DIVERSITY */
+
 struct rtl8187_priv {
 	/* common between rtl818x drivers */
 	struct rtl818x_csr *map;
 	const struct rtl818x_rf_ops *rf;
 	struct ieee80211_vif *vif;
+	struct ieee80211_hw *hw;
 	int mode;
 	/* The mutex protects the TX loopback state.
 	 * Any attempt to set channels concurrently locks the device.
@@ -112,6 +129,13 @@
 	u8 signal;
 	u8 quality;
 	u8 noise;
+
+#ifdef SW_ANTENNA_DIVERSITY
+	struct timer_list sw_antenna_diversity_timer;
+	struct rtl8187_ant_diversity ant_diversity;
+	struct delayed_work antenna_work;
+#endif /* SW_ANTENNA_DIVERSITY */
+
 };
 
 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
@@ -218,4 +242,20 @@
 	rtl818x_iowrite32_idx(priv, addr, val, 0);
 }
 
+void rtl8187_bss_info_changed(struct ieee80211_hw *hw,
+								struct ieee80211_vif *vif,
+								struct ieee80211_bss_conf *bss_conf,
+								u32 changes);
+#ifdef SW_ANTENNA_DIVERSITY
+
+void sw_antenna_diversity_timer_callback(struct rtl8187_priv *dev);
+
+bool SwitchAntenna(struct rtl8187_priv *priv);
+
+void write_nic_byte(struct rtl8187_priv *priv, int indx, u8 data);
+
+void SwAntennaWorkItemCallback(struct work_struct *work);
+
+#endif /* SW_ANTENNA_DIVERSITY */
+
 #endif /* RTL8187_H */