diff options
| author | Mingcheng Zhu <mingchen@qca.qualcomm.com> | 2014-02-12 17:46:04 -0800 |
|---|---|---|
| committer | Prakash Dhavali <pdhavali@qca.qualcomm.com> | 2014-02-14 21:08:55 -0800 |
| commit | 10d21e7f8b32c778fdcbe4be722a707b3c19f609 (patch) | |
| tree | 2483253422e1420a95f41723a1bf0a674a2f38b8 | |
| parent | e7b9abadecb3d570d2b5e07f233b636c8487f1af (diff) | |
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
| -rw-r--r-- | CORE/SERVICES/HIF/PCIe/if_pci.c | 85 |
1 files changed, 48 insertions, 37 deletions
diff --git a/CORE/SERVICES/HIF/PCIe/if_pci.c b/CORE/SERVICES/HIF/PCIe/if_pci.c index 7e6e9896998b..41bd55c655fa 100644 --- a/CORE/SERVICES/HIF/PCIe/if_pci.c +++ b/CORE/SERVICES/HIF/PCIe/if_pci.c @@ -613,27 +613,32 @@ again: 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 @@ again: 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); |
