From 10d21e7f8b32c778fdcbe4be722a707b3c19f609 Mon Sep 17 00:00:00 2001 From: Mingcheng Zhu Date: Wed, 12 Feb 2014 17:46:04 -0800 Subject: 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 --- CORE/SERVICES/HIF/PCIe/if_pci.c | 85 +++++++++++++++++++++++------------------ 1 file 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); -- cgit v1.2.3