summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath10k/core.c
AgeCommit message (Collapse)Author
2014-09-11ath10k: add testmodeKalle Valo
Add testmode interface for starting and using UTF firmware which is used to run factory tests. This is implemented by adding new state ATH10K_STATE_UTF and user space can enable this state with ATH10K_TM_CMD_UTF_START command. To go back to normal mode user space can send ATH10K_TM_CMD_UTF_STOP. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-09-10ath10k: move fw_crash_dump allocationMichal Kazior
The fw_crash_data was allocated too late. Upon early firmware crash, before registering to mac80211, it was possible to crash the whole system: ath10k_pci 0000:00:05.0: device has crashed during init BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffffa0058005>] ath10k_debug_get_new_fw_crash_data+0x15/0x30 [ath10k_core] PGD 0 Oops: 0002 [#1] SMP Modules linked in: ath10k_pci(O) ath10k_core(O) ath [last unloaded: ath] CPU: 3 PID: 29 Comm: kworker/u8:1 Tainted: G O 3.17.0-rc2-wl-ath+ #447 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: ath10k_wq ath10k_core_register_work [ath10k_core] task: ffff88001eb01ad0 ti: ffff88001eb60000 task.ti: ffff88001eb60000 RIP: 0010:[<ffffffffa0058005>] [<ffffffffa0058005>] ath10k_debug_get_new_fw_crash_data+0x15/0x30 [ath10k_core] RSP: 0018:ffff88001eb63ce8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffc90001a09030 RDI: 0000000000000001 RBP: ffff88001eb63cf0 R08: 0000000000000000 R09: ffff8800000bb200 R10: 00000000000001e2 R11: ffff88001eb638de R12: ffff88001d7459a0 R13: ffff88001d746ab0 R14: 00000000fffe14d4 R15: ffff88001d747c60 FS: 0000000000000000(0000) GS:ffff88001fd80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000000 CR3: 000000001df34000 CR4: 00000000000006e0 Stack: ffff88001d7459a0 ffff88001eb63d58 ffffffffa0083bbe ffff880000000010 ffff88001eb63d68 ffff88001eb63d18 0000000000000002 0000000000059010 ffffffffa0086fef 00000000deadbeef ffff88001d747a28 ffff88001d7459a0 Call Trace: [<ffffffffa0083bbe>] ath10k_pci_fw_crashed_dump+0x2e/0xd0 [ath10k_pci] [<ffffffffa0085410>] __ath10k_pci_hif_power_up+0x5f0/0x700 [ath10k_pci] [<ffffffffa0085550>] ath10k_pci_hif_power_up+0x30/0xe0 [ath10k_pci] [<ffffffffa005bc7b>] ath10k_core_register_work+0x2b/0x520 [ath10k_core] [<ffffffff810689cc>] process_one_work+0x18c/0x3f0 [<ffffffff81069011>] worker_thread+0x121/0x4a0 [<ffffffff81068ef0>] ? rescuer_thread+0x2c0/0x2c0 [<ffffffff8106daf2>] kthread+0xd2/0xf0 [<ffffffff8106da20>] ? kthread_create_on_node+0x170/0x170 [<ffffffff81857cfc>] ret_from_fork+0x7c/0xb0 [<ffffffff8106da20>] ? kthread_create_on_node+0x170/0x170 Code: 8b 40 38 48 c7 80 00 01 00 00 00 00 00 00 5b 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 53 48 8b 9f 90 1d 00 00 48 8d 7b 01 <c6> 03 01 e8 e3 ec 2b e1 48 8d 7b 18 e8 6a 4f 05 e1 48 89 d8 5b RIP [<ffffffffa0058005>] ath10k_debug_get_new_fw_crash_data+0x15/0x30 [ath10k_core] RSP <ffff88001eb63ce8> CR2: 0000000000000000 ---[ end trace 5d0ed15b050bcc1f ]--- Kernel panic - not syncing: Fatal exception in interrupt Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff) ---[ end Kernel panic - not syncing: Fatal exception in interrupt To prevent that split debug functions and allocate fw_crash_data earlier. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-26ath10k: improve logging to include dev idMichal Kazior
This makes it a lot easier to log and debug messages if there's more than 1 ath10k device on a system. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25ath10k: flush hif buffers before recoveryMichal Kazior
Transport buffers weren't flushed and processed before queueing hw recovery request to mac80211. This could in theory result in an unwanted htt/wmi rx events being processed while mac80211 recovers the device and possibly interfere or even crash the system. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25ath10k: move fw init printMichal Kazior
Firmware probing is done only once when driver is registered and firmware version is guaranteed to remain the same until driver is unregistered. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25ath10k: print more driver info when firmware crashesKalle Valo
Sometimes users forget to include important info like firmware version, so better to print all the info. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-14ath10k: unregister spectral before macSimon Wunderlich
If spectral is unregistered after mac80211, the relayfs file has already been removed recursively by mac/cfg80211, and spectral tries to remove the file once more, thus leading to double free problems. Better clean up spectral before to avoid that problem. Reported-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-12ath10k: remove htc->stoppedMichal Kazior
This is not necessary anymore. There are no more uncontrolled htc tx entry points. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-12ath10k: embed ar_pci inside arMichal Kazior
Use the common convention of embedding private structures inside parent structures. This reduces allocations and simplifies pci probing code. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-12ath10k: introduce a stricter scan state machineMichal Kazior
This aims at fixing some rare scan bugs related to firmware reporting unexpected scan event sequences. One such bug was if spectral scan phyerr reporting prevented firmware from properly propagating scan events to host. This led to scan timeout. After that next scan would trigger scan completed event first (before scan started event) leading to ar->scan.in_progress and timeout timer states to be overwritten incorrectly and making the very next scan to hang forever. Reported-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-04ath10k: add spectral scan featureSimon Wunderlich
Adds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file. Essentially, to try it out: ip link set dev wlan0 up echo background > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl echo trigger > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl iw dev wlan0 scan echo disable > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl cat /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0 > samples This feature is still experimental. Based on the original RFC patch of Sven Eckelmann. Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-07-28ath10k: add support for 10.2 firmwareMichal Kazior
The 10.2 firmware is a successor of 10.1 firmware (formerly identified as 10.x). Both share a lot but have some slight ABI differences that need to be taken care of. The 10.2 firmware introduces some new features but those can be added in subsequent patches. This patch makes ath10k boot and work with 10.2 with comparable functionality to 10.1. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-07-18Merge tag 'for-linville-20140717' of git://github.com/kvalo/athJohn W. Linville
2014-07-14ath10k: fix unregister deadlock when fw probe failsMichal Kazior
If firmware probing worker failed it called device_release_driver() which synchronously called remove() pci callback. The callback in turn waited for the worker that called it to finish resulting in a deadlock. Waiting for a completion instead of a worker, like some other drivers do, doesn't seem like the best idea either: Syscall Worker probe_fw() rmmod dev_lock() pci->remove() wait_for_completion() complete_all() device_release_driver() dev_lock() [sleep] free(ar) dev_unlock() [resume] There's no guarantee that Worker upon resuming can still access any data/code of the module. Leaving device bound to a driver is not as harmful as deadlocking so remove the call to device_release_driver() while a proper solution is figured out. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-06-02ath10k: fix 8th virtual AP interface with DFSBartosz Markowski
Firmware 10.x supports up to 8 virtual AP interfaces, but in a DFS channel it was possible to create only 7 interfaces as ath10k internal creates a monitor interface for DFS. Previous vdev map initialization was missing enough space for 8 + 1 vdevs due to wrong define used and that's why there was no space for 8th interface. Use the correct define TARGET_10X_NUM_VDEVS with 10.x firmware to make it possible to create the 8th virtual interface. Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-06-02ath10k: print Kconfig optionsJanusz Dziedzic
Print Kconfig options enabled/disabled in the build. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-05-27ath10k: perform hw restart lazilyMichal Kazior
This reduces risk of races and prepares for more hw restart fixes. It also makes sense to perform teardown after mac80211 starts its restart routine as it guarantees it has stopped itself by then (including tx queues). Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-05-26ath10k: make core registering asyncMichal Kazior
If ath10k was built into the kernel it could stall booting for 120 seconds by default (60 seconds for each firmware API variant) waiting for firmware files before userspace was ready or filesystems mounted. Fix this by making the core registering asynchronous. This also shoves off about 1 second from boot time on most systems since the driver is now mostly initialized in a worker and modprobe takes very little time to complete. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-05-26ath10k: relocate core create/destroy functionsMichal Kazior
This will avoid unnecessary forward declaration of any kind in the future. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-05-23ath10k: fix core start sequenceMichal Kazior
It was possible to call hif_stop() 2 times through ath10k_htc_connect_init() timeout failpath which could lead to double free_irq() kernel splat for multiple MSI interrupt case. Re-order init sequence to avoid this problem. The HTC stop shouldn't stop HIF implicitly since it doesn't implicitly start it. Since the re-ordering required some functions to be split/removed/renamed rename a few functions to make more sense while at it. Reported-By: Ben Greear <greearb@candelatech.com> Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-04-24ath10k: skip suspending when recoveringMichal Kazior
It doesn't make much sense to even try suspending the device when recovering. Recovering means the device is unresponsive and waiting for suspend procedure means taking a 3 second timeout waiting for tx credits. This speeds up firmware recovery significantly. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-03-28ath10k: print chip id during bootKalle Valo
This makes it easier to debug what kind of board is used. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-03-28ath10k: add otp and firmware boot error messagesBen Greear
If OTP or firmware fails to load properly, print out some extra info in the kernel logs. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-03-28ath10k: better firmware loading error messagesBen Greear
Let user know the name of the board file if it is not found, and make it easier to determine the firmware api being used. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-03-21ath10k: check otp.bin resultKalle Valo
When we execute otp.bin in the target check that the result it returns doesn't contain an error. This is to make sure that we don't accidentally use invalid calibration data. While at it, remove the useless label in the function and add few debug messages. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-03-21ath10k: separate result parameter in ath10k_bmi_execute()Kalle Valo
It's just cleaner to have separate argument for the parameter and result. Also fix returned error value if response length is invalid. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-02-13ath10k: suspend hardware before resetMarek Puzyniak
In case of warm reset target need to be suspended. Suspend function is extented to handle both cases with disabling interrupts and without disabling interrupts. Warm target reset requires suspend with all interrupts disabled. This patch depends on ath10k: fix device initialization routine Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-02-13ath10k: refactor suspend/resume functionsMarek Puzyniak
Suspend/resume callbacks are not protected by configuration mutex so adding such protection. Also in order to simplify implemetation of suspend function wait queue is replaced by completion. Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-02-04ath10k: Print out firmware feature bits from IE.Ben Greear
Aids in understanding excactly what a firmware is offering. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-11-20ath10k: show hardware and firmware info prints only onceKalle Valo
This makes ath10k a lot less spammy by default. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-11-20ath10k: make core boot messages more compactKalle Valo
We can show the same amount of information in one line. And then it's easier to show this information only during first firmware boot (see next patch). For UART printouts there's already a message when they are enabled so no need to have a print when they are disabled, that's the default anyway. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-11-12ath10k: fix core init failpathMichal Kazior
HIF was not stopped properly in ath10k_core_start() upon failure. This could cause memory leaks of CE completions entries and possibly other issues as well. Move the HIF start/stop out of ath10k_htc_wait_target(). The ctl_resp completion is already prepared in ath10k_htc_init. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-11-08ath10k: Fix un-initialized debug objects.Ben Greear
If the 'ar' registration fails early, the debug objects were not initialized, and trouble ensued when the object was later destroyed and the un-initialized objects were accessed. Per Kalle's suggestion, move the debug_destroy to the core_unregister method. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-21ath10k: fix NULL deref upon early FW crashMichal Kazior
If firmware crashes during FW probing it would try to perform FW recovery which uses mac80211 workqueue before registering to mac80211. Using internal workqueue solves the problem. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-16ath10k: track vif list internallyMichal Kazior
mac80211 interface interations functions have peculiar locking issues. This patch introduces internal (to ath10k) vif list that will be used for vif iteration purposes. kvalo: remove extra INIT_LIST_HEAD() Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-09ath10k: remove unneded semicolon from ath10k_core_fetch_firmware_api_n()Fengguang Wu
drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon Removes unneeded semicolon. Generated by: coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-09ath10k: fix ath10k_debug_start() lockingKalle Valo
ath10k_debug_start() was not called with conf_mutex, fix that. Also there was a deadlock in ath10k_debug_stop(), rename it to ath10k_debug_destroy() and call it only when the device is destroyed. Reported-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08ath10k: fix possible memory leak in new FW loadingMichal Kazior
Some failpaths did `return` instead of a `goto` leaking requested firmware. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08ath10k: fix printf format stringMichal Kazior
size_t corresponds to %zu not %d. Compiler was complaining about it. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30ath10k: implement firmware IE container supportKalle Valo
Firmware IE containers can dynamically provide various information what firmware supports. Also it can embed more than one image so updating firmware is easy, user just needs to update one file in /lib/firmware/. The firmware API 2 or higher will use the IE container format, the current API 1 will not use the new format but it still is supported for some time. FW API 2 files are named as firmware-2.bin (which contains both firmware and otp images) and API 1 files are firmware.bin and otp.bin. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30ath10k: store separate pointers for firmware dataKalle Valo
Needed for firmware IE formatted images. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30ath10k: rename board_data in struct ath10kKalle Valo
I will use board_data for something else in the following patch so I need to rename it. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27ath10k: bring back the WMI path for mgmt framesBartosz Markowski
This is still the only way to submit mgmt frames in case of 10.X firmware. This patch introduces wmi_mgmt_tx queue, because of the fact WMI command can block. This is a problem for ath10k_tx_htt(), since it's called from atomic context. The skb queue and worker are introduced to move the mgmt frame handling out of .tx callback context and not block. Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27ath10k: drop the fw versioning sanity checkBartosz Markowski
It was corrupted and leading to compilation warning core.c: In function 'ath10k_check_fw_version': core.c:79: warning: comparison is always true due to limited range of data type Since we are going to support new FW track in the driver, the sanity check for fw version number would be an overkill then. This is just for information purposes anyway. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12ath10k: cleanup debug messages in core.cKalle Valo
Fix them to follow the general logging style in ath10k. While at it, add print id chip_id to the debug log. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12ath10k: rename ATH10K_DBG_CORE to BOOTKalle Valo
core.c mostly deals with driver and firmware starting related actions. And we can use the boot level also in other components, like PCI and HTT. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06ath10k: set the UART baud rate to 19200Bartosz Markowski
When configuring the host_interests over BMI, set the UART baud rate to 19200. This is valid for QCA988X_2.0 devices. kvalo: found during code review, there should not be any functionality changes Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06ath10k: implement ath10k_debug_start/stop()Kalle Valo
Needed for the HTT stats implementation. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03ath10k: check chip id from the soc register during probeKalle Valo
ath10k doesn't support qca988x hw1.0 boards anymore. Unfortunately the PCI id is the same in hw1.0 and hw2.0 so ath10k tries to use hw1.0 boards anyway. But without hw1.0 workarounds in place ath10k just crashes horribly. To avoid using hw1.0 boards at all add a chip id detection and fail the probe if hw1.0 is detected: [ 5265.786408] ath10k: ERROR: qca988x hw1.0 is not supported [ 5265.786497] ath10k: Unsupported chip id 0x043200ff [ 5265.786574] ath10k: could not register driver core (-95) [ 5265.793191] ath10k_pci: probe of 0000:02:00.0 failed with error -95 Also add a warning if there's an unknown chip id but continue the boot process normally anyway. Reported-by: Zaki Bakar <zaki.bm@gmail.com> Tested-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-08-12ath10k: Remove qca98xx hw1.0 supportBartosz Markowski
Since the firmware support is no longer available for hw1.0, drop all code (especially workarounds) for those units. Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>