aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/pci.c
Commit message (Collapse)AuthorAge
...
* ath10k: cleanup ath10k_pci_wait_for_target_init()Kalle Valo2014-03-28
| | | | | | | | ath10k_pci_wait_for_target_init() did really follow the style used elsewhere in ath10k. Use ath10k_pci_read/write() wrappers, simplify the while loop and improve warning messages. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: remove pci completion listMichal Kazior2014-02-28
| | | | | | | | | | | | | | | | | | | | | One of the premises was to guarantee serialized completion handling for upper layers (HTC/WMI/HTT). Since quite some time now it is no longer necessary. The other premise was to batch up tx/rx completions to take advantage of hot caches. However frame tx/rx completion indications come in on a single pipe already so they are already batched up. More meaningful batching is done in HTT itself. This means PCI completion is no longer necessary to keep around. It just wastes memory, cycles and SLOC. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: bypass htc for htt tx pathMichal Kazior2014-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Going through full htc tx path for htt tx is a waste of resources. By skipping it it's possible to easily submit scatter-gather to the pci hif for reduced host cpu load and improved performance. The new approach uses dma pool to store the following metadata for each tx request: * msdu fragment list * htc header * htt tx command The htt tx command contains a msdu prefetch. Instead of copying it original mapped msdu address is used to submit a second scatter-gather item to hif to make a complete htt tx command. The htt tx command itself hands over dma mapped pointers to msdus and completion of the command itself doesn't mean the frame has been sent and can be unmapped/freed. This is why htc tx completion is skipped for htt tx as all tx related resources are freed upon htt tx completion indication event (which also implicitly means htt tx command itself was completed). Since now each htt tx request effectively consists of 2 copy engine items CE_HTT_H2T_MSG_SRC_NENTRIES is updated to allow maximum of TARGET_10X_NUM_MSDU_DESC msdus being queued. This keeps the tx path resource management simple. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: replace send_head() with tx_sg()Michal Kazior2014-02-28
| | | | | | | | | | | PCI is capable of handling scatter-gather lists. This can be used to avoid copying memory. Change the name of the callback while at to reflect its purpose. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: remove is_aborted from skb_cbMichal Kazior2014-02-28
| | | | | | | The flag wasn't used anymore. No need to keep it. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: Use pci_enable_msi_range()Alexander Gordeev2014-02-13
| | | | | | | | | | | As result deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: Disable MSI in case IRQ configuration is unknownAlexander Gordeev2014-02-13
| | | | | | | | | In case IRQ configuration is unknown possibly enabled MSIs are left enabled in ath10k_pci_deinit_irq(). This update fixes the described misbehaviour. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: Get rid of superfluous call to pci_disable_msi()Alexander Gordeev2014-02-13
| | | | | | | | | | | The documentation states that pci_enable_msi_block() returns the number of requests 'could have been allocated', not 'could allocate'. IOW, MSIs are *not* enabled if a positive value returned. kvalo: add commit log based on Alexander's email Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: fix device initialization routineMichal Kazior2014-02-13
| | | | | | | | | | | | | | | | Hardware CUS232 version 2 has some issues with cold reset that lead to Data Bus Errors or system hangs in some cases. It's safer to use warm reset when possible as it shouldn't trigger the aforementioned issues. Prefer warm reset over cold reset. However since warm reset doesn't work after FW crash make sure to fallback to cold reset when booting up the HW. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* ath10k: fix the printing of 10.x FW version when FW crashedChun-Yeow Yeoh2014-01-23
| | | | | | | | | | 10.x FW has no structure member sw_version_1. Thus, both fw_version_release and fw_version_build are not available. The provided fw_version_major is also wrong. Fix this by using the fw_version from struct wiphy. Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* Merge tag 'for-linville-20131203' of git://github.com/kvalo/athJohn W. Linville2013-12-09
|\ | | | | | | | | | | Conflicts: drivers/net/wireless/ath/ath10k/htc.c drivers/net/wireless/ath/ath10k/mac.c
| * ath10k: allow explicit MSI/MSI-X disablingMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be useful for testing and debugging. This introduces new ath10k_pci module parameter `irq_mode`. By default it is 0, meaning automatic irq mode (MSI-X as long as both target HW and host platform supports it). The parameter works on a best effort basis. kvalo: fix typo "ayto" Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: re-add support for early fw indicationMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible for FW to panic during early boot. The patch re-introduces support to detect and print those crashes. This introduces an additional irq handler that is set for the duration of early boot and shutdown. The handler is then overriden with regular handlers upon hif start(). Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: extract functions for legacy irq handlingMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | Preparation for code re-use. Also use ioread/write wrappers. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: defer irq registration until hif start()Michal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's impossible to rely on disable_irq() and/or CE interrupt masking with legacy shared interrupts. Other devices sharing the same irq line may assert it while ath10k is doing something that requires no interrupts. Irq handlers are now registered after all preparations are complete so spurious/foreign interrupts won't do any harm. The handlers are unregistered when no interrupts are required (i.e. during driver teardown). This also removes the ability to receive FW early indication (since interrupts are not registered until early boot is complete). This is not mission critical (it's more of a hint that early boot failed due to unexpected FW crash) and will be re-added in a follow up patch. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: decouple ath10k_pci_start_ce()Michal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function did a couple of things: it allocated CE completions, registered CE callbacks and enabled CE interrupts through HW registers. This cannot be so. Split the function into one that allocates CE completions and the other one that starts off CE operation. This is required for future legacy shared interrupt handling. This also fixes possible memory leak if post rx failed. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: don't use interrupts for BMIMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | It's not really necessary for interrupts to be used for BMI. BMI already assumes there's only one caller at a time and it works directly with CE. Make BMI poll for CE completions instead of waiting for interrupts. This makes disabling interrupts during early boot possible. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: split up pci irq codeMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Hardware waits until host signals whether it has chosen MSI(-X) or shared legacy interrupts. It is not required for the driver to register interrupt handlers immediately. This patch prepares the pci irq code for more changes. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: don't consume other's shared interruptsMichal Kazior2013-11-27
| | | | | | | | | | | | | | | | | | | | | | | | ath10k assumed all interrupts were directed to it. This isn't the case for legacy shared interrupts. ath10k consumed interrupts for other devices. Check device irq status and return IRQ_NONE when appropriate. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: show hardware and firmware info prints only onceKalle Valo2013-11-20
| | | | | | | | | | | | This makes ath10k a lot less spammy by default. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: don't show MSI registration warningsKalle Valo2013-11-20
| | | | | | | | | | | | | | | | Convert the MSI failure warnings to a debug message to make them less spammy. Also convert the irq mode printout to a single print to make it easier to show it only once. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: reset device upon stopping/power downMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | | | | | | | This should make sure the device won't issue any interrupts nor access any memory after the driver is stopped/freed thus avoid memory corruption in some cases. Reported-By: Ben Greear <greearb@candelatech.com> 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>
| * ath10k: add and fix some PCI printsMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | Add missing error reporting and adjust other prints to make everything more consistent. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: re-arrange PCI init codeMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | | | | | This patch moves irq registering after necessary structures have been allocated and initialized. This should prevent interrupts from causing tasklet access invalid memory pointers. 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>
| * ath10k: guard against CE corruption from firmwareMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | | | In case firmware crashes it may report CE completions for entries that were never submitted/filled with meaningful data. This in turn led to NULL dereferences. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: propagate ath10k_ce_disable_interrupts() errorsMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | This shouldn't be silenced. This will be necessary for PCI init code reordering. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: use ath10k_do_pci_wake/sleepMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | | | This removes some remaining direct use of the wake register which could interfere with power state tracking of the target device. This will allow initialization code reordering. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: remove meaningless checkMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | The check doesn't make much sense. If the address were to be 0x0000 the check would fail. In this case a 0 address isn't wrong. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: rename ath10k_pci_reset_target()Michal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | What the function does is to actually wait for the firmware indication bit to be set. Prerequisite for this is having interrupts registered. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: split tasklet killing functionMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | The function will soon be called from more than 1 place. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: don't forget to kill fw error taskletMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | It was possible for FW error tasklet to be executed during teardown. This could lead to system crashes and/or memory corruption. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: remove ar_pci->ce_countMichal Kazior2013-11-12
| | | | | | | | | | | | | | | | | | | | It wasn't really useful to have it to begin with. This makes it a little simpler to re-arrange PCI init code as some function depended on ar_pci->ce_count being set. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: fix possible memory leak in ath10k_pci_probe()Wei Yongjun2013-11-06
| | | | | | | | | | | | | | | | | | memory is malloced in ath10k_pci_probe() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: add error handling to ath10k_pci_wait()Kalle Valo2013-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ath10k_pci_wait() didn't notify any errors to callers, it just printed a warning so add proper error handling. This fixes a crash Ben reported: ath10k: MSI-X interrupt handling (8 intrs) ath10k: Unable to wakeup target ath10k: target took longer 5000 us to wake up (awake count 1) ath10k: Failed to get pcie state addr: -16 ath10k: early firmware event indicated BUG: unable to handle kernel NULL pointer dereference at 0000000000000004 IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci] Reported-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: implement ath10k_pci_soc_read/write32()Kalle Valo2013-10-21
| | | | | | | | | | | | | | To make it easier to access SOC registers. No functional changes. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
| * ath10k: fix NULL deref upon early FW crashMichal Kazior2013-10-21
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-linus' of ↵Linus Torvalds2013-11-15
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree updates from Jiri Kosina: "Usual earth-shaking, news-breaking, rocket science pile from trivial.git" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (23 commits) doc: usb: Fix typo in Documentation/usb/gadget_configs.txt doc: add missing files to timers/00-INDEX timekeeping: Fix some trivial typos in comments mm: Fix some trivial typos in comments irq: Fix some trivial typos in comments NUMA: fix typos in Kconfig help text mm: update 00-INDEX doc: Documentation/DMA-attributes.txt fix typo DRM: comment: `halve' -> `half' Docs: Kconfig: `devlopers' -> `developers' doc: typo on word accounting in kprobes.c in mutliple architectures treewide: fix "usefull" typo treewide: fix "distingush" typo mm/Kconfig: Grammar s/an/a/ kexec: Typo s/the/then/ Documentation/kvm: Update cpuid documentation for steal time and pv eoi treewide: Fix common typo in "identify" __page_to_pfn: Fix typo in comment Correct some typos for word frequency clk: fixed-factor: Fix a trivial typo ...
| * treewide: Fix typo in printkMasanari Iida2013-10-14
| | | | | | | | | | | | | | | | Correct spelling typo within various part of the kernel Signed-off-by: Masanari Iida <standby24x7@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | ath10k: remove num_sends_allowedMichal Kazior2013-10-07
| | | | | | | | | | | | | | | | The value provided by num_sends_allowed is now derived from CE source ringbuffer state. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: remove ce_sendlist_sendMichal Kazior2013-10-07
| | | | | | | | | | | | | | | | | | It is completely pointless to keep this function around. It doesn't do anything different than ce_send except it introduces more overhead. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: fix num_sends_allowed replenishingMichal Kazior2013-09-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e9bb0aa39 ("ath10k: delete struct ce_sendlist") broke num_sends_allowed incrementing. num_sends_allowed exceeded initial values and could overflow. This code was supposed to replenish num_sends_allowed for partial sendlist items (i.e. before final sendlist item from a sendlist was completed and could be processed by completion handlers). Fortunately it seems it did not cause any major breakage, yet. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | wireless: ath10k: remove unnecessary pci_set_drvdata()Jingoo Han2013-09-12
| | | | | | | | | | | | | | | | | | The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: delete struct ce_sendlistKalle Valo2013-09-12
| | | | | | | | | | | | | | struct ce_sendlist is useless as we always add just one buffer onto it. And most importantly, it's ugly as it doesn't use skb properly. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: add boot debug messages to pci.c and ce.cKalle Valo2013-09-12
| | | | | | | | | | | | | | To unify all boot related debug messages into one debug level. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: prevent CE from looping indefinitelyMichal Kazior2013-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The double while() could end up running forever. Inner while() would complete very fast. However the completion processing could take enough time for more completions to flow in. In that case the outer while() would not terminate and run again, and again. This could happen especially on a slow host system. This could lead to a system freeze during heavy traffic. Note: this doesn't solve all known starvation issues yet. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: add missing braces to ath10k_pci_tx_pipe_cleanupDave Jones2013-09-06
| | | | | | | | | | | | | | | | | | | | The indentation here implies this was meant to be a multi-statement if, but it lacks the braces. kvalo: add "ath10k: " prefix Signed-off-by: Dave Jones <davej@fedoraproject.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: check chip id from the soc register during probeKalle Valo2013-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | ath10k: convert ath10k_pci_wake() to returnKalle Valo2013-09-03
| | | | | | | | | | | | | | | | We should not try to access hw if wakeup fails so add proper error checking for that. Also add the timeout lenght to the warning message. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10kKalle Valo2013-09-03
| | | | | | | | | | | | This is consistent with all other functions. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
* | ath10k: remove void pointer from struct ath10k_pci_complKalle Valo2013-09-03
| | | | | | | | | | | | | | | | Void pointers are bad, mmkay. No functional changes. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>