Mikael Olsson | 9c999fd | 2023-10-30 11:05:39 +0100 | [diff] [blame] | 1 | /* |
Mikael Olsson | d4ad9e5 | 2024-02-07 11:22:26 +0100 | [diff] [blame] | 2 | * SPDX-FileCopyrightText: Copyright 2023-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> |
Mikael Olsson | 9c999fd | 2023-10-30 11:05:39 +0100 | [diff] [blame] | 3 | * SPDX-License-Identifier: GPL-2.0-only |
| 4 | * |
| 5 | * This program is free software and is provided to you under the terms of the |
| 6 | * GNU General Public License version 2 as published by the Free Software |
| 7 | * Foundation, and any use by you of this program is subject to the terms |
| 8 | * of such GNU licence. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, you can access it online at |
| 17 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 18 | */ |
| 19 | |
| 20 | #ifndef ETHOSU_DMA_MEM_H |
| 21 | #define ETHOSU_DMA_MEM_H |
| 22 | |
| 23 | /**************************************************************************** |
| 24 | * Includes |
| 25 | ****************************************************************************/ |
| 26 | |
| 27 | #include <linux/types.h> |
| 28 | |
| 29 | /**************************************************************************** |
| 30 | * Types |
| 31 | ****************************************************************************/ |
| 32 | |
| 33 | struct device; |
| 34 | |
| 35 | /** |
| 36 | * struct ethosu_dma_mem - DMA memory allocation |
| 37 | * @dev: Device |
| 38 | * @size: Size of the allocation |
| 39 | * @cpu_addr: Kernel mapped address |
| 40 | * @dma_addr: DMA address |
| 41 | */ |
| 42 | struct ethosu_dma_mem { |
| 43 | struct device *dev; |
| 44 | size_t size; |
| 45 | void *cpu_addr; |
| 46 | dma_addr_t dma_addr; |
| 47 | }; |
| 48 | |
| 49 | /**************************************************************************** |
| 50 | * Functions |
| 51 | ****************************************************************************/ |
| 52 | |
| 53 | struct ethosu_dma_mem *ethosu_dma_mem_alloc(struct device *dev, |
| 54 | size_t size); |
| 55 | |
| 56 | void ethosu_dma_mem_free(struct ethosu_dma_mem **dma_mem); |
| 57 | |
| 58 | #endif /* ETHOSU_DMA_MEM_H */ |