J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 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_DPMCP_H |
| 33 | #define __FSL_DPMCP_H |
| 34 | |
| 35 | /* Data Path Management Command Portal API |
| 36 | * Contains initialization APIs and runtime control APIs for DPMCP |
| 37 | */ |
| 38 | |
| 39 | struct fsl_mc_io; |
| 40 | |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 41 | int dpmcp_open(struct fsl_mc_io *mc_io, |
| 42 | uint32_t cmd_flags, |
| 43 | int dpmcp_id, |
| 44 | uint16_t *token); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 45 | |
| 46 | /* Get portal ID from pool */ |
| 47 | #define DPMCP_GET_PORTAL_ID_FROM_POOL (-1) |
| 48 | |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 49 | int dpmcp_close(struct fsl_mc_io *mc_io, |
| 50 | uint32_t cmd_flags, |
| 51 | uint16_t token); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 52 | |
| 53 | /** |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 54 | * struct dpmcp_cfg - Structure representing DPMCP configuration |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 55 | * @portal_id: Portal ID; 'DPMCP_GET_PORTAL_ID_FROM_POOL' to get the portal ID |
| 56 | * from pool |
| 57 | */ |
| 58 | struct dpmcp_cfg { |
| 59 | int portal_id; |
| 60 | }; |
| 61 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 62 | int dpmcp_create(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 63 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 64 | const struct dpmcp_cfg *cfg, |
| 65 | uint16_t *token); |
| 66 | |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 67 | int dpmcp_destroy(struct fsl_mc_io *mc_io, |
| 68 | uint32_t cmd_flags, |
| 69 | uint16_t token); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 70 | |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 71 | int dpmcp_reset(struct fsl_mc_io *mc_io, |
| 72 | uint32_t cmd_flags, |
| 73 | uint16_t token); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 74 | |
| 75 | /* IRQ */ |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 76 | /* IRQ Index */ |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 77 | #define DPMCP_IRQ_INDEX 0 |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 78 | /* irq event - Indicates that the link state changed */ |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 79 | #define DPMCP_IRQ_EVENT_CMD_DONE 0x00000001 |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * struct dpmcp_irq_cfg - IRQ configuration |
| 83 | * @paddr: Address that must be written to signal a message-based interrupt |
| 84 | * @val: Value to write into irq_addr address |
| 85 | * @user_irq_id: A user defined number associated with this IRQ |
| 86 | */ |
| 87 | struct dpmcp_irq_cfg { |
| 88 | uint64_t paddr; |
| 89 | uint32_t val; |
| 90 | int user_irq_id; |
| 91 | }; |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 92 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 93 | int dpmcp_set_irq(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 94 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 95 | uint16_t token, |
| 96 | uint8_t irq_index, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 97 | struct dpmcp_irq_cfg *irq_cfg); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 98 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 99 | int dpmcp_get_irq(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 100 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 101 | uint16_t token, |
| 102 | uint8_t irq_index, |
| 103 | int *type, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 104 | struct dpmcp_irq_cfg *irq_cfg); |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 105 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 106 | int dpmcp_set_irq_enable(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 107 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 108 | uint16_t token, |
| 109 | uint8_t irq_index, |
| 110 | uint8_t en); |
| 111 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 112 | int dpmcp_get_irq_enable(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 113 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 114 | uint16_t token, |
| 115 | uint8_t irq_index, |
| 116 | uint8_t *en); |
| 117 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 118 | int dpmcp_set_irq_mask(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 119 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 120 | uint16_t token, |
| 121 | uint8_t irq_index, |
| 122 | uint32_t mask); |
| 123 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 124 | int dpmcp_get_irq_mask(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 125 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 126 | uint16_t token, |
| 127 | uint8_t irq_index, |
| 128 | uint32_t *mask); |
| 129 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 130 | int dpmcp_get_irq_status(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 131 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 132 | uint16_t token, |
| 133 | uint8_t irq_index, |
| 134 | uint32_t *status); |
| 135 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 136 | int dpmcp_clear_irq_status(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 137 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 138 | uint16_t token, |
| 139 | uint8_t irq_index, |
| 140 | uint32_t status); |
| 141 | |
| 142 | /** |
| 143 | * struct dpmcp_attr - Structure representing DPMCP attributes |
| 144 | * @id: DPMCP object ID |
| 145 | * @version: DPMCP version |
| 146 | */ |
| 147 | struct dpmcp_attr { |
| 148 | int id; |
| 149 | /** |
| 150 | * struct version - Structure representing DPMCP version |
| 151 | * @major: DPMCP major version |
| 152 | * @minor: DPMCP minor version |
| 153 | */ |
| 154 | struct { |
| 155 | uint16_t major; |
| 156 | uint16_t minor; |
| 157 | } version; |
| 158 | }; |
| 159 | |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 160 | int dpmcp_get_attributes(struct fsl_mc_io *mc_io, |
J. German Rivera | 7a9a56b | 2015-09-23 16:11:01 -0500 | [diff] [blame] | 161 | uint32_t cmd_flags, |
J. German Rivera | 197f4d6 | 2015-03-05 19:35:25 -0600 | [diff] [blame] | 162 | uint16_t token, |
| 163 | struct dpmcp_attr *attr); |
| 164 | |
| 165 | #endif /* __FSL_DPMCP_H */ |