| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/arm/common/dmabounce.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 16 | 17 | * |
|---|
| 17 | 18 | * Copyright (C) 2002 Hewlett Packard Company. |
|---|
| 18 | 19 | * Copyright (C) 2004 MontaVista Software, Inc. |
|---|
| 19 | | - * |
|---|
| 20 | | - * This program is free software; you can redistribute it and/or |
|---|
| 21 | | - * modify it under the terms of the GNU General Public License |
|---|
| 22 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 23 | 20 | */ |
|---|
| 24 | 21 | |
|---|
| 25 | 22 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 27 | 24 | #include <linux/slab.h> |
|---|
| 28 | 25 | #include <linux/page-flags.h> |
|---|
| 29 | 26 | #include <linux/device.h> |
|---|
| 30 | | -#include <linux/dma-mapping.h> |
|---|
| 27 | +#include <linux/dma-direct.h> |
|---|
| 28 | +#include <linux/dma-map-ops.h> |
|---|
| 31 | 29 | #include <linux/dmapool.h> |
|---|
| 32 | 30 | #include <linux/list.h> |
|---|
| 33 | 31 | #include <linux/scatterlist.h> |
|---|
| .. | .. |
|---|
| 257 | 255 | if (buf == NULL) { |
|---|
| 258 | 256 | dev_err(dev, "%s: unable to map unsafe buffer %p!\n", |
|---|
| 259 | 257 | __func__, ptr); |
|---|
| 260 | | - return ARM_MAPPING_ERROR; |
|---|
| 258 | + return DMA_MAPPING_ERROR; |
|---|
| 261 | 259 | } |
|---|
| 262 | 260 | |
|---|
| 263 | 261 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", |
|---|
| .. | .. |
|---|
| 327 | 325 | |
|---|
| 328 | 326 | ret = needs_bounce(dev, dma_addr, size); |
|---|
| 329 | 327 | if (ret < 0) |
|---|
| 330 | | - return ARM_MAPPING_ERROR; |
|---|
| 328 | + return DMA_MAPPING_ERROR; |
|---|
| 331 | 329 | |
|---|
| 332 | 330 | if (ret == 0) { |
|---|
| 333 | 331 | arm_dma_ops.sync_single_for_device(dev, dma_addr, size, dir); |
|---|
| .. | .. |
|---|
| 336 | 334 | |
|---|
| 337 | 335 | if (PageHighMem(page)) { |
|---|
| 338 | 336 | dev_err(dev, "DMA buffer bouncing of HIGHMEM pages is not supported\n"); |
|---|
| 339 | | - return ARM_MAPPING_ERROR; |
|---|
| 337 | + return DMA_MAPPING_ERROR; |
|---|
| 340 | 338 | } |
|---|
| 341 | 339 | |
|---|
| 342 | 340 | return map_single(dev, page_address(page) + offset, size, dir, attrs); |
|---|
| .. | .. |
|---|
| 453 | 451 | return arm_dma_ops.dma_supported(dev, dma_mask); |
|---|
| 454 | 452 | } |
|---|
| 455 | 453 | |
|---|
| 456 | | -static int dmabounce_mapping_error(struct device *dev, dma_addr_t dma_addr) |
|---|
| 457 | | -{ |
|---|
| 458 | | - return arm_dma_ops.mapping_error(dev, dma_addr); |
|---|
| 459 | | -} |
|---|
| 460 | | - |
|---|
| 461 | 454 | static const struct dma_map_ops dmabounce_ops = { |
|---|
| 462 | 455 | .alloc = arm_dma_alloc, |
|---|
| 463 | 456 | .free = arm_dma_free, |
|---|
| .. | .. |
|---|
| 472 | 465 | .sync_sg_for_cpu = arm_dma_sync_sg_for_cpu, |
|---|
| 473 | 466 | .sync_sg_for_device = arm_dma_sync_sg_for_device, |
|---|
| 474 | 467 | .dma_supported = dmabounce_dma_supported, |
|---|
| 475 | | - .mapping_error = dmabounce_mapping_error, |
|---|
| 476 | 468 | }; |
|---|
| 477 | 469 | |
|---|
| 478 | 470 | static int dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev, |
|---|