blob: 598e60f57d4b41ff749e48fb222991914ab9f8c6 [file] [log] [blame]
Inki Dae0519f9a2012-10-20 07:53:42 -07001/* exynos_drm_iommu.h
2 *
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Authoer: Inki Dae <inki.dae@samsung.com>
5 *
Inki Daed81aecb2012-12-18 02:30:17 +09006 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
Inki Dae0519f9a2012-10-20 07:53:42 -070010 */
11
12#ifndef _EXYNOS_DRM_IOMMU_H_
13#define _EXYNOS_DRM_IOMMU_H_
14
15#define EXYNOS_DEV_ADDR_START 0x20000000
16#define EXYNOS_DEV_ADDR_SIZE 0x40000000
Inki Daefe9e31372013-01-29 16:28:30 +090017#define EXYNOS_DEV_ADDR_ORDER 0x0
Inki Dae0519f9a2012-10-20 07:53:42 -070018
19#ifdef CONFIG_DRM_EXYNOS_IOMMU
20
21int drm_create_iommu_mapping(struct drm_device *drm_dev);
22
23void drm_release_iommu_mapping(struct drm_device *drm_dev);
24
25int drm_iommu_attach_device(struct drm_device *drm_dev,
26 struct device *subdrv_dev);
27
28void drm_iommu_detach_device(struct drm_device *dev_dev,
29 struct device *subdrv_dev);
30
31static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
32{
33#ifdef CONFIG_ARM_DMA_USE_IOMMU
34 struct device *dev = drm_dev->dev;
35
36 return dev->archdata.mapping ? true : false;
37#else
38 return false;
39#endif
40}
41
42#else
43
44struct dma_iommu_mapping;
45static inline int drm_create_iommu_mapping(struct drm_device *drm_dev)
46{
47 return 0;
48}
49
50static inline void drm_release_iommu_mapping(struct drm_device *drm_dev)
51{
52}
53
54static inline int drm_iommu_attach_device(struct drm_device *drm_dev,
55 struct device *subdrv_dev)
56{
57 return 0;
58}
59
60static inline void drm_iommu_detach_device(struct drm_device *drm_dev,
61 struct device *subdrv_dev)
62{
63}
64
65static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
66{
67 return false;
68}
69
70#endif
71#endif