diff options
Diffstat (limited to 'kernel/drivers/staging/fsl-mc/include/mc-cmd.h')
-rw-r--r-- | kernel/drivers/staging/fsl-mc/include/mc-cmd.h | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/kernel/drivers/staging/fsl-mc/include/mc-cmd.h b/kernel/drivers/staging/fsl-mc/include/mc-cmd.h index 32501e020..65277e3de 100644 --- a/kernel/drivers/staging/fsl-mc/include/mc-cmd.h +++ b/kernel/drivers/staging/fsl-mc/include/mc-cmd.h @@ -35,21 +35,21 @@ #define MC_CMD_NUM_OF_PARAMS 7 #define MAKE_UMASK64(_width) \ - ((uint64_t)((_width) < 64 ? ((uint64_t)1 << (_width)) - 1 : -1)) + ((u64)((_width) < 64 ? ((u64)1 << (_width)) - 1 : -1)) -static inline uint64_t mc_enc(int lsoffset, int width, uint64_t val) +static inline u64 mc_enc(int lsoffset, int width, u64 val) { - return (uint64_t)(((uint64_t)val & MAKE_UMASK64(width)) << lsoffset); + return (u64)(((u64)val & MAKE_UMASK64(width)) << lsoffset); } -static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width) +static inline u64 mc_dec(u64 val, int lsoffset, int width) { - return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width)); + return (u64)((val >> lsoffset) & MAKE_UMASK64(width)); } struct mc_command { - uint64_t header; - uint64_t params[MC_CMD_NUM_OF_PARAMS]; + u64 header; + u64 params[MC_CMD_NUM_OF_PARAMS]; }; enum mc_cmd_status { @@ -67,24 +67,41 @@ enum mc_cmd_status { MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */ }; +/* + * MC command flags + */ + +/* High priority flag */ +#define MC_CMD_FLAG_PRI 0x00008000 +/* Command completion flag */ +#define MC_CMD_FLAG_INTR_DIS 0x01000000 + +/* + * TODO Remove following two defines after completion of flib 8.0.0 + * integration + */ +#define MC_CMD_PRI_LOW 0 /*!< Low Priority command indication */ +#define MC_CMD_PRI_HIGH 1 /*!< High Priority command indication */ + #define MC_CMD_HDR_CMDID_O 52 /* Command ID field offset */ #define MC_CMD_HDR_CMDID_S 12 /* Command ID field size */ #define MC_CMD_HDR_TOKEN_O 38 /* Token field offset */ #define MC_CMD_HDR_TOKEN_S 10 /* Token field size */ #define MC_CMD_HDR_STATUS_O 16 /* Status field offset */ #define MC_CMD_HDR_STATUS_S 8 /* Status field size*/ -#define MC_CMD_HDR_PRI_O 15 /* Priority field offset */ -#define MC_CMD_HDR_PRI_S 1 /* Priority field size */ +#define MC_CMD_HDR_FLAGS_O 0 /* Flags field offset */ +#define MC_CMD_HDR_FLAGS_S 32 /* Flags field size*/ +#define MC_CMD_HDR_FLAGS_MASK 0xFF00FF00 /* Command flags mask */ #define MC_CMD_HDR_READ_STATUS(_hdr) \ ((enum mc_cmd_status)mc_dec((_hdr), \ MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S)) #define MC_CMD_HDR_READ_TOKEN(_hdr) \ - ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S)) + ((u16)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S)) -#define MC_CMD_PRI_LOW 0 /* Low Priority command indication */ -#define MC_CMD_PRI_HIGH 1 /* High Priority command indication */ +#define MC_CMD_HDR_READ_FLAGS(_hdr) \ + ((u32)mc_dec((_hdr), MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S)) #define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \ ((_ext)[_param] |= mc_enc((_offset), (_width), _arg)) @@ -95,15 +112,16 @@ enum mc_cmd_status { #define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \ (_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width))) -static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id, - uint8_t priority, - uint16_t token) +static inline u64 mc_encode_cmd_header(u16 cmd_id, + u32 cmd_flags, + u16 token) { - uint64_t hdr; + u64 hdr; hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id); + hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S, + (cmd_flags & MC_CMD_HDR_FLAGS_MASK)); hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token); - hdr |= mc_enc(MC_CMD_HDR_PRI_O, MC_CMD_HDR_PRI_S, priority); hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S, MC_CMD_STATUS_READY); |