From: Suravee Suthikulpanit Date: Thu, 12 Jun 2014 17:40:23 +0000 (-0500) Subject: ahci: Check and set 64-bit DMA mask for platform AHCI driver X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=394a16ab605d8685c830c4d0b8add49f85dd498f;p=karo-tx-linux.git 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 Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Hans de Goede Tested-by: Hans de Goede Tested-by: Suman Tripathi Signed-off-by: Tejun Heo (cherry picked from commit cc7a9e27562cd78a1dc885504086fab24addce40) --- diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index b0077589f065..28840a2f470f 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -369,6 +369,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;