qca / open-ath9k-htc-firmware

The firmware for QCA AR7010/AR9271 802.11n USB NICs
Other
429 stars 182 forks source link

[ARM] Driver takes long time to be load #58

Closed TuTizz closed 10 years ago

TuTizz commented 10 years ago

Hi all,

I am wondering if you could comment on that. I have got a Zconmax ZCN-722M dongle wifi with an Atheros AR9271 chipset with which I have got some issues. I am working on a freescale imx6 (ARM) and creating my own OS with yocto https://www.yoctoproject.org/ After activated the drivers : CONFIG_ATH_COMMON=y CONFIG_ATH9K_HW=y CONFIG_ATH9K_COMMON=y CONFIG_ATH9K_HTC=y I put htc_9271.fw on /lib/firmware and this is what happen when I plug my wifi device :

[  169.886113] usb 1-1.3.3: new high speed USB device number 9 using fsl-ehci
[  200.353466] usb 1-1.3.3: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[  200.588820] ath9k_htc 1-1.3.3:1.0: ath9k_htc: HTC initialized with 33 credits
[  200.801453] ath9k_htc 1-1.3.3:1.0: ath9k_htc: FW Version: 1.3
[  200.815647] ieee80211 phy0: Atheros AR9271 Rev:1
[  200.826037] usb 1-1.3.3: ath9k_htc: USB layer initialized

As you can see, the driver took a very long time to be effective (200 - 169 = 31 sec). I tried to plug the device on a intel i7 Kubuntu and its very effective (less than 2sec). Anyone got an idea?

Best regards,

olerem commented 10 years ago

Which kernel version are you using? My log looks:

[24648.626380] usb 3-2: new high-speed USB device number 4 using xhci_hcd
[24648.795078] usb 3-2: New USB device found, idVendor=0cf3, idProduct=7015
[24648.795091] usb 3-2: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[24648.795098] usb 3-2: Product: USB WLAN
[24648.795105] usb 3-2: Manufacturer: ATHEROS
[24648.795110] usb 3-2: SerialNumber: 12345
[24649.354391] usb 3-2: ath9k_htc: Firmware htc_7010.fw requested
[24649.354553] usbcore: registered new interface driver ath9k_htc
[24649.459818] usb 3-2: ath9k_htc: Transferred FW: htc_7010.fw, size: 72812
[24649.529905] ath9k_htc 3-2:1.0: ath9k_htc: HTC initialized with 45 credits
[24649.758225] ath9k_htc 3-2:1.0: ath9k_htc: FW Version: 1.4
[24649.758235] ath: EEPROM regdomain: 0x809c
[24649.758239] ath: EEPROM indicates we should expect a country code
[24649.758243] ath: doing EEPROM country->regdmn map search
[24649.758247] ath: country maps to regdmn code: 0x52
[24649.758252] ath: Country alpha2 being used: CN
[24649.758255] ath: Regpair used: 0x52
[24649.763110] ieee80211 phy1: Atheros AR9287 Rev:2
TuTizz commented 10 years ago

I am using the kernel 3.0.35

olerem commented 10 years ago

That feels some what old. You can add some printk to probe function in drivers/net/wireless/ath/ath9k/hif_usb.c. To make sure it is really firmware load issue. If it is FW load, you will need to sniff usb traffic and find what is actually happening.

TuTizz commented 10 years ago

