| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * pdc_adma.c - Pacific Digital Corporation ADMA |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright 2005 Mark Lord |
|---|
| 7 | 8 | * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 11 | | - * any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; see the file COPYING. If not, write to |
|---|
| 20 | | - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 21 | | - * |
|---|
| 22 | | - * |
|---|
| 23 | 9 | * libata documentation is available via 'make {ps|pdf}docs', |
|---|
| 24 | 10 | * as Documentation/driver-api/libata.rst |
|---|
| 25 | | - * |
|---|
| 26 | 11 | * |
|---|
| 27 | 12 | * Supports ATA disks in single-packet ADMA mode. |
|---|
| 28 | 13 | * Uses PIO for everything else. |
|---|
| 29 | 14 | * |
|---|
| 30 | 15 | * TODO: Use ADMA transfers for ATAPI devices, when possible. |
|---|
| 31 | 16 | * This requires careful attention to a number of quirks of the chip. |
|---|
| 32 | | - * |
|---|
| 33 | 17 | */ |
|---|
| 34 | 18 | |
|---|
| 35 | 19 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 567 | 551 | (u32)pp->pkt_dma); |
|---|
| 568 | 552 | return -ENOMEM; |
|---|
| 569 | 553 | } |
|---|
| 570 | | - memset(pp->pkt, 0, ADMA_PKT_BYTES); |
|---|
| 571 | 554 | ap->private_data = pp; |
|---|
| 572 | 555 | adma_reinit_engine(ap); |
|---|
| 573 | 556 | return 0; |
|---|
| .. | .. |
|---|
| 588 | 571 | /* reset the ADMA logic */ |
|---|
| 589 | 572 | for (port_no = 0; port_no < ADMA_PORTS; ++port_no) |
|---|
| 590 | 573 | adma_reset_engine(host->ports[port_no]); |
|---|
| 591 | | -} |
|---|
| 592 | | - |
|---|
| 593 | | -static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) |
|---|
| 594 | | -{ |
|---|
| 595 | | - int rc; |
|---|
| 596 | | - |
|---|
| 597 | | - rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 598 | | - if (rc) { |
|---|
| 599 | | - dev_err(&pdev->dev, "32-bit DMA enable failed\n"); |
|---|
| 600 | | - return rc; |
|---|
| 601 | | - } |
|---|
| 602 | | - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 603 | | - if (rc) { |
|---|
| 604 | | - dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n"); |
|---|
| 605 | | - return rc; |
|---|
| 606 | | - } |
|---|
| 607 | | - return 0; |
|---|
| 608 | 574 | } |
|---|
| 609 | 575 | |
|---|
| 610 | 576 | static int adma_ata_init_one(struct pci_dev *pdev, |
|---|
| .. | .. |
|---|
| 637 | 603 | host->iomap = pcim_iomap_table(pdev); |
|---|
| 638 | 604 | mmio_base = host->iomap[ADMA_MMIO_BAR]; |
|---|
| 639 | 605 | |
|---|
| 640 | | - rc = adma_set_dma_masks(pdev, mmio_base); |
|---|
| 641 | | - if (rc) |
|---|
| 606 | + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 607 | + if (rc) { |
|---|
| 608 | + dev_err(&pdev->dev, "32-bit DMA enable failed\n"); |
|---|
| 642 | 609 | return rc; |
|---|
| 610 | + } |
|---|
| 643 | 611 | |
|---|
| 644 | 612 | for (port_no = 0; port_no < ADMA_PORTS; ++port_no) { |
|---|
| 645 | 613 | struct ata_port *ap = host->ports[port_no]; |
|---|