blob: 11cdd39278f7efa059da3f436f8773e8205b5651 [file] [log] [blame]
Mikael Olsson9c999fd2023-10-30 11:05:39 +01001/*
2 * SPDX-FileCopyrightText: Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
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
33struct 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 */
42struct 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
53struct ethosu_dma_mem *ethosu_dma_mem_alloc(struct device *dev,
54 size_t size);
55
56void ethosu_dma_mem_free(struct ethosu_dma_mem **dma_mem);
57
58#endif /* ETHOSU_DMA_MEM_H */