OpenWrt Forum Archive

Topic: ar9331's usb stability issue - [SOLVED]

The content of this topic has been archived between 23 Mar 2017 and 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Mark_V wrote:

Many! thanks for the work and the drive to solve this problem (from reading i understand that Atheros knows the problem but don't want to solve it)

Actually, the chip has a hardware bug where spurious RF emissions affect the USB PLL. Of course, they will not aknowledge it as a critical bug as they found a software workaround for it.

This workaround is using some undocumented registers, and even the datasheet is normally under NDA only, which makes it very difficult for open source initiatives like OpenWrt to catch up. We basically just lost 2 years because of information obfuscation wink

Mark_V wrote:

For my understanding, this patch sets some bits from the USB controller registers (here the USB PLL) which are not set the right way at initialize (boot) but change when you switch off the WiFi?

Yes, you have to tweak some USB PLL bits every time you change the WiFi (init, change, reset...).

The original macro appeared publicly in QCA's github, but the merit of applying it to OpenWrt goes to the Carambola2 developers!

it'a early morning,cant have wait the squonk's patch,so i just apply the patch to the source 12.09,and i compile all the ar71xx device,but not yet test,if someone like do a early test but dont want do the compile which its cost me about 5 hours:(,you can have a look at:   

http://162.243.126.90/ar71xx/

that's a really great day,and it should be change something,which squonk telled me the ar9331 is only 0.5w cost power!and with this path just look like a champ!

Squonk wrote:

The original macro appeared publicly in QCA's github, but the merit of applying it to OpenWrt goes to the Carambola2 developers!

and what's the qca doing?wired name..

(Last edited by slboat on 17 Dec 2013, 16:52)

QCA = Qualcomm Atheros

pepe2k wrote:

QCA = Qualcomm Atheros

wah!i dont know them doing open source too.
and pepe2k,i have a idea about you uboot-mod,which still i not yet have time to finish the mac mod on web,but in this idea,i suggestion the uboot can download all the flash content,and maybe compress it,so it just like the ghost on windows,you actually can backup everything with you upgrade,you change,any thing!all in the backup file.we can called it [xxxxx.2013-1218.bin]

slboat wrote:
pepe2k wrote:

QCA = Qualcomm Atheros

wah!i dont know them doing open source too.

Yes they do:
https://github.com/qca/qcamain_open_hal_public

This is where the workaround macro is originating!

The main contact there is Adrian Chadd.

Hi everyone! help me pleas. I want to install the patch for correct work of usb 1.1 , my router TP-LINK mr3220 v2.2 https://github.com/8devices/carambola2/ … 5c4e168923, I throw in a folder / package / Kernel / mac80211 / patches / 566-ath9k_usb_hang_workaround.patch collect firmware but i have error

Patch failed!  Please fix ./patches/566-ath9k_usb_hang_workaround.patch!
make[3]: *** [/home/lion/openwrt/trunk/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/compat-wireless-2013-11-05/.prepared_adb671db036694a8948190e1b1302b5d] Error 1
make[3]: Leaving directory `/home/lion/openwrt/trunk/package/kernel/mac80211'
make[2]: *** [package/kernel/mac80211/compile] Error 2
make[2]: Leaving directory `/home/lion/openwrt/trunk'
make[1]: *** [/home/lion/openwrt/trunk/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/lion/openwrt/trunk'

This happens because the file hw.c has changed from release to release.  What you need to do is to create a patch from your copy of hw.c. It is quite easy.  See instructions below  (... denotes actual text which I was too lazy to type in)

In a junk dir  create a/drivers/net/wireless/ath/ath9k/  and  b/drivers/net/wireless/ath/ath9k/
put hw.c which was created in build_dir/target-.../linux-ar7../compat-wireless-201.../drivers/net/wireless/ath/ath9k/  during the orignal build into both a and b directories and edit hw.c in directory b/...     with the USB fix

To edit hw.c with the fix - review the patch and just copy the changes over to the appropriate sections in hw.c. If your version of trunk is fairly curent - then you will be off by only a few lines.

Then do
diff -U 2 a/drivers/net....../hw.c  b/drivers/net/..../hw.c  > 566-usb-....patch
move patch to package/kernel/mac80211/patches  directory

I don't why this has not been accepted into trunk yet - squonk submitted it on Dec 16.






uaLion wrote:

Hi everyone! help me pleas. I want to install the patch for correct work of usb 1.1 , my router TP-LINK mr3220 v2.2 https://github.com/8devices/carambola2/ … 5c4e168923, I throw in a folder / package / Kernel / mac80211 / patches / 566-ath9k_usb_hang_workaround.patch collect firmware but i have error

Patch failed!  Please fix ./patches/566-ath9k_usb_hang_workaround.patch!
make[3]: *** [/home/lion/openwrt/trunk/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/compat-wireless-2013-11-05/.prepared_adb671db036694a8948190e1b1302b5d] Error 1
make[3]: Leaving directory `/home/lion/openwrt/trunk/package/kernel/mac80211'
make[2]: *** [package/kernel/mac80211/compile] Error 2
make[2]: Leaving directory `/home/lion/openwrt/trunk'
make[1]: *** [/home/lion/openwrt/trunk/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/lion/openwrt/trunk'

I tried to edit the file "566-ath9k_usb_hang workaround.patch" according to my file "hw.c" but the last line of the file 566-ath9k_usb_hang workaround.patch

@@ -2052,6 +2069,8 @@
    if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv)
        REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+
    return 0;
}
EXPORT_SYMBOL(ath9k_hw_reset);

I do not have to in my file hw.c


it's my hw.c
and
566-ath9k_usb_hang workaround.patch

---
I'm new and I am sorry for noob questions, thanks.

It looks like the flag for BlueTooth antenna diversity has moved...

Just replace the "ah->shared_chain_lnadiv"f lag in the patch file by the "common->bt_ant_diversity" flag from your hw.c file and apply the patch again from the original hw.c.

(Last edited by Squonk on 4 Jan 2014, 14:52)

it's a new "566-ath9k_usb_hang_workaround.patch" but i have error

Applying ./patches/566-ath9k_usb_hang_workaround.patch using plaintext: 
patching file drivers/net/wireless/ath/ath9k/hw.c
/usr/bin/patch: **** malformed patch at line 4: MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");

Patch failed!  Please fix ./patches/566-ath9k_usb_hang_workaround.patch!
make[3]: *** [/home/lion/openwrt/trunk/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/compat-wireless-2013-11-05/.prepared_adb671db036694a8948190e1b1302b5d] Error 1
make[3]: Leaving directory `/home/lion/openwrt/trunk/package/kernel/mac80211'
make[2]: *** [package/kernel/mac80211/compile] Error 2
make[2]: Leaving directory `/home/lion/openwrt/trunk'
make[1]: *** [/home/lion/openwrt/trunk/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.package_compile] Error 2

thank you so much for your help snowyowlster and Squonk ))
I have done many syntax errors in my patch file, so do not worked.
---
Maybe install AA version for tp-link 3220 v2.2? Or need to wait for the official release?

