| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * sata_sil24.c - Driver for Silicon Image 3124/3132 SATA-2 controllers |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2005 Tejun Heo |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Based on preview driver from Silicon Image. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2, or (at your option) any |
|---|
| 11 | | - * later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | 8 | */ |
|---|
| 19 | 9 | |
|---|
| 20 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 1214 | 1204 | cb = dmam_alloc_coherent(dev, cb_size, &cb_dma, GFP_KERNEL); |
|---|
| 1215 | 1205 | if (!cb) |
|---|
| 1216 | 1206 | return -ENOMEM; |
|---|
| 1217 | | - memset(cb, 0, cb_size); |
|---|
| 1218 | 1207 | |
|---|
| 1219 | 1208 | pp->cmd_block = cb; |
|---|
| 1220 | 1209 | pp->cmd_block_dma = cb_dma; |
|---|
| .. | .. |
|---|
| 1314 | 1303 | host->iomap = iomap; |
|---|
| 1315 | 1304 | |
|---|
| 1316 | 1305 | /* configure and activate the device */ |
|---|
| 1317 | | - if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { |
|---|
| 1318 | | - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); |
|---|
| 1319 | | - if (rc) { |
|---|
| 1320 | | - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 1321 | | - if (rc) { |
|---|
| 1322 | | - dev_err(&pdev->dev, |
|---|
| 1323 | | - "64-bit DMA enable failed\n"); |
|---|
| 1324 | | - return rc; |
|---|
| 1325 | | - } |
|---|
| 1326 | | - } |
|---|
| 1327 | | - } else { |
|---|
| 1328 | | - rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 1329 | | - if (rc) { |
|---|
| 1330 | | - dev_err(&pdev->dev, "32-bit DMA enable failed\n"); |
|---|
| 1331 | | - return rc; |
|---|
| 1332 | | - } |
|---|
| 1333 | | - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 1334 | | - if (rc) { |
|---|
| 1335 | | - dev_err(&pdev->dev, |
|---|
| 1336 | | - "32-bit consistent DMA enable failed\n"); |
|---|
| 1337 | | - return rc; |
|---|
| 1338 | | - } |
|---|
| 1306 | + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
|---|
| 1307 | + if (rc) { |
|---|
| 1308 | + dev_err(&pdev->dev, "DMA enable failed\n"); |
|---|
| 1309 | + return rc; |
|---|
| 1339 | 1310 | } |
|---|
| 1340 | 1311 | |
|---|
| 1341 | 1312 | /* Set max read request size to 4096. This slightly increases |
|---|