hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/ata/sata_inic162x.c
....@@ -1,10 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * sata_inic162x.c - Driver for Initio 162x SATA controllers
34 *
45 * Copyright 2006 SUSE Linux Products GmbH
56 * Copyright 2006 Tejun Heo <teheo@novell.com>
6
- *
7
- * This file is released under GPL v2.
87 *
98 * **** WARNING ****
109 *
....@@ -146,7 +145,7 @@
146145
147146 /* PORT_IDMA_CTL bits */
148147 IDMA_CTL_RST_ATA = (1 << 2), /* hardreset ATA bus */
149
- IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinary */
148
+ IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinery */
150149 IDMA_CTL_GO = (1 << 7), /* IDMA mode go */
151150 IDMA_CTL_ATA_NIEN = (1 << 8), /* ATA IRQ disable */
152151
....@@ -245,8 +244,15 @@
245244
246245 static struct scsi_host_template inic_sht = {
247246 ATA_BASE_SHT(DRV_NAME),
248
- .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */
249
- .dma_boundary = INIC_DMA_BOUNDARY,
247
+ .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */
248
+
249
+ /*
250
+ * This controller is braindamaged. dma_boundary is 0xffff like others
251
+ * but it will lock up the whole machine HARD if 65536 byte PRD entry
252
+ * is fed. Reduce maximum segment size.
253
+ */
254
+ .dma_boundary = INIC_DMA_BOUNDARY,
255
+ .max_segment_size = 65536 - 512,
250256 };
251257
252258 static const int scr_map[] = {
....@@ -858,26 +864,9 @@
858864 }
859865
860866 /* Set dma_mask. This devices doesn't support 64bit addressing. */
861
- rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
867
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
862868 if (rc) {
863869 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
864
- return rc;
865
- }
866
-
867
- rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
868
- if (rc) {
869
- dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n");
870
- return rc;
871
- }
872
-
873
- /*
874
- * This controller is braindamaged. dma_boundary is 0xffff
875
- * like others but it will lock up the whole machine HARD if
876
- * 65536 byte PRD entry is fed. Reduce maximum segment size.
877
- */
878
- rc = pci_set_dma_max_seg_size(pdev, 65536 - 512);
879
- if (rc) {
880
- dev_err(&pdev->dev, "failed to set the maximum segment size\n");
881870 return rc;
882871 }
883872