hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/ata/pdc_adma.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * pdc_adma.c - Pacific Digital Corporation ADMA
34 *
....@@ -5,31 +6,14 @@
56 *
67 * Copyright 2005 Mark Lord
78 *
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
- *
239 * libata documentation is available via 'make {ps|pdf}docs',
2410 * as Documentation/driver-api/libata.rst
25
- *
2611 *
2712 * Supports ATA disks in single-packet ADMA mode.
2813 * Uses PIO for everything else.
2914 *
3015 * TODO: Use ADMA transfers for ATAPI devices, when possible.
3116 * This requires careful attention to a number of quirks of the chip.
32
- *
3317 */
3418
3519 #include <linux/kernel.h>
....@@ -567,7 +551,6 @@
567551 (u32)pp->pkt_dma);
568552 return -ENOMEM;
569553 }
570
- memset(pp->pkt, 0, ADMA_PKT_BYTES);
571554 ap->private_data = pp;
572555 adma_reinit_engine(ap);
573556 return 0;
....@@ -588,23 +571,6 @@
588571 /* reset the ADMA logic */
589572 for (port_no = 0; port_no < ADMA_PORTS; ++port_no)
590573 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;
608574 }
609575
610576 static int adma_ata_init_one(struct pci_dev *pdev,
....@@ -637,9 +603,11 @@
637603 host->iomap = pcim_iomap_table(pdev);
638604 mmio_base = host->iomap[ADMA_MMIO_BAR];
639605
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");
642609 return rc;
610
+ }
643611
644612 for (port_no = 0; port_no < ADMA_PORTS; ++port_no) {
645613 struct ata_port *ap = host->ports[port_no];