summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-08-26 06:57:23 -0400
committerJens Axboe <axboe@kernel.dk>2019-08-26 15:58:58 -0400
commit440bd77f09b8a11a5c729ef61f346421e4d10b87 (patch)
treef8cd9ea5f80bb356600f3310a6abb5cc24f93543 /drivers/ata
parent51872b6606eb52a5c8b82e79c644d352fdb41d04 (diff)
sata_qstor: use dma_set_mask_and_coherent
Use the dma_set_mask_and_coherent helper to set the DMA mask. Rely on the relatively recent change that setting a larger than required mask will never fail to avoid the need for the boilerplate 32-bit fallback code. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/sata_qstor.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 865e5c58bd94..c53c5a47204d 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -537,33 +537,13 @@ static void qs_host_init(struct ata_host *host, unsigned int chip_id)
537static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) 537static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
538{ 538{
539 u32 bus_info = readl(mmio_base + QS_HID_HPHY); 539 u32 bus_info = readl(mmio_base + QS_HID_HPHY);
540 int rc, have_64bit_bus = (bus_info & QS_HPHY_64BIT); 540 int dma_bits = (bus_info & QS_HPHY_64BIT) ? 64 : 32;
541 541 int rc;
542 if (have_64bit_bus && 542
543 !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { 543 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(dma_bits));
544 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); 544 if (rc)
545 if (rc) { 545 dev_err(&pdev->dev, "%d-bit DMA enable failed\n", dma_bits);
546 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 546 return rc;
547 if (rc) {
548 dev_err(&pdev->dev,
549 "64-bit DMA enable failed\n");
550 return rc;
551 }
552 }
553 } else {
554 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
555 if (rc) {
556 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
557 return rc;
558 }
559 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
560 if (rc) {
561 dev_err(&pdev->dev,
562 "32-bit consistent DMA enable failed\n");
563 return rc;
564 }
565 }
566 return 0;
567} 547}
568 548
569static int qs_ata_init_one(struct pci_dev *pdev, 549static int qs_ata_init_one(struct pci_dev *pdev,