Machine: Virtual Machine running on Mac OS X 10.4.11 2GHz Intal Core 2 Duo Device: TP-Link TL-WN322G v3 AR9271 0x0cf3 0x1006 (http://wireless.kernel.org/en/users/Drivers/ath9k_htc/devices) output from dmesg: usb 1-1: new high speed USB device using ehci_hcd and address 4 usb 1-1: New USB device found, idVendor=0cf3, idProduct=1006 usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48 usb 1-1: Product: USB2.0 WLAN usb 1-1: Manufacturer: ATHEROS usb 1-1: SerialNumber: 12345 usb 1-1: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 usb 1-1: ath9k_htc: HTC initialized with 33 credits ath: cf4fdc04 ath: cf4fdc3c ath: cf4fdc50 ath: cf4fdc4c ath: cf4fdc88 Failed to initialize the device ath9k_hif_usb: probe of 1-1:1.0 failed with error -22 After some investigation, I found the code that might caused the failure during initialization. ath9k_hw_wait() failed to read the status of register. drivers/net/wireless/ath/ath9k/hw.c static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah) { ENABLE_REGWRITE_BUFFER(ah); ... REG_WRITE(ah, AR_RTC_RESET, 0); udelay(2); REGWRITE_BUFFER_FLUSH(ah); if (!AR_SREV_9300_20_OR_LATER(ah)) udelay(2); if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) REG_WRITE(ah, AR_RC, 0); REG_WRITE(ah, AR_RTC_RESET, 1); if (!ath9k_hw_wait(ah, AR_RTC_STATUS, AR_RTC_STATUS_M, AR_RTC_STATUS_ON, AH_WAIT_TIMEOUT)) { ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, "RTC not waking up\n"); return false; } ath9k_hw_read_revisions(ah); return ath9k_hw_set_reset(ah, ATH9K_RESET_WARM); }
Are you using compat-wireless ? If so, which release ? Sometimes the target fails to respond, can you try re-plugging the card ?
He seems to be using compat-wireless as the following messages do not appear on wirless-testing and is a problem in compat-wireless only ath: cf4fdc04 ath: cf4fdc3c ath: cf4fdc50 ath: cf4fdc4c ath: cf4fdc88 Shuxian, Please let me know what version of compat_wireless are you using?
The version I am using is compat-wireless-2011-01-30. At first I use clean 2.6.35.7 kernel, but I encountered this problem. So I had resort to compat-wireless trying to solve the problem. However the problem persist. FYI, following are the dmesg of clean kernel: [root@fc9 ~]# modprobe ath9k_htc debug=0xffffffff [root@fc9 ~]# dmesg | tail -n 20 Bluetooth: RFCOMM ver 1.11 Bridge firewalling registered pcnet32 0000:02:01.0: eth0: link up eth0: no IPv6 routers present cfg80211: Calling CRDA to update world regulatory domain usbcore: registered new interface driver ath9k_hif_usb usb 1-1: new high speed USB device using ehci_hcd and address 2 usb 1-1: New USB device found, idVendor=0cf3, idProduct=1006 usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48 usb 1-1: Product: USB2.0 WLAN usb 1-1: Manufacturer: ATHEROS usb 1-1: SerialNumber: 12345 usb 1-1: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 ath: timeout (100000 us) on reg 0x7044: 0x00000000 & 0x0000000f != 0x00000002 ath: RTC not waking up ath: Couldn't reset chip ath: Unable to initialize hardware; initialization status: -5 ath: Unable to initialize hardware; initialization status: -5 Failed to initialize the device ath9k_hif_usb: probe of 1-1:1.0 failed with error -22 (In reply to comment #2) > He seems to be using compat-wireless as the following messages do not appear > on > wirless-testing and is a problem in compat-wireless only > > ath: cf4fdc04 > ath: cf4fdc3c > ath: cf4fdc50 > ath: cf4fdc4c > ath: cf4fdc88 > > Shuxian, > > Please let me know what version of compat_wireless are you using?
I tried re-plugging the card, but it didn't help: [root@fc9 ~]# dmesg | tail -n 30 usbcore: registered new interface driver ath9k_hif_usb usb 1-1: new high speed USB device using ehci_hcd and address 2 usb 1-1: New USB device found, idVendor=0cf3, idProduct=1006 usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48 usb 1-1: Product: USB2.0 WLAN usb 1-1: Manufacturer: ATHEROS usb 1-1: SerialNumber: 12345 usb 1-1: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 ath: timeout (100000 us) on reg 0x7044: 0x00000000 & 0x0000000f != 0x00000002 ath: RTC not waking up ath: Couldn't reset chip ath: Unable to initialize hardware; initialization status: -5 ath: Unable to initialize hardware; initialization status: -5 Failed to initialize the device ath9k_hif_usb: probe of 1-1:1.0 failed with error -22 usb 1-1: USB disconnect, address 2 usb 1-1: new high speed USB device using ehci_hcd and address 3 usb 1-1: New USB device found, idVendor=0cf3, idProduct=1006 usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48 usb 1-1: Product: USB2.0 WLAN usb 1-1: Manufacturer: ATHEROS usb 1-1: SerialNumber: 12345 usb 1-1: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 ath: timeout (100000 us) on reg 0x7044: 0x00000000 & 0x0000000f != 0x00000002 ath: RTC not waking up ath: Couldn't reset chip ath: Unable to initialize hardware; initialization status: -5 ath: Unable to initialize hardware; initialization status: -5 Failed to initialize the device ath9k_hif_usb: probe of 1-1:1.0 failed with error -22 (In reply to comment #1) > Are you using compat-wireless ? If so, which release ? > Sometimes the target fails to respond, can you try re-plugging the card ?
This seems to be a problem with a virtual machine setup. See: http://thread.gmane.org/gmane.linux.drivers.ath9k.devel/4869/focus=4881 I'll try to reproduce it.
Thank you. I forgot to mention. I'm using VMware Fusion on Mac OS X 10.4.11. Some other info, hope it might help: 1. Virtual Machine Linux version [root@fc9 ~]# cat /proc/version Linux version 2.6.35.7 (diviner@fc9) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) ) #1 SMP Sun Jan 23 03:36:16 CST 2011 2. This card works fine on another PC with Windows XP SP3. I have use the Vendor(TP-LINK)'s windows driver under Windows XP. Sorry I don't have a stand alone Linux installation right now. I'll try this card with stand alone Linux installation but not Virtual Machine to verify if it is related to virtual machine later.
Well, it worked fine in VirtualBox, on a Windows machine with Ubuntu as the guest. But my card's VID/PID is 0cf3:9271. So unsure where the problem lies.
Hi Sujith I have tried this TP-LINK TL-WN322G card on another x86_64 machine with Fedora 13 installed(I have updated the kernel to 2.6.35.7). However the same problem still exist. It seems this problem is not related to Virtual Machine. Maybe this problem has something to do with Vendor? Here is the dmesg from this linux machine: [root@diviner-dev ~]# rmmod ath9k_htc [root@diviner-dev ~]# lsmod | grep ath9k_htc [root@diviner-dev ~]# modprobe ath9k_htc debug=0xffffffff [root@diviner-dev ~]# lsmod | grep ath9k_htc ath9k_htc 42794 0 ath9k_common 5200 1 ath9k_htc ath9k_hw 296209 2 ath9k_htc,ath9k_common mac80211 218176 2 ath9k_htc,ath9k_common ath 9512 3 ath9k_htc,ath9k_common,ath9k_hw cfg80211 130799 4 ath9k_htc,ath9k_common,mac80211,ath ~~~~~~~~At this point I plugged the card and wait~~~~~~~~~~~~~~ [root@diviner-dev ~]# dmesg | tail -n 20 Failed to initialize the device ath9k_hif_usb: probe of 2-1:1.0 failed with error -22 usb 2-1: USB disconnect, address 4 usbcore: deregistering interface driver ath9k_hif_usb ath9k_htc: Driver unloaded usbcore: registered new interface driver ath9k_hif_usb usb 2-1: new high speed USB device using ehci_hcd and address 5 usb 2-1: New USB device found, idVendor=0cf3, idProduct=1006 usb 2-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48 usb 2-1: Product: USB2.0 WLAN usb 2-1: Manufacturer: ATHEROS usb 2-1: SerialNumber: 12345 usb 2-1: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 ath: timeout (100000 us) on reg 0x7044: 0x00000000 & 0x0000000f != 0x00000002 ath: RTC not waking up ath: Couldn't reset chip ath: Unable to initialize hardware; initialization status: -5 ath: Unable to initialize hardware; initialization status: -5 Failed to initialize the device ath9k_hif_usb: probe of 2-1:1.0 failed with error -22 Following are some other info of this machine. I have also installed Windows 7 on this x86_64 machine and the card works fine under Windows 7. [root@diviner-dev ~]# cat /proc/version Linux version 2.6.35.7 (diviner@diviner-dev) (gcc version 4.4.4 20100503 (Red Hat 4.4.4-2) (GCC) ) #1 SMP Sat Feb 12 06:28:49 CST 2011 [root@diviner-dev ~]# arch x86_64 [root@diviner-dev ~]# cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 220 Processor stepping : 3 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save bogomips : 5601.55 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 1 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 220 Processor stepping : 3 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt npt lbrv svm_lock nrip_save bogomips : 5600.35 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate
TL-WN322G is a G-only device ! I wasn't aware that non-11n cards using AR9271 were rolled out. The driver assumes that _all_ the devices it claims to support are 11n-aware. But still, the debug messages indicate that the target doesn't even get powered on ...
commit ee031112d9eef5508f765ebc90ab488e01db002e Author: Luis R. Rodriguez <lrodriguez@atheros.com> Date: Mon Jun 21 18:38:51 2010 -0400 ath9k_hw: add an extra delay when reseting AR_RTC_RESET Without this we could start trying to work with the device without it being fully functional yet and loose some packets upon resume. This added an extra unexplained udelay(2) and it looks fishy. Can you remove the udelay(2) just before REGWRITE_BUFFER_FLUSH(ah) in ath9k_hw_set_reset_power_on(), and see if the device at least comes up ? A little more work is required to handle 11g-only initialization in the driver, though. Unfortunately we don't have this particular card, so the we can't test the code change.
Hi Luis I have checked hw.c from both compat-wireless-2011-01-30 and standard kernel 2.6.35.7. The extra udelay(2) before REGWRITE_BUFFER_FLUSH(ah) appeared only in compat-wireless-2011-01-30 but not in standard 2.6.35.7 kernel. The same problem also appeared when I use kernel 2.6.35.7(which don't have this extra delay). In fact I use compat-wireless-2011-01-30 because the driver didn't work under standard 2.6.35.7 kernel. Seems the problem is not about this delay. Is there any trick that I can do to at least get this card power on? Thank you.
Created attachment 47802 [details] Reset patch
Can you test the attached patch ? Please use the latest compat-wireless package. It's a shot in the dark, but I don't think resetting AHB is required for USB devices. diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index f9cf815..bf5c5ef 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -1086,6 +1086,8 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah) { + struct ath_common *common = ath9k_hw_common(ah); + ENABLE_REGWRITE_BUFFER(ah); if (AR_SREV_9300_20_OR_LATER(ah)) { @@ -1096,19 +1098,22 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah) REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); - if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, AR_RC_AHB); + if (common->bus_ops->ath_bus_type != ATH_USB) { + if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) + REG_WRITE(ah, AR_RC, AR_RC_AHB); + } REG_WRITE(ah, AR_RTC_RESET, 0); - udelay(2); REGWRITE_BUFFER_FLUSH(ah); if (!AR_SREV_9300_20_OR_LATER(ah)) udelay(2); - if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, 0); + if (common->bus_ops->ath_bus_type != ATH_USB) { + if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) + REG_WRITE(ah, AR_RC, 0); + } REG_WRITE(ah, AR_RTC_RESET, 1);
Thanks a lot for this patch, though it didn't do the trick. Finally I have decided to buy another same card from TP-LINK and this new card magically works. I have no idea why this happens. However it seems there are still some problems with this new card under Linux. I have configured this new card to work under Managed mode with WEP encryption. Here is the output from iwconfig: [diviner@diviner-dev ~]$ iwconfig wlan0 wlan0 IEEE 802.11bgn ESSID:"TP-LINK_AABB" Mode:Managed Frequency:2.427 GHz Access Point: 00:25:86:3D:20:6A Bit Rate=1 Mb/s Tx-Power=20 dBm Retry long limit:7 RTS thr:off Fragment thr:off Power Management:off Link Quality=64/70 Signal level=-46 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 The problem is the 1Mb/s Bit Rate cannot be changed and is fixed 1 Mb/s. [diviner@diviner-dev ~]$ sudo iwconfig wlan0 rate 54M Error for wireless request "Set Bit Rate" (8B20) : SET failed on device wlan0 ; Operation not supported. And following are outputs from dmesg after ath9k_htc driver is unloaded and then loaded: [root@diviner-dev ~]# lsmod | grep ath9k_htc [root@diviner-dev ~]# modprobe ath9k_htc WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/. [root@diviner-dev ~]# dmesg | tail -n 40 cfg80211: World regulatory domain updated: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm) (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm) usb 1-2: ath9k_htc: USB layer deinitialized ath9k_htc: Driver unloaded usb 1-2: ath9k_htc: Transferred FW: ar9271.fw, size: 51280 ath: EEPROM regdomain: 0x809c ath: EEPROM indicates we should expect a country code ath: doing EEPROM country->regdmn map search ath: country maps to regdmn code: 0x52 ath: Country alpha2 being used: CN ath: Regpair used: 0x52 cfg80211: Calling CRDA for country: CN cfg80211: Regulatory domain changed to country: CN (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm) (5735000 KHz - 5835000 KHz @ 40000 KHz), (N/A, 3000 mBm) Registered led device: ath9k-phy2::radio Registered led device: ath9k-phy2::assoc Registered led device: ath9k-phy2::tx Registered led device: ath9k-phy2::rx usb 1-2: ath9k_htc: USB layer initialized usbcore: registered new interface driver ath9k_hif_usb ath: Device not present ADDRCONF(NETDEV_UP): wlan0: link is not ready wlan0: direct probe to 00:25:86:3d:20:6a (try 1) wlan0: direct probe to 00:25:86:3d:20:6a (try 2) wlan0: direct probe responded wlan0: authenticate with 00:25:86:3d:20:6a (try 1) wlan0: authenticated wlan0: associate with 00:25:86:3d:20:6a (try 1) wlan0: associate with 00:25:86:3d:20:6a (try 2) wlan0: RX AssocResp from 00:25:86:3d:20:6a (capab=0x431 status=0 aid=5) wlan0: associated ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready wlan0: no IPv6 routers present [root@diviner-dev ~]# ping -c 1 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=70.4 ms --- 192.168.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 70ms rtt min/avg/max/mdev = 70.462/70.462/70.462/0.000 ms
Is the new card the same as the old one ? What does lsusb show ? And yes, currently, the rate is always shown as 1Mbps, and fixed rate is not supported by the driver, so there is no problem there. To test throughput, you can use iperf or any other tool of your choice.
Thank you. It's the same card as the old one. [diviner@diviner-dev ~]$ lsusb Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 002: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0 Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 0cf3:1006 Atheros Communications, Inc. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Well, that is strange. This is a 11g only card, right ? In which case, changes are required in the driver, since currently it enables 11n for all supported cards.
Yes. It is a 11g only card. Just let me know if there is anything I can do to help improve this driver.
ath9k guys, ping?
Hm, sorry. Wasn't aware that this was still open. Shuxian, does your card work now ? Are there problems with performance ? And as for identifying it as a 11g card, I can post patches, but I don't have this card, so help would be required to test them.
Yes. The new card worked well since I bought it. Thank you. How can I help to test it? Just shot me some emails and I would be very glad to help. BTW, is there anything I need to do to close this bug? I have changed the status to RESOLVED. (In reply to comment #20) > Hm, sorry. Wasn't aware that this was still open. Shuxian, does your card > work > now ? Are there problems with performance ? > > And as for identifying it as a 11g card, I can post patches, but I don't have > this card, so help would be required to test them.