4 #include <linux/vcm-drv.h>
5 #include <plat/sysmmu.h>
6 #include <asm/atomic.h>
10 /* for physical allocator of frame buffer */
31 static inline sysmmu_ips vcmid_to_smmuid(enum vcm_dev_id vcm_id)
33 BUG_ON((vcm_id < 0) || (vcm_id >= VCM_DEV_NUM));
34 return (sysmmu_ips)vcm_id;
37 static inline enum vcm_dev_id smmuid_to_vcmid(sysmmu_ips ips)
39 BUG_ON((ips < 0) || (ips > SYSMMU_MFC_R));
40 return (enum vcm_dev_id)ips;
43 enum S5PVCM_RESCHECK {
44 S5PVCM_RES_NOT_IN_VCM = 0,
46 S5PVCM_RES_IN_ADDRSPACE
49 struct s5p_vcm_driver {
50 void (*tlb_invalidator)(enum vcm_dev_id id);
51 void (*pgd_base_specifier)(enum vcm_dev_id id, unsigned long base);
52 dma_addr_t (*phys_alloc)(resource_size_t size, unsigned flag);
53 void (*phys_free)(struct vcm_phys *phys);
56 /* Turns on the system MMU of the specified vcm context
57 * If the system MMU is not turned on, TLB invalidation and setting page table
58 * base on the system MMU is not performed.
60 void s5p_vcm_turn_on(struct vcm *vcm);
62 /* Turns off the system MMU of the specified vcm context
64 void s5p_vcm_turn_off(struct vcm *vcm);
66 /* The caller must check the return value of vcm_create_unified with
67 * IS_ERR_OR_NULL() macro defined in err.h
69 struct vcm *__must_check
70 vcm_create_unified(resource_size_t size, enum vcm_dev_id id,
71 const struct s5p_vcm_driver *driver);
73 /* vcm : your vcm context.
74 * res : the reservation that you want to know if it is allocated from
78 vcm_reservation_in_vcm(struct vcm *vcm, struct vcm_res *res);
80 struct vcm *vcm_find_vcm(enum vcm_dev_id id);
82 /* Initializes the page table base of the system MMU of the given device
83 * id: device ID defined in enum vcm_dev_id
85 * No operation performs if the ID is wrong or no callback method is specified
86 * by the device driver.
88 void vcm_set_pgtable_base(enum vcm_dev_id id);
90 #endif /* CONFIG_VCM_MMU */
92 #endif /* __S5P_VCM_H */