Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [v3.10-rc2] iwlwifi regression
From: Sedat Dilek @ 2013-06-26 16:37 UTC (permalink / raw)
  To: Jörg Otte
  Cc: linux-wireless, Linux Kernel Mailing List, Johannes Berg,
	Linus Torvalds
In-Reply-To: <CADDKRnCP_s2hL2wr8TsKeToNRt5nXF3NBYAqkmCCUPX8HbY_yQ@mail.gmail.com>

On Wed, Jun 26, 2013 at 6:16 PM, Jörg Otte <jrg.otte@gmail.com> wrote:
> 2013/5/25 Jörg Otte <jrg.otte@gmail.com>:
>> If iwlwifi/iwldvm are built into the kernel (no loadable modules)
>> following error is written to console and syslog since v3.10-rc:
>>
>> iwlwifi 0000:08:00.0: failed to load module iwldvm (error -38), is
>> dynamic loading enabled?
>>
>> reverting
>> commit 1618b2b02a3a0ee7a6863fed4b0d22e697e7e97c
>> Author: Johannes Berg <johannes.berg@intel.com>
>> Date:   Thu Apr 4 10:35:23 2013 +0200
>>     iwlwifi: print warning on request_module failure
>>
>> fixes the problem for me.
>>
>> Jörg
>>
>> I'm not subscribed,please CC me in answeres
>
> We have rc-7 now and it's still not fixed. What is the problem?
>

The patch is pending in wireless.git and is not in mainline, right.
AFAICS there was a recent pull request... so should be in rc8.

commit 8edf3fd6eb0649b0f19363baf23bca39c6fbdba4
"iwlwifi: don't print module loading error if not modular"

- Sedat -

http://git.kernel.org/cgit/linux/kernel/git/linville/wireless.git/commit/?id=8edf3fd6eb0649b0f19363baf23bca39c6fbdba4

> Thanks, Jörg
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [RFC] mac80211: Use libnl-configurable values for retry counts
From: Jean-Pierre Tosoni @ 2013-06-26 17:28 UTC (permalink / raw)
  To: linux-wireless; +Cc: J.P. Tosoni

From: J.P. Tosoni <jp.tosoni@acksys.fr>

In the rate control algorithms, the maximum retry count is limited by
a) a constant value obtained from the hardware driver
b) a constant limit (6ms) on the time allowed for all
   retries of each frame.

Replace the retry count by existing configurable values from nl80211.
Use wiphy->retry_short for management frames.
Use wiphy->retry_long for other frames.
Check that the configured value does not exceed driver capabilities.

Caveat: in minstrel rate control, the retry count is reused for each
rate of the rate table, potentially resulting in 4*max_retry retries.
---
Please comment on the patch and the caveat above, then I'll proceed
to update iw and to change the hard limit of 30 retries in ath9k.

 net/mac80211/cfg.c              |    4 ++++
 net/mac80211/rate.c             |    2 +-
 net/mac80211/rc80211_minstrel.c |    6 +-----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 082f270..4d3eb56 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2203,11 +2203,15 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
 	if (changed & WIPHY_PARAM_RETRY_SHORT) {
 		if (wiphy->retry_short > IEEE80211_MAX_TX_RETRY)
 			return -EINVAL;
+		if (wiphy->retry_short > local->hw.max_rate_tries)
+			return -EINVAL;
 		local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
 	}
 	if (changed & WIPHY_PARAM_RETRY_LONG) {
 		if (wiphy->retry_long > IEEE80211_MAX_TX_RETRY)
 			return -EINVAL;
+		if (wiphy->retry_long > local->hw.max_rate_tries)
+			return -EINVAL;
 		local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
 	}
 	if (changed &
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index a02bef3..9be3006 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -266,7 +266,7 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
 
 	info->control.rates[0].count =
 		(info->flags & IEEE80211_TX_CTL_NO_ACK) ?
-		1 : hw->max_rate_tries;
+		1 : hw->conf.short_frame_max_tx_count;
 
 	info->control.skip_table = 1;
 }
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index ac7ef54..502d0c9 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -592,11 +592,7 @@ minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
 	/* maximum time that the hw is allowed to stay in one MRR segment */
 	mp->segment_size = 6000;
 
-	if (hw->max_rate_tries > 0)
-		mp->max_retry = hw->max_rate_tries;
-	else
-		/* safe default, does not necessarily have to match hw properties */
-		mp->max_retry = 7;
+	mp->max_retry = hw->conf.long_frame_max_tx_count;
 
 	if (hw->max_rates >= 4)
 		mp->has_mrr = true;
-- 
1.7.2.5


^ permalink raw reply related

* Re: Fwd: Re: TP-Link 8200ND - rtl8192cu module not loading / working
From: shiki.biomernok @ 2013-06-26 17:29 UTC (permalink / raw)
  To: Larry Finger, linux-wireless
In-Reply-To: <51CB1356.80306@lwfinger.net>

Hello Larry/Mailing list!

I have compiled and installed the new wireless-testing kernel from git.
I'm sure I used the new kernel, as the device lighted up as soon as I 
plugged in. (And I got some new atheros ac module at "make oldconfig".)
There was no need for manual echo or modprobe.

Yet, the device is not working. It dies at the very same step.
Here is the dmesg: http://pastebin.com/C1MNdFiw

Please, let me know if I can help with anything.
Any debug option, patch or things like that.

My offer is still there Larry, I'm willing to give you a full SSH access 
to the machine with this stuff plugged in.
Besides that, I have no other idea.


! My router runs OpenWRT (latest stable), so I could also gather info 
from there. If it's possible.
(I checked dmesg but there is nothing. Only some non-crucial info about 
the generic eth ports and such.)

Thank you for the help.

(By the way if the chip is rare (no other people will benefit), then I 
can just get it back and ask for a refund. But if others use it as well, 
then it's not a waste of time... I guess.)

On 2013-06-26 18:14, Larry Finger wrote:
> On 06/26/2013 06:30 AM, shiki.biomernok wrote:
>> Hello everyone!
>>
>> CC'ing my original message that I sent to Larry.
>> It's been a while, but I've been busy and I couldn't fiddle with the 
>> wireless
>> device.
>>
>> Basically it's a 8192cu device. Larry suspected it's not, but I think 
>> he saw the
>> advertisement displayed on top of the TP-Link page.
>> I even mailed TP-Link, and here is the reply:
>>
>>     The chipset is Realtek RTL8192CU and you can download the driver
>>     from
>>
>> http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true. 
>>
>>
>>     Thank you.
>>
>> Tested with many kernels, but none of them worked.
>> Ubuntu 13.04 (both stock + updated), Fedora (Schrodinger-1), Fedora Beta
>> (Schrodinger), openSUSE (normal+tumbleweed).
>> I even tried the latest kernels since 3.10-rc4. (latest I tried is -rc7)
>>
>> Basically this device *should* work with the 8192cu driver, but it 
>> just won't.
>> If you just plug it in, nothing happens.
>> You have to first:
>> $ modprobe 8192cu
>> $ echo 2357 0100 > /sys/bus/usb/drivers/rtl8192cu/new_id
>>
>> Then it lights up, it shows up in NM-Applet. But it won't work.
>> I tried enabling the realtek debug option at the kernel driver, but 
>> it didn't help.
>> Even with that, I only see the authentication failed messages.
>>
>> Dmesg shows the errors: http://pastebin.com/QCfXYCZ1
>>
>>
>> Hope you guys can come up with some tips/ideas.
>> Ps.: I hope you don't mind the CC Larry.
>
> No, that is what I told you to do.
>
> A patch has been submitted to add that device to the USB_DEVICE table. 
> It is included in the wireless-testing git tree, but it is not in the 
> mainline code (yet). After that patch was applied, the device worked 
> for that reported.
>
> I noticed that you are getting an oops from iwlwifi, and an ehci-hcd 
> error. Are you also exploring these problems?
>
> If possible, could you use the wireless-testing repo? That will get 
> you the latest code for all wireless drivers, and the USB code will 
> match mainline.
>
> Larry
>
>


^ permalink raw reply

* [PATCH 0/5] rt2x00: rt2800lib: add support for extended EEPROM of three-cain devices
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos

Gabor Juhos (5):
  rt2x00: rt2800lib: introduce rt2800_eeprom_word enum
  rt2x00: rt2800lib: introduce local EEPROM access functions
  rt2x00: rt2800lib: introduce rt2800_eeprom_read_from_array helper
  rt2x00: rt2800lib: introduce rt2800_eeprom_word_index helper
  rt2x00: rt2800lib: add EEPROM map for the RT3593 chipset

 drivers/net/wireless/rt2x00/rt2800.h    |   87 +++++----
 drivers/net/wireless/rt2x00/rt2800lib.c |  306 +++++++++++++++++++++++--------
 2 files changed, 280 insertions(+), 113 deletions(-)

--
1.7.10


^ permalink raw reply

* [PATCH 3/5] rt2x00: rt2800lib: introduce rt2800_eeprom_read_from_array helper
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
In-Reply-To: <1372269318-30233-1-git-send-email-juhosg@openwrt.org>

Add a new helper function and use that for reading
single elements of various arrays in the EEPROM.

The patch does not change the current behaviour,
but it allows to use sequential values for the
rt2800_eeprom_word enums. The conversion will be
implemented in a subsequent change.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 522f0b1..b59772a 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -239,6 +239,14 @@ static void rt2800_eeprom_write(struct rt2x00_dev *rt2x00dev,
 	rt2x00_eeprom_write(rt2x00dev, word, data);
 }
 
+static void rt2800_eeprom_read_from_array(struct rt2x00_dev *rt2x00dev,
+					  const enum rt2800_eeprom_word array,
+					  unsigned int offset,
+					  u16 *data)
+{
+	rt2x00_eeprom_read(rt2x00dev, array + offset, data);
+}
+
 static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
 {
 	u32 reg;
@@ -2995,8 +3003,8 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
 		 * .11b data rate need add additional 4dbm
 		 * when calculating eirp txpower.
 		 */
-		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + 1,
-				   &eeprom);
+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE,
+					      1, &eeprom);
 		criterion = rt2x00_get_field16(eeprom,
 					       EEPROM_TXPOWER_BYRATE_RATE0);
 
@@ -3101,8 +3109,8 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
 		rt2800_register_read(rt2x00dev, offset, &reg);
 
 		/* read the next four txpower values */
-		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i,
-				   &eeprom);
+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE,
+					      i, &eeprom);
 
 		is_rate_b = i ? 0 : 1;
 		/*
@@ -3150,8 +3158,8 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
 		rt2x00_set_field32(&reg, TX_PWR_CFG_RATE3, txpower);
 
 		/* read the next four txpower values */
-		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i + 1,
-				   &eeprom);
+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE,
+					      i + 1, &eeprom);
 
 		is_rate_b = 0;
 		/*
@@ -4579,7 +4587,8 @@ static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
 	}
 
 	for (i = 0; i < EEPROM_BBP_SIZE; i++) {
-		rt2800_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
+		rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_BBP_START, i,
+					      &eeprom);
 
 		if (eeprom != 0xffff && eeprom != 0x0000) {
 			reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID);
-- 
1.7.10


^ permalink raw reply related

* [PATCH 1/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word enum
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
In-Reply-To: <1372269318-30233-1-git-send-email-juhosg@openwrt.org>

The patch converts the EEPROM_* word address defines
into new enum values. The new enum type will be used
by new functions which will be introduced in subsequent
changes.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800.h |   79 +++++++++++++++++-----------------
 1 file changed, 39 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index d78c495..0647039 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -2206,28 +2206,59 @@ struct mac_iveiv_entry {
  * The wordsize of the EEPROM is 16 bits.
  */
 
