2 * Copyright (C) ROCKCHIP, Inc.
3 * Author:yzq<yzq@rock-chips.com>
5 * based on exynos_drm_iommu.h
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 #ifndef _ROCKCHIP_DRM_IOMMU_H_
17 #define _ROCKCHIP_DRM_IOMMU_H_
19 #define ROCKCHIP_DEV_ADDR_START 0x20000000
20 #define ROCKCHIP_DEV_ADDR_SIZE 0x40000000
21 #define ROCKCHIP_DEV_ADDR_ORDER 0x0
23 #ifdef CONFIG_DRM_ROCKCHIP_IOMMU
25 int drm_create_iommu_mapping(struct drm_device *drm_dev);
27 void drm_release_iommu_mapping(struct drm_device *drm_dev);
29 int drm_iommu_attach_device(struct drm_device *drm_dev,
30 struct device *subdrv_dev);
32 void drm_iommu_detach_device(struct drm_device *dev_dev,
33 struct device *subdrv_dev);
35 static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
37 #ifdef CONFIG_ARM_DMA_USE_IOMMU
38 struct device *dev = drm_dev->dev;
40 return dev->archdata.mapping ? true : false;
48 struct dma_iommu_mapping;
49 static inline int drm_create_iommu_mapping(struct drm_device *drm_dev)
54 static inline void drm_release_iommu_mapping(struct drm_device *drm_dev)
58 static inline int drm_iommu_attach_device(struct drm_device *drm_dev,
59 struct device *subdrv_dev)
64 static inline void drm_iommu_detach_device(struct drm_device *drm_dev,
65 struct device *subdrv_dev)
69 static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)