xref: /linux/drivers/staging/media/ipu3/ipu3-mmu.h (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
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  */
17 struct imgu_mmu_info {
18 	dma_addr_t aperture_start;
19 	dma_addr_t aperture_end;
20 };
21 
22 struct device;
23 struct scatterlist;
24 
25 struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base);
26 void imgu_mmu_exit(struct imgu_mmu_info *info);
27 void imgu_mmu_suspend(struct imgu_mmu_info *info);
28 void imgu_mmu_resume(struct imgu_mmu_info *info);
29 
30 int imgu_mmu_map(struct imgu_mmu_info *info, unsigned long iova,
31 		 phys_addr_t paddr, size_t size);
32 size_t imgu_mmu_unmap(struct imgu_mmu_info *info, unsigned long iova,
33 		      size_t size);
34 size_t imgu_mmu_map_sg(struct imgu_mmu_info *info, unsigned long iova,
35 		       struct scatterlist *sg, unsigned int nents);
36 #endif
37