0001
0002
0003
0004 #ifndef __FSL_DPDMAI_H
0005 #define __FSL_DPDMAI_H
0006
0007
0008 #define DPDMAI_VER_MAJOR 2
0009 #define DPDMAI_VER_MINOR 2
0010
0011 #define DPDMAI_CMD_BASE_VERSION 0
0012 #define DPDMAI_CMD_ID_OFFSET 4
0013
0014 #define DPDMAI_CMDID_FORMAT(x) (((x) << DPDMAI_CMD_ID_OFFSET) | \
0015 DPDMAI_CMD_BASE_VERSION)
0016
0017
0018 #define DPDMAI_CMDID_CLOSE DPDMAI_CMDID_FORMAT(0x800)
0019 #define DPDMAI_CMDID_OPEN DPDMAI_CMDID_FORMAT(0x80E)
0020 #define DPDMAI_CMDID_CREATE DPDMAI_CMDID_FORMAT(0x90E)
0021 #define DPDMAI_CMDID_DESTROY DPDMAI_CMDID_FORMAT(0x900)
0022
0023 #define DPDMAI_CMDID_ENABLE DPDMAI_CMDID_FORMAT(0x002)
0024 #define DPDMAI_CMDID_DISABLE DPDMAI_CMDID_FORMAT(0x003)
0025 #define DPDMAI_CMDID_GET_ATTR DPDMAI_CMDID_FORMAT(0x004)
0026 #define DPDMAI_CMDID_RESET DPDMAI_CMDID_FORMAT(0x005)
0027 #define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMDID_FORMAT(0x006)
0028
0029 #define DPDMAI_CMDID_SET_IRQ DPDMAI_CMDID_FORMAT(0x010)
0030 #define DPDMAI_CMDID_GET_IRQ DPDMAI_CMDID_FORMAT(0x011)
0031 #define DPDMAI_CMDID_SET_IRQ_ENABLE DPDMAI_CMDID_FORMAT(0x012)
0032 #define DPDMAI_CMDID_GET_IRQ_ENABLE DPDMAI_CMDID_FORMAT(0x013)
0033 #define DPDMAI_CMDID_SET_IRQ_MASK DPDMAI_CMDID_FORMAT(0x014)
0034 #define DPDMAI_CMDID_GET_IRQ_MASK DPDMAI_CMDID_FORMAT(0x015)
0035 #define DPDMAI_CMDID_GET_IRQ_STATUS DPDMAI_CMDID_FORMAT(0x016)
0036 #define DPDMAI_CMDID_CLEAR_IRQ_STATUS DPDMAI_CMDID_FORMAT(0x017)
0037
0038 #define DPDMAI_CMDID_SET_RX_QUEUE DPDMAI_CMDID_FORMAT(0x1A0)
0039 #define DPDMAI_CMDID_GET_RX_QUEUE DPDMAI_CMDID_FORMAT(0x1A1)
0040 #define DPDMAI_CMDID_GET_TX_QUEUE DPDMAI_CMDID_FORMAT(0x1A2)
0041
0042 #define MC_CMD_HDR_TOKEN_O 32
0043 #define MC_CMD_HDR_TOKEN_S 16
0044
0045 #define MAKE_UMASK64(_width) \
0046 ((u64)((_width) < 64 ? ((u64)1 << (_width)) - 1 : (u64)-1))
0047
0048
0049
0050
0051
0052
0053
0054
0055 #define DPDMAI_PRIO_NUM 2
0056
0057
0058
0059
0060
0061
0062 #define DPDMAI_QUEUE_OPT_USER_CTX 0x1
0063
0064
0065
0066
0067 #define DPDMAI_QUEUE_OPT_DEST 0x2
0068
0069
0070
0071
0072
0073
0074
0075 struct dpdmai_cfg {
0076 u8 priorities[DPDMAI_PRIO_NUM];
0077 };
0078
0079
0080
0081
0082
0083
0084
0085 struct dpdmai_attr {
0086 int id;
0087
0088
0089
0090
0091
0092 struct {
0093 u16 major;
0094 u16 minor;
0095 } version;
0096 u8 num_of_priorities;
0097 };
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 enum dpdmai_dest {
0112 DPDMAI_DEST_NONE = 0,
0113 DPDMAI_DEST_DPIO = 1,
0114 DPDMAI_DEST_DPCON = 2
0115 };
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125 struct dpdmai_dest_cfg {
0126 enum dpdmai_dest dest_type;
0127 int dest_id;
0128 u8 priority;
0129 };
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141 struct dpdmai_rx_queue_cfg {
0142 struct dpdmai_dest_cfg dest_cfg;
0143 u32 options;
0144 u64 user_ctx;
0145
0146 };
0147
0148
0149
0150
0151
0152
0153
0154
0155 struct dpdmai_rx_queue_attr {
0156 struct dpdmai_dest_cfg dest_cfg;
0157 u64 user_ctx;
0158 u32 fqid;
0159 };
0160
0161 int dpdmai_open(struct fsl_mc_io *mc_io, u32 cmd_flags,
0162 int dpdmai_id, u16 *token);
0163 int dpdmai_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
0164 int dpdmai_destroy(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
0165 int dpdmai_create(struct fsl_mc_io *mc_io, u32 cmd_flags,
0166 const struct dpdmai_cfg *cfg, u16 *token);
0167 int dpdmai_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
0168 int dpdmai_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
0169 int dpdmai_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
0170 int dpdmai_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags,
0171 u16 token, struct dpdmai_attr *attr);
0172 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
0173 u8 priority, const struct dpdmai_rx_queue_cfg *cfg);
0174 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
0175 u8 priority, struct dpdmai_rx_queue_attr *attr);
0176 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags,
0177 u16 token, u8 priority, u32 *fqid);
0178
0179 #endif