Skip to contentSkip to conversation

rt2x00 : fix rt3290 resuming failed.

PATCH Superseded Chen, Chien-Chia 2 participants 5 messages Jul 27, 2012 – Jul 30, 2012 Networking drivers (wireless)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00 : fix rt3290 resuming failed.

This patch is going to fix the resuming failed from S3/S4 for rt3290 chip.

----

drivers/net/wireless/rt2x00/rt2800lib.c +70 -0
index e76f03c..ed756f4 100644
@@ -401,6 +401,14 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
 	unsigned int i;
 	u32 reg;
 
+	int retval;
+
+	if (rt2x00_rt(rt2x00dev, RT3290)) {
+		retval = rt2800_enable_wlan_rt3290(rt2x00dev);
+		if (retval)
+			return -EBUSY;
+	}
+
 	/*
 	 * If driver doesn't wake up firmware here,
 	 * rt2800_load_firmware will hang forever when interface is up again.
@@ -5152,6 +5160,68 @@ int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
 }
 EXPORT_SYMBOL_GPL(rt2800_get_survey);
 
+static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
+{
+	u32 reg;
+	int i, count;
+
+	rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
+	if (rt2x00_get_field32(reg, WLAN_EN))
+		return 0;
+
+	rt2x00_set_field32(&reg, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
+	rt2x00_set_field32(&reg, FRC_WL_ANT_SET, 1);
+	rt2x00_set_field32(&reg, WLAN_CLK_EN, 0);
+	rt2x00_set_field32(&reg, WLAN_EN, 1);
+	rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+
+	udelay(REGISTER_BUSY_DELAY);
+
+	count = 0;
+	do {
+		/*
+		 * Check PLL_LD & XTAL_RDY.
+		 */
+		for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
+			rt2800_register_read(rt2x00dev, CMB_CTRL, &reg);
+			if (rt2x00_get_field32(reg, PLL_LD) &&
+			    rt2x00_get_field32(reg, XTAL_RDY))
+				break;
+			udelay(REGISTER_BUSY_DELAY);
+		}
+
+		if (i >= REGISTER_BUSY_COUNT) {
+
+			if (count >= 10)
+				return -EIO;
+
+			rt2800_register_write(rt2x00dev, 0x58, 0x018);
+			udelay(REGISTER_BUSY_DELAY);
+			rt2800_register_write(rt2x00dev, 0x58, 0x418);
+			udelay(REGISTER_BUSY_DELAY);
+			rt2800_register_write(rt2x00dev, 0x58, 0x618);
+			udelay(REGISTER_BUSY_DELAY);
+			count++;
+		} else {
+			count = 0;
+		}
+
+		rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
+		rt2x00_set_field32(&reg, PCIE_APP0_CLK_REQ, 0);
+		rt2x00_set_field32(&reg, WLAN_CLK_EN, 1);
+		rt2x00_set_field32(&reg, WLAN_RESET, 1);
+		rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+		udelay(10);
+		rt2x00_set_field32(&reg, WLAN_RESET, 0);
+		rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
+		udelay(10);
+		rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff);
+	} while (count != 0);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(rt2800_enable_wlan_rt3290);
+
 MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz");
 MODULE_VERSION(DRV_VERSION);
 MODULE_DESCRIPTION("Ralink RT2800 library");
drivers/net/wireless/rt2x00/rt2800lib.h +1 -0
index 18a0b67..0321fd8 100644
@@ -209,5 +209,6 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
 		      struct survey_info *survey);
 void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
+int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev);
 
 #endif /* RT2800LIB_H */
drivers/net/wireless/rt2x00/rt2800pci.c +0 -60

66 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Chien-Chia

This patch is going to fix the resuming failed from S3/S4 for rt3290 chip.

Could you please post patches that compile? Also you did not set true author of the patch. Additionally, since repost that patch with changes, you should mark version of the patch and provide information about changes, like for example here:
http://marc.info/?l=linux-wireless&m=134338186523059&w=2