Morning every one, I tried to add some printk to the driver ( http://pastebin.com/KRYY3s8p ) and I also stopped udev : here the result :

[  349.998260] usb 1-1.7: new high speed USB device number 5 using fsl-ehci
[  350.139560] usb 1-1.7: ath9k_htc: Firmware number 1 - hĒ��&�� 
[  381.078128] usb 1-1.7: ath9k_htc: Firmware number 2
[  381.087877] usb 1-1.7: ath9k_htc: Firmware - htc_9271.fw not found
[  381.100251] ath9k_htc: probe of 1-1.7:1.0 failed with error -22

/sys/class/firmware/timeout = 30 = 380-350

Where can I specifying the firmware path? In kernel menuconfig? I have no idea where the probe error can be found, Do you have an idea what happen?

log with udev started :

[  202.958253] usb 1-1.7: new high speed USB device number 4 using fsl-ehci
[  203.099710] usb 1-1.7: ath9k_htc: Firmware number 1 - hĒ��&�� 
[  233.147669] usb 1-1.7: ath9k_htc: Firmware number 2
[  233.157559] usb 1-1.7: ath9k_htc: Firmware number 3
[  233.454092] usb 1-1.7: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[  233.467897] usb 1-1.7: ath9k_htc: Firmware number 4
[  233.477732] usb 1-1.7: ath9k_htc: Firmware - idx = 0 
[  233.487878] usb 1-1.7: ath9k_htc: Firmware - idx = 1 
[  233.498046] usb 1-1.7: ath9k_htc: Firmware - idx = 2 
[  233.508201] usb 1-1.7: ath9k_htc: Firmware - idx = 3 
[  233.518401] usb 1-1.7: ath9k_htc: Firmware - idx = 4 
[  233.528556] usb 1-1.7: ath9k_htc: Firmware - idx = 5 
[  233.689207] ath9k_htc 1-1.7:1.0: ath9k_htc: HTC initialized with 33 credits
[  233.898220] ath9k_htc 1-1.7:1.0: ath9k_htc: FW Version: 1.3
[  233.910596] ieee80211 phy0: Atheros AR9271 Rev:1
[  233.921169] usb 1-1.7: ath9k_htc: USB layer initialized

Taking a long time in the request_firmware fonction...

TuTizz commented 10 years ago

I tried to add CONFIG_EXTRA_FIRMWARE=htc_9271.bin and CONFIG_EXTRA_FIRMWARE_DIR=/lib/firmware in my kernel menuconfig.

[    5.280062] usb 1-1.7: ath9k_htc: Firmware number 1 - h�� :�`F�,0�*�p��@9���Et� 
[    5.296993] usb 1-1.7: ath9k_htc: Firmware number 2
[    5.307547] usb 1-1.7: ath9k_htc: Firmware number 3
[    5.605585] usb 1-1.7: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[    5.620059] usb 1-1.7: ath9k_htc: Firmware number 4
[    5.630470] usb 1-1.7: ath9k_htc: Firmware - idx = 0 
[    5.640906] usb 1-1.7: ath9k_htc: Firmware - idx = 1 
[    5.651028] usb 1-1.7: ath9k_htc: Firmware - idx = 2 
[    5.663072] usb 1-1.7: ath9k_htc: Firmware - idx = 3 
[    5.673361] usb 1-1.7: ath9k_htc: Firmware - idx = 4 
[    5.683505] usb 1-1.7: ath9k_htc: Firmware - idx = 5 
[    5.841154] ath9k_htc 1-1.7:1.0: ath9k_htc: HTC initialized with 33 credits

My kernel is not waiting anymore. Is that a correct solution?

olerem commented 10 years ago

It is not good solution, because you won't be able to update firmware without rebuilding kernel. Take a look here http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/firmware_class/README?id=HEAD

TuTizz commented 10 years ago

Re, With the kernel 3.0.35, user had to manualy upload the firmware into the device. https://github.com/Freescale/linux-fslc/tree/patches-3.0.35-4.0.0-wandboard/Documentation/firmware_class With udev and script my driver is now completely loaded in 3 sec :

[ 1060.828597] usb 1-1.7.4: ath9k_htc: USB layer deinitialized
[ 1062.878175] usb 1-1.7.4: new high speed USB device number 10 using fsl-ehci
[ 1063.314410] usb 1-1.7.4: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 1063.549760] ath9k_htc 1-1.7.4:1.0: ath9k_htc: HTC initialized with 33 credits
[ 1063.762515] ath9k_htc 1-1.7.4:1.0: ath9k_htc: FW Version: 1.3
[ 1063.776371] ieee80211 phy3: Atheros AR9271 Rev:1
[ 1063.787029] usb 1-1.7.4: ath9k_htc: USB layer initialized

Thanks for your help.