summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libahci_platform.c
diff options
context:
space:
mode:
authorSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>2014-06-12 19:40:23 +0200
committerTejun Heo <tj@kernel.org>2014-06-17 21:02:35 +0200
commitcc7a9e27562cd78a1dc885504086fab24addce40 (patch)
treeaf6fe405b9a1262922b2e1079b5a84c9768ffdbb /drivers/ata/libahci_platform.c
parentata: Use dma_zalloc_coherent (diff)
downloadlinux-cc7a9e27562cd78a1dc885504086fab24addce40.tar.xz
linux-cc7a9e27562cd78a1dc885504086fab24addce40.zip
ahci: Check and set 64-bit DMA mask for platform AHCI driver
The current platform AHCI driver does not set the dma_mask correctly for 64-bit DMA capable AHCI controller. This patch checks the AHCI capability bit and set the dma_mask and coherent_dma_mask accordingly. Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Suman Tripathi <stripathi@apm.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libahci_platform.c')
-rw-r--r--drivers/ata/libahci_platform.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 3a5b4ed25a4f..a958a2b8fd93 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -364,6 +364,19 @@ int ahci_platform_init_host(struct platform_device *pdev,
ap->ops = &ata_dummy_port_ops;
}
+ if (hpriv->cap & HOST_CAP_64) {
+ rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+ if (rc) {
+ rc = dma_coerce_mask_and_coherent(dev,
+ DMA_BIT_MASK(32));
+ if (rc) {
+ dev_err(dev, "Failed to enable 64-bit DMA.\n");
+ return rc;
+ }
+ dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n");
+ }
+ }
+
rc = ahci_reset_controller(host);
if (rc)
return rc;