GNU Linux-libre 4.9.318-gnu1
[releases.git] / drivers / staging / fsl-mc / bus / dprc-cmd.h
1 /*
2  * Copyright 2013-2016 Freescale Semiconductor Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of the above-listed copyright holders nor the
12  *       names of any contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 /*
35  * dprc-cmd.h
36  *
37  * defines dprc portal commands
38  *
39  */
40
41 #ifndef _FSL_DPRC_CMD_H
42 #define _FSL_DPRC_CMD_H
43
44 /* Minimal supported DPRC Version */
45 #define DPRC_MIN_VER_MAJOR                      5
46 #define DPRC_MIN_VER_MINOR                      0
47
48 /* Command IDs */
49 #define DPRC_CMDID_CLOSE                        0x800
50 #define DPRC_CMDID_OPEN                         0x805
51 #define DPRC_CMDID_CREATE                       0x905
52
53 #define DPRC_CMDID_GET_ATTR                     0x004
54 #define DPRC_CMDID_RESET_CONT                   0x005
55
56 #define DPRC_CMDID_SET_IRQ                      0x010
57 #define DPRC_CMDID_GET_IRQ                      0x011
58 #define DPRC_CMDID_SET_IRQ_ENABLE               0x012
59 #define DPRC_CMDID_GET_IRQ_ENABLE               0x013
60 #define DPRC_CMDID_SET_IRQ_MASK                 0x014
61 #define DPRC_CMDID_GET_IRQ_MASK                 0x015
62 #define DPRC_CMDID_GET_IRQ_STATUS               0x016
63 #define DPRC_CMDID_CLEAR_IRQ_STATUS             0x017
64
65 #define DPRC_CMDID_CREATE_CONT                  0x151
66 #define DPRC_CMDID_DESTROY_CONT                 0x152
67 #define DPRC_CMDID_SET_RES_QUOTA                0x155
68 #define DPRC_CMDID_GET_RES_QUOTA                0x156
69 #define DPRC_CMDID_ASSIGN                       0x157
70 #define DPRC_CMDID_UNASSIGN                     0x158
71 #define DPRC_CMDID_GET_OBJ_COUNT                0x159
72 #define DPRC_CMDID_GET_OBJ                      0x15A
73 #define DPRC_CMDID_GET_RES_COUNT                0x15B
74 #define DPRC_CMDID_GET_RES_IDS                  0x15C
75 #define DPRC_CMDID_GET_OBJ_REG                  0x15E
76 #define DPRC_CMDID_SET_OBJ_IRQ                  0x15F
77 #define DPRC_CMDID_GET_OBJ_IRQ                  0x160
78 #define DPRC_CMDID_SET_OBJ_LABEL                0x161
79 #define DPRC_CMDID_GET_OBJ_DESC                 0x162
80
81 #define DPRC_CMDID_CONNECT                      0x167
82 #define DPRC_CMDID_DISCONNECT                   0x168
83 #define DPRC_CMDID_GET_POOL                     0x169
84 #define DPRC_CMDID_GET_POOL_COUNT               0x16A
85
86 #define DPRC_CMDID_GET_CONNECTION               0x16C
87
88 struct dprc_cmd_open {
89         __le32 container_id;
90 };
91
92 struct dprc_cmd_create_container {
93         /* cmd word 0 */
94         __le32 options;
95         __le16 icid;
96         __le16 pad0;
97         /* cmd word 1 */
98         __le32 pad1;
99         __le32 portal_id;
100         /* cmd words 2-3 */
101         u8 label[16];
102 };
103
104 struct dprc_rsp_create_container {
105         /* response word 0 */
106         __le64 pad0;
107         /* response word 1 */
108         __le32 child_container_id;
109         __le32 pad1;
110         /* response word 2 */
111         __le64 child_portal_addr;
112 };
113
114 struct dprc_cmd_destroy_container {
115         __le32 child_container_id;
116 };
117
118 struct dprc_cmd_reset_container {
119         __le32 child_container_id;
120 };
121
122 struct dprc_cmd_set_irq {
123         /* cmd word 0 */
124         __le32 irq_val;
125         u8 irq_index;
126         u8 pad[3];
127         /* cmd word 1 */
128         __le64 irq_addr;
129         /* cmd word 2 */
130         __le32 irq_num;
131 };
132
133 struct dprc_cmd_get_irq {
134         __le32 pad;
135         u8 irq_index;
136 };
137
138 struct dprc_rsp_get_irq {
139         /* response word 0 */
140         __le32 irq_val;
141         __le32 pad;
142         /* response word 1 */
143         __le64 irq_addr;
144         /* response word 2 */
145         __le32 irq_num;
146         __le32 type;
147 };
148
149 #define DPRC_ENABLE             0x1
150
151 struct dprc_cmd_set_irq_enable {
152         u8 enable;
153         u8 pad[3];
154         u8 irq_index;
155 };
156
157 struct dprc_cmd_get_irq_enable {
158         __le32 pad;
159         u8 irq_index;
160 };
161
162 struct dprc_rsp_get_irq_enable {
163         u8 enabled;
164 };
165
166 struct dprc_cmd_set_irq_mask {
167         __le32 mask;
168         u8 irq_index;
169 };
170
171 struct dprc_cmd_get_irq_mask {
172         __le32 pad;
173         u8 irq_index;
174 };
175
176 struct dprc_rsp_get_irq_mask {
177         __le32 mask;
178 };
179
180 struct dprc_cmd_get_irq_status {
181         __le32 status;
182         u8 irq_index;
183 };
184
185 struct dprc_rsp_get_irq_status {
186         __le32 status;
187 };
188
189 struct dprc_cmd_clear_irq_status {
190         __le32 status;
191         u8 irq_index;
192 };
193
194 struct dprc_rsp_get_attributes {
195         /* response word 0 */
196         __le32 container_id;
197         __le16 icid;
198         __le16 pad;
199         /* response word 1 */
200         __le32 options;
201         __le32 portal_id;
202         /* response word 2 */
203         __le16 version_major;
204         __le16 version_minor;
205 };
206
207 struct dprc_cmd_set_res_quota {
208         /* cmd word 0 */
209         __le32 child_container_id;
210         __le16 quota;
211         __le16 pad;
212         /* cmd words 1-2 */
213         u8 type[16];
214 };
215
216 struct dprc_cmd_get_res_quota {
217         /* cmd word 0 */
218         __le32 child_container_id;
219         __le32 pad;
220         /* cmd word 1-2 */
221         u8 type[16];
222 };
223
224 struct dprc_rsp_get_res_quota {
225         __le32 pad;
226         __le16 quota;
227 };
228
229 struct dprc_cmd_assign {
230         /* cmd word 0 */
231         __le32 container_id;
232         __le32 options;
233         /* cmd word 1 */
234         __le32 num;
235         __le32 id_base_align;
236         /* cmd word 2-3 */
237         u8 type[16];
238 };
239
240 struct dprc_cmd_unassign {
241         /* cmd word 0 */
242         __le32 child_container_id;
243         __le32 options;
244         /* cmd word 1 */
245         __le32 num;
246         __le32 id_base_align;
247         /* cmd word 2-3 */
248         u8 type[16];
249 };
250
251 struct dprc_rsp_get_pool_count {
252         __le32 pool_count;
253 };
254
255 struct dprc_cmd_get_pool {
256         __le32 pool_index;
257 };
258
259 struct dprc_rsp_get_pool {
260         /* response word 0 */
261         __le64 pad;
262         /* response word 1-2 */
263         u8 type[16];
264 };
265
266 struct dprc_rsp_get_obj_count {
267         __le32 pad;
268         __le32 obj_count;
269 };
270
271 struct dprc_cmd_get_obj {
272         __le32 obj_index;
273 };
274
275 struct dprc_rsp_get_obj {
276         /* response word 0 */
277         __le32 pad0;
278         __le32 id;
279         /* response word 1 */
280         __le16 vendor;
281         u8 irq_count;
282         u8 region_count;
283         __le32 state;
284         /* response word 2 */
285         __le16 version_major;
286         __le16 version_minor;
287         __le16 flags;
288         __le16 pad1;
289         /* response word 3-4 */
290         u8 type[16];
291         /* response word 5-6 */
292         u8 label[16];
293 };
294
295 struct dprc_cmd_get_obj_desc {
296         /* cmd word 0 */
297         __le32 obj_id;
298         __le32 pad;
299         /* cmd word 1-2 */
300         u8 type[16];
301 };
302
303 struct dprc_rsp_get_obj_desc {
304         /* response word 0 */
305         __le32 pad0;
306         __le32 id;
307         /* response word 1 */
308         __le16 vendor;
309         u8 irq_count;
310         u8 region_count;
311         __le32 state;
312         /* response word 2 */
313         __le16 version_major;
314         __le16 version_minor;
315         __le16 flags;
316         __le16 pad1;
317         /* response word 3-4 */
318         u8 type[16];
319         /* response word 5-6 */
320         u8 label[16];
321 };
322
323 struct dprc_cmd_get_res_count {
324         /* cmd word 0 */
325         __le64 pad;
326         /* cmd word 1-2 */
327         u8 type[16];
328 };
329
330 struct dprc_rsp_get_res_count {
331         __le32 res_count;
332 };
333
334 struct dprc_cmd_get_res_ids {
335         /* cmd word 0 */
336         u8 pad0[5];
337         u8 iter_status;
338         __le16 pad1;
339         /* cmd word 1 */
340         __le32 base_id;
341         __le32 last_id;
342         /* cmd word 2-3 */
343         u8 type[16];
344 };
345
346 struct dprc_rsp_get_res_ids {
347         /* response word 0 */
348         u8 pad0[5];
349         u8 iter_status;
350         __le16 pad1;
351         /* response word 1 */
352         __le32 base_id;
353         __le32 last_id;
354 };
355
356 struct dprc_cmd_get_obj_region {
357         /* cmd word 0 */
358         __le32 obj_id;
359         __le16 pad0;
360         u8 region_index;
361         u8 pad1;
362         /* cmd word 1-2 */
363         __le64 pad2[2];
364         /* cmd word 3-4 */
365         u8 obj_type[16];
366 };
367
368 struct dprc_rsp_get_obj_region {
369         /* response word 0 */
370         __le64 pad;
371         /* response word 1 */
372         __le64 base_addr;
373         /* response word 2 */
374         __le32 size;
375 };
376
377 struct dprc_cmd_set_obj_label {
378         /* cmd word 0 */
379         __le32 obj_id;
380         __le32 pad;
381         /* cmd word 1-2 */
382         u8 label[16];
383         /* cmd word 3-4 */
384         u8 obj_type[16];
385 };
386
387 struct dprc_cmd_set_obj_irq {
388         /* cmd word 0 */
389         __le32 irq_val;
390         u8 irq_index;
391         u8 pad[3];
392         /* cmd word 1 */
393         __le64 irq_addr;
394         /* cmd word 2 */
395         __le32 irq_num;
396         __le32 obj_id;
397         /* cmd word 3-4 */
398         u8 obj_type[16];
399 };
400
401 struct dprc_cmd_get_obj_irq {
402         /* cmd word 0 */
403         __le32 obj_id;
404         u8 irq_index;
405         u8 pad[3];
406         /* cmd word 1-2 */
407         u8 obj_type[16];
408 };
409
410 struct dprc_rsp_get_obj_irq {
411         /* response word 0 */
412         __le32 irq_val;
413         __le32 pad;
414         /* response word 1 */
415         __le64 irq_addr;
416         /* response word 2 */
417         __le32 irq_num;
418         __le32 type;
419 };
420
421 struct dprc_cmd_connect {
422         /* cmd word 0 */
423         __le32 ep1_id;
424         __le32 ep1_interface_id;
425         /* cmd word 1 */
426         __le32 ep2_id;
427         __le32 ep2_interface_id;
428         /* cmd word 2-3 */
429         u8 ep1_type[16];
430         /* cmd word 4 */
431         __le32 max_rate;
432         __le32 committed_rate;
433         /* cmd word 5-6 */
434         u8 ep2_type[16];
435 };
436
437 struct dprc_cmd_disconnect {
438         /* cmd word 0 */
439         __le32 id;
440         __le32 interface_id;
441         /* cmd word 1-2 */
442         u8 type[16];
443 };
444
445 struct dprc_cmd_get_connection {
446         /* cmd word 0 */
447         __le32 ep1_id;
448         __le32 ep1_interface_id;
449         /* cmd word 1-2 */
450         u8 ep1_type[16];
451 };
452
453 struct dprc_rsp_get_connection {
454         /* response word 0-2 */
455         __le64 pad[3];
456         /* response word 3 */
457         __le32 ep2_id;
458         __le32 ep2_interface_id;
459         /* response word 4-5 */
460         u8 ep2_type[16];
461         /* response word 6 */
462         __le32 state;
463 };
464
465 #endif /* _FSL_DPRC_CMD_H */