Still patch does not include registers/values names, but if providing such information is not possible, we will accept that.

Thanks
Stanislaw

author
#2 lore raw

Hi Stanislaw,

2012/7/27 Stanislaw Gruszka <[email protected]>:

Quoted 8 lines · Chien-Chia
Quoted 5 lines

This patch is going to fix the resuming failed from S3/S4 for rt3290 chip.

Could you please post patches that compile? Also you did not set true

Compile ? you mean the *.o files and *.ko ?

Quoted 3 lines

author of the patch. Additionally, since repost that patch with changes, you should mark version of the patch and provide information about changes, like for example here:

Hmm....I added the Author: Woody Hung <[email protected]> but don't know why it doesn't show here. :(

Quoted 1 line

http://marc.info/?l=linux-wireless&m=134338186523059&w=2

It makes sense to me. I will repost it and mark version of the patch.

Quoted 2 lines

Still patch does not include registers/values names, but if providing such information is not possible, we will accept that.

Thanks, Ralink doesn't intend to give me the registers/values names.

Quoted 4 lines

Thanks
Stanislaw

Signature · 1 line
Thank you.
#3 lore raw

Hi

Quoted 10 lines · Matt Chen

2012/7/27 Stanislaw Gruszka <[email protected]>:

Quoted 8 lines · Chien-Chia
Quoted 5 lines

This patch is going to fix the resuming failed from S3/S4 for rt3290 chip.

Could you please post patches that compile? Also you did not set true

Compile ? you mean the *.o files and *.ko ?

Patch does not compile:

drivers/net/wireless/rt2x00/rt2800lib.c:5163: error: static declaration of ‘rt2800_enable_wlan_rt3290’ follows non-static declaration drivers/net/wireless/rt2x00/rt2800lib.h:212: note: previous declaration of ‘rt2800_enable_wlan_rt3290’ was here make[1]: *** [drivers/net/wireless/rt2x00/rt2800lib.o] Error 1
make: *** [drivers/net/wireless/rt2x00/] Error 2

How did you tested the patch ?

Quoted 5 lines
Quoted 3 lines

author of the patch. Additionally, since repost that patch with changes, you should mark version of the patch and provide information about changes, like for example here:

Hmm....I added the Author: Woody Hung <[email protected]> but don't know why it doesn't show here. :(

So fix that. Post patch to yourself first to see if setting works.

Stanislaw

author
#4 lore raw

Hi

2012/7/30 Stanislaw Gruszka <[email protected]>:

Quoted 14 lines

Hi

Quoted 10 lines · Matt Chen

2012/7/27 Stanislaw Gruszka <[email protected]>:

Quoted 8 lines · Chien-Chia
Quoted 5 lines

This patch is going to fix the resuming failed from S3/S4 for rt3290 chip.

Could you please post patches that compile? Also you did not set true

Compile ? you mean the *.o files and *.ko ?

Quoted 8 lines

Patch does not compile:

drivers/net/wireless/rt2x00/rt2800lib.c:5163: error: static declaration of ‘rt2800_enable_wlan_rt3290’ follows non-static declaration drivers/net/wireless/rt2x00/rt2800lib.h:212: note: previous declaration of ‘rt2800_enable_wlan_rt3290’ was here make[1]: *** [drivers/net/wireless/rt2x00/rt2800lib.o] Error 1
make: *** [drivers/net/wireless/rt2x00/] Error 2

How did you tested the patch ?

Ah......it must be my direct copy and past, I am working on V2 path, I am working on building it now, make sure my v2 patch is fine to build.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

author of the patch. Additionally, since repost that patch with changes, you should mark version of the patch and provide information about changes, like for example here:

Hmm....I added the Author: Woody Hung <[email protected]> but don't know why it doesn't show here. :(

So fix that. Post patch to yourself first to see if setting works.

I see. thanks.

Quoted 2 lines

Stanislaw

Signature · 1 line
Thank you.