GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / staging / fsl-mc / include / dpbp.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 #ifndef __FSL_DPBP_H
34 #define __FSL_DPBP_H
35
36 /*
37  * Data Path Buffer Pool API
38  * Contains initialization APIs and runtime control APIs for DPBP
39  */
40
41 struct fsl_mc_io;
42
43 int dpbp_open(struct fsl_mc_io *mc_io,
44               u32 cmd_flags,
45               int dpbp_id,
46               u16 *token);
47
48 int dpbp_close(struct fsl_mc_io *mc_io,
49                u32 cmd_flags,
50                u16 token);
51
52 int dpbp_enable(struct fsl_mc_io *mc_io,
53                 u32 cmd_flags,
54                 u16 token);
55
56 int dpbp_disable(struct fsl_mc_io *mc_io,
57                  u32 cmd_flags,
58                  u16 token);
59
60 int dpbp_is_enabled(struct fsl_mc_io *mc_io,
61                     u32 cmd_flags,
62                     u16 token,
63                     int *en);
64
65 int dpbp_reset(struct fsl_mc_io *mc_io,
66                u32 cmd_flags,
67                u16 token);
68
69 /**
70  * struct dpbp_attr - Structure representing DPBP attributes
71  * @id:         DPBP object ID
72  * @bpid:       Hardware buffer pool ID; should be used as an argument in
73  *              acquire/release operations on buffers
74  */
75 struct dpbp_attr {
76         int id;
77         u16 bpid;
78 };
79
80 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
81                         u32 cmd_flags,
82                         u16 token,
83                         struct dpbp_attr *attr);
84
85 int dpbp_get_api_version(struct fsl_mc_io *mc_io,
86                          u32 cmd_flags,
87                          u16 *major_ver,
88                          u16 *minor_ver);
89
90 #endif /* __FSL_DPBP_H */