1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (C) 2018 Intel Corporation */
3/* Copyright 2018 Google LLC. */
4
5#ifndef __IPU3_MMU_H
6#define __IPU3_MMU_H
7
8#define IPU3_PAGE_SHIFT		12
9#define IPU3_PAGE_SIZE		(1UL << IPU3_PAGE_SHIFT)
10
11/**
12 * struct imgu_mmu_info - Describes mmu geometry
13 *
14 * @aperture_start:	First address that can be mapped
15 * @aperture_end:	Last address that can be mapped
16 */
17struct imgu_mmu_info {
18	dma_addr_t aperture_start;
19	dma_addr_t aperture_end;
20};
21
22struct device;
23struct scatterlist;
24
25struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base);
26void imgu_mmu_exit(struct imgu_mmu_info *info);
27void imgu_mmu_suspend(struct imgu_mmu_info *info);
28void imgu_mmu_resume(struct imgu_mmu_info *info);
29
30int imgu_mmu_map(struct imgu_mmu_info *info, unsigned long iova,
31		 phys_addr_t paddr, size_t size);
32size_t imgu_mmu_unmap(struct imgu_mmu_info *info, unsigned long iova,
33		      size_t size);
34size_t imgu_mmu_map_sg(struct imgu_mmu_info *info, unsigned long iova,
35		       struct scatterlist *sg, unsigned int nents);
36#endif
37