1 /* Copyright 2013-2015 Freescale Semiconductor Inc. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are met: 5 * * Redistributions of source code must retain the above copyright 6 * notice, this list of conditions and the following disclaimer. 7 * * Redistributions in binary form must reproduce the above copyright 8 * notice, this list of conditions and the following disclaimer in the 9 * documentation and/or other materials provided with the distribution. 10 * * Neither the name of the above-listed copyright holders nor the 11 * names of any contributors may be used to endorse or promote products 12 * derived from this software without specific prior written permission. 13 * 14 * 15 * ALTERNATIVELY, this software may be distributed under the terms of the 16 * GNU General Public License ("GPL") as published by the Free Software 17 * Foundation, either version 2 of that License or (at your option) any 18 * later version. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 #ifndef __FSL_DPBP_H 33 #define __FSL_DPBP_H 34 35 /* Data Path Buffer Pool API 36 * Contains initialization APIs and runtime control APIs for DPBP 37 */ 38 39 struct fsl_mc_io; 40 41 int dpbp_open(struct fsl_mc_io *mc_io, 42 u32 cmd_flags, 43 int dpbp_id, 44 u16 *token); 45 46 int dpbp_close(struct fsl_mc_io *mc_io, 47 u32 cmd_flags, 48 u16 token); 49 50 /** 51 * struct dpbp_cfg - Structure representing DPBP configuration 52 * @options: place holder 53 */ 54 struct dpbp_cfg { 55 u32 options; 56 }; 57 58 int dpbp_create(struct fsl_mc_io *mc_io, 59 u32 cmd_flags, 60 const struct dpbp_cfg *cfg, 61 u16 *token); 62 63 int dpbp_destroy(struct fsl_mc_io *mc_io, 64 u32 cmd_flags, 65 u16 token); 66 67 int dpbp_enable(struct fsl_mc_io *mc_io, 68 u32 cmd_flags, 69 u16 token); 70 71 int dpbp_disable(struct fsl_mc_io *mc_io, 72 u32 cmd_flags, 73 u16 token); 74 75 int dpbp_is_enabled(struct fsl_mc_io *mc_io, 76 u32 cmd_flags, 77 u16 token, 78 int *en); 79 80 int dpbp_reset(struct fsl_mc_io *mc_io, 81 u32 cmd_flags, 82 u16 token); 83 84 /** 85 * struct dpbp_irq_cfg - IRQ configuration 86 * @addr: Address that must be written to signal a message-based interrupt 87 * @val: Value to write into irq_addr address 88 * @user_irq_id: A user defined number associated with this IRQ 89 */ 90 struct dpbp_irq_cfg { 91 u64 addr; 92 u32 val; 93 int user_irq_id; 94 }; 95 96 int dpbp_set_irq(struct fsl_mc_io *mc_io, 97 u32 cmd_flags, 98 u16 token, 99 u8 irq_index, 100 struct dpbp_irq_cfg *irq_cfg); 101 102 int dpbp_get_irq(struct fsl_mc_io *mc_io, 103 u32 cmd_flags, 104 u16 token, 105 u8 irq_index, 106 int *type, 107 struct dpbp_irq_cfg *irq_cfg); 108 109 int dpbp_set_irq_enable(struct fsl_mc_io *mc_io, 110 u32 cmd_flags, 111 u16 token, 112 u8 irq_index, 113 u8 en); 114 115 int dpbp_get_irq_enable(struct fsl_mc_io *mc_io, 116 u32 cmd_flags, 117 u16 token, 118 u8 irq_index, 119 u8 *en); 120 121 int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, 122 u32 cmd_flags, 123 u16 token, 124 u8 irq_index, 125 u32 mask); 126 127 int dpbp_get_irq_mask(struct fsl_mc_io *mc_io, 128 u32 cmd_flags, 129 u16 token, 130 u8 irq_index, 131 u32 *mask); 132 133 int dpbp_get_irq_status(struct fsl_mc_io *mc_io, 134 u32 cmd_flags, 135 u16 token, 136 u8 irq_index, 137 u32 *status); 138 139 int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, 140 u32 cmd_flags, 141 u16 token, 142 u8 irq_index, 143 u32 status); 144 145 /** 146 * struct dpbp_attr - Structure representing DPBP attributes 147 * @id: DPBP object ID 148 * @version: DPBP version 149 * @bpid: Hardware buffer pool ID; should be used as an argument in 150 * acquire/release operations on buffers 151 */ 152 struct dpbp_attr { 153 int id; 154 /** 155 * struct version - Structure representing DPBP version 156 * @major: DPBP major version 157 * @minor: DPBP minor version 158 */ 159 struct { 160 u16 major; 161 u16 minor; 162 } version; 163 u16 bpid; 164 }; 165 166 int dpbp_get_attributes(struct fsl_mc_io *mc_io, 167 u32 cmd_flags, 168 u16 token, 169 struct dpbp_attr *attr); 170 171 /** @} */ 172 173 #endif /* __FSL_DPBP_H */ 174