-/*
- * Chip ID
- */
-#define EEPROM_CHIP_ID			0x0000
+enum rt2800_eeprom_word {
+	EEPROM_CHIP_ID		= 0x0000,
+	EEPROM_VERSION		= 0x0001,
+	EEPROM_MAC_ADDR_0	= 0x0002,
+	EEPROM_MAC_ADDR_1	= 0x0003,
+	EEPROM_MAC_ADDR_2	= 0x0004,
+	EEPROM_NIC_CONF0	= 0x001a,
+	EEPROM_NIC_CONF1	= 0x001b,
+	EEPROM_FREQ		= 0x001d,
+	EEPROM_LED_AG_CONF	= 0x001e,
+	EEPROM_LED_ACT_CONF	= 0x001f,
+	EEPROM_LED_POLARITY	= 0x0020,
+	EEPROM_NIC_CONF2	= 0x0021,
+	EEPROM_LNA		= 0x0022,
+	EEPROM_RSSI_BG		= 0x0023,
+	EEPROM_RSSI_BG2		= 0x0024,
+	EEPROM_TXMIXER_GAIN_BG	= 0x0024, /* overlaps with RSSI_BG2 */
+	EEPROM_RSSI_A		= 0x0025,
+	EEPROM_RSSI_A2		= 0x0026,
+	EEPROM_TXMIXER_GAIN_A	= 0x0026, /* overlaps with RSSI_A2 */
+	EEPROM_EIRP_MAX_TX_POWER = 0x0027,
+	EEPROM_TXPOWER_DELTA	= 0x0028,
+	EEPROM_TXPOWER_BG1	= 0x0029,
+	EEPROM_TXPOWER_BG2	= 0x0030,
+	EEPROM_TSSI_BOUND_BG1	= 0x0037,
+	EEPROM_TSSI_BOUND_BG2	= 0x0038,
+	EEPROM_TSSI_BOUND_BG3	= 0x0039,
+	EEPROM_TSSI_BOUND_BG4	= 0x003a,
+	EEPROM_TSSI_BOUND_BG5	= 0x003b,
+	EEPROM_TXPOWER_A1	= 0x003c,
+	EEPROM_TXPOWER_A2	= 0x0053,
+	EEPROM_TSSI_BOUND_A1	= 0x006a,
+	EEPROM_TSSI_BOUND_A2	= 0x006b,
+	EEPROM_TSSI_BOUND_A3	= 0x006c,
+	EEPROM_TSSI_BOUND_A4	= 0x006d,
+	EEPROM_TSSI_BOUND_A5	= 0x006e,
+	EEPROM_TXPOWER_BYRATE	= 0x006f,
+	EEPROM_BBP_START	= 0x0078,
+};
 
 /*
  * EEPROM Version
  */
-#define EEPROM_VERSION			0x0001
 #define EEPROM_VERSION_FAE		FIELD16(0x00ff)
 #define EEPROM_VERSION_VERSION		FIELD16(0xff00)
 
 /*
  * HW MAC address.
  */
-#define EEPROM_MAC_ADDR_0		0x0002
 #define EEPROM_MAC_ADDR_BYTE0		FIELD16(0x00ff)
 #define EEPROM_MAC_ADDR_BYTE1		FIELD16(0xff00)
-#define EEPROM_MAC_ADDR_1		0x0003
 #define EEPROM_MAC_ADDR_BYTE2		FIELD16(0x00ff)
 #define EEPROM_MAC_ADDR_BYTE3		FIELD16(0xff00)
-#define EEPROM_MAC_ADDR_2		0x0004
 #define EEPROM_MAC_ADDR_BYTE4		FIELD16(0x00ff)
 #define EEPROM_MAC_ADDR_BYTE5		FIELD16(0xff00)
 
@@ -2237,7 +2268,6 @@ struct mac_iveiv_entry {
  * TXPATH: 1: 1T, 2: 2T, 3: 3T
  * RF_TYPE: RFIC type
  */
-#define	EEPROM_NIC_CONF0		0x001a
 #define EEPROM_NIC_CONF0_RXPATH		FIELD16(0x000f)
 #define EEPROM_NIC_CONF0_TXPATH		FIELD16(0x00f0)
 #define EEPROM_NIC_CONF0_RF_TYPE		FIELD16(0x0f00)
@@ -2261,7 +2291,6 @@ struct mac_iveiv_entry {
  * BT_COEXIST: 0: disable, 1: enable
  * DAC_TEST: 0: disable, 1: enable
  */
-#define	EEPROM_NIC_CONF1		0x001b
 #define EEPROM_NIC_CONF1_HW_RADIO		FIELD16(0x0001)
 #define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC		FIELD16(0x0002)
 #define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G		FIELD16(0x0004)
@@ -2281,7 +2310,6 @@ struct mac_iveiv_entry {
 /*
  * EEPROM frequency
  */
-#define	EEPROM_FREQ			0x001d
 #define EEPROM_FREQ_OFFSET		FIELD16(0x00ff)
 #define EEPROM_FREQ_LED_MODE		FIELD16(0x7f00)
 #define EEPROM_FREQ_LED_POLARITY	FIELD16(0x1000)
@@ -2298,9 +2326,6 @@ struct mac_iveiv_entry {
  * POLARITY_GPIO_4: Polarity GPIO4 setting.
  * LED_MODE: Led mode.
  */
-#define EEPROM_LED_AG_CONF		0x001e
-#define EEPROM_LED_ACT_CONF		0x001f
-#define EEPROM_LED_POLARITY		0x0020
 #define EEPROM_LED_POLARITY_RDY_BG	FIELD16(0x0001)
 #define EEPROM_LED_POLARITY_RDY_A	FIELD16(0x0002)
 #define EEPROM_LED_POLARITY_ACT		FIELD16(0x0004)
@@ -2317,7 +2342,6 @@ struct mac_iveiv_entry {
  * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
  * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved
  */
-#define EEPROM_NIC_CONF2		0x0021
 #define EEPROM_NIC_CONF2_RX_STREAM		FIELD16(0x000f)
 #define EEPROM_NIC_CONF2_TX_STREAM		FIELD16(0x00f0)
 #define EEPROM_NIC_CONF2_CRYSTAL		FIELD16(0x0600)
@@ -2325,54 +2349,46 @@ struct mac_iveiv_entry {
 /*
  * EEPROM LNA
  */
-#define EEPROM_LNA			0x0022
 #define EEPROM_LNA_BG			FIELD16(0x00ff)
 #define EEPROM_LNA_A0			FIELD16(0xff00)
 
 /*
  * EEPROM RSSI BG offset
  */
-#define EEPROM_RSSI_BG			0x0023
 #define EEPROM_RSSI_BG_OFFSET0		FIELD16(0x00ff)
 #define EEPROM_RSSI_BG_OFFSET1		FIELD16(0xff00)
 
 /*
  * EEPROM RSSI BG2 offset
  */
-#define EEPROM_RSSI_BG2			0x0024
 #define EEPROM_RSSI_BG2_OFFSET2		FIELD16(0x00ff)
 #define EEPROM_RSSI_BG2_LNA_A1		FIELD16(0xff00)
 
 /*
  * EEPROM TXMIXER GAIN BG offset (note overlaps with EEPROM RSSI BG2).
  */
-#define EEPROM_TXMIXER_GAIN_BG		0x0024
 #define EEPROM_TXMIXER_GAIN_BG_VAL	FIELD16(0x0007)
 
 /*
  * EEPROM RSSI A offset
  */
-#define EEPROM_RSSI_A			0x0025
 #define EEPROM_RSSI_A_OFFSET0		FIELD16(0x00ff)
 #define EEPROM_RSSI_A_OFFSET1		FIELD16(0xff00)
 
 /*
  * EEPROM RSSI A2 offset
  */
-#define EEPROM_RSSI_A2			0x0026
 #define EEPROM_RSSI_A2_OFFSET2		FIELD16(0x00ff)
 #define EEPROM_RSSI_A2_LNA_A2		FIELD16(0xff00)
 
 /*
  * EEPROM TXMIXER GAIN A offset (note overlaps with EEPROM RSSI A2).
  */
-#define EEPROM_TXMIXER_GAIN_A		0x0026
 #define EEPROM_TXMIXER_GAIN_A_VAL	FIELD16(0x0007)
 
 /*
  * EEPROM EIRP Maximum TX power values(unit: dbm)
  */
-#define EEPROM_EIRP_MAX_TX_POWER	0x0027
 #define EEPROM_EIRP_MAX_TX_POWER_2GHZ	FIELD16(0x00ff)
 #define EEPROM_EIRP_MAX_TX_POWER_5GHZ	FIELD16(0xff00)
 
@@ -2383,7 +2399,6 @@ struct mac_iveiv_entry {
  * TYPE: 1: Plus the delta value, 0: minus the delta value
  * ENABLE: enable tx power compensation for 40BW
  */
-#define EEPROM_TXPOWER_DELTA		0x0028
 #define EEPROM_TXPOWER_DELTA_VALUE_2G	FIELD16(0x003f)
 #define EEPROM_TXPOWER_DELTA_TYPE_2G	FIELD16(0x0040)
 #define EEPROM_TXPOWER_DELTA_ENABLE_2G	FIELD16(0x0080)
@@ -2394,8 +2409,6 @@ struct mac_iveiv_entry {
 /*
  * EEPROM TXPOWER 802.11BG
  */
-#define	EEPROM_TXPOWER_BG1		0x0029
-#define	EEPROM_TXPOWER_BG2		0x0030
 #define EEPROM_TXPOWER_BG_SIZE		7
 #define EEPROM_TXPOWER_BG_1		FIELD16(0x00ff)
 #define EEPROM_TXPOWER_BG_2		FIELD16(0xff00)
@@ -2407,7 +2420,6 @@ struct mac_iveiv_entry {
  * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
  *         reduced by (agc_step * -3)
  */
-#define EEPROM_TSSI_BOUND_BG1		0x0037
 #define EEPROM_TSSI_BOUND_BG1_MINUS4	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_BG1_MINUS3	FIELD16(0xff00)
 
@@ -2418,7 +2430,6 @@ struct mac_iveiv_entry {
  * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
  *         reduced by (agc_step * -1)
  */
-#define EEPROM_TSSI_BOUND_BG2		0x0038
 #define EEPROM_TSSI_BOUND_BG2_MINUS2	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_BG2_MINUS1	FIELD16(0xff00)
 
@@ -2428,7 +2439,6 @@ struct mac_iveiv_entry {
  * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
  *        increased by (agc_step * 1)
  */
-#define EEPROM_TSSI_BOUND_BG3		0x0039
 #define EEPROM_TSSI_BOUND_BG3_REF	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_BG3_PLUS1	FIELD16(0xff00)
 
@@ -2439,7 +2449,6 @@ struct mac_iveiv_entry {
  * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
  *        increased by (agc_step * 3)
  */
-#define EEPROM_TSSI_BOUND_BG4		0x003a
 #define EEPROM_TSSI_BOUND_BG4_PLUS2	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_BG4_PLUS3	FIELD16(0xff00)
 
@@ -2449,15 +2458,12 @@ struct mac_iveiv_entry {
  *        increased by (agc_step * 4)
  * AGC_STEP: Temperature compensation step.
  */
-#define EEPROM_TSSI_BOUND_BG5		0x003b
 #define EEPROM_TSSI_BOUND_BG5_PLUS4	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_BG5_AGC_STEP	FIELD16(0xff00)
 
 /*
  * EEPROM TXPOWER 802.11A
  */
-#define EEPROM_TXPOWER_A1		0x003c
-#define EEPROM_TXPOWER_A2		0x0053
 #define EEPROM_TXPOWER_A_SIZE		6
 #define EEPROM_TXPOWER_A_1		FIELD16(0x00ff)
 #define EEPROM_TXPOWER_A_2		FIELD16(0xff00)
@@ -2469,7 +2475,6 @@ struct mac_iveiv_entry {
  * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
  *         reduced by (agc_step * -3)
  */
-#define EEPROM_TSSI_BOUND_A1		0x006a
 #define EEPROM_TSSI_BOUND_A1_MINUS4	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_A1_MINUS3	FIELD16(0xff00)
 
@@ -2480,7 +2485,6 @@ struct mac_iveiv_entry {
  * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
  *         reduced by (agc_step * -1)
  */
-#define EEPROM_TSSI_BOUND_A2		0x006b
 #define EEPROM_TSSI_BOUND_A2_MINUS2	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_A2_MINUS1	FIELD16(0xff00)
 
@@ -2490,7 +2494,6 @@ struct mac_iveiv_entry {
  * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
  *        increased by (agc_step * 1)
  */
-#define EEPROM_TSSI_BOUND_A3		0x006c
 #define EEPROM_TSSI_BOUND_A3_REF	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_A3_PLUS1	FIELD16(0xff00)
 
@@ -2501,7 +2504,6 @@ struct mac_iveiv_entry {
  * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
  *        increased by (agc_step * 3)
  */
-#define EEPROM_TSSI_BOUND_A4		0x006d
 #define EEPROM_TSSI_BOUND_A4_PLUS2	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_A4_PLUS3	FIELD16(0xff00)
 
@@ -2511,14 +2513,12 @@ struct mac_iveiv_entry {
  *        increased by (agc_step * 4)
  * AGC_STEP: Temperature compensation step.
  */
-#define EEPROM_TSSI_BOUND_A5		0x006e
 #define EEPROM_TSSI_BOUND_A5_PLUS4	FIELD16(0x00ff)
 #define EEPROM_TSSI_BOUND_A5_AGC_STEP	FIELD16(0xff00)
 
 /*
  * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode
  */
-#define EEPROM_TXPOWER_BYRATE		0x006f
 #define EEPROM_TXPOWER_BYRATE_SIZE	9
 
 #define EEPROM_TXPOWER_BYRATE_RATE0	FIELD16(0x000f)
@@ -2529,7 +2529,6 @@ struct mac_iveiv_entry {
 /*
  * EEPROM BBP.
  */
-#define	EEPROM_BBP_START		0x0078
 #define EEPROM_BBP_SIZE			16
 #define EEPROM_BBP_VALUE		FIELD16(0x00ff)
 #define EEPROM_BBP_REG_ID		FIELD16(0xff00)
-- 
1.7.10


^ permalink raw reply related

* [PATCH 2/5] rt2x00: rt2800lib: introduce local EEPROM access functions
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
In-Reply-To: <1372269318-30233-1-git-send-email-juhosg@openwrt.org>

The patch adds rt2800 specific functions for
EEPROM data access and changes the code to use
these instead of the generic rt2x00_eeprom_*
variants.

To avoid functional changes, the new functions
are wrappers around the corresponding generic
rt2x00_eeprom_* routines for now. Functional
changes will be implemented in additional patches.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |  165 ++++++++++++++++++-------------
 1 file changed, 95 insertions(+), 70 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 1f80ea5..522f0b1 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -221,6 +221,24 @@ static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev,
 	mutex_unlock(&rt2x00dev->csr_mutex);
 }
 
+static void *rt2800_eeprom_addr(struct rt2x00_dev *rt2x00dev,
+				const enum rt2800_eeprom_word word)
+{
+	return rt2x00_eeprom_addr(rt2x00dev, word);
+}
+
+static void rt2800_eeprom_read(struct rt2x00_dev *rt2x00dev,
+			       const enum rt2800_eeprom_word word, u16 *data)
+{
+	rt2x00_eeprom_read(rt2x00dev, word, data);
+}
+
+static void rt2800_eeprom_write(struct rt2x00_dev *rt2x00dev,
+				const enum rt2800_eeprom_word word, u16 data)
+{
+	rt2x00_eeprom_write(rt2x00dev, word, data);
+}
+
 static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
 {
 	u32 reg;
@@ -609,16 +627,16 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2)
 	u8 offset2;
 
 	if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &eeprom);
 		offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET0);
 		offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET1);
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom);
 		offset2 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_OFFSET2);
 	} else {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &eeprom);
 		offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A_OFFSET0);
 		offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A_OFFSET1);
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom);
 		offset2 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_OFFSET2);
 	}
 
@@ -890,6 +908,9 @@ const struct rt2x00debug rt2800_rt2x00debug = {
 		.word_count	= CSR_REG_SIZE / sizeof(u32),
 	},
 	.eeprom	= {
+		/* NOTE: The local EEPROM access functions can't
+		 * be used here, use the generic versions instead.
+		 */
 		.read		= rt2x00_eeprom_read,
 		.write		= rt2x00_eeprom_write,
 		.word_base	= EEPROM_BASE,
@@ -1547,7 +1568,7 @@ static void rt2800_config_3572bt_ant(struct rt2x00_dev *rt2x00dev)
 	led_r_mode = rt2x00_get_field32(reg, LED_CFG_LED_POLAR) ? 0 : 3;
 	if (led_g_mode != rt2x00_get_field32(reg, LED_CFG_G_LED_MODE) ||
 	    led_r_mode != rt2x00_get_field32(reg, LED_CFG_R_LED_MODE)) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
 		led_ctrl = rt2x00_get_field16(eeprom, EEPROM_FREQ_LED_MODE);
 		if (led_ctrl == 0 || led_ctrl > 0x40) {
 			rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE, led_g_mode);
@@ -1622,7 +1643,7 @@ void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant)
 		    rt2x00_rt(rt2x00dev, RT3090) ||
 		    rt2x00_rt(rt2x00dev, RT3352) ||
 		    rt2x00_rt(rt2x00dev, RT3390)) {
-			rt2x00_eeprom_read(rt2x00dev,
+			rt2800_eeprom_read(rt2x00dev,
 					   EEPROM_NIC_CONF1, &eeprom);
 			if (rt2x00_get_field16(eeprom,
 						EEPROM_NIC_CONF1_ANT_DIVERSITY))
@@ -1659,16 +1680,16 @@ static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev,
 	short lna_gain;
 
 	if (libconf->rf.channel <= 14) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
 		lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_BG);
 	} else if (libconf->rf.channel <= 64) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
 		lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
 	} else if (libconf->rf.channel <= 128) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom);
 		lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_LNA_A1);
 	} else {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom);
 		lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_LNA_A2);
 	}
 
