• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3  */
4 
5 #ifndef _DPU_HW_VBIF_H
6 #define _DPU_HW_VBIF_H
7 
8 #include "dpu_hw_catalog.h"
9 #include "dpu_hw_mdss.h"
10 #include "dpu_hw_util.h"
11 
12 struct dpu_hw_vbif;
13 
14 /**
15  * struct dpu_hw_vbif_ops : Interface to the VBIF hardware driver functions
16  *  Assumption is these functions will be called after clocks are enabled
17  */
18 struct dpu_hw_vbif_ops {
19 	/**
20 	 * set_limit_conf - set transaction limit config
21 	 * @vbif: vbif context driver
22 	 * @xin_id: client interface identifier
23 	 * @rd: true for read limit; false for write limit
24 	 * @limit: outstanding transaction limit
25 	 */
26 	void (*set_limit_conf)(struct dpu_hw_vbif *vbif,
27 			u32 xin_id, bool rd, u32 limit);
28 
29 	/**
30 	 * get_limit_conf - get transaction limit config
31 	 * @vbif: vbif context driver
32 	 * @xin_id: client interface identifier
33 	 * @rd: true for read limit; false for write limit
34 	 * @return: outstanding transaction limit
35 	 */
36 	u32 (*get_limit_conf)(struct dpu_hw_vbif *vbif,
37 			u32 xin_id, bool rd);
38 
39 	/**
40 	 * set_halt_ctrl - set halt control
41 	 * @vbif: vbif context driver
42 	 * @xin_id: client interface identifier
43 	 * @enable: halt control enable
44 	 */
45 	void (*set_halt_ctrl)(struct dpu_hw_vbif *vbif,
46 			u32 xin_id, bool enable);
47 
48 	/**
49 	 * get_halt_ctrl - get halt control
50 	 * @vbif: vbif context driver
51 	 * @xin_id: client interface identifier
52 	 * @return: halt control enable
53 	 */
54 	bool (*get_halt_ctrl)(struct dpu_hw_vbif *vbif,
55 			u32 xin_id);
56 
57 	/**
58 	 * set_qos_remap - set QoS priority remap
59 	 * @vbif: vbif context driver
60 	 * @xin_id: client interface identifier
61 	 * @level: priority level
62 	 * @remap_level: remapped level
63 	 */
64 	void (*set_qos_remap)(struct dpu_hw_vbif *vbif,
65 			u32 xin_id, u32 level, u32 remap_level);
66 
67 	/**
68 	 * set_mem_type - set memory type
69 	 * @vbif: vbif context driver
70 	 * @xin_id: client interface identifier
71 	 * @value: memory type value
72 	 */
73 	void (*set_mem_type)(struct dpu_hw_vbif *vbif,
74 			u32 xin_id, u32 value);
75 
76 	/**
77 	 * clear_errors - clear any vbif errors
78 	 *	This function clears any detected pending/source errors
79 	 *	on the VBIF interface, and optionally returns the detected
80 	 *	error mask(s).
81 	 * @vbif: vbif context driver
82 	 * @pnd_errors: pointer to pending error reporting variable
83 	 * @src_errors: pointer to source error reporting variable
84 	 */
85 	void (*clear_errors)(struct dpu_hw_vbif *vbif,
86 		u32 *pnd_errors, u32 *src_errors);
87 
88 	/**
89 	 * set_write_gather_en - set write_gather enable
90 	 * @vbif: vbif context driver
91 	 * @xin_id: client interface identifier
92 	 */
93 	void (*set_write_gather_en)(struct dpu_hw_vbif *vbif, u32 xin_id);
94 };
95 
96 struct dpu_hw_vbif {
97 	/* base */
98 	struct dpu_hw_blk_reg_map hw;
99 
100 	/* vbif */
101 	enum dpu_vbif idx;
102 	const struct dpu_vbif_cfg *cap;
103 
104 	/* ops */
105 	struct dpu_hw_vbif_ops ops;
106 };
107 
108 /**
109  * dpu_hw_vbif_init - initializes the vbif driver for the passed interface idx
110  * @idx:  Interface index for which driver object is required
111  * @addr: Mapped register io address of MDSS
112  * @m:    Pointer to mdss catalog data
113  */
114 struct dpu_hw_vbif *dpu_hw_vbif_init(enum dpu_vbif idx,
115 		void __iomem *addr,
116 		const struct dpu_mdss_cfg *m);
117 
118 void dpu_hw_vbif_destroy(struct dpu_hw_vbif *vbif);
119 
120 #endif /*_DPU_HW_VBIF_H */
121