aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/pci.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-11-25 08:06:27 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-11-27 09:47:00 -0500
commitcfe9c45b21ce2649e31f7e5d997f9c26b56f29e9 (patch)
tree7f8dd0c189943726b104b14de981966266f41fce /drivers/net/wireless/ath/ath10k/pci.c
parentab977bd04bd56edf473e0317eb2370abba04356c (diff)
ath10k: allow explicit MSI/MSI-X disabling
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>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/pci.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 0a2d1c20e4df..1365b55e7cca 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -33,10 +33,21 @@
33#include "ce.h" 33#include "ce.h"
34#include "pci.h" 34#include "pci.h"
35 35
36enum ath10k_pci_irq_mode {
37 ATH10K_PCI_IRQ_AUTO = 0,
38 ATH10K_PCI_IRQ_LEGACY = 1,
39 ATH10K_PCI_IRQ_MSI = 2,
40};
41
36static unsigned int ath10k_target_ps; 42static unsigned int ath10k_target_ps;
43static unsigned int ath10k_pci_irq_mode = ATH10K_PCI_IRQ_AUTO;
44
37module_param(ath10k_target_ps, uint, 0644); 45module_param(ath10k_target_ps, uint, 0644);
38MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option"); 46MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option");
39 47
48module_param_named(irq_mode, ath10k_pci_irq_mode, uint, 0644);
49MODULE_PARM_DESC(irq_mode, "0: auto, 1: legacy, 2: msi (default: 0)");
50
40#define QCA988X_2_0_DEVICE_ID (0x003c) 51#define QCA988X_2_0_DEVICE_ID (0x003c)
41 52
42static DEFINE_PCI_DEVICE_TABLE(ath10k_pci_id_table) = { 53static DEFINE_PCI_DEVICE_TABLE(ath10k_pci_id_table) = {
@@ -2387,27 +2398,37 @@ static void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
2387static int ath10k_pci_init_irq(struct ath10k *ar) 2398static int ath10k_pci_init_irq(struct ath10k *ar)
2388{ 2399{
2389 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 2400 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
2401 bool msix_supported = test_bit(ATH10K_PCI_FEATURE_MSI_X,
2402 ar_pci->features);
2390 int ret; 2403 int ret;
2391 2404
2392 ath10k_pci_init_irq_tasklets(ar); 2405 ath10k_pci_init_irq_tasklets(ar);
2393 2406
2394 if (!test_bit(ATH10K_PCI_FEATURE_MSI_X, ar_pci->features)) 2407 if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO &&
2395 goto msi; 2408 !test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags))
2409 ath10k_info("limiting irq mode to: %d\n", ath10k_pci_irq_mode);
2396 2410
2397 /* Try MSI-X */ 2411 /* Try MSI-X */
2398 ar_pci->num_msi_intrs = MSI_NUM_REQUEST; 2412 if (ath10k_pci_irq_mode == ATH10K_PCI_IRQ_AUTO && msix_supported) {
2399 ret = pci_enable_msi_block(ar_pci->pdev, ar_pci->num_msi_intrs); 2413 ar_pci->num_msi_intrs = MSI_NUM_REQUEST;
2400 if (ret == 0) 2414 ret = pci_enable_msi_block(ar_pci->pdev, ar_pci->num_msi_intrs);
2401 return 0; 2415 if (ret == 0)
2402 if (ret > 0) 2416 return 0;
2403 pci_disable_msi(ar_pci->pdev); 2417 if (ret > 0)
2418 pci_disable_msi(ar_pci->pdev);
2419
2420 /* fall-through */
2421 }
2404 2422
2405msi:
2406 /* Try MSI */ 2423 /* Try MSI */
2407 ar_pci->num_msi_intrs = 1; 2424 if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_LEGACY) {
2408 ret = pci_enable_msi(ar_pci->pdev); 2425 ar_pci->num_msi_intrs = 1;
2409 if (ret == 0) 2426 ret = pci_enable_msi(ar_pci->pdev);
2410 return 0; 2427 if (ret == 0)
2428 return 0;
2429
2430 /* fall-through */
2431 }
2411 2432
2412 /* Try legacy irq 2433 /* Try legacy irq
2413 * 2434 *