@@ -2798,62 +2819,62 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
 	 * Example TSSI bounds  0xF0 0xD0 0xB5 0xA0 0x88 0x45 0x25 0x15 0x00
 	 */
 	if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG1, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG1, &eeprom);
 		tssi_bounds[0] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG1_MINUS4);
 		tssi_bounds[1] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG1_MINUS3);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG2, &eeprom);
 		tssi_bounds[2] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG2_MINUS2);
 		tssi_bounds[3] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG2_MINUS1);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG3, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG3, &eeprom);
 		tssi_bounds[4] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG3_REF);
 		tssi_bounds[5] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG3_PLUS1);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG4, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG4, &eeprom);
 		tssi_bounds[6] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG4_PLUS2);
 		tssi_bounds[7] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG4_PLUS3);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG5, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG5, &eeprom);
 		tssi_bounds[8] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_BG5_PLUS4);
 
 		step = rt2x00_get_field16(eeprom,
 					  EEPROM_TSSI_BOUND_BG5_AGC_STEP);
 	} else {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A1, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A1, &eeprom);
 		tssi_bounds[0] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A1_MINUS4);
 		tssi_bounds[1] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A1_MINUS3);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A2, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A2, &eeprom);
 		tssi_bounds[2] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A2_MINUS2);
 		tssi_bounds[3] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A2_MINUS1);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A3, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A3, &eeprom);
 		tssi_bounds[4] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A3_REF);
 		tssi_bounds[5] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A3_PLUS1);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A4, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A4, &eeprom);
 		tssi_bounds[6] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A4_PLUS2);
 		tssi_bounds[7] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A4_PLUS3);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A5, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A5, &eeprom);
 		tssi_bounds[8] = rt2x00_get_field16(eeprom,
 					EEPROM_TSSI_BOUND_A5_PLUS4);
 
@@ -2899,7 +2920,7 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,
 	u8 comp_type;
 	int comp_value = 0;
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_DELTA, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_DELTA, &eeprom);
 
 	/*
 	 * HT40 compensation not required.
@@ -2974,12 +2995,12 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
 		 * .11b data rate need add additional 4dbm
 		 * when calculating eirp txpower.
 		 */
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + 1,
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + 1,
 				   &eeprom);
 		criterion = rt2x00_get_field16(eeprom,
 					       EEPROM_TXPOWER_BYRATE_RATE0);
 
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER,
+		rt2800_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER,
 				   &eeprom);
 
 		if (band == IEEE80211_BAND_2GHZ)
@@ -3080,7 +3101,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
 		rt2800_register_read(rt2x00dev, offset, &reg);
 
 		/* read the next four txpower values */
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i,
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i,
 				   &eeprom);
 
 		is_rate_b = i ? 0 : 1;
@@ -3129,7 +3150,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
 		rt2x00_set_field32(&reg, TX_PWR_CFG_RATE3, txpower);
 
 		/* read the next four txpower values */
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i + 1,
+		rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i + 1,
 				   &eeprom);
 
 		is_rate_b = 0;
@@ -3528,7 +3549,8 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
 		if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
 		    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
 		    rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
-			rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+			rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1,
+					   &eeprom);
 			if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
 				rt2800_register_write(rt2x00dev, TX_SW_CFG2,
 						      0x0000002c);
@@ -3989,7 +4011,7 @@ static void rt2800_disable_unused_dac_adc(struct rt2x00_dev *rt2x00dev)
 	u8 value;
 
 	rt2800_bbp_read(rt2x00dev, 138, &value);
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
 		value |= 0x20;
 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
@@ -4402,7 +4424,7 @@ static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
 
 	rt2800_disable_unused_dac_adc(rt2x00dev);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
 	div_mode = rt2x00_get_field16(eeprom,
 				      EEPROM_NIC_CONF1_ANT_DIVERSITY);
 	ant = (div_mode == 3) ? 1 : 0;
@@ -4488,7 +4510,7 @@ static void rt2800_init_bbp_5592(struct rt2x00_dev *rt2x00dev)
 
 	rt2800_bbp4_mac_if_ctrl(rt2x00dev);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
 	div_mode = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_ANT_DIVERSITY);
 	ant = (div_mode == 3) ? 1 : 0;
 	rt2800_bbp_read(rt2x00dev, 152, &value);
@@ -4557,7 +4579,7 @@ static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
 	}
 
 	for (i = 0; i < EEPROM_BBP_SIZE; i++) {
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom);
 
 		if (eeprom != 0xffff && eeprom != 0x0000) {
 			reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID);
@@ -4728,7 +4750,7 @@ static void rt2800_normal_mode_setup_3xxx(struct rt2x00_dev *rt2x00dev)
 	if (rt2x00_rt(rt2x00dev, RT3090)) {
 		/*  Turn off unused DAC1 and ADC1 to reduce power consumption */
 		rt2800_bbp_read(rt2x00dev, 138, &bbp);
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
 		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
 			rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0);
 		if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
@@ -4778,7 +4800,7 @@ static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev)
 
 	/*  Turn off unused DAC1 and ADC1 to reduce power consumption */
 	rt2800_bbp_read(rt2x00dev, 138, &reg);
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1)
 		rt2x00_set_field8(&reg, BBP138_RX_ADC1, 0);
 	if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1)
@@ -4884,7 +4906,8 @@ static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev)
 		rt2x00_set_field32(&reg, LDO_CFG0_BGSEL, 1);
 		if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
 		    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) {
-			rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+			rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1,
+					   &eeprom);
 			if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST))
 				rt2x00_set_field32(&reg, LDO_CFG0_LDO_CORE_VLEVEL, 3);
 			else
@@ -5456,15 +5479,15 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Initialize LED control
 	 */
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_AG_CONF, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_LED_AG_CONF, &word);
 	rt2800_mcu_request(rt2x00dev, MCU_LED_AG_CONF, 0xff,
 			   word & 0xff, (word >> 8) & 0xff);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_ACT_CONF, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_LED_ACT_CONF, &word);
 	rt2800_mcu_request(rt2x00dev, MCU_LED_ACT_CONF, 0xff,
 			   word & 0xff, (word >> 8) & 0xff);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_POLARITY, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_LED_POLARITY, &word);
 	rt2800_mcu_request(rt2x00dev, MCU_LED_LED_POLARITY, 0xff,
 			   word & 0xff, (word >> 8) & 0xff);
 
@@ -5578,18 +5601,18 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Start validation of the data that has been read.
 	 */
-	mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
+	mac = rt2800_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
 	if (!is_valid_ether_addr(mac)) {
 		eth_random_addr(mac);
 		rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);
 	}
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &word);
 	if (word == 0xffff) {
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2);
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1);
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
 		rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
 	} else if (rt2x00_rt(rt2x00dev, RT2860) ||
 		   rt2x00_rt(rt2x00dev, RT2872)) {
@@ -5598,10 +5621,10 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 		 */
 		if (rt2x00_get_field16(word, EEPROM_NIC_CONF0_RXPATH) > 2)
 			rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
 	}
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &word);
 	if (word == 0xffff) {
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_HW_RADIO, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC, 0);
@@ -5618,24 +5641,24 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_INTERNAL_TX_ALC, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BT_COEXIST, 0);
 		rt2x00_set_field16(&word, EEPROM_NIC_CONF1_DAC_TEST, 0);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word);
 		rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word);
 	}
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ, &word);
 	if ((word & 0x00ff) == 0x00ff) {
 		rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
 		rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word);
 	}
 	if ((word & 0xff00) == 0xff00) {
 		rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE,
 				   LED_MODE_TXRX_ACTIVITY);
 		rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221);
-		rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_FREQ, word);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221);
+		rt2800_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8);
 		rt2x00_eeprom_dbg(rt2x00dev, "Led Mode: 0x%04x\n", word);
 	}
 
@@ -5644,17 +5667,17 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 	 * lna0 as correct value. Note that EEPROM_LNA
 	 * is never validated.
 	 */
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &word);
 	default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
-	rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
+	rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
 	if ((word & 0x00ff) != 0x00ff) {
 		drv_data->txmixer_gain_24g =
 			rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_BG_VAL);
@@ -5662,16 +5685,16 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 		drv_data->txmixer_gain_24g = 0;
 	}
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
 	if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
 	    rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
 		rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
 				   default_lna_gain);
-	rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
+	rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A, &word);
 	if ((word & 0x00ff) != 0x00ff) {
 		drv_data->txmixer_gain_5g =
 			rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_A_VAL);
@@ -5679,21 +5702,21 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 		drv_data->txmixer_gain_5g = 0;
 	}
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0);
-	rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
+	rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
 	if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
 		rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
 	if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
 	    rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
 		rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
 				   default_lna_gain);
