wlan: Only set 64 bit DMA mask when CONFIG_ARM_LPAE is enabled

In general DMA mask needs to be set to 32 bit for the 32 bit device.
But there is an exception: for 32 bits ARM chip, there is an
option to enable CONFIG_ARM_LPAE. In this case the DMA mask has to
be set to 64 bits.

CRs-Fixed: 606137
Change-Id: Ie28ed19cd21377da6696e297a369ea024ecfe1ad
diff --git a/CORE/SERVICES/HIF/PCIe/if_pci.c b/CORE/SERVICES/HIF/PCIe/if_pci.c
index 7e6e989..41bd55c 100644
--- a/CORE/SERVICES/HIF/PCIe/if_pci.c
+++ b/CORE/SERVICES/HIF/PCIe/if_pci.c
@@ -613,27 +613,32 @@
         ret = -EIO;
         goto err_region;
     }
-
+#ifdef CONFIG_ARM_LPAE
+    /* if CONFIG_ARM_LPAE is enabled, we have to set 64 bits mask
+     * for 32 bits device also. */
     ret =  pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
-    if (!ret) {
-        ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-
-        if (ret) {
-            printk(KERN_ERR "ath: Cannot enable 64-bit consistent DMA\n");
-            goto err_dma;
-        }
-    } else {
-        ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
-
-        if (!ret) {
-            ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
-            if (ret) {
-                printk(KERN_ERR "ath: Cannot enable 32-bit consistent DMA\n");
-                goto err_dma;
-            }
-        }
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 64-bit pci DMA\n");
+        goto err_dma;
     }
-
+    ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 64-bit consistent DMA\n");
+        goto err_dma;
+    }
+#else
+    ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 32-bit pci DMA\n");
+        goto err_dma;
+    }
+    ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+    if (ret) {
+        printk(KERN_ERR "%s: Cannot enable 32-bit consistent DMA!\n",
+               __func__);
+        goto err_dma;
+    }
+#endif
 
     /* Set bus master bit in PCI_COMMAND to enable DMA */
     pci_set_master(pdev);
@@ -913,26 +918,32 @@
         goto err_region;
     }
 
+#ifdef CONFIG_ARM_LPAE
+    /* if CONFIG_ARM_LPAE is enabled, we have to set 64 bits mask
+     * for 32 bits device also. */
     ret =  pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
-    if (!ret) {
-        ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-
-        if (ret) {
-            printk(KERN_ERR "%s: Cannot enable 64-bit consistent DMA!\n",
-                   __func__);
-            goto err_dma;
-        }
-    } else {
-        ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
-        if (!ret) {
-            ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
-            if (ret) {
-                printk(KERN_ERR "%s: Cannot enable 32-bit consistent DMA!\n",
-                       __func__);
-                goto err_dma;
-            }
-        }
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 64-bit pci DMA\n");
+        goto err_dma;
     }
+    ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 64-bit consistent DMA\n");
+        goto err_dma;
+    }
+#else
+    ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+    if (ret) {
+        printk(KERN_ERR "ath: Cannot enable 32-bit pci DMA\n");
+        goto err_dma;
+    }
+    ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+    if (ret) {
+        printk(KERN_ERR "%s: Cannot enable 32-bit consistent DMA!\n",
+               __func__);
+        goto err_dma;
+    }
+#endif
 
     /* Set bus master bit in PCI_COMMAND to enable DMA */
     pci_set_master(pdev);