mwifiex: enable MSI interrupt support in pcie
authorAvinash Patil <patila@marvell.com>
Wed, 16 Dec 2015 12:21:45 +0000 (04:21 -0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 30 Dec 2015 15:31:33 +0000 (17:31 +0200)
Newer pcie devices (8897 onwards) support MSI. This
patch enables it.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/pcie.c
drivers/net/wireless/marvell/mwifiex/pcie.h

index 21192b6f9c64fd8013edeb3dbef9585d8c210b88..9703848ba9f8e5c1e2e9378d6f727907016a8d6f 100644 (file)
@@ -2599,6 +2599,30 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
        kfree(card);
 }
 
+static int mwifiex_pcie_request_irq(struct mwifiex_adapter *adapter)
+{
+       int ret;
+       struct pcie_service_card *card = adapter->card;
+       struct pci_dev *pdev = card->dev;
+
+       if (pci_enable_msi(pdev) != 0)
+               pci_disable_msi(pdev);
+       else
+               card->msi_enable = 1;
+
+       mwifiex_dbg(adapter, INFO, "msi_enable = %d\n", card->msi_enable);
+
+       ret = request_irq(pdev->irq, mwifiex_pcie_interrupt, IRQF_SHARED,
+                         "MRVL_PCIE", pdev);
+       if (ret) {
+               pr_err("request_irq failed: ret=%d\n", ret);
+               adapter->card = NULL;
+               return -1;
+       }
+
+       return 0;
+}
+
 /*
  * This function registers the PCIE device.
  *
@@ -2606,21 +2630,14 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
  */
 static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
 {
-       int ret;
        struct pcie_service_card *card = adapter->card;
        struct pci_dev *pdev = card->dev;
 
        /* save adapter pointer in card */
        card->adapter = adapter;
 
-       ret = request_irq(pdev->irq, mwifiex_pcie_interrupt, IRQF_SHARED,
-                         "MRVL_PCIE", pdev);
-       if (ret) {
-               mwifiex_dbg(adapter, ERROR,
-                           "request_irq failed: ret=%d\n", ret);
-               adapter->card = NULL;
+       if (mwifiex_pcie_request_irq(adapter))
                return -1;
-       }
 
        adapter->dev = &pdev->dev;
        adapter->tx_buf_size = card->pcie.tx_buf_size;
index 347ba45f1f2ad2f11140db13c1e79947d6cb993d..6fc28737b576c64b1ac52d0199611cb81c8bad2b 100644 (file)
@@ -326,6 +326,7 @@ struct pcie_service_card {
        dma_addr_t sleep_cookie_pbase;
        void __iomem *pci_mmap;
        void __iomem *pci_mmap1;
+       int msi_enable;
 };
 
 static inline int