-	rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
+	rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
 
 	return 0;
 }
@@ -5707,7 +5730,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Read EEPROM word for configuration.
 	 */
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
 
 	/*
 	 * Identify RF chipset by EEPROM value
@@ -5717,7 +5740,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	if (rt2x00_rt(rt2x00dev, RT3290) ||
 	    rt2x00_rt(rt2x00dev, RT5390) ||
 	    rt2x00_rt(rt2x00dev, RT5392))
-		rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
+		rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
 	else
 		rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
 
@@ -5757,7 +5780,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	rt2x00dev->default_ant.rx_chain_num =
 	    rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH);
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
 
 	if (rt2x00_rt(rt2x00dev, RT3070) ||
 	    rt2x00_rt(rt2x00dev, RT3090) ||
@@ -5810,7 +5833,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Read frequency offset and RF programming sequence.
 	 */
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
 	rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
 
 	/*
@@ -5827,7 +5850,7 @@ static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Check if support EIRP tx power limit feature.
 	 */
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER, &eeprom);
 
 	if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) <
 					EIRP_MAX_TX_POWER_LIMIT)
@@ -6148,7 +6171,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
-				rt2x00_eeprom_addr(rt2x00dev,
+				rt2800_eeprom_addr(rt2x00dev,
 						   EEPROM_MAC_ADDR_0));
 
 	/*
@@ -6164,7 +6187,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	rt2x00dev->hw->max_report_rates = 7;
 	rt2x00dev->hw->max_rate_tries = 1;
 
-	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
+	rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom);
 
 	/*
 	 * Initialize hw_mode information.
@@ -6264,8 +6287,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 
 	spec->channels_info = info;
 
-	default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
-	default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
+	default_power1 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
+	default_power2 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
 
 	for (i = 0; i < 14; i++) {
 		info[i].default_power1 = default_power1[i];
@@ -6273,8 +6296,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	}
 
 	if (spec->num_channels > 14) {
-		default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1);
-		default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
+		default_power1 = rt2800_eeprom_addr(rt2x00dev,
+						    EEPROM_TXPOWER_A1);
+		default_power2 = rt2800_eeprom_addr(rt2x00dev,
+						    EEPROM_TXPOWER_A2);
 
 		for (i = 14; i < spec->num_channels; i++) {
 			info[i].default_power1 = default_power1[i - 14];
-- 
1.7.10


^ permalink raw reply related

* [PATCH 5/5] rt2x00: rt2800lib: add EEPROM map for the RT3593 chipset
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
In-Reply-To: <1372269318-30233-1-git-send-email-juhosg@openwrt.org>

Three-chain devices are using a different
EEPROM layout than the rest of the chipsets.
Add a new map which describes the new layout
and use that for the RT3593 chipset.

The index values has been computed from the
EEPROM_EXT_* defines, which can be found in
the 'include/chip/rt3593.h' file in the
Ralink DPO_RT5572_LinuxSTA_2.6.0.1_20120629
driver.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800.h    |    6 ++++
 drivers/net/wireless/rt2x00/rt2800lib.c |   48 ++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index bc5c695..9216834 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -2244,6 +2244,12 @@ enum rt2800_eeprom_word {
 	EEPROM_TSSI_BOUND_A5,
 	EEPROM_TXPOWER_BYRATE,
 	EEPROM_BBP_START,
+
+	/* IDs for extended EEPROM format used by three-chain devices */
+	EEPROM_EXT_LNA2,
+	EEPROM_EXT_TXPOWER_BG3,
+	EEPROM_EXT_TXPOWER_A3,
+
 	/* New values must be added before this */
 	EEPROM_WORD_COUNT
 };
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9ff62b0..7b216f9 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -261,6 +261,48 @@ static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = {
 	[EEPROM_BBP_START]		= 0x0078,
 };
 