Yes - move to AA 12.09. Several fixes have been backported to hw.c in AA 12.09  but the USB fix has not been backported yet. Create the patch using instructions provided earlier.

(Last edited by snowyowlster on 7 Jan 2014, 18:44)

I was facing the same problem.. Thanks to all for helping me to solve this problem...

I submitted the patch to the dev list, but it is not yet integrated into either the BB trunk or AA branch.

It is just a matter of days before it will be integrated into BB trunk, then hopefully backported to the AA branch,.

Please be patient!

You  are welcome big_smile

Sweet.

is the tl-mr3020 have the same problem ? cause when i put  my usb storage and left it all the night i found thaht the router has been rebouted or the usb sitck seems to be unmounted  ? the usb storage is for extroot

(Last edited by ysf.zer on 13 Jan 2014, 23:00)

ysf.zer wrote:

is the tl-mr3020 have the same problem ? cause when i put  my usb storage and left it all the night i found thaht the router has been rebouted or the usb sitck seems to be unmounted  ? the usb storage is for extroot

Possibly, but this bug affects USB full-speed devices mainly, not high-speed devices like an USB stick, unless it is a very low-cost one;)

Check in the logs how it is enumerated (high or full speed).

ok i will check but i think its a high speed device because when i copy a file shared using (samba) on the stick the speed is 8 mb/s ~ 10 mb/s so i dont think its detected as fullspeed (from router to cmputer)

(Last edited by ysf.zer on 13 Jan 2014, 23:42)

[    8.380000] hub 1-0:1.0: USB hub found
[    8.380000] hub 1-0:1.0: 1 port detected
[    8.420000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    8.460000] uhci_hcd: USB Universal Host Controller Interface driver
[    8.480000] Initializing USB Mass Storage driver...
[    8.490000] usbcore: registered new interface driver usb-storage
[    8.490000] USB Mass Storage support registered.
[    8.720000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    8.870000] scsi0 : usb-storage 1-1:1.0
[    9.890000] scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 2.0 1.00 PQ                                                                                                 : 0 ANSI: 4
[    9.900000] sd 0:0:0:0: [sda] 7567964 512-byte logical blocks: (3.87 GB/3.60     

its  a high speed device hmm

Squonk 2014-01-09 wrote:

I submitted the patch to the dev list, but it is not yet integrated into either the BB trunk or AA branch.
It is just a matter of days before it will be integrated into BB trunk, then hopefully backported to the AA branch,.
Please be patient!

Sorry for my noob question as i don't really understand how this patch policy works.

When i look at AA 12.09 in the download section it still has the april 2013 date, so i think this
is still the original version without the USB solution.
How can i apply some sort of patch to this version so that it has the USB solution? ( i can't compile
as i still have to install a toolchain) or does this patch already excist and do i overlook something?.

At this moment i manually copy the module ath9k_hw.ko (thanks to Slboat) to /lib/module/3.3.8
but if i do a firstboot all is back to original...

Grtzz  Mark

Anybody knows why it is not backported to AA?