+static const unsigned int rt2800_eeprom_map_ext[EEPROM_WORD_COUNT] = {
+	[EEPROM_CHIP_ID]		= 0x0000,
+	[EEPROM_VERSION]		= 0x0001,
+	[EEPROM_MAC_ADDR_0]		= 0x0002,
+	[EEPROM_MAC_ADDR_1]		= 0x0003,
+	[EEPROM_MAC_ADDR_2]		= 0x0004,
+	[EEPROM_NIC_CONF0]		= 0x001a,
+	[EEPROM_NIC_CONF1]		= 0x001b,
+	[EEPROM_NIC_CONF2]		= 0x001c,
+	[EEPROM_EIRP_MAX_TX_POWER]	= 0x0020,
+	[EEPROM_FREQ]			= 0x0022,
+	[EEPROM_LED_AG_CONF]		= 0x0023,
+	[EEPROM_LED_ACT_CONF]		= 0x0024,
+	[EEPROM_LED_POLARITY]		= 0x0025,
+	[EEPROM_LNA]			= 0x0026,
+	[EEPROM_EXT_LNA2]		= 0x0027,
+	[EEPROM_RSSI_BG]		= 0x0028,
+	[EEPROM_TXPOWER_DELTA]		= 0x0028, /* Overlaps with RSSI_BG */
+	[EEPROM_RSSI_BG2]		= 0x0029,
+	[EEPROM_TXMIXER_GAIN_BG]	= 0x0029, /* Overlaps with RSSI_BG2 */
+	[EEPROM_RSSI_A]			= 0x002a,
+	[EEPROM_RSSI_A2]		= 0x002b,
+	[EEPROM_TXMIXER_GAIN_A]		= 0x002b, /* Overlaps with RSSI_A2 */
+	[EEPROM_TXPOWER_BG1]		= 0x0030,
+	[EEPROM_TXPOWER_BG2]		= 0x0037,
+	[EEPROM_EXT_TXPOWER_BG3]	= 0x003e,
+	[EEPROM_TSSI_BOUND_BG1]		= 0x0045,
+	[EEPROM_TSSI_BOUND_BG2]		= 0x0046,
+	[EEPROM_TSSI_BOUND_BG3]		= 0x0047,
+	[EEPROM_TSSI_BOUND_BG4]		= 0x0048,
+	[EEPROM_TSSI_BOUND_BG5]		= 0x0049,
+	[EEPROM_TXPOWER_A1]		= 0x004b,
+	[EEPROM_TXPOWER_A2]		= 0x0065,
+	[EEPROM_EXT_TXPOWER_A3]		= 0x007f,
+	[EEPROM_TSSI_BOUND_A1]		= 0x009a,
+	[EEPROM_TSSI_BOUND_A2]		= 0x009b,
+	[EEPROM_TSSI_BOUND_A3]		= 0x009c,
+	[EEPROM_TSSI_BOUND_A4]		= 0x009d,
+	[EEPROM_TSSI_BOUND_A5]		= 0x009e,
+	[EEPROM_TXPOWER_BYRATE]		= 0x00a0,
+};
+
 static unsigned int rt2800_eeprom_word_index(struct rt2x00_dev *rt2x00dev,
 					     const enum rt2800_eeprom_word word)
 {
@@ -272,7 +314,11 @@ static unsigned int rt2800_eeprom_word_index(struct rt2x00_dev *rt2x00dev,
 		return 0;
 	}
 
-	map = rt2800_eeprom_map;
+	if (rt2x00_rt(rt2x00dev, RT3593))
+		map = rt2800_eeprom_map_ext;
+	else
+		map = rt2800_eeprom_map;
+
 	index = map[word];
 
 	if (WARN_ON(word != EEPROM_CHIP_ID && index == 0)) {
-- 
1.7.10


^ permalink raw reply related

* [PATCH 4/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word_index helper
From: Gabor Juhos @ 2013-06-26 17:55 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
In-Reply-To: <1372269318-30233-1-git-send-email-juhosg@openwrt.org>

Instead of assign the offset value to the
enum directly use a new helper function to
convert a rt2800_eeprom_word enum into an
index of the rt2x00_dev->eeprom array.

The patch does not change the existing
behaviour, but makes it possible to add
support for three-chain devices which are
using a different EEPROM layout.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800.h    |   76 +++++++++++++-------------
 drivers/net/wireless/rt2x00/rt2800lib.c |   88 +++++++++++++++++++++++++++++--
 2 files changed, 123 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index 0647039..bc5c695 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -2207,43 +2207,45 @@ struct mac_iveiv_entry {
  */
 
 enum rt2800_eeprom_word {
-	EEPROM_CHIP_ID		= 0x0000,
-	EEPROM_VERSION		= 0x0001,
-	EEPROM_MAC_ADDR_0	= 0x0002,
-	EEPROM_MAC_ADDR_1	= 0x0003,
-	EEPROM_MAC_ADDR_2	= 0x0004,
-	EEPROM_NIC_CONF0	= 0x001a,
-	EEPROM_NIC_CONF1	= 0x001b,
-	EEPROM_FREQ		= 0x001d,
-	EEPROM_LED_AG_CONF	= 0x001e,
-	EEPROM_LED_ACT_CONF	= 0x001f,
-	EEPROM_LED_POLARITY	= 0x0020,
-	EEPROM_NIC_CONF2	= 0x0021,
-	EEPROM_LNA		= 0x0022,
-	EEPROM_RSSI_BG		= 0x0023,
-	EEPROM_RSSI_BG2		= 0x0024,
-	EEPROM_TXMIXER_GAIN_BG	= 0x0024, /* overlaps with RSSI_BG2 */
-	EEPROM_RSSI_A		= 0x0025,
-	EEPROM_RSSI_A2		= 0x0026,
-	EEPROM_TXMIXER_GAIN_A	= 0x0026, /* overlaps with RSSI_A2 */
-	EEPROM_EIRP_MAX_TX_POWER = 0x0027,
-	EEPROM_TXPOWER_DELTA	= 0x0028,
-	EEPROM_TXPOWER_BG1	= 0x0029,
-	EEPROM_TXPOWER_BG2	= 0x0030,
-	EEPROM_TSSI_BOUND_BG1	= 0x0037,
-	EEPROM_TSSI_BOUND_BG2	= 0x0038,
-	EEPROM_TSSI_BOUND_BG3	= 0x0039,
-	EEPROM_TSSI_BOUND_BG4	= 0x003a,
-	EEPROM_TSSI_BOUND_BG5	= 0x003b,
-	EEPROM_TXPOWER_A1	= 0x003c,
-	EEPROM_TXPOWER_A2	= 0x0053,
-	EEPROM_TSSI_BOUND_A1	= 0x006a,
-	EEPROM_TSSI_BOUND_A2	= 0x006b,
-	EEPROM_TSSI_BOUND_A3	= 0x006c,
-	EEPROM_TSSI_BOUND_A4	= 0x006d,
-	EEPROM_TSSI_BOUND_A5	= 0x006e,
-	EEPROM_TXPOWER_BYRATE	= 0x006f,
-	EEPROM_BBP_START	= 0x0078,
+	EEPROM_CHIP_ID = 0,
+	EEPROM_VERSION,
+	EEPROM_MAC_ADDR_0,
+	EEPROM_MAC_ADDR_1,
+	EEPROM_MAC_ADDR_2,
+	EEPROM_NIC_CONF0,
+	EEPROM_NIC_CONF1,
+	EEPROM_FREQ,
+	EEPROM_LED_AG_CONF,
+	EEPROM_LED_ACT_CONF,
+	EEPROM_LED_POLARITY,
+	EEPROM_NIC_CONF2,
+	EEPROM_LNA,
+	EEPROM_RSSI_BG,
+	EEPROM_RSSI_BG2,
+	EEPROM_TXMIXER_GAIN_BG,
+	EEPROM_RSSI_A,
+	EEPROM_RSSI_A2,
+	EEPROM_TXMIXER_GAIN_A,
+	EEPROM_EIRP_MAX_TX_POWER,
+	EEPROM_TXPOWER_DELTA,
+	EEPROM_TXPOWER_BG1,
+	EEPROM_TXPOWER_BG2,
+	EEPROM_TSSI_BOUND_BG1,
+	EEPROM_TSSI_BOUND_BG2,
+	EEPROM_TSSI_BOUND_BG3,
+	EEPROM_TSSI_BOUND_BG4,
+	EEPROM_TSSI_BOUND_BG5,
+	EEPROM_TXPOWER_A1,
+	EEPROM_TXPOWER_A2,
+	EEPROM_TSSI_BOUND_A1,
+	EEPROM_TSSI_BOUND_A2,
+	EEPROM_TSSI_BOUND_A3,
+	EEPROM_TSSI_BOUND_A4,
+	EEPROM_TSSI_BOUND_A5,
+	EEPROM_TXPOWER_BYRATE,
+	EEPROM_BBP_START,
+	/* New values must be added before this */
+	EEPROM_WORD_COUNT
 };
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b59772a..9ff62b0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -221,22 +221,99 @@ static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev,
 	mutex_unlock(&rt2x00dev->csr_mutex);
 }
 
+static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = {
+	[EEPROM_CHIP_ID]		= 0x0000,
+	[EEPROM_VERSION]		= 0x0001,
+	[EEPROM_MAC_ADDR_0]		= 0x0002,
+	[EEPROM_MAC_ADDR_1]		= 0x0003,
+	[EEPROM_MAC_ADDR_2]		= 0x0004,
+	[EEPROM_NIC_CONF0]		= 0x001a,
+	[EEPROM_NIC_CONF1]		= 0x001b,
+	[EEPROM_FREQ]			= 0x001d,
+	[EEPROM_LED_AG_CONF]		= 0x001e,
+	[EEPROM_LED_ACT_CONF]		= 0x001f,
+	[EEPROM_LED_POLARITY]		= 0x0020,
+	[EEPROM_NIC_CONF2]		= 0x0021,
+	[EEPROM_LNA]			= 0x0022,
+	[EEPROM_RSSI_BG]		= 0x0023,
+	[EEPROM_RSSI_BG2]		= 0x0024,
+	[EEPROM_TXMIXER_GAIN_BG]	= 0x0024, /* overlaps with RSSI_BG2 */
+	[EEPROM_RSSI_A]			= 0x0025,
+	[EEPROM_RSSI_A2]		= 0x0026,
+	[EEPROM_TXMIXER_GAIN_A]		= 0x0026, /* overlaps with RSSI_A2 */
+	[EEPROM_EIRP_MAX_TX_POWER]	= 0x0027,
+	[EEPROM_TXPOWER_DELTA]		= 0x0028,
+	[EEPROM_TXPOWER_BG1]		= 0x0029,
+	[EEPROM_TXPOWER_BG2]		= 0x0030,
+	[EEPROM_TSSI_BOUND_BG1]		= 0x0037,
+	[EEPROM_TSSI_BOUND_BG2]		= 0x0038,
+	[EEPROM_TSSI_BOUND_BG3]		= 0x0039,
+	[EEPROM_TSSI_BOUND_BG4]		= 0x003a,
+	[EEPROM_TSSI_BOUND_BG5]		= 0x003b,
+	[EEPROM_TXPOWER_A1]		= 0x003c,
+	[EEPROM_TXPOWER_A2]		= 0x0053,
+	[EEPROM_TSSI_BOUND_A1]		= 0x006a,
+	[EEPROM_TSSI_BOUND_A2]		= 0x006b,
+	[EEPROM_TSSI_BOUND_A3]		= 0x006c,
+	[EEPROM_TSSI_BOUND_A4]		= 0x006d,
+	[EEPROM_TSSI_BOUND_A5]		= 0x006e,
+	[EEPROM_TXPOWER_BYRATE]		= 0x006f,
+	[EEPROM_BBP_START]		= 0x0078,
+};
+
+static unsigned int rt2800_eeprom_word_index(struct rt2x00_dev *rt2x00dev,
+					     const enum rt2800_eeprom_word word)
+{
+	const unsigned int *map;
+	unsigned int index;
+
+	if (WARN_ON(word >= EEPROM_WORD_COUNT)) {
+		rt2x00_warn(rt2x00dev, "invalid EEPROM word %d\n", word);
+		return 0;
+	}
+
+	map = rt2800_eeprom_map;
+	index = map[word];
+
+	if (WARN_ON(word != EEPROM_CHIP_ID && index == 0)) {
+		/* Index 0 is valid only for EEPROM_CHIP_ID.
+		 * Otherwise it means that the offset of the
+		 * given word is not initialized in the map,
+		 * or that the field is not usable on the
+		 * actual chipset.
+		 */
+		rt2x00_warn(rt2x00dev, "invalid access of EEPROM word %d\n",
+			    word);
+	}
+
+	return index;
+}
+
 static void *rt2800_eeprom_addr(struct rt2x00_dev *rt2x00dev,
 				const enum rt2800_eeprom_word word)
 {
-	return rt2x00_eeprom_addr(rt2x00dev, word);
+	unsigned int index;
+
+	index = rt2800_eeprom_word_index(rt2x00dev, word);
+	return rt2x00_eeprom_addr(rt2x00dev, index);
 }
 
 static void rt2800_eeprom_read(struct rt2x00_dev *rt2x00dev,
 			       const enum rt2800_eeprom_word word, u16 *data)
 {
-	rt2x00_eeprom_read(rt2x00dev, word, data);
+	unsigned int index;
+
+	index = rt2800_eeprom_word_index(rt2x00dev, word);
+	rt2x00_eeprom_read(rt2x00dev, index, data);
 }
 
 static void rt2800_eeprom_write(struct rt2x00_dev *rt2x00dev,
 				const enum rt2800_eeprom_word word, u16 data)
 {
-	rt2x00_eeprom_write(rt2x00dev, word, data);
+	unsigned int index;
+
+	index = rt2800_eeprom_word_index(rt2x00dev, word);
+	rt2x00_eeprom_write(rt2x00dev, index, data);
 }
 
 static void rt2800_eeprom_read_from_array(struct rt2x00_dev *rt2x00dev,
@@ -244,7 +321,10 @@ static void rt2800_eeprom_read_from_array(struct rt2x00_dev *rt2x00dev,
 					  unsigned int offset,
 					  u16 *data)
 {
-	rt2x00_eeprom_read(rt2x00dev, array + offset, data);
+	unsigned int index;
+
+	index = rt2800_eeprom_word_index(rt2x00dev, array);
+	rt2x00_eeprom_read(rt2x00dev, index + offset, data);
 }
 
 static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
-- 
1.7.10


^ permalink raw reply related

* Re: [RFC] mac80211: Use libnl-configurable values for retry counts
From: Felix Fietkau @ 2013-06-26 18:32 UTC (permalink / raw)
  To: Jean-Pierre Tosoni; +Cc: linux-wireless
In-Reply-To: <1372267723-25072-1-git-send-email-jp.tosoni@acksys.fr>

On 2013-06-26 7:28 PM, Jean-Pierre Tosoni wrote:
> From: J.P. Tosoni <jp.tosoni@acksys.fr>
> 
> In the rate control algorithms, the maximum retry count is limited by
> a) a constant value obtained from the hardware driver
> b) a constant limit (6ms) on the time allowed for all
>    retries of each frame.
> 
> Replace the retry count by existing configurable values from nl80211.
> Use wiphy->retry_short for management frames.
> Use wiphy->retry_long for other frames.
That seems a bit arbitrary.

> diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
> index ac7ef54..502d0c9 100644
> --- a/net/mac80211/rc80211_minstrel.c
> +++ b/net/mac80211/rc80211_minstrel.c
> @@ -592,11 +592,7 @@ minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
>  	/* maximum time that the hw is allowed to stay in one MRR segment */
>  	mp->segment_size = 6000;
>  
> -	if (hw->max_rate_tries > 0)
> -		mp->max_retry = hw->max_rate_tries;
> -	else
> -		/* safe default, does not necessarily have to match hw properties */
> -		mp->max_retry = 7;
> +	mp->max_retry = hw->conf.long_frame_max_tx_count;
minstrel_alloc is called at rate control init time. You're not making
max_retry configurable here, it'll pick the default value of
hw->conf.long_frame_max_tx_count and never update it again.

- Felix

^ permalink raw reply

* RE: [PATCH v4 2/2] cfg80211/nl80211: Add packet coalesce support
From: Amitkumar Karwar @ 2013-06-26 18:53 UTC (permalink / raw)
  To: Johannes Berg, Bing Zhao
  Cc: linux-wireless@vger.kernel.org, Luis R. Rodriguez, Jouni Malinen,
	Vasanthakumar Thiagarajan, Senthil Balasubramanian,
	Luciano Coelho
In-Reply-To: <1372259597.13529.11.camel@jlt4.sipsolutions.net>


Hi Johannes,

Thanks for your comments.

>> +struct cfg80211_coalesce {
>> +     struct cfg80211_coalesce_rules **rules;

>I don't really see why this should be a double pointer? The
>coalesce_rules struct is small enough that you could just allocate an
>array of that, no?

Actually it came from our previous design which used to add one rule per iw command by allocating an array of rule pointers.
You are right. We will use normal pointer and allocate an array of rules in updated version.

>>  /**
>> + * struct wiphy_coalesce_support - coalesce support data
>> + * @n_rules: maximum number of coalesce rules
>> + * @n_patterns: number of supported patterns
>> + *   (see nl80211.h for the pattern definition)
>> + * @pattern_max_len: maximum length of each pattern
>> + * @pattern_min_len: minimum length of each pattern
>> + * @max_pkt_offset: maximum Rx packet offset

>Should there be any limits on the timer? Will the firmware actually work
>if I set it to (useless) values like 2^32-1 msecs?

Makes sense. There should be a limit for colaescing delay. We will add new parameter 'max_delay'.

>Also -- is n_patterns per rule, or global? It seems global, but in the
>rules you can have multiple patterns per rule?

n_patterns is per rule. We will update description of 'n_patterns'.

>> + * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
>> + *
>> + * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.

> I'd prefer no space between the two :)
Sure.

>> +struct nl80211_coalesce_rule_support {
>> +     __u32 max_rules;
>> +     struct nl80211_pattern_support pat;

>(timing stuff would also go here, I suppose)
Yes. The new parameter will be added here.


>> +     new_rule->delay = nla_get_u32(tb[NL80211_ATTR_COALESCE_RULE_DELAY]);
>no check that it actually exists?

>> +     new_rule->condition =
>> +             nla_get_u32(tb[NL80211_ATTR_COALESCE_RULE_CONDITION]);
>ditto. easy to crash, no?

Thanks. We will add checks to see if these attributes are present.

> +     if (!rdev->wiphy.coalesce)
> +             return -EOPNOTSUPP;
> +     if (!rdev->ops->set_coalesce)
> +             return -EOPNOTSUPP;

>could combine the conditions :)
Ack.

>> +     new_coalesce = kzalloc(sizeof(*new_coalesce), GFP_KERNEL);
>> +     new_coalesce->rules = kcalloc(coalesce->n_rules,
>> +                                     sizeof(void *), GFP_KERNEL);
>*kaboom*
>> +     cfg80211_rdev_free_coalesce(rdev->coalesce);
>> +     rdev->coalesce = new_coalesce;
>> +
>> +     err = rdev->ops->set_coalesce(&rdev->wiphy, rdev->coalesce);
>> +     if (err)
>> +             goto error;
>> +
>> +     return 0;
>> +error:
>> +     cfg80211_rdev_free_coalesce(new_coalesce);

>*kaboom* if it ever fails, and you then do get_coalesce -- should
>probably assign only after setting the new value successfully?

Thanks for pointing this out. We will take care of this error path.

Regards,
Amitkumar Karwar

^ permalink raw reply

* Re: regression after, " ath9k_htc: Add support for mesh interfaces"
From: Thomas Pedersen @ 2013-06-26 18:52 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Oleksij Rempel, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org, Javier Cardona
In-Reply-To: <1372231882.8157.0.camel@jlt4.sipsolutions.net>

On Wed, Jun 26, 2013 at 12:31 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2013-06-25 at 13:05 -0700, Thomas Pedersen wrote:
>
>> That warning is triggered by wiphy_verify_combinations():
>>
>>                         if (WARN_ON((wiphy->interface_modes & types) != types))
>>                                 return -EINVAL;
>>
>> But before that, the mesh iftype bit is cleared in ieee80211_register_hw():
>>
>> #ifndef CONFIG_MAC80211_MESH
>>         /* mesh depends on Kconfig, but drivers should set it if they want */
>>         local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
>> #endif
>>
>> It seems the intention was to avoid an #ifdef CONFIG_MAC80211_MESH in
>> every driver, but then mac80211 also has to clear the MESH_POINT bit
>> for each ieee80211_iface_limit? I don't really see a cleaner way of
>> resolving this.
>
> The problem is that the data structures there are const, so we can't
> modify them. I think the other drivers just have an #ifdef on
> MAC80211_MESH or so in there.

Indeed, ath5k and rt2x00 at least already do this.

Thanks,

--
Thomas

^ permalink raw reply

* Re: regression after, " ath9k_htc: Add support for mesh interfaces"
From: Oleksij Rempel @ 2013-06-26 19:16 UTC (permalink / raw)
  To: Thomas Pedersen
  Cc: Johannes Berg, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org, Javier Cardona
In-Reply-To: <CAG6hwVNk-sA_RFYJN+MzSURwWZYd-X3Uu8g2sRP8AfyKWQUQbw@mail.gmail.com>

Am 26.06.2013 20:52, schrieb Thomas Pedersen:
> On Wed, Jun 26, 2013 at 12:31 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
>> On Tue, 2013-06-25 at 13:05 -0700, Thomas Pedersen wrote:
>>
>>> That warning is triggered by wiphy_verify_combinations():
>>>
>>>                          if (WARN_ON((wiphy->interface_modes & types) != types))
>>>                                  return -EINVAL;
>>>
>>> But before that, the mesh iftype bit is cleared in ieee80211_register_hw():
>>>
>>> #ifndef CONFIG_MAC80211_MESH
>>>          /* mesh depends on Kconfig, but drivers should set it if they want */
>>>          local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
>>> #endif
>>>
>>> It seems the intention was to avoid an #ifdef CONFIG_MAC80211_MESH in
>>> every driver, but then mac80211 also has to clear the MESH_POINT bit
>>> for each ieee80211_iface_limit? I don't really see a cleaner way of
>>> resolving this.
>>
>> The problem is that the data structures there are const, so we can't
>> modify them. I think the other drivers just have an #ifdef on
>> MAC80211_MESH or so in there.
>
> Indeed, ath5k and rt2x00 at least already do this.
>
> Thanks,

I just discovered one more issue with mesh on ath9k* devices.
if i try to do "ifconfig mesh0 down" this task will freeze and after 
some time kernel will oops.

Steps to reproduce:
iw dev wlan2 interface add mesh0 type mp mesh_id mesh
iwconfig mesh0 channel 1
ifconfig mesh0 10.0.0.1 netmask 255.255.255.0 up
sleep 30
ifconfig mesh0 down

-- 
Regards,
Oleksij

^ permalink raw reply

* Re: Fwd: Re: TP-Link 8200ND - rtl8192cu module not loading / working
From: Larry Finger @ 2013-06-26 20:25 UTC (permalink / raw)
  To: shiki.biomernok; +Cc: linux-wireless
In-Reply-To: <51CB250A.3060900@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]

On 06/26/2013 12:29 PM, shiki.biomernok wrote:
> Hello Larry/Mailing list!
>
> I have compiled and installed the new wireless-testing kernel from git.
> I'm sure I used the new kernel, as the device lighted up as soon as I plugged
> in. (And I got some new atheros ac module at "make oldconfig".)
> There was no need for manual echo or modprobe.
>
> Yet, the device is not working. It dies at the very same step.
> Here is the dmesg: http://pastebin.com/C1MNdFiw
>
> Please, let me know if I can help with anything.
> Any debug option, patch or things like that.
>
> My offer is still there Larry, I'm willing to give you a full SSH access to the
> machine with this stuff plugged in.
> Besides that, I have no other idea.
>
>
> ! My router runs OpenWRT (latest stable), so I could also gather info from
> there. If it's possible.
> (I checked dmesg but there is nothing. Only some non-crucial info about the
> generic eth ports and such.)
>
> Thank you for the help.
>
> (By the way if the chip is rare (no other people will benefit), then I can just
> get it back and ask for a refund. But if others use it as well, then it's not a
> waste of time... I guess.)

I think the TP-Link 8200ND is relatively new. You have version 0x11 for your 
chip, and mine is 0x10. That could be a difference.

Whay are you forcing the module loading? As indicated by the (F) in the 
traceback, it looks as if all of them are being forced.

[   13.111932] BUG: unable to handle kernel NULL pointer dereference at 
0000000000000005
[   13.111943] IP: [<ffffffffa03196c7>] iwl_dbgfs_register+0x27/0x70 [iwldvm]
[   13.111944] PGD 0
[   13.111945] Oops: 0000 [#1] PREEMPT SMP
[   13.111964] Modules linked in: arc4(F) snd_hda_codec(F) snd_hwdep(F) 
snd_pcm(F) iwldvm(F+) snd_page_alloc(F) thinkpad_acpi(F) nvram(F) mac80211(F) 
snd_seq_midi(F) i915(F+) snd_seq_midi_event(F) drm_kms_helper(F) snd_rawmidi(F) 
drm(F) snd_seq(F) snd_timer(F) coretemp(F) snd_seq_device(F) r592(F) 
i2c_algo_bit(F) snd(F) iwlwifi(F) soundcore(F) tpm_tis(F) memstick(F) btusb(F) 
microcode(F) psmouse(F) bluetooth(F) serio_raw(F) wmi(F) cfg80211(F) video(F) 
lpc_ich(F) hid_generic(F) usbhid(F) hid(F) sdhci_pci(F) sdhci(F) ahci(F) 
libahci(F) e1000e(F) ptp(F) pps_core(F)
[   13.111967] CPU: 1 PID: 741 Comm: modprobe Tainted: GF 
3.10.0-rc7-wl-x1-1000hz-wifitesting #1
[   13.111968] Hardware name: LENOVO 208252G/208252G, BIOS 6FET92WW (3.22 ) 
12/14/2011
[   13.111969] task: ffff8801a3f5d640 ti: ffff8801a1b9e000 task.ti: ffff8801a1b9e000
[   13.111975] RIP: 0010:[<ffffffffa03196c7>]  [<ffffffffa03196c7>] 
iwl_dbgfs_register+0x27/0x70 [iwldvm]

To help us debug this matter, the attached patch will let you compile the vendor 
driver that you downloaded from the vendor site.

Larry



[-- Attachment #2: compile_warnings --]
[-- Type: text/plain, Size: 8899 bytes --]

Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_mlme_ext.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/core/rtw_mlme_ext.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_mlme_ext.c
@@ -1053,8 +1053,8 @@ unsigned int OnAuth(_adapter *padapter,
 	sa = GetAddr2Ptr(pframe);
 	
 	auth_mode = psecuritypriv->dot11AuthAlgrthm;
-	seq = cpu_to_le16(*(unsigned short *)((unsigned int)pframe + WLAN_HDR_A3_LEN + 2));
-	algorithm = cpu_to_le16(*(unsigned short *)((unsigned int)pframe + WLAN_HDR_A3_LEN));
+	seq = cpu_to_le16(*(unsigned short *)((unsigned long)pframe + WLAN_HDR_A3_LEN + 2));
+	algorithm = cpu_to_le16(*(unsigned short *)((unsigned long)pframe + WLAN_HDR_A3_LEN));
 
 	if (GetPrivacy(pframe))
 	{	
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_p2p.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/core/rtw_p2p.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_p2p.c
@@ -2595,7 +2595,7 @@ u8 process_p2p_group_negotation_confirm(
 		_rtw_memset( groupid, 0x00, 38 );
 		if ( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen) )
 		{
-			DBG_8192C( "[%s] Ssid = %s, ssidlen = %d\n", __FUNCTION__, &groupid[ETH_ALEN], strlen(&groupid[ETH_ALEN]) );
+			DBG_8192C( "[%s] Ssid = %s, ssidlen = %d\n", __FUNCTION__, &groupid[ETH_ALEN], (int)strlen(&groupid[ETH_ALEN]) );
 			_rtw_memcpy( pwdinfo->groupid_info.go_device_addr, &groupid[0], ETH_ALEN );
 			_rtw_memcpy( pwdinfo->groupid_info.ssid, &groupid[6], attr_contentlen - ETH_ALEN );			
 		}
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/rtw_recv.h
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/include/rtw_recv.h
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/rtw_recv.h
@@ -623,7 +623,7 @@ __inline static union recv_frame *rxmem_
 	//from any given member of recv_frame.
 	// rxmem indicates the any member/address in recv_frame
 	
-	return (union recv_frame*)(((uint)rxmem>>RXFRAME_ALIGN) <<RXFRAME_ALIGN) ;
+	return (union recv_frame*)(((ulong)rxmem>>RXFRAME_ALIGN) <<RXFRAME_ALIGN) ;
 	
 }
 
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_br_ext.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/core/rtw_br_ext.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_br_ext.c
@@ -126,11 +126,11 @@ static int skb_pull_and_merge(struct sk_
 	int tail_len;
 	unsigned long end, tail;
 
-	if ((src+len) > skb->tail || skb->len < len)
-		return -1;
-
 	tail = (unsigned long)skb->tail;
 	end = (unsigned long)src+len;
+	if ((end) > tail || skb->len < len)
+		return -1;
+
 	if (tail < end)
 		return -1;
 
@@ -1633,13 +1633,13 @@ void dhcp_flag_bcast(_adapter *priv, str
 
 			if(iph->protocol == IPPROTO_UDP) // UDP
 			{
-				struct udphdr *udph = (struct udphdr *)((unsigned int)iph + (iph->ihl << 2));
+				struct udphdr *udph = (struct udphdr *)((unsigned long)iph + (iph->ihl << 2));
 
 				if((udph->source == __constant_htons(CLIENT_PORT))
 					&& (udph->dest == __constant_htons(SERVER_PORT))) // DHCP request
 				{
 					struct dhcpMessage *dhcph =
-						(struct dhcpMessage *)((unsigned int)udph + sizeof(struct udphdr));
+						(struct dhcpMessage *)((unsigned long)udph + sizeof(struct udphdr));
 
 					if(dhcph->cookie == __constant_htonl(DHCP_MAGIC)) // match magic word
 					{
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_recv.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/core/rtw_recv.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/core/rtw_recv.c
@@ -3305,7 +3305,7 @@ static int amsdu_to_msdu(_adapter *padap
 			{
 				sub_skb->data = pdata;
 				sub_skb->len = nSubframe_Length;
-				sub_skb->tail = sub_skb->data + nSubframe_Length;
+				skb_set_tail_pointer(sub_skb, nSubframe_Length);
 			}
 			else
 			{
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/os_dep/linux/ioctl_linux.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/os_dep/linux/ioctl_linux.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/os_dep/linux/ioctl_linux.c
@@ -143,7 +143,7 @@ static void indicate_wx_custom_event(_ad
 	union iwreq_data wrqu;
 
 	if (strlen(msg) > IW_CUSTOM_MAX) {
-		DBG_871X("%s strlen(msg):%u > IW_CUSTOM_MAX:%u\n", __FUNCTION__ ,strlen(msg), IW_CUSTOM_MAX);
+		DBG_871X("%s strlen(msg):%u > IW_CUSTOM_MAX:%u\n", __FUNCTION__ ,(uint)strlen(msg), IW_CUSTOM_MAX);
 		return;
 	}
 
@@ -3865,7 +3865,7 @@ static int rtw_p2p_set_go_nego_ssid(stru
 	struct iw_point *pdata = &wrqu->data;
 	struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
 
-	DBG_8192C( "[%s] ssid = %s, len = %d\n", __FUNCTION__, extra, strlen( extra ) );
+	DBG_8192C( "[%s] ssid = %s, len = %d\n", __FUNCTION__, extra, (int)strlen( extra ) );
 	_rtw_memcpy( pwdinfo->nego_ssid, extra, strlen( extra ) );
 	pwdinfo->nego_ssidlen = strlen( extra );
 	
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/drv_types.h
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/include/drv_types.h
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/drv_types.h
@@ -462,10 +462,10 @@ struct _ADAPTER{
 	u8	bfirst_init;
 	u8	bHaltInProgress;
 	
-	_thread_hdl_	cmdThread;
-	_thread_hdl_	evtThread;
-	_thread_hdl_	xmitThread;
-	_thread_hdl_	recvThread;
+	void *cmdThread;
+	void *evtThread;
+	void *xmitThread;
+	void *recvThread;
 
 
 	NDIS_STATUS (*dvobj_init)(_adapter * adapter);
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/os_dep/linux/os_intfs.c
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/os_dep/linux/os_intfs.c
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/os_dep/linux/os_intfs.c
@@ -35,6 +35,10 @@
 #include <rtw_ioctl.h>
 #include <rtw_version.h>
 
+#ifdef PLATFORM_LINUX
+#include <linux/kthread.h>
+#endif
+
 #ifdef CONFIG_SDIO_HCI
 #include <sdio_osintf.h>
 #endif
@@ -255,6 +259,17 @@ static char rtw_proc_name[IFNAMSIZ];
 static struct proc_dir_entry *rtw_proc = NULL;
 static int	rtw_proc_cnt = 0;
 
+#ifndef create_proc_entry
+/* dummy routines */
+void rtw_proc_remove_one(struct net_device *dev)
+{
+}
+
+void rtw_proc_init_one(struct net_device *dev)
+{
+}
+
+#else	/* create_proc_entry not defined */
 void rtw_proc_init_one(struct net_device *dev)
 {
 	struct proc_dir_entry *dir_dev = NULL;
@@ -518,6 +533,7 @@ void rtw_proc_remove_one(struct net_devi
 	}
 }
 #endif
+#endif
 
 uint loadparam( _adapter *padapter,  _nic_hdl	pnetdev)
 {
@@ -790,27 +806,27 @@ u32 rtw_start_drv_threads(_adapter *pada
 	RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_start_drv_threads\n"));
 
 #ifdef CONFIG_SDIO_HCI
-	padapter->xmitThread = kernel_thread(rtw_xmit_thread, padapter, CLONE_FS|CLONE_FILES);
-	if(padapter->xmitThread < 0)
+	padapter->xmitThread = kthread_run(rtw_xmit_thread, padapter, "xmitThread");
+	if(IS_ERR(padapter->xmitThread))
 		_status = _FAIL;
 #endif
 
 #ifdef CONFIG_RECV_THREAD_MODE
-	padapter->recvThread = kernel_thread(recv_thread, padapter, CLONE_FS|CLONE_FILES);
-	if(padapter->recvThread < 0)
+	padapter->recvThread = kthread_run(recv_thread, padapter, "recvThread");
+	if(IS_ERR(padapter->recvThread))
 		_status = _FAIL;	
 #endif
 
-	padapter->cmdThread = kernel_thread(rtw_cmd_thread, padapter, CLONE_FS|CLONE_FILES);
-	if(padapter->cmdThread < 0)
+	padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "cmdThread");
+	if(IS_ERR(padapter->cmdThread))
 		_status = _FAIL;
 	else
 		_rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); //wait for cmd_thread to run
 		
 
 #ifdef CONFIG_EVENT_THREAD_MODE
-	padapter->evtThread = kernel_thread(event_thread, padapter, CLONE_FS|CLONE_FILES);
-	if(padapter->evtThread < 0)
+	padapter->evtThread = kthread_run(event_thread, padapter, "evtThread");
+	if(IS_ERR(padapter->evtThread))
 		_status = _FAIL;		
 #endif
 
Index: rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/osdep_service.h
===================================================================
--- rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730.orig/include/osdep_service.h
+++ rtl8188C_8192C_usb_linux_v3.4.4_4749.20120730/include/osdep_service.h
@@ -570,10 +570,12 @@ __inline static unsigned char _cancel_ti
 __inline static void thread_enter(void *context)
 {
 #ifdef PLATFORM_LINUX
+	#ifdef daemonize
 	//struct net_device *pnetdev = (struct net_device *)context;
 	//daemonize("%s", pnetdev->name);
 	daemonize("%s", "RTKTHREAD");
 	allow_signal(SIGTERM);
+	#endif
 #endif
 }
 

^ permalink raw reply

* Re: regression after, " ath9k_htc: Add support for mesh interfaces"
From: Thomas Pedersen @ 2013-06-26 21:45 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Johannes Berg, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org, Javier Cardona
In-Reply-To: <51CB3E04.3000402@rempel-privat.de>

On Wed, Jun 26, 2013 at 12:16 PM, Oleksij Rempel <linux@rempel-privat.de> wrote:
> Am 26.06.2013 20:52, schrieb Thomas Pedersen:
> I just discovered one more issue with mesh on ath9k* devices.
> if i try to do "ifconfig mesh0 down" this task will freeze and after some
> time kernel will oops.
>
> Steps to reproduce:
> iw dev wlan2 interface add mesh0 type mp mesh_id mesh
> iwconfig mesh0 channel 1
> ifconfig mesh0 10.0.0.1 netmask 255.255.255.0 up
> sleep 30
> ifconfig mesh0 down

are you running wireless-testing master HEAD? There is a fix for that
deadlock in mac80211-next ("mac80211: update mesh beacon on
workqueue") still waiting to get into wireless-testing.

--
Thomas

^ permalink raw reply

* [PATCH] ath9k_htc: ifdef out IFTYPE_MESH advertisement
From: Thomas Pedersen @ 2013-06-26 22:06 UTC (permalink / raw)
  To: John W. Linville; +Cc: ath9k, linux-wireless, linux, Thomas Pedersen

This is needed so the interface combination can still be
validated when CONFIG_MAC80211_MESH is not enabled.
Otherwise wiphy registration fails.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index bb0ba9e..07ca932 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -701,8 +701,10 @@ static const struct ieee80211_iface_limit if_limits[] = {
 	{ .max = 2,	.types = BIT(NL80211_IFTYPE_STATION) |
 				 BIT(NL80211_IFTYPE_P2P_CLIENT) },
 	{ .max = 2,	.types = BIT(NL80211_IFTYPE_AP) |
-				 BIT(NL80211_IFTYPE_P2P_GO) |
-				 BIT(NL80211_IFTYPE_MESH_POINT) },
+#ifdef CONFIG_MAC80211_MESH
+				 BIT(NL80211_IFTYPE_MESH_POINT) |
+#endif
+				 BIT(NL80211_IFTYPE_P2P_GO) },
 };
 
 static const struct ieee80211_iface_combination if_comb = {
-- 
1.7.10.4


^ permalink raw reply related

* Re: pull-request: iwlwifi-next 2013-06-25
From: John W. Linville @ 2013-06-27  0:05 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1372160186.8372.13.camel@jlt4.sipsolutions.net>

On Tue, Jun 25, 2013 at 01:36:26PM +0200, Johannes Berg wrote:
> Hi John,
> 
> This is hopefully going to be the last big pull request for
> iwlwifi-next, luckily it actually mostly removes code ;-)
> 
> Emmanuel removed some unneeded/unsupported module parameters and adds a
> Bluetooth 1x1 lookup-table for some upcoming products. From Alex I have
> an older patch to add low-power receive support, this depended on a
> mac80211 commit that only just came in with the merge from wireless-next
> I did. Ilan made beacon timings better, and Eytan added some debug
> statements for thermal throttling. I have a few cleanups, a fix for a
> long-standing but rare warning, and, arguably the most important patch
> here, the firmware API version bump for the 7260/3160 devices.
> 
> Let me know if there are any issues.
> 
> johannes
> 
> 
> 
> The following changes since commit 9fbdc75116f7a2b183464d42f3abccb616584105:
> 
>   Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next (2013-06-24 14:45:50 -0400)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git for-john
> 
> for you to fetch changes up to bd4ace2a36e7c87bb5f3eceb54d3b304d395dcf0:
> 
>   iwlwifi: mvm: Add support for Low Power RX (2013-06-25 12:21:19 +0200)

Pulling now...

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [v3.10-rc2] iwlwifi regression
From: Sedat Dilek @ 2013-06-27  6:29 UTC (permalink / raw)
  To: Jörg Otte
  Cc: linux-wireless, Linux Kernel Mailing List, Johannes Berg,
	Linus Torvalds
In-Reply-To: <CA+icZUXJK2ks7TQbH0AiPYAWrFuQC85Uw2sSM6d_YD5yS7unhA@mail.gmail.com>

On Wed, Jun 26, 2013 at 6:37 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Wed, Jun 26, 2013 at 6:16 PM, Jörg Otte <jrg.otte@gmail.com> wrote:
>> 2013/5/25 Jörg Otte <jrg.otte@gmail.com>:
>>> If iwlwifi/iwldvm are built into the kernel (no loadable modules)
>>> following error is written to console and syslog since v3.10-rc:
>>>
>>> iwlwifi 0000:08:00.0: failed to load module iwldvm (error -38), is
>>> dynamic loading enabled?
>>>
>>> reverting
>>> commit 1618b2b02a3a0ee7a6863fed4b0d22e697e7e97c
>>> Author: Johannes Berg <johannes.berg@intel.com>
>>> Date:   Thu Apr 4 10:35:23 2013 +0200
>>>     iwlwifi: print warning on request_module failure
>>>
>>> fixes the problem for me.
>>>
>>> Jörg
>>>
>>> I'm not subscribed,please CC me in answeres
>>
>> We have rc-7 now and it's still not fixed. What is the problem?
>>
>
> The patch is pending in wireless.git and is not in mainline, right.
> AFAICS there was a recent pull request... so should be in rc8.
>
> commit 8edf3fd6eb0649b0f19363baf23bca39c6fbdba4
> "iwlwifi: don't print module loading error if not modular"
>
> - Sedat -
>
> http://git.kernel.org/cgit/linux/kernel/git/linville/wireless.git/commit/?id=8edf3fd6eb0649b0f19363baf23bca39c6fbdba4
>

Hi Jörg,

the fix you are waiting for hit mainline several minutes ago.

Regards,
- Sedat -

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=98b6ed0f2bf4abfb759206aa70690636372bdee7

>> Thanks, Jörg
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: rtl8192cu: slow path warning
From: Richard Genoud @ 2013-06-27  7:33 UTC (permalink / raw)
  To: Larry Finger; +Cc: Chaoming Li, John W. Linville, linux-wireless, linux-kernel
In-Reply-To: <51CB0E9C.50408@lwfinger.net>

2013/6/26 Larry Finger <Larry.Finger@lwfinger.net>:
> On 06/26/2013 09:22 AM, Richard GENOUD wrote:
>>
>> Using 3.10-rc7, I'm still seeing the warning, BUT ONLY on the first
>> connection.
>>
>> [   40.312500] usb 2-2: default language 0x0409
>> [   40.312500] usb 2-2: udev 2, busnum 2, minor = 129
>> [   40.320312] usb 2-2: New USB device found, idVendor=0bda,
>> idProduct=8176
>> [   40.328125] usb 2-2: New USB device strings: Mfr=1, Product=2,
>> SerialNumber=3
>> [   40.328125] usb 2-2: Product: 802.11n WLAN Adapter
>> [   40.335937] usb 2-2: Manufacturer: Realtek
>> [   40.343750] usb 2-2: SerialNumber: 00e04c000001
>> [   40.343750] usb 2-2: usb_probe_device
>> [   40.351562] usb 2-2: configuration #1 chosen from 1 choice
>> [   40.351562] usb 2-2: adding 2-2:1.0 (config #1, interface 0)
>> [   40.500000] cfg80211: Calling CRDA to update world regulatory domain
>> [   40.648437] rtl8192cu 2-2:1.0: usb_probe_interface
>> [   40.656250] rtl8192cu 2-2:1.0: usb_probe_interface - got id
>> [   40.664062] rtl8192cu: Chip version 0x10
>> [   40.757812] rtl8192cu: MAC address: a0:f3:c1:1e:02:a0
>> [   40.765625] rtl8192cu: Board Type 0
>> [   40.773437] rtlwifi: rx_max_size 15360, rx_urb_num 8, in_ep 1
>> [   40.773437] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
>> [   40.781250] usbcore: registered new interface driver rtl8192cu
>> [   40.835937] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
>> [   40.843750] rtlwifi: wireless switch is on
>> # ip link set wlan0 up
>> [   59.921875] rtl8192cu: MAC auto ON okay!
>> [   59.960937] rtl8192cu: Tx queue select: 0x05
>> # iw wlan0 connect test
>> [   75.390625] wlan0: authenticate with f8:1a:67:1a:df:88
>> [   75.421875] wlan0: send auth to f8:1a:67:1a:df:88 (try 1/3)
>> [   75.437500] wlan0: authenticated
>> [   75.453125] wlan0: associate with f8:1a:67:1a:df:88 (try 1/3)
>> [   75.460937] wlan0: RX AssocResp from f8:1a:67:1a:df:88 (capab=0x401
>> status=0 aid=2)
>> [   75.468750] wlan0: associated
>> [   76.375000] ------------[ cut here ]------------
>> [   76.375000] WARNING: at kernel/workqueue.c:1365
>> __queue_work+0x168/0x200()
>> [   76.375000] Modules linked in: rtl8192cu rtl8192c_common rtlwifi
>> mac80211 cfg80211 rfkill ehci_atmel ehci_hcd atmel_usba_udc udc_core
>> ohci_hcd
>> [   76.375000] CPU: 0 PID: 308 Comm: kworker/0:1 Not tainted 3.10.0-rc7
>> #36
>> [   76.375000] Workqueue: rtl92c_usb rtl_watchdog_wq_callback [rtlwifi]
>> [   76.375000] [<c000d9bc>] (unwind_backtrace+0x0/0xf0) from [<c000b9ec>]
>> (show_stack+0x10/0x14)
>> [   76.375000] [<c000b9ec>] (show_stack+0x10/0x14) from [<c0015c00>]
>> (warn_slowpath_common+0x4c/0x68)
>> [   76.375000] [<c0015c00>] (warn_slowpath_common+0x4c/0x68) from
>> [<c0015c38>] (warn_slowpath_null+0x1c/0x24)
>> [   76.375000] [<c0015c38>] (warn_slowpath_null+0x1c/0x24) from
>> [<c0029e40>] (__queue_work+0x168/0x200)
>> [   76.375000] [<c0029e40>] (__queue_work+0x168/0x200) from [<c0029f2c>]
>> (queue_work_on+0x44/0x50)
>> [   76.375000] [<c0029f2c>] (queue_work_on+0x44/0x50) from [<bf09bb54>]
>> (rtl_watchdog_wq_callback+0x320/0x404 [rtlwifi])
>> [   76.375000] [<bf09bb54>] (rtl_watchdog_wq_callback+0x320/0x404
>> [rtlwifi]) from [<c002b168>] (process_one_work+0x10c/0x354)
>> [   76.375000] [<c002b168>] (process_one_work+0x10c/0x354) from
>> [<c002b784>] (worker_thread+0x130/0x380)
>> [   76.375000] [<c002b784>] (worker_thread+0x130/0x380) from [<c0030330>]
>> (kthread+0xa4/0xb0)
>> [   76.375000] [<c0030330>] (kthread+0xa4/0xb0) from [<c00092f0>]
>> (ret_from_fork+0x14/0x24)
>> [   76.375000] ---[ end trace e116b4b3d671f3d2 ]---
>
>
> The WARNING is the result of a workqueue not being initialized for the USB
> driver.
>
> Please try the attached patch. As you have posted on a public mailing list,
> May I assume that it will be OK to use your address in Reported-by/Tested-by
> lines in the patch submission?
>
> Thanks,
>
> Larry
>
Yes, of course, you can add my
Reported-by: Richard Genoud <richard.genoud@gmail.com>

But the patch doesn't compile on my platform ( since I'm on ARM, I
haven't got a PCI bus, so rtlwifi/pci.c is not compiled ) :

ERROR: "rtl_lps_change_work_callback"
[drivers/net/wireless/rtlwifi/rtlwifi.ko] undefined!


Best regards,
Richard.

PS: duckducking the warning, I found this automated report also :
https://retrace.fedoraproject.org/faf/reports/142038/

-- 
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?

^ permalink raw reply

* [PATCH V2] vlan priority handling in WMM
From: cedric.voncken @ 2013-06-27  7:52 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, cedric voncken

From: cedric voncken <cedric.voncken@acksys.fr>

If the VLAN tci is set in skb->vlan_tci use the priority field to determine the WMM priority.

V2 modifications :
	Fix indentation
	Use symbolic constant
	include the header linux/if_vlan.h

Signed-off-by: cedric Voncken <cedric.voncken@acksys.fr>
---
 net/wireless/util.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 74458b7..13937db 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -10,6 +10,7 @@
 #include <net/cfg80211.h>
 #include <net/ip.h>
 #include <net/dsfield.h>
+#include <linux/if_vlan.h>
 #include "core.h"
 #include "rdev-ops.h"
 
@@ -685,6 +686,7 @@ EXPORT_SYMBOL(ieee80211_amsdu_to_8023s);
 unsigned int cfg80211_classify8021d(struct sk_buff *skb)
 {
 	unsigned int dscp;
+	unsigned char vlan_priority;
 
 	/* skb->priority values from 256->263 are magic values to
 	 * directly indicate a specific 802.1d priority.  This is used
@@ -694,6 +696,10 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb)
 	if (skb->priority >= 256 && skb->priority <= 263)
 		return skb->priority - 256;
 
+	vlan_priority = (skb->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
+	if (vlan_priority > 0)
+		return vlan_priority;
+
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
 		dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
-- 
1.7.2.5


^ permalink raw reply related

* RE: [RFC] mac80211: Use libnl-configurable values for retry counts
From: Jean-Pierre Tosoni @ 2013-06-27  8:09 UTC (permalink / raw)
  To: 'Felix Fietkau'; +Cc: linux-wireless
In-Reply-To: <51CB33D9.1070104@openwrt.org>

First, thanks for your prompt reply and for pointing out my mistakes.

> > Use wiphy->retry_short for management frames.
> > Use wiphy->retry_long for other frames.
> That seems a bit arbitrary.

Indeed.
Should I use the following?
  retry_long for data frames subject to RTS
  retry_short for all other frames.
That looks closer to the descriptions in 802.11-2012.
 
> > +	mp->max_retry = hw->conf.long_frame_max_tx_count;
> minstrel_alloc is called at rate control init time. You're not making
> max_retry configurable here, it'll pick the default value of
> hw->conf.long_frame_max_tx_count and never update it again.

Is it OK if I replace max_retry with the config values in minstrel_rate_init
and minstrel_update_rates instead?
Then we can get rid of max_retry completely?

(Sorry, I got mixed in the never-ending sequence of callbacks :)

> > diff --git a/net/mac80211/rc80211_minstrel.c
> b/net/mac80211/rc80211_minstrel.c
> > index ac7ef54..502d0c9 100644
> > --- a/net/mac80211/rc80211_minstrel.c
> > +++ b/net/mac80211/rc80211_minstrel.c
> > @@ -592,11 +592,7 @@ minstrel_alloc(
> >	/* maximum time that the hw is allowed to stay in one MRR  segment
*/
> >  	mp->segment_size = 6000;
> >
> > -	if (hw->max_rate_tries > 0)
> > -		mp->max_retry = hw->max_rate_tries;
> > -	else
> > -		/* safe default, does not necessarily have to match hw
properties */
> > -		mp->max_retry = 7;
> > +	mp->max_retry = hw->conf.long_frame_max_tx_count;> 
> - Felix

Jean-Pierre


^ permalink raw reply

* RTL8192CU on ARM not working
From: Maxime Ripard @ 2013-06-27  8:12 UTC (permalink / raw)
  To: Larry.Finger, chaoming_li, linville
  Cc: linux-wireless, netdev, linux-kernel, linux-arm-kernel,
	Alexandre Belloni, Brian Lilly, Brent-Crosby, Jim Wall,
	Thomas Petazzoni

[-- Attachment #1: Type: text/plain, Size: 3400 bytes --]

Hi everyone,

I'm currently trying to use a RTL8192CU on an ARM (Freescale imx28,
armv5) platform, using 3.10-rc3.

Trouble is, while the chip is correctly detected and you can use iw on it
without any problem it seems, once you start an association to an access
point, the association goes on, seems to associate, displaying a WARN()
message [1] and then, after what looks like a random amount of time (could
be right away, could be after a few minutes), deassociate [2].

During the time where it's associated, we never seem to transmit any
packets, while iw reports packets being sent, I guess we can assume that
they are actually never transmitted as well [3].

What seems odd to me as well is that the signal power reported for the access
point is excessively high when using iw scan (10 dbm), and once connected, the
signal strength is -64dbm, which makes quite a huge difference.

Do you have any suggestions on how to solve this issue?

Thanks,
Maxime


[1]:
# iw wlan0 connect FreeWifi 2447
# [  485.010858] wlan0: authenticate with f4:ca:e5:c9:f5:91
[  485.065514] wlan0: send auth to f4:ca:e5:c9:f5:91 (try 1/3)
[  485.075963] wlan0: authenticated
[  485.088915] wlan0: associate with f4:ca:e5:c9:f5:91 (try 1/3)
[  485.117137] wlan0: RX AssocResp from f4:ca:e5:c9:f5:91 (capab=0x401 status=0 aid=1)
[  485.130607] wlan0: associated
[  486.917555] ------------[ cut here ]------------
[  486.922277] WARNING: at kernel/workqueue.c:1365 __queue_work+0x1f0/0x2f4()
[  486.929175] Modules linked in:
[  486.932284] CPU: 0 PID: 615 Comm: kworker/0:2 Not tainted 3.10.0-rc3 #2
[  486.938958] Workqueue: rtl92c_usb rtl_watchdog_wq_callback
[  486.944548] [<c00147dc>] (unwind_backtrace+0x0/0xf0) from [<c00120a0>] (show_stack+0x10/0x14)
[  486.953132] [<c00120a0>] (show_stack+0x10/0x14) from [<c001d2ec>] (warn_slowpath_common+0x4c/0x68)
[  486.962140] [<c001d2ec>] (warn_slowpath_common+0x4c/0x68) from [<c001d324>] (warn_slowpath_null+0x1c/0x24)
[  486.971844] [<c001d324>] (warn_slowpath_null+0x1c/0x24) from [<c003769c>] (__queue_work+0x1f0/0x2f4)
[  486.981025] [<c003769c>] (__queue_work+0x1f0/0x2f4) from [<c0037830>] (queue_work_on+0x80/0x88)
[  486.989777] [<c0037830>] (queue_work_on+0x80/0x88) from [<c0267ca4>] (rtl_watchdog_wq_callback+0x5dc/0x8bc)
[  486.999572] [<c0267ca4>] (rtl_watchdog_wq_callback+0x5dc/0x8bc) from [<c0038cbc>] (process_one_work+0x1c0/0x4c8)
[  487.009795] [<c0038cbc>] (process_one_work+0x1c0/0x4c8) from [<c0039684>] (worker_thread+0x140/0x3ac)
[  487.019065] [<c0039684>] (worker_thread+0x140/0x3ac) from [<c003f914>] (kthread+0xa4/0xb0)
[  487.027381] [<c003f914>] (kthread+0xa4/0xb0) from [<c000f0c0>] (ret_from_fork+0x14/0x34)
[  487.035498] ---[ end trace 93341a0c249e647e ]---


[2]:

# [  786.086127] wlan0: deauthenticated from f4:ca:e5:c9:f5:91 (Reason: 2)
[  786.126368] cfg80211: Calling CRDA to update world regulatory domain


[3]:
# iw wlan0 station dump
Station f4:ca:e5:c9:f5:91 (on wlan0)
	inactive time:	55430 ms
	rx bytes:	77826
	rx packets:	1026
	tx packets:	2
	tx retries:	0
	tx failed:	0
	signal:  	-64 dBm
	signal avg:	-63 dBm
	tx bitrate:	1.0 MBit/s
	authorized:	yes
	authenticated:	yes
	preamble:	long
	WMM/WME:	yes
	MFP:		no
	TDLS peer:	no


-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH] nl80211: fix missing rtnl_unlock()
From: Johannes Berg @ 2013-06-27  8:18 UTC (permalink / raw)
  To: linux-wireless

In the new nl80211_dump_wiphy() handling I forgot to properly
unlock the RTNL (again!), fix that.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/wireless/nl80211.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 785761f..66382b1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1568,8 +1568,10 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
 	rtnl_lock();
 	if (!state) {
 		state = kzalloc(sizeof(*state), GFP_KERNEL);
-		if (!state)
+		if (!state) {
+			rtnl_unlock();
 			return -ENOMEM;
+		}
 		state->filter_wiphy = -1;
 		ret = nl80211_dump_wiphy_parse(skb, cb, state);
 		if (ret) {
-- 
1.8.0


^ permalink raw reply related

* Re: [PATCH] Documentation: dt: bindings: TI WiLink modules
From: Luciano Coelho @ 2013-06-27  8:47 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Nishanth Menon, grant.likely, rob.herring, devicetree-discuss,
	linux-doc, linux-kernel, linux-wireless, tony, linux-omap,
	linux-arm
In-Reply-To: <51CBC1C8.1040301@gmail.com>

(added mailing lists and everyone back to the thread)

On Wed, 2013-06-26 at 23:38 -0500, Nishanth Menon wrote:
> On 06/25/2013 03:35 AM, Luciano Coelho wrote:
> > +Optional properties:
> > +--------------------
> > +
> > +- refclock: the internal WLAN reference clock frequency (required for
> > +  WiLink6 and WiLink7; not used for WiLink8).  Must be one of the
> > +  following:
> > +	0 = 19.2 MHz
> > +	1 = 26.0 MHz
> > +	2 = 38.4 MHz
> > +	3 = 52.0 MHz
> > +	4 = 38.4 MHz, XTAL
> > +	5 = 26.0 MHz, XTAL
> > +
> > +- tcxoclock: the internal WLAN TCXO clock frequency (required for
> > +  WiLink7 not used for WiLink6 and WiLink8).  Must be one of the
> > +  following:
> > +	0 = 19.200 MHz
> > +	1 = 26.000 MHz
> > +	2 = 38.400 MHz
> > +	3 = 52.000 MHz
> > +	4 = 16.368 MHz
> > +	5 = 32.736 MHz
> > +	6 = 16.800 MHz
> > +	7 = 33.600 MHz
> >
> just a gentle query - why not use frequency itself here in Hz for 
> refclock and txoclk?

I thought about using the actual frequencies, but I decided not to do
so, because I'd have to convert them to these values anyway.  These
values are used to configure the firmware and it uses these
"enumerations".


> might not another option of using
> node {
> clocks=<&clk>;
> }
> 
> Usually refclock is an external clock source, no?

No.  In the WiLink case, both refclock and tcxoclock are internal
clocks.  They are in the module itself and what we need to do is tell
the WiLink chip what the module's clocks look like.


> the above allows you to do an devm_clk_get and clk_get_rate() to figure 
> out the exact clock frequency.

No, we can't use these calls, because they are internal clocks.

Please see my more complete explanation as an answer to Tony's email.

Thanks for your review!

--
Luca.


^ permalink raw reply

* Re: TP-Link 8200ND - rtl8192cu module not loading / working
From: Xose Vazquez Perez @ 2013-06-27  9:18 UTC (permalink / raw)
  To: linux-wireless, shiki.biomernok, Larry Finger

Larry Finger wrote:

> I think the TP-Link 8200ND is relatively new. You have version 0x11 for your 
> chip, and mine is 0x10. That could be a difference.

It's a *2T2R* RTL8192CUS

http://wikidevi.com/wiki/TP-LINK_TL-WN8200